The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Revision:
169:a7c7b631e539
Parent:
167:84c0a372a020
--- a/TARGET_NUCLEO_F031K6/TARGET_STM/rtc_api_hal.h	Thu May 24 15:35:55 2018 +0100
+++ b/TARGET_NUCLEO_F031K6/TARGET_STM/rtc_api_hal.h	Fri Jun 22 15:38:59 2018 +0100
@@ -1,6 +1,6 @@
 /* mbed Microcontroller Library
 *******************************************************************************
-* Copyright (c) 2017, STMicroelectronics
+* Copyright (c) 2018, STMicroelectronics
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
@@ -31,15 +31,8 @@
 #ifndef MBED_RTC_API_HAL_H
 #define MBED_RTC_API_HAL_H
 
-#include <stdint.h>
 #include "rtc_api.h"
-#include "ticker_api.h"
 #include "lp_ticker_api.h"
-#include "us_ticker_api.h"
-#include "hal_tick.h"
-#include "mbed_critical.h"
-#include "mbed_error.h"
-#include "mbed_debug.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -51,31 +44,26 @@
 #define RTC_CLOCK LSI_VALUE
 #endif
 
+#if DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM
 /* PREDIV_A : 7-bit asynchronous prescaler */
-/* PREDIV_S : 15-bit synchronous prescaler */
-/* PREDIV_S is set in order to get a 1 Hz clock */
-#if DEVICE_LOWPOWERTIMER && !MBED_CONF_TARGET_LOWPOWERTIMER_LPTIM
-/* PREDIV_A is set to a small value to improve the SubSeconds resolution */
-/* with a 32768Hz clock, PREDIV_A=7 gives a precision of 244us */
-#define PREDIV_A_VALUE 7
-#else /* DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM */
-/* PREDIV_A is set to the maximum value to improve the consumption */
-#define PREDIV_A_VALUE 127
-#endif /* DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM */
+/* PREDIV_A is set to set LPTICKER frequency to RTC_CLOCK/4 */
+#define PREDIV_A_VALUE 3
 
-#define PREDIV_S_VALUE RTC_CLOCK / (PREDIV_A_VALUE + 1) - 1
-
-/** Read RTC time with subsecond precision.
+/** Read RTC counter with sub second precision
  *
- * @return Time is microsecond
+ * @return LP ticker counter
  */
-uint32_t rtc_read_us(void);
+uint32_t rtc_read_lp(void);
 
-/** Program a wake up timer event in delta microseconds.
+/** Program a wake up timer event
  *
- * @param delta    The time to wait
+ * @param timestamp: counter to set
  */
-void rtc_set_wake_up_timer(uint32_t delta);
+void rtc_set_wake_up_timer(timestamp_t timestamp);
+
+/** Call RTC Wake Up IT
+ */
+void rtc_fire_interrupt(void);
 
 /** Disable the wake up timer event.
  *
@@ -83,13 +71,24 @@
  */
 void rtc_deactivate_wake_up_timer(void);
 
+#else /* DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM */
+
+/* PREDIV_A : 7-bit asynchronous prescaler */
+/* PREDIV_A is set to the maximum value to improve the consumption */
+#define PREDIV_A_VALUE 127
+
+#endif /* DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM */
+
+/* PREDIV_S : 15-bit synchronous prescaler */
+/* PREDIV_S is set in order to get a 1 Hz clock */
+#define PREDIV_S_VALUE RTC_CLOCK / (PREDIV_A_VALUE + 1) - 1
+
 /** Synchronise the RTC shadow registers.
  *
  * Must be called after a deepsleep.
  */
 void rtc_synchronize(void);
 
-
 #ifdef __cplusplus
 }
 #endif