Very early flyable code.

Dependencies:   mbed RF12B

System.h

Committer:
madcowswe
Date:
2011-10-01
Revision:
0:9fcb3bf5c231

File content as of revision 0:9fcb3bf5c231:


//General system functions

#include <string>

//
void kill(string reason = "Killed for no reason!") {
    PWMleft = NOPOWER - 0.004;
    PWMright = NOPOWER - 0.004;
    PWMfront = NOPOWER - 0.004;
    PWMrear = NOPOWER - 0.004;
    //TODO: send this over RF as well..
    pc.printf("%s\r\n", reason.c_str());
    /*wait(0.5);
    left = 0;
    right = 0;
    front = 0;
    rear = 0;
    */
    while (1);
}

//
void wdt() {
    if (!loopalive)
        kill("Killed by WDT: loop has stalled");
    if (!commandsalive)
        kill("Killed by WDT: command starvation");

    loopalive = 0;
    commandsalive = 0;
}