Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
FanPump/FanPump.h@12:e0adb697fcdb, 2014-10-21 (annotated)
- Committer:
- martydd3
- Date:
- Tue Oct 21 23:44:15 2014 +0000
- Revision:
- 12:e0adb697fcdb
- Parent:
- 6:6a04210a3f4f
- Child:
- 13:fbd9b3f5a07c
Added Error update thread, changed CAN message IDs
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| martydd3 | 6:6a04210a3f4f | 1 | #ifndef _FILE_FANPUMP_H |
| martydd3 | 6:6a04210a3f4f | 2 | #define _FILE_FANPUMP_H |
| martydd3 | 6:6a04210a3f4f | 3 | |
| martydd3 | 6:6a04210a3f4f | 4 | #include "mbed.h" |
| martydd3 | 6:6a04210a3f4f | 5 | #include "rtos.h" |
| martydd3 | 6:6a04210a3f4f | 6 | #include "CANBuffer.h" |
| martydd3 | 6:6a04210a3f4f | 7 | |
| martydd3 | 6:6a04210a3f4f | 8 | typedef enum { |
| martydd3 | 12:e0adb697fcdb | 9 | Pump1 = 0, |
| martydd3 | 12:e0adb697fcdb | 10 | Pump2 = 1, |
| martydd3 | 12:e0adb697fcdb | 11 | Fan1 = 2, |
| martydd3 | 12:e0adb697fcdb | 12 | Fan2 = 3, |
| martydd3 | 12:e0adb697fcdb | 13 | } FanPumpSelect; |
| martydd3 | 6:6a04210a3f4f | 14 | |
| martydd3 | 6:6a04210a3f4f | 15 | typedef struct{ |
| martydd3 | 12:e0adb697fcdb | 16 | float cur_duty; |
| martydd3 | 12:e0adb697fcdb | 17 | float new_duty; |
| martydd3 | 6:6a04210a3f4f | 18 | PwmOut *pin; |
| martydd3 | 6:6a04210a3f4f | 19 | } PinStatus; |
| martydd3 | 6:6a04210a3f4f | 20 | |
| martydd3 | 6:6a04210a3f4f | 21 | const int PIN_NUM = 4; |
| martydd3 | 12:e0adb697fcdb | 22 | const int TX_FAN_ID = ((0x4 << 8) | 0x11); |
| martydd3 | 12:e0adb697fcdb | 23 | const int RX_FAN_ID = ((0x4 << 8) | 0x81); |
| martydd3 | 12:e0adb697fcdb | 24 | const int TX_PUMP_ID = ((0x4 << 8) | 0x10); |
| martydd3 | 12:e0adb697fcdb | 25 | const int RX_PUMP_ID = ((0x4 << 8) | 0x80); |
| martydd3 | 6:6a04210a3f4f | 26 | |
| martydd3 | 6:6a04210a3f4f | 27 | class FanPump{ |
| martydd3 | 6:6a04210a3f4f | 28 | public: |
| martydd3 | 6:6a04210a3f4f | 29 | FanPump(CANBuffer *can); |
| martydd3 | 12:e0adb697fcdb | 30 | void set_fan_pump(FanPumpSelect fan, float duty); |
| martydd3 | 12:e0adb697fcdb | 31 | void shutdown(FanPumpSelect fan); |
| martydd3 | 6:6a04210a3f4f | 32 | void shutdown_all(); |
| martydd3 | 6:6a04210a3f4f | 33 | void start_update(); |
| martydd3 | 6:6a04210a3f4f | 34 | |
| martydd3 | 6:6a04210a3f4f | 35 | private: |
| martydd3 | 6:6a04210a3f4f | 36 | Thread *pin_threads[PIN_NUM]; |
| martydd3 | 12:e0adb697fcdb | 37 | void free_pin(FanPumpSelect fan); |
| martydd3 | 6:6a04210a3f4f | 38 | }; |
| martydd3 | 6:6a04210a3f4f | 39 | #endif |
