pwm period is now 200us instead of the default 20ms veml6040 config is now AF_BIT | TRIG_BIT

Dependencies:   mbed MMA8451Q USBDevice WakeUp vt100

Fork of afero_node_suntory_2017_06_15 by Orefatoi

sensors/TimeEventHandler.hpp

Committer:
wataloh
Date:
2017-06-09
Revision:
21:d03c7bbb9f37
Parent:
15:2c2c0a7c50c1

File content as of revision 21:d03c7bbb9f37:

#ifndef _TIME_EVENT_HANDLER_HPP_
#define _TIME_EVENT_HANDLER_HPP_

#include "Preferences.hpp"
#include "DebugIO.hpp"

template<typename A> class TimeEventHandler
{
protected:
    TimeEventHandler()
    {
        timeout = new Timeout();
    }
    Timeout *timeout;
    PACKET packet;
    void (A::*cb)();
    int32_t interval_current;
    void read()
    {
        cb = &A::go;
    }
    void backToNOP()
    {
        cb = NULL;
    }
    virtual void checkIntervalUpdate()
    {
    }
public:
    int loop()
    {
        if(cb != NULL)
        {
            (A::self->*cb)();
        }
        A::self->checkIntervalUpdate();
        return 0;
    }
};

#endif //_TIME_EVENT_HANDLER_HPP_