Host library for controlling a WiConnect enabled Wi-Fi module.

Dependents:   wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more

sdk/mbed/PeriodicTimer.cpp

Committer:
dan_ackme
Date:
2014-08-11
Revision:
0:ea85c4bb5e1f
Child:
1:6ec9998427ad

File content as of revision 0:ea85c4bb5e1f:

/*
 * Copyright 2014, ACKme Networks
 * All Rights Reserved.
 *
 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ACKme Networks;
 * the contents of this file may not be disclosed to third parties, copied
 * or duplicated in any form, in whole or in part, without the prior
 * written permission of ACKme Networks.
 */


#include "Wiconnect.h"
#include "internal/common.h"

#include "Ticker.h"


/*************************************************************************************************/
PeriodicTimer::PeriodicTimer()
{
    running = false;
}

/*************************************************************************************************/
template<typename T>
void PeriodicTimer::start(T* tptr, void (T::*mptr)(void), int timeoutMs)
{
    attach_us(tptr, mptr, timeoutMs*1000);
    running = true;
}
template void PeriodicTimer::start<Wiconnect>(Wiconnect* tptr, void (Wiconnect::*mptr)(void), int timeoutMs);
template void PeriodicTimer::start<NetworkInterface>(NetworkInterface* tptr, void (NetworkInterface::*mptr)(void), int timeoutMs);

/*************************************************************************************************/
void PeriodicTimer::stop(void)
{
    detach();
    running = false;
}

/*************************************************************************************************/
bool PeriodicTimer::isRunning()
{
    return running;
}