armchair_fw/main/currentsensor.hpp
jonny_l480 a6de6c4c10 Add currentsensor support - current limit functional
- add currentsensor class
- add current limit to motorctl handle function
- add config options for curring limit for each motor
- update connection plan with more detailed driver-box overview
2023-08-22 11:16:25 +02:00

21 lines
511 B
C++

#include <driver/adc.h>
//supported current sensor working method:
//0V = -ratedCurrent
//centerVoltage = 0A
//3.3V = ratedCurrent
class currentSensor{
public:
currentSensor (adc1_channel_t adcChannel_f, float ratedCurrent);
void calibrateZeroAmpere(void); //set current voltage to voltage representing 0A
float read(void); //get current ampere
private:
adc1_channel_t adcChannel;
float ratedCurrent;
uint32_t measure;
float voltage;
float current;
float centerVoltage = 3.3/2;
};