Skip to content
This repository was archived by the owner on Mar 2, 2023. It is now read-only.

Commit 0311e5d

Browse files
committed
LowPowerTicker - Add ::attach(...) method + call callback
1 parent d5506b0 commit 0311e5d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

drivers/tests/UNITTESTS/doubles/drivers/LowPowerTicker.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef MBED_LOWPOWERTICKER_H
1818
#define MBED_LOWPOWERTICKER_H
1919

20+
#include <chrono>
21+
2022
#include "hal/ticker_api.h"
2123
#include "Callback.h"
2224

@@ -28,21 +30,23 @@ namespace mbed {
2830
class LowPowerTicker {
2931

3032
public:
31-
LowPowerTicker()
32-
{
33-
}
33+
LowPowerTicker() = default;
34+
35+
virtual ~LowPowerTicker() = default;
3436

35-
virtual ~LowPowerTicker()
37+
void attach(Callback<void()> func, std::chrono::microseconds t)
3638
{
39+
func();
3740
}
3841

3942
void attach_us(Callback<void()> func, us_timestamp_t t)
4043
{
41-
44+
func();
4245
}
46+
4347
void detach()
4448
{
45-
49+
// nothing to do
4650
}
4751
};
4852

0 commit comments

Comments
 (0)