System Management code
Dependencies: CANBuffer mbed SystemManagement mbed-rtos
System Management code for Penn Electric Racing
Functions:
Controls Fans and Pumps via instruction from CAN Messages, ramps them up over time to prevent damage
Turns on/off DC-DC converter via instruction from CAN Messages
FanPump/FanPump.h
- Committer:
- martydd3
- Date:
- 2014-10-10
- Revision:
- 7:5f6e31faa08e
- Parent:
- 6:6a04210a3f4f
File content as of revision 7:5f6e31faa08e:
#ifndef _FILE_FANPUMP_H #define _FILE_FANPUMP_H #include "mbed.h" #include "rtos.h" #include "CANBuffer.h" typedef enum { Pump = 0, Fan1 = 1, Fan2 = 2, Fan3 = 3, } FanSelect; typedef struct{ unsigned char cur_duty; unsigned char new_duty; PwmOut *pin; } PinStatus; const int PIN_NUM = 4; const int TX_FAN_ID = ((4 << 8) | 4); const int RX_FAN_ID = ((4 << 8) | 12); class FanPump{ public: FanPump(CANBuffer *can); void set_fan(FanSelect fan, unsigned char duty); void shutdown(FanSelect fan); void shutdown_all(); void start_update(); private: Thread *pin_threads[PIN_NUM]; void free_pin(FanSelect fan); }; #endif