SimpleFOClibrary 2.4.0
Loading...
Searching...
No Matches
GenericCurrentSense.h
Go to the documentation of this file.
1#ifndef GENERIC_CS_LIB_H
2#define GENERIC_CS_LIB_H
3
4#include "Arduino.h"
5#include "../common/foc_utils.h"
6#include "../common/time_utils.h"
7#include "../common/defaults.h"
8#include "../common/base_classes/CurrentSense.h"
9#include "../common/lowpass_filter.h"
10#include "hardware_api.h"
11
12
14 public:
15 /**
16 GenericCurrentSense class constructor
17 */
18 GenericCurrentSense(PhaseCurrent_s (*readCallback)() = nullptr, void (*initCallback)() = nullptr);
19
20 // CurrentSense interface implementing functions
21 int init() override;
23 int driverAlign(float align_voltage, bool modulation_centered) override;
24
25
26 PhaseCurrent_s (*readCallback)() = nullptr; //!< function pointer to sensor reading
27 void (*initCallback)() = nullptr; //!< function pointer to sensor initialisation
28
29 private:
30 /**
31 * Function finding zero offsets of the ADC
32 */
33 void calibrateOffsets();
34 float offset_ia; //!< zero current A voltage value (center of the adc reading)
35 float offset_ib; //!< zero current B voltage value (center of the adc reading)
36 float offset_ic; //!< zero current C voltage value (center of the adc reading)
37
38};
39
40#endif
PhaseCurrent_s(* readCallback)()
function pointer to sensor reading
void(* initCallback)()
function pointer to sensor initialisation
PhaseCurrent_s getPhaseCurrents() override
int driverAlign(float align_voltage, bool modulation_centered) override
Phase_s PhaseCurrent_s
Definition foc_utils.h:71