This is for ICRS\' second generation Quadcopter

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers System.h Source File

System.h

00001 
00002 //General system functions
00003 
00004 #include <string>
00005 
00006 //
00007 void kill(string reason = "Killed for no reason!") {
00008     PWMleft = NOPOWER - 0.004;
00009     PWMright = NOPOWER - 0.004;
00010     PWMfront = NOPOWER - 0.004;
00011     PWMrear = NOPOWER - 0.004;
00012     //TODO: send this over RF as well..
00013     pc.printf("%s\r\n", reason.c_str());
00014     /*wait(0.5);
00015     left = 0;
00016     right = 0;
00017     front = 0;
00018     rear = 0;
00019     */
00020     while (1);
00021 }
00022 
00023 //
00024 void wdt() {
00025     if (!loopalive)
00026         kill("Killed by WDT: loop has stalled");
00027     if (!commandsalive)
00028         kill("Killed by WDT: command starvation");
00029 
00030     loopalive = 0;
00031     commandsalive = 0;
00032 }