FSST - Hardwarenahe Programmierung

Lösung MyTimer

C++ Seite

class MyTimer : public Timer{   // inheritance 
public:
    MyTimer() : Timer(){ 
        stop(); 
        reset(); 
    }

    void Start() {
        start();
    }
    void Stop() {
        stop();
    }
    void Reset() {
        reset();
    }

    int CheckTimerMS() {
        return read_ms();
    }
    int CheckTimerS() {
        return read();
    }
};

int main() {
    MyTimer tm;
    while(1) {
        tm.Start();
        wait(1);
        tm.Stop();   
        printf("\r\nTimer stopped: %d ", tm.CheckTimerMS());
        tm.Reset();
}

IsA


All wikipages