LowPowerTimer
LowPowerTimer class hierarchy
LowPowerTimer inherits from the Timer Class. The timer in this case continues operating even in deep sleep mode. It relies on lp_ticker
, which is the low power ticker.
You can use the LowPowerTimer interface to create, start, stop and read a timer for measuring small times (between microseconds and seconds). You can independently create, start and stop any number of LowPowerTimer objects. For more information about power management, please see our power management APIs.
LowPowerTimer class reference
LowPowerTimer example
/*
* Copyright (c) 2020 Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*/
#include "mbed.h"
using namespace std::chrono;
LowPowerTimer t;
int main()
{
t.start();
printf("Hello World!\n");
t.stop();
printf("The time taken was %llu milliseconds\n", duration_cast<milliseconds>(t.elapsed_time()).count());
}