Custom version for NXP cup car
MotorControl.h
- Committer:
- Clarkk
- Date:
- 2016-03-25
- Revision:
- 1:7ce4ffeb8ccb
- Parent:
- 0:a1bb4583940a
- Child:
- 2:0d5c994d8135
File content as of revision 1:7ce4ffeb8ccb:
#include "mbed.h" #include "TFC.h" #ifndef _MOTORCONTROL_H #define _MOTORCONTROL_H #define MOTSAMPLECOUNT 100 #define BATSAMPLECOUNT 50 class Motors { public: Motors(); void start(); void stop(); void saveBatteryVoltageMeasure(uint16_t ADCresult); void saveMotorCurrentMeasure(uint16_t MotA_ADCresult, uint16_t MotB_ADCresult); void saveSteering(float angle); float getWheelSpeed(char mot); float getWheelRPS(char mot); void processTasks(); float getAverageMotCurrent(char mot); float getAverageBatteryVoltage(); void setFixedPWMValue(float pwm); private: uint16_t motorACurrent[MOTSAMPLECOUNT]; uint16_t motorBCurrent[MOTSAMPLECOUNT]; uint16_t batteryVoltage[BATSAMPLECOUNT]; uint8_t motorCurrentIndex; uint8_t batVoltageIndex; float currentPWM; float steeringAngle; }; #endif