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
Diff: SysMngmt.cpp
- Revision:
- 3:1345f882d8f3
- Parent:
- 2:baeb80c778f7
- Child:
- 4:e31528929150
--- a/SysMngmt.cpp Sun Oct 05 17:35:20 2014 +0000
+++ b/SysMngmt.cpp Tue Oct 07 22:42:35 2014 +0000
@@ -346,9 +346,29 @@
}
}
+char dcCANId = 1; // first byte of CANData, last byte states whether to toggle on (1) or off (0)
+DigitalOut dcPin(p20);
+
+void toggleDC_DC(bool toggle){
+ static bool dc_on = false;
+
+ //dcPin turns on DC_DC converter when 0, off when 1
+
+ if(toggle && !dc_on){
+ dcPin = 0;
+ dc_on = true;
+ } else if(!toggle && dc_on){
+ dcPin = 1;
+ dc_on = false;
+ }
+}
+
int main() {
CANMessage rx_msg;
+ //turn off DC-DC converter on startup
+ toggleDC_DC(false);
+
while(1)
{
if(rxBuffer.rxRead(rx_msg) && rx_msg.id == sysCANId){
@@ -363,6 +383,9 @@
fan_Threads[pin_id] = new Thread(rampFans, rx_msg.data);
}
+ if(rx_msg.data[0] == dcCANId){
+ toggleDC_DC((bool)rx_msg.data[7]);
+ }
}
}
}
