Martin Deng / Mbed 2 deprecated SystemManagement

Dependencies:   CANBuffer mbed SystemManagement mbed-rtos

Dependents:   SystemManagement

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FanPump.h Source File

FanPump.h

00001 #ifndef _FILE_FANPUMP_H
00002 #define _FILE_FANPUMP_H
00003 
00004 #include "mbed.h"
00005 #include "rtos.h"
00006 #include "CANBuffer.h"
00007 
00008 typedef enum {
00009     Pump = 0,
00010     Fan1 = 1,
00011     Fan2 = 2,
00012     Fan3 = 3,
00013 } FanSelect;
00014 
00015 typedef struct{
00016     unsigned char cur_duty;
00017     unsigned char new_duty;
00018     PwmOut *pin;    
00019 } PinStatus;
00020 
00021 const int PIN_NUM = 4;
00022 const int TX_FAN_ID = ((4 << 8) | 4);
00023 const int RX_FAN_ID = ((4 << 8) | 12);
00024 
00025 class FanPump{
00026 public:
00027     FanPump(CANBuffer *can);
00028     void set_fan(FanSelect fan, unsigned char duty);
00029     void shutdown(FanSelect fan);
00030     void shutdown_all();
00031     void start_update();
00032     
00033 private:
00034     Thread *pin_threads[PIN_NUM];
00035     void free_pin(FanSelect fan);
00036 };
00037 #endif