Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of priustroller by
Diff: core/core.h
- Revision:
- 11:dccbaa9274c5
- Parent:
- 6:99ee0ce47fb2
- Child:
- 29:cb03760ba9ea
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/core.h Sun Mar 08 08:37:38 2015 +0000 @@ -0,0 +1,57 @@ +#ifndef __CORE_H +#define __CORE_H + +#include "includes.h" +#include "sensors.h" + +class Motor; +class Inverter; +class CurrentSensor; +class VoltageSensor; +class PositionSensor; +class TempSensor; + +class Motor { +public: + Motor(CurrentSensor *sense_c, CurrentSensor *sense_b, PositionSensor *sense_p, TempSensor *sense_t); + void Config(int num_poles, float kv); + float GetCurrentC(); + float GetCurrentB(); + float GetPosition(); + float GetTemp(); +private: + CurrentSensor *_sense_c,*_sense_b; + PositionSensor *_sense_p; + TempSensor *_sense_t; + int _num_poles; + float _kv; +}; + +class Inverter { +public: + Inverter(PinName ph_a, PinName ph_b, PinName ph_c, PinName en, VoltageSensor *sense_bus, TempSensor *sense_t); + void SetDtcA(float dtc); + void SetDtcB(float dtc); + void SetDtcC(float dtc); + void Disable(); + void Enable(); + float GetVbus(); + float GetTemp(); +private: + PwmOut *_pwm_a, *_pwm_b, *_pwm_c; + DigitalOut *_en; + VoltageSensor *_sense_bus; + TempSensor *_sense_t; +}; + +class User { +public: + User(Throttle *throttle) {_throttle = throttle;} + void UpdateThrottle() {throttle = _throttle->GetThrottle();} +public: + float throttle; +private: + Throttle *_throttle; +}; + +#endif \ No newline at end of file