Skip to content

Commit 9b8dd34

Browse files
committed
STM32 LPTICKER : clean include file
1 parent 7572536 commit 9b8dd34

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

targets/TARGET_STM/lp_ticker.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* mbed Microcontroller Library
22
*******************************************************************************
3-
* Copyright (c) 2017, STMicroelectronics
3+
* Copyright (c) 2018, STMicroelectronics
44
* All rights reserved.
55
*
66
* Redistribution and use in source and binary forms, with or without
@@ -30,16 +30,24 @@
3030

3131
#if DEVICE_LPTICKER
3232

33-
#include "rtc_api_hal.h"
34-
33+
/***********************************************************************/
34+
/* lpticker_lptim config is 1 in json config file */
35+
/* LPTICKER is based on LPTIM feature from ST drivers. RTC is not used */
3536
#if MBED_CONF_TARGET_LPTICKER_LPTIM
3637

38+
#include "lp_ticker_api.h"
39+
#include "mbed_error.h"
40+
3741
LPTIM_HandleTypeDef LptimHandle;
3842

3943
const ticker_info_t* lp_ticker_get_info()
4044
{
4145
static const ticker_info_t info = {
42-
RTC_CLOCK,
46+
#if MBED_CONF_TARGET_LSE_AVAILABLE
47+
LSE_VALUE,
48+
#else
49+
LSI_VALUE,
50+
#endif
4351
16
4452
};
4553
return &info;
@@ -224,8 +232,14 @@ void lp_ticker_clear_interrupt(void)
224232
NVIC_ClearPendingIRQ(LPTIM1_IRQn);
225233
}
226234

235+
236+
237+
/*****************************************************************/
238+
/* lpticker_lptim config is 0 or not defined in json config file */
239+
/* LPTICKER is based on RTC wake up feature from ST drivers */
227240
#else /* MBED_CONF_TARGET_LPTICKER_LPTIM */
228241

242+
#include "rtc_api_hal.h"
229243
void lp_ticker_init(void)
230244
{
231245
rtc_init();

targets/TARGET_STM/rtc_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* mbed Microcontroller Library
22
*******************************************************************************
3-
* Copyright (c) 2017, STMicroelectronics
3+
* Copyright (c) 2018, STMicroelectronics
44
* All rights reserved.
55
*
66
* Redistribution and use in source and binary forms, with or without
@@ -32,6 +32,7 @@
3232

3333
#include "rtc_api_hal.h"
3434
#include "mbed_mktime.h"
35+
#include "mbed_error.h"
3536

3637
static RTC_HandleTypeDef RtcHandle;
3738

targets/TARGET_STM/rtc_api_hal.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* mbed Microcontroller Library
22
*******************************************************************************
3-
* Copyright (c) 2017, STMicroelectronics
3+
* Copyright (c) 2018, STMicroelectronics
44
* All rights reserved.
55
*
66
* Redistribution and use in source and binary forms, with or without
@@ -31,15 +31,8 @@
3131
#ifndef MBED_RTC_API_HAL_H
3232
#define MBED_RTC_API_HAL_H
3333

34-
#include <stdint.h>
3534
#include "rtc_api.h"
36-
#include "ticker_api.h"
3735
#include "lp_ticker_api.h"
38-
#include "us_ticker_api.h"
39-
#include "hal_tick.h"
40-
#include "mbed_critical.h"
41-
#include "mbed_error.h"
42-
#include "mbed_debug.h"
4336

4437
#ifdef __cplusplus
4538
extern "C" {

targets/TARGET_STM/sleep.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* mbed Microcontroller Library
22
*******************************************************************************
3-
* Copyright (c) 2016, STMicroelectronics
3+
* Copyright (c) 2018, STMicroelectronics
44
* All rights reserved.
55
*
66
* Redistribution and use in source and binary forms, with or without
@@ -30,10 +30,14 @@
3030
#if DEVICE_SLEEP
3131

3232
#include "sleep_api.h"
33-
#include "rtc_api_hal.h"
33+
#include "us_ticker_api.h"
34+
#include "hal_tick.h"
35+
#include "mbed_critical.h"
36+
#include "mbed_error.h"
3437

3538
extern void HAL_SuspendTick(void);
3639
extern void HAL_ResumeTick(void);
40+
extern void rtc_synchronize(void);
3741

3842
/* Wait loop - assuming tick is 1 us */
3943
static void wait_loop(uint32_t timeout)

0 commit comments

Comments
 (0)