mbed

Fork of mbed-dev by mbed official

Revision:
181:96ed750bd169
Parent:
175:b96e65c34a4d
Child:
182:57724642e740
--- a/targets/TARGET_STM/lp_ticker.c	Thu Dec 07 14:01:42 2017 +0000
+++ b/targets/TARGET_STM/lp_ticker.c	Wed Jan 17 15:23:54 2018 +0000
@@ -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 usecs = 0;
     time_t time = 0;
 
-    lp_ticker_init();
-
     do {
         time = rtc_read();
         usecs = rtc_read_subseconds();
@@ -82,7 +71,7 @@
 
 void lp_ticker_clear_interrupt(void)
 {
-
+    NVIC_ClearPendingIRQ(RTC_WKUP_IRQn);
 }
 
-#endif
+#endif /* DEVICE_LOWPOWERTIMER */