Initial commit

Dependencies:   MODSERIAL Terminal TextLCD mbed

mytimer.cpp

Committer:
anmar
Date:
2014-12-05
Revision:
1:a6b0e0ce3e7a
Parent:
0:0903545c0460

File content as of revision 1:a6b0e0ce3e7a:

#include "mytimer.h"

mytimer::mytimer()
{
    running = 0;
    timer = 0;

    tick = new Ticker();    
    tick->attach(this, &mytimer::update, 1);
}

void mytimer::start()
{
    running = 1;
}


void mytimer::stop()
{
    running = 0;
}


void mytimer::reset()
{
    timer = 0;
}

uint32_t mytimer::read()
{
    return timer;
}    

void mytimer::update()
{
    if ( running )
        timer++;
}