Bayley Wang
/
priustroller_3
temp repo
Fork of priustroller_2 by
Embed:
(wiki syntax)
Show/hide line numbers
core.h
00001 #ifndef __CORE_H 00002 #define __CORE_H 00003 00004 #include "includes.h" 00005 #include "sensors.h" 00006 00007 class Motor; 00008 class Inverter; 00009 class CurrentSensor; 00010 class VoltageSensor; 00011 class PositionSensor; 00012 class TempSensor; 00013 00014 class Motor { 00015 public: 00016 Motor(CurrentSensor *sense_c, CurrentSensor *sense_b, PositionSensor *sense_p, TempSensor *sense_t); 00017 void Config(int num_poles, float kv); 00018 float GetCurrentC(); 00019 float GetCurrentB(); 00020 float GetPosition(); 00021 float GetTemp(); 00022 private: 00023 CurrentSensor *_sense_c,*_sense_b; 00024 PositionSensor *_sense_p; 00025 TempSensor *_sense_t; 00026 int _num_poles; 00027 float _kv; 00028 }; 00029 00030 class Inverter { 00031 public: 00032 Inverter(PinName ph_a, PinName ph_b, PinName ph_c, PinName en, VoltageSensor *sense_bus, TempSensor *sense_t); 00033 void SetDtcA(float dtc); 00034 void SetDtcB(float dtc); 00035 void SetDtcC(float dtc); 00036 void Disable(); 00037 void Enable(); 00038 float GetVbus(); 00039 float GetTemp(); 00040 private: 00041 PwmOut *_pwm_a, *_pwm_b, *_pwm_c; 00042 DigitalOut *_en; 00043 VoltageSensor *_sense_bus; 00044 TempSensor *_sense_t; 00045 }; 00046 00047 class User { 00048 public: 00049 User(Throttle *throttle) {_throttle = throttle;} 00050 void UpdateThrottle() {throttle = _throttle->GetThrottle();} 00051 public: 00052 float throttle; 00053 private: 00054 Throttle *_throttle; 00055 }; 00056 00057 #endif
Generated on Tue Jul 12 2022 20:58:06 by 1.7.2