From b65e861b20ba30207458f34e28103b1c8aea727a Mon Sep 17 00:00:00 2001 From: jeromecoutant Date: Tue, 7 Nov 2017 17:18:09 +0100 Subject: [PATCH] STM32 LOW_POWER_TIMER update : lp_ticker Removed unnecessary part --- targets/TARGET_STM/lp_ticker.c | 17 +++-------------- targets/TARGET_STM/rtc_api_hal.h | 11 ++--------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/targets/TARGET_STM/lp_ticker.c b/targets/TARGET_STM/lp_ticker.c index 689833ffcd..dfe84aff75 100644 --- a/targets/TARGET_STM/lp_ticker.c +++ b/targets/TARGET_STM/lp_ticker.c @@ -1,6 +1,6 @@ /* mbed Microcontroller Library ******************************************************************************* - * Copyright (c) 2016, STMicroelectronics + * Copyright (c) 2017, STMicroelectronics * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,20 +31,11 @@ #if DEVICE_LOWPOWERTIMER -#include "ticker_api.h" -#include "lp_ticker_api.h" -#include "rtc_api.h" #include "rtc_api_hal.h" -static uint8_t lp_ticker_inited = 0; - void lp_ticker_init(void) { - if (lp_ticker_inited) return; - lp_ticker_inited = 1; - rtc_init(); - rtc_set_irq_handler((uint32_t) lp_ticker_irq_handler); } uint32_t lp_ticker_read(void) @@ -52,8 +43,6 @@ uint32_t lp_ticker_read(void) uint32_t usecs = 0; time_t time = 0; - lp_ticker_init(); - do { time = rtc_read(); usecs = rtc_read_subseconds(); @@ -82,7 +71,7 @@ void lp_ticker_disable_interrupt(void) void lp_ticker_clear_interrupt(void) { - + NVIC_ClearPendingIRQ(RTC_WKUP_IRQn); } -#endif +#endif /* DEVICE_LOWPOWERTIMER */ diff --git a/targets/TARGET_STM/rtc_api_hal.h b/targets/TARGET_STM/rtc_api_hal.h index 14a345438d..313b0dbd78 100644 --- a/targets/TARGET_STM/rtc_api_hal.h +++ b/targets/TARGET_STM/rtc_api_hal.h @@ -33,19 +33,12 @@ #include #include "rtc_api.h" +#include "ticker_api.h" +#include "lp_ticker_api.h" #ifdef __cplusplus extern "C" { #endif -/* - * Extend rtc_api.h - */ - -/** Set the given function as handler of wakeup timer event. - * - * @param handler The function to set as handler - */ -void rtc_set_irq_handler(uint32_t handler); /** Read the subsecond register. *