Bayley Wang
/
priustroller_3
temp repo
Fork of priustroller_2 by
core/core.h
- Committer:
- nki
- Date:
- 2015-03-15
- Revision:
- 30:2b6d426f3bfc
- Parent:
- 29:cb03760ba9ea
- Child:
- 33:e7b132029bae
File content as of revision 30:2b6d426f3bfc:
#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(PositionSensor *sense_p, TempSensor *sense_t); void InitSensors(float ib_zero, float ic_zero, float scale); void Config(int num_poles, float kv); float GetCurrentC(); float GetCurrentB(); float GetPosition(); float GetTemp(); private: PositionSensor *_sense_p; TempSensor *_sense_t; int _num_poles; float _kv; float _ib, _ic; float _ib_zero, _ic_zero; float _scale; }; 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