ICRS Eurobot 2013

Dependencies:   mbed mbed-rtos Servo QEI

Actuators/Actuator.h

Committer:
twighk
Date:
2013-03-29
Revision:
2:45da48fab346
Child:
4:1be0f6c6ceae

File content as of revision 2:45da48fab346:

#ifndef __Actuator_h__
#define __Actuator_h__
// Eurobot13 Actuator.h

#include "mbed.h"

class Actuator {
    private:
    static Actuator *Head;
    Actuator *next;
    
    public:
    Actuator(){
        next = NULL;
        if (Head == NULL){
            Head = this;
        } else {
            Actuator* nxt = Head;
            for(;nxt->next != NULL; nxt = nxt->next);
            nxt->next = this;
        }
    } 
    
    virtual void halt (void) = 0;
    
    static void haltandCatchFire(void){
            //halt
            for(Actuator* nxt = Head; nxt != NULL; nxt = nxt->next){
                nxt->halt();
            }
            DigitalOut myled(LED1);
            myled = 1;
            
            //catchFire
            while(true);
    }


};

#endif