try to fix submodule
This commit is contained in:
26
firmware/lib/Arduino-FOC/src/sensors/GenericSensor.cpp
Normal file
26
firmware/lib/Arduino-FOC/src/sensors/GenericSensor.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "GenericSensor.h"
|
||||
|
||||
|
||||
/*
|
||||
GenericSensor( float (*readCallback)() )
|
||||
- readCallback - pointer to the function which reads the sensor angle.
|
||||
*/
|
||||
|
||||
GenericSensor::GenericSensor(float (*readCallback)(), void (*initCallback)()){
|
||||
// if function provided add it to the
|
||||
if(readCallback != nullptr) this->readCallback = readCallback;
|
||||
if(initCallback != nullptr) this->initCallback = initCallback;
|
||||
}
|
||||
|
||||
void GenericSensor::init(){
|
||||
// if init callback specified run it
|
||||
if(initCallback != nullptr) this->initCallback();
|
||||
this->Sensor::init(); // call base class init
|
||||
}
|
||||
|
||||
/*
|
||||
Shaft angle calculation
|
||||
*/
|
||||
float GenericSensor::getSensorAngle(){
|
||||
return this->readCallback();
|
||||
}
|
||||
Reference in New Issue
Block a user