STM32 LPTICKER : clean include file

pull/7009/head
jeromecoutant 2018-03-28 15:00:53 +02:00 committed by Bartek Szatkowski
parent c31a7c2277
commit 39a9801675
4 changed files with 27 additions and 15 deletions

View File

@ -1,6 +1,6 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
******************************************************************************* *******************************************************************************
* Copyright (c) 2017, STMicroelectronics * Copyright (c) 2018, STMicroelectronics
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -30,16 +30,24 @@
#if DEVICE_LPTICKER #if DEVICE_LPTICKER
#include "rtc_api_hal.h" /***********************************************************************/
/* lpticker_lptim config is 1 in json config file */
/* LPTICKER is based on LPTIM feature from ST drivers. RTC is not used */
#if MBED_CONF_TARGET_LPTICKER_LPTIM #if MBED_CONF_TARGET_LPTICKER_LPTIM
#include "lp_ticker_api.h"
#include "mbed_error.h"
LPTIM_HandleTypeDef LptimHandle; LPTIM_HandleTypeDef LptimHandle;
const ticker_info_t* lp_ticker_get_info() const ticker_info_t* lp_ticker_get_info()
{ {
static const ticker_info_t info = { static const ticker_info_t info = {
RTC_CLOCK, #if MBED_CONF_TARGET_LSE_AVAILABLE
LSE_VALUE,
#else
LSI_VALUE,
#endif
16 16
}; };
return &info; return &info;
@ -224,8 +232,14 @@ void lp_ticker_clear_interrupt(void)
NVIC_ClearPendingIRQ(LPTIM1_IRQn); NVIC_ClearPendingIRQ(LPTIM1_IRQn);
} }
/*****************************************************************/
/* lpticker_lptim config is 0 or not defined in json config file */
/* LPTICKER is based on RTC wake up feature from ST drivers */
#else /* MBED_CONF_TARGET_LPTICKER_LPTIM */ #else /* MBED_CONF_TARGET_LPTICKER_LPTIM */
#include "rtc_api_hal.h"
void lp_ticker_init(void) void lp_ticker_init(void)
{ {
rtc_init(); rtc_init();

View File

@ -1,6 +1,6 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
******************************************************************************* *******************************************************************************
* Copyright (c) 2017, STMicroelectronics * Copyright (c) 2018, STMicroelectronics
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -32,6 +32,7 @@
#include "rtc_api_hal.h" #include "rtc_api_hal.h"
#include "mbed_mktime.h" #include "mbed_mktime.h"
#include "mbed_error.h"
static RTC_HandleTypeDef RtcHandle; static RTC_HandleTypeDef RtcHandle;

View File

@ -1,6 +1,6 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
******************************************************************************* *******************************************************************************
* Copyright (c) 2017, STMicroelectronics * Copyright (c) 2018, STMicroelectronics
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -31,15 +31,8 @@
#ifndef MBED_RTC_API_HAL_H #ifndef MBED_RTC_API_HAL_H
#define MBED_RTC_API_HAL_H #define MBED_RTC_API_HAL_H
#include <stdint.h>
#include "rtc_api.h" #include "rtc_api.h"
#include "ticker_api.h"
#include "lp_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 #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -1,6 +1,6 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
******************************************************************************* *******************************************************************************
* Copyright (c) 2016, STMicroelectronics * Copyright (c) 2018, STMicroelectronics
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -30,10 +30,14 @@
#if DEVICE_SLEEP #if DEVICE_SLEEP
#include "sleep_api.h" #include "sleep_api.h"
#include "rtc_api_hal.h" #include "us_ticker_api.h"
#include "hal_tick.h"
#include "mbed_critical.h"
#include "mbed_error.h"
extern void HAL_SuspendTick(void); extern void HAL_SuspendTick(void);
extern void HAL_ResumeTick(void); extern void HAL_ResumeTick(void);
extern void rtc_synchronize(void);
/* Wait loop - assuming tick is 1 us */ /* Wait loop - assuming tick is 1 us */
static void wait_loop(uint32_t timeout) static void wait_loop(uint32_t timeout)