N K / Mbed 2 deprecated priustroller_current

Dependencies:   mbed

Fork of priustroller_2 by N K

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers core.h Source File

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 GetSpeed();
00022     float GetTemp();
00023 private:
00024     CurrentSensor *_sense_c,*_sense_b;
00025     PositionSensor *_sense_p;
00026     TempSensor *_sense_t;
00027     int _num_poles;
00028     float _kv;
00029 };
00030 
00031 class Inverter {
00032 public:
00033     Inverter(PinName ph_a, PinName ph_b, PinName ph_c, PinName en, VoltageSensor *sense_bus, TempSensor *sense_t);
00034     void SetDtcA(float dtc);
00035     void SetDtcB(float dtc);
00036     void SetDtcC(float dtc);
00037     void Disable();
00038     void Enable();
00039     float GetVbus();
00040     float GetTemp();
00041 private:
00042     PwmOut *_pwm_a, *_pwm_b, *_pwm_c;
00043     DigitalOut *_en;
00044     VoltageSensor *_sense_bus;
00045     TempSensor *_sense_t;
00046 };
00047 
00048 class User {
00049 public:
00050     User(Throttle *throttle) {_throttle = throttle;}
00051     void UpdateThrottle() {throttle = _throttle->GetThrottle();} 
00052 public:
00053     float throttle;
00054 private:
00055     Throttle *_throttle;
00056 };
00057 
00058 #endif