36 lines
1.0 KiB
C
36 lines
1.0 KiB
C
/*
|
|
* buck_emulator.h
|
|
*
|
|
* Created on: 13. maj 2025
|
|
* Author: Christian L. V. Madsen (OZ1CM)
|
|
*/
|
|
|
|
#ifndef BUCK_EMULATOR_H_
|
|
#define BUCK_EMULATOR_H_
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
|
|
typedef float (*regulate_evt_t)(float Vout);
|
|
typedef int (*getResult_evt_t)(float duty, float Vout, float time);
|
|
|
|
typedef struct {
|
|
|
|
regulate_evt_t regulate_evt;
|
|
getResult_evt_t getResult_evt;
|
|
float simTime;
|
|
|
|
float Vin; // Input voltage
|
|
float Vout; // Output voltage
|
|
float IL; // Inductor current
|
|
float L; // Inductance
|
|
float C; // Capacitance
|
|
float Rload; // Load resistance
|
|
float dt; // Time step (e.g., 25e-6)
|
|
} BuckEmulator_t;
|
|
|
|
int buck_emulator_Run(BuckEmulator_t *inst);
|
|
int buck_emulator_RegGetResultEvt(BuckEmulator_t *inst, getResult_evt_t getRes_evt);
|
|
int buck_emulator_RegRegulationEvt(BuckEmulator_t *inst, regulate_evt_t reg_evt);
|
|
int buck_emulator_init(BuckEmulator_t *inst, float Vin, float L, float C, float Rload, float dt, float sim_time);
|
|
#endif /* BUCK_EMULATOR_H_ */
|