Skip to content

Commit 58388b7

Browse files
committed
Out-of-line LowPowerTimeout etc, lock
To match Timer etc, make LowPowerTimer et al out-of-line. Correct LowPowerTimeout to not lock deep sleep.
1 parent 8e3e198 commit 58388b7

File tree

5 files changed

+24
-15
lines changed

5 files changed

+24
-15
lines changed

drivers/LowPowerTicker.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,8 @@ namespace mbed {
4040
* @note Synchronization level: Interrupt safe
4141
*/
4242
class LowPowerTicker : public TickerBase {
43-
4443
public:
45-
LowPowerTicker() : TickerBase(get_lp_ticker_data())
46-
{
47-
}
44+
LowPowerTicker();
4845
};
4946

5047
/** @}*/

drivers/LowPowerTimer.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,8 @@ namespace mbed {
3737
* @note Synchronization level: Interrupt safe
3838
*/
3939
class LowPowerTimer : public TimerBase {
40-
4140
public:
42-
LowPowerTimer() : TimerBase(get_lp_ticker_data())
43-
{
44-
}
45-
41+
LowPowerTimer();
4642
};
4743

4844
/** @}*/

drivers/source/Ticker.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
* limitations under the License.
1616
*/
1717
#include "drivers/Ticker.h"
18+
#include "drivers/LowPowerTicker.h"
1819

1920
#include "hal/us_ticker_api.h"
21+
#include "hal/lp_ticker_api.h"
2022
#include "platform/CriticalSectionLock.h"
2123
#include "platform/mbed_power_mgmt.h"
2224

@@ -103,4 +105,10 @@ Ticker::Ticker() : TickerBase(get_us_ticker_data(), true)
103105
{
104106
}
105107

108+
#if DEVICE_LPTICKER
109+
LowPowerTicker::LowPowerTicker() : TickerBase(get_lp_ticker_data(), false)
110+
{
111+
}
112+
#endif
113+
106114
} // namespace mbed

drivers/source/Timeout.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ Timeout::Timeout() : TimeoutBase(get_us_ticker_data(), true)
3939
{
4040
}
4141

42+
#if DEVICE_LPTICKER
43+
LowPowerTimeout::LowPowerTimeout() : TimeoutBase(get_lp_ticker_data(), false)
44+
{
45+
}
46+
#endif
47+
4248
/* A few miscellaneous out-of-line static members from various related classes,
4349
* just to save them getting needing their own cpp file for one line.
4450
* (In C++17 could avoid the need for this by making the members inline).
@@ -49,10 +55,4 @@ const bool LowPowerClock::is_steady;
4955
#endif
5056
const bool RealTimeClock::is_steady;
5157

52-
#if DEVICE_LPTICKER
53-
LowPowerTimeout::LowPowerTimeout() : TimeoutBase(get_lp_ticker_data(), true)
54-
{
55-
}
56-
#endif
57-
5858
} // namespace mbed

drivers/source/Timer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
* limitations under the License.
1616
*/
1717
#include "drivers/Timer.h"
18+
#include "drivers/LowPowerTimer.h"
1819
#include "hal/ticker_api.h"
1920
#include "hal/us_ticker_api.h"
21+
#include "hal/lp_ticker_api.h"
2022
#include "platform/CriticalSectionLock.h"
2123
#include "platform/mbed_critical.h"
2224
#include "platform/mbed_power_mgmt.h"
@@ -121,4 +123,10 @@ Timer::Timer() : TimerBase(get_us_ticker_data(), true)
121123
{
122124
}
123125

126+
#if DEVICE_LPTICKER
127+
LowPowerTimer::LowPowerTimer() : TimerBase(get_lp_ticker_data(), false)
128+
{
129+
}
130+
#endif
131+
124132
} // namespace mbed

0 commit comments

Comments
 (0)