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
DC_DC/DC_DC.cpp@17:c9ce210f6654, 2014-10-25 (annotated)
- Committer:
- pspatel321
- Date:
- Sat Oct 25 03:28:55 2014 +0000
- Revision:
- 17:c9ce210f6654
- Parent:
- 12:e0adb697fcdb
Parth's edits for 10/24/14, items remaining: DC-DC, XBee, reading AMS/IMD error, main code
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| martydd3 | 6:6a04210a3f4f | 1 | #include "mbed.h" |
| martydd3 | 6:6a04210a3f4f | 2 | #include "DC_DC.h" |
| martydd3 | 6:6a04210a3f4f | 3 | |
| martydd3 | 6:6a04210a3f4f | 4 | FanPump *fanPump; |
| martydd3 | 6:6a04210a3f4f | 5 | CANBuffer *tx_DC_Buffer; |
| martydd3 | 6:6a04210a3f4f | 6 | bool status; |
| martydd3 | 6:6a04210a3f4f | 7 | |
| martydd3 | 10:db13782f05d9 | 8 | DigitalOut dc_pin(p20); |
| martydd3 | 10:db13782f05d9 | 9 | |
| martydd3 | 6:6a04210a3f4f | 10 | DC::DC(FanPump *fp, CANBuffer *can){ |
| martydd3 | 6:6a04210a3f4f | 11 | status = false; |
| martydd3 | 6:6a04210a3f4f | 12 | dc_pin = !status; |
| martydd3 | 6:6a04210a3f4f | 13 | tx_DC_Buffer = can; |
| martydd3 | 6:6a04210a3f4f | 14 | fanPump = fp; |
| martydd3 | 6:6a04210a3f4f | 15 | } |
| martydd3 | 6:6a04210a3f4f | 16 | |
| martydd3 | 6:6a04210a3f4f | 17 | bool DC::is_on(){ |
| martydd3 | 6:6a04210a3f4f | 18 | return status; |
| martydd3 | 6:6a04210a3f4f | 19 | } |
| martydd3 | 6:6a04210a3f4f | 20 | |
| pspatel321 | 17:c9ce210f6654 | 21 | void DC::set(bool s){/* |
| martydd3 | 6:6a04210a3f4f | 22 | status = s; |
| martydd3 | 6:6a04210a3f4f | 23 | if(!status){ |
| martydd3 | 6:6a04210a3f4f | 24 | fanPump->shutdown_all(); |
| martydd3 | 6:6a04210a3f4f | 25 | } |
| martydd3 | 6:6a04210a3f4f | 26 | |
| pspatel321 | 17:c9ce210f6654 | 27 | dc_pin = !status;*/ |
| martydd3 | 6:6a04210a3f4f | 28 | } |
| martydd3 | 6:6a04210a3f4f | 29 | |
| martydd3 | 10:db13782f05d9 | 30 | void update_dcdc(const void *arg){ |
| martydd3 | 12:e0adb697fcdb | 31 | char data[1] = {0}; |
| martydd3 | 6:6a04210a3f4f | 32 | while(1){ |
| martydd3 | 6:6a04210a3f4f | 33 | data[0] = status; |
| martydd3 | 12:e0adb697fcdb | 34 | CANMessage txMessage(TX_DC_DC_ID, data, 1); |
| martydd3 | 10:db13782f05d9 | 35 | tx_DC_Buffer->txWrite(txMessage); |
| martydd3 | 6:6a04210a3f4f | 36 | |
| martydd3 | 6:6a04210a3f4f | 37 | Thread::wait(100); //10 Hz update |
| martydd3 | 6:6a04210a3f4f | 38 | } |
| martydd3 | 6:6a04210a3f4f | 39 | } |
| martydd3 | 6:6a04210a3f4f | 40 | |
| martydd3 | 6:6a04210a3f4f | 41 | void DC::start_update(){ |
| martydd3 | 10:db13782f05d9 | 42 | Thread update_thread(update_dcdc); |
| martydd3 | 6:6a04210a3f4f | 43 | } |
