diff --git a/TESTS/mbed_drivers/lp_ticker/main.cpp b/TESTS/mbed_drivers/lp_ticker/main.cpp index aeb3676..1d687cc 100644 --- a/TESTS/mbed_drivers/lp_ticker/main.cpp +++ b/TESTS/mbed_drivers/lp_ticker/main.cpp @@ -19,7 +19,7 @@ #include "unity/unity.h" -#if !DEVICE_LOWPOWERTIMER +#if !DEVICE_LPTICKER #error [NOT_SUPPORTED] Low power ticker not supported for this target #endif diff --git a/TESTS/mbed_drivers/lp_timeout/main.cpp b/TESTS/mbed_drivers/lp_timeout/main.cpp index eaccab9..b3cbe7d 100644 --- a/TESTS/mbed_drivers/lp_timeout/main.cpp +++ b/TESTS/mbed_drivers/lp_timeout/main.cpp @@ -14,8 +14,8 @@ * limitations under the License. */ -#if !DEVICE_LOWPOWERTIMER -#error [NOT_SUPPORTED] Low power timer not supported for this target +#if !DEVICE_LPTICKER + #error [NOT_SUPPORTED] Low power timer not supported for this target #endif #include "mbed.h" diff --git a/TESTS/mbed_drivers/lp_timer/main.cpp b/TESTS/mbed_drivers/lp_timer/main.cpp index a723214..aded382 100644 --- a/TESTS/mbed_drivers/lp_timer/main.cpp +++ b/TESTS/mbed_drivers/lp_timer/main.cpp @@ -22,7 +22,7 @@ #include "rtos.h" #include "hal/us_ticker_api.h" -#if !DEVICE_LOWPOWERTIMER +#if !DEVICE_LPTICKER #error [NOT_SUPPORTED] test not supported #endif diff --git a/TESTS/mbed_hal/lp_ticker/main.cpp b/TESTS/mbed_hal/lp_ticker/main.cpp index 14794f9..177af3f 100644 --- a/TESTS/mbed_hal/lp_ticker/main.cpp +++ b/TESTS/mbed_hal/lp_ticker/main.cpp @@ -21,8 +21,8 @@ #include "lp_ticker_api_tests.h" #include "hal/lp_ticker_api.h" -#if !DEVICE_LOWPOWERTIMER -#error [NOT_SUPPORTED] test not supported +#if !DEVICE_LPTICKER + #error [NOT_SUPPORTED] Low power timer not supported for this target #endif using namespace utest::v1; diff --git a/TESTS/mbed_hal/lp_us_tickers/main.cpp b/TESTS/mbed_hal/lp_us_tickers/main.cpp index a0283e1..7d8ee71 100644 --- a/TESTS/mbed_hal/lp_us_tickers/main.cpp +++ b/TESTS/mbed_hal/lp_us_tickers/main.cpp @@ -73,7 +73,7 @@ if (ticker == get_us_ticker_data()) { us_ticker_clear_interrupt(); } else { -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER lp_ticker_clear_interrupt(); #endif } @@ -411,7 +411,7 @@ return greentea_case_setup_handler(source, index_of_case); } -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER utest::v1::status_t lp_ticker_setup(const Case *const source, const size_t index_of_case) { intf = get_lp_ticker_data()->interface; @@ -444,7 +444,7 @@ Case("hf ticker overflow test", hf_ticker_setup, ticker_overflow_test), Case("hf ticker increment test", hf_ticker_setup, ticker_increment_test), Case("hf ticker speed test", hf_ticker_setup, ticker_speed_test), -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER Case("lp ticker init is safe to call repeatedly", lp_ticker_setup, ticker_init_test), Case("lp ticker info test", lp_ticker_setup, ticker_info_test), Case("lp ticker interrupt test", lp_ticker_setup, ticker_interrupt_test), diff --git a/TESTS/mbed_hal/lp_us_tickers_freq/main.cpp b/TESTS/mbed_hal/lp_us_tickers_freq/main.cpp index f8f35e8..879b801 100644 --- a/TESTS/mbed_hal/lp_us_tickers_freq/main.cpp +++ b/TESTS/mbed_hal/lp_us_tickers_freq/main.cpp @@ -51,7 +51,7 @@ if (ticker == get_us_ticker_data()) { us_ticker_clear_interrupt(); } else { -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER lp_ticker_clear_interrupt(); #endif } @@ -111,7 +111,7 @@ return greentea_case_setup_handler(source, index_of_case); } -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER utest::v1::status_t lp_ticker_case_setup_handler_t(const Case * const source, const size_t index_of_case) { intf = get_lp_ticker_data()->interface; @@ -130,7 +130,7 @@ Case cases[] = { Case("hf ticker frequency test", hf_ticker_case_setup_handler_t, ticker_frequency_test, ticker_case_teardown_handler_t), -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER Case("lp ticker frequency test", lp_ticker_case_setup_handler_t, ticker_frequency_test, ticker_case_teardown_handler_t), #endif diff --git a/doxyfile_options b/doxyfile_options index 2764893..747208a 100644 --- a/doxyfile_options +++ b/doxyfile_options @@ -2079,7 +2079,7 @@ DEVICE_I2C_ASYNCH \ DEVICE_INTERRUPTIN \ DEVICE_ITM \ - DEVICE_LOWPOWERTIMER \ + DEVICE_LPTICKER \ DEVICE_PORTIN \ DEVICE_PORTINOUT \ DEVICE_PORTOUT \ diff --git a/doxygen_options.json b/doxygen_options.json index 3677ddc..b1c6fd8 100644 --- a/doxygen_options.json +++ b/doxygen_options.json @@ -6,7 +6,7 @@ "SEARCH_INCLUDES": "YES", "INCLUDE_PATH": "", "INCLUDE_FILE_PATTERNS": "", - "PREDEFINED": "DOXYGEN_ONLY DEVICE_ANALOGIN DEVICE_ANALOGOUT DEVICE_CAN DEVICE_CRC DEVICE_ETHERNET DEVICE_EMAC DEVICE_FLASH DEVICE_I2C DEVICE_I2CSLAVE DEVICE_I2C_ASYNCH DEVICE_INTERRUPTIN DEVICE_ITM DEVICE_LOWPOWERTIMER DEVICE_PORTIN DEVICE_PORTINOUT DEVICE_PORTOUT DEVICE_PWMOUT DEVICE_RTC DEVICE_TRNG DEVICE_SERIAL DEVICE_SERIAL_ASYNCH DEVICE_SERIAL_FC DEVICE_SLEEP DEVICE_SPI DEVICE_SPI_ASYNCH DEVICE_SPISLAVE DEVICE_STORAGE \"MBED_DEPRECATED_SINCE(f, g)=\" \"MBED_ENABLE_IF_CALLBACK_COMPATIBLE(F, M)=\" \"MBED_DEPRECATED(s)=\"", + "PREDEFINED": "DOXYGEN_ONLY DEVICE_ANALOGIN DEVICE_ANALOGOUT DEVICE_CAN DEVICE_CRC DEVICE_ETHERNET DEVICE_EMAC DEVICE_FLASH DEVICE_I2C DEVICE_I2CSLAVE DEVICE_I2C_ASYNCH DEVICE_INTERRUPTIN DEVICE_ITM DEVICE_LPTICKER DEVICE_PORTIN DEVICE_PORTINOUT DEVICE_PORTOUT DEVICE_PWMOUT DEVICE_RTC DEVICE_TRNG DEVICE_SERIAL DEVICE_SERIAL_ASYNCH DEVICE_SERIAL_FC DEVICE_SLEEP DEVICE_SPI DEVICE_SPI_ASYNCH DEVICE_SPISLAVE DEVICE_STORAGE \"MBED_DEPRECATED_SINCE(f, g)=\" \"MBED_ENABLE_IF_CALLBACK_COMPATIBLE(F, M)=\" \"MBED_DEPRECATED(s)=\"", "EXPAND_AS_DEFINED": "", "SKIP_FUNCTION_MACROS": "NO", "STRIP_CODE_COMMENTS": "NO", diff --git a/drivers/LowPowerTicker.h b/drivers/LowPowerTicker.h index 2df8ef3..9a4caf8 100644 --- a/drivers/LowPowerTicker.h +++ b/drivers/LowPowerTicker.h @@ -20,7 +20,7 @@ #include "drivers/Ticker.h" #include "platform/NonCopyable.h" -#if defined (DEVICE_LOWPOWERTIMER) || defined(DOXYGEN_ONLY) +#if defined (DEVICE_LPTICKER) || defined(DOXYGEN_ONLY) #include "hal/lp_ticker_api.h" diff --git a/drivers/LowPowerTimeout.h b/drivers/LowPowerTimeout.h index 6aaefe2..ef96006 100644 --- a/drivers/LowPowerTimeout.h +++ b/drivers/LowPowerTimeout.h @@ -18,7 +18,7 @@ #include "platform/platform.h" -#if defined (DEVICE_LOWPOWERTIMER) || defined(DOXYGEN_ONLY) +#if defined (DEVICE_LPTICKER) || defined(DOXYGEN_ONLY) #include "hal/lp_ticker_api.h" #include "drivers/LowPowerTicker.h" diff --git a/drivers/LowPowerTimer.h b/drivers/LowPowerTimer.h index e7e0037..20959d6 100644 --- a/drivers/LowPowerTimer.h +++ b/drivers/LowPowerTimer.h @@ -20,7 +20,7 @@ #include "drivers/Timer.h" #include "platform/NonCopyable.h" -#if defined (DEVICE_LOWPOWERTIMER) || defined(DOXYGEN_ONLY) +#if defined (DEVICE_LPTICKER) || defined(DOXYGEN_ONLY) #include "hal/lp_ticker_api.h" diff --git a/drivers/Ticker.h b/drivers/Ticker.h index 646f826..59a24df 100644 --- a/drivers/Ticker.h +++ b/drivers/Ticker.h @@ -71,7 +71,7 @@ // When low power ticker is in use, then do not disable deep-sleep. Ticker(const ticker_data_t *data) : TimerEvent(data), _function(0), _lock_deepsleep(true) { -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER _lock_deepsleep = (data != get_lp_ticker_data()); #endif } diff --git a/drivers/Timer.cpp b/drivers/Timer.cpp index f523974..b8af5dc 100644 --- a/drivers/Timer.cpp +++ b/drivers/Timer.cpp @@ -27,7 +27,7 @@ Timer::Timer(const ticker_data_t *data) : _running(), _start(), _time(), _ticker_data(data), _lock_deepsleep(true) { reset(); -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER _lock_deepsleep = (data != get_lp_ticker_data()); #endif } diff --git a/hal/lp_ticker_api.h b/hal/lp_ticker_api.h index 51eb64f..51c35bd 100644 --- a/hal/lp_ticker_api.h +++ b/hal/lp_ticker_api.h @@ -21,7 +21,7 @@ #include "device.h" -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER #include "hal/ticker_api.h" diff --git a/hal/mbed_lp_ticker_api.c b/hal/mbed_lp_ticker_api.c index d9bfd86..43a4c8e 100644 --- a/hal/mbed_lp_ticker_api.c +++ b/hal/mbed_lp_ticker_api.c @@ -15,7 +15,7 @@ */ #include "hal/lp_ticker_api.h" -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER void lp_ticker_set_interrupt_wrapper(timestamp_t timestamp); diff --git a/targets/TARGET_ARM_SSG/TARGET_BEETLE/lp_ticker.c b/targets/TARGET_ARM_SSG/TARGET_BEETLE/lp_ticker.c index 50d3039..e96379a 100644 --- a/targets/TARGET_ARM_SSG/TARGET_BEETLE/lp_ticker.c +++ b/targets/TARGET_ARM_SSG/TARGET_BEETLE/lp_ticker.c @@ -30,7 +30,7 @@ /* lp_ticker Overflow limit */ static uint32_t lp_ticker_overflow_limit = 0; -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER /** * Interrupt Handler */ diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/lp_ticker.c b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/lp_ticker.c index 3ebc0ce..71a8844 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/lp_ticker.c +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/lp_ticker.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER #include "lp_ticker_api.h" #include "fsl_rtc.h" @@ -241,4 +241,4 @@ lptmr_schedule = 0; } -#endif /* DEVICE_LOWPOWERTIMER */ +#endif /* DEVICE_LPTICKER */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/lp_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/lp_ticker.c index 5661bec..a6d8bd0 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/lp_ticker.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/lp_ticker.c @@ -15,7 +15,7 @@ */ #include "lp_ticker_api.h" -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER #include "common_rtc.h" #include "mbed_critical.h" @@ -60,4 +60,4 @@ nrf_rtc_event_clear(COMMON_RTC_INSTANCE, LP_TICKER_EVENT); } -#endif // DEVICE_LOWPOWERTIMER +#endif // DEVICE_LPTICKER diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/us_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/us_ticker.c index 6a5776d..a341ae2 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/us_ticker.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/us_ticker.c @@ -81,7 +81,7 @@ us_ticker_irq_handler(); } -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER if (m_common_sw_irq_flag & LP_TICKER_SW_IRQ_MASK) { m_common_sw_irq_flag &= ~LP_TICKER_SW_IRQ_MASK; lp_ticker_irq_handler(); @@ -133,7 +133,7 @@ #if defined(TARGET_MCU_NRF51822) nrf_rtc_event_clear(COMMON_RTC_INSTANCE, OS_TICK_EVENT); #endif -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER nrf_rtc_event_clear(COMMON_RTC_INSTANCE, LP_TICKER_EVENT); #endif nrf_rtc_event_clear(COMMON_RTC_INSTANCE, NRF_RTC_EVENT_OVERFLOW); @@ -142,7 +142,7 @@ // events will be enabled or disabled as needed (such approach is more // energy efficient). nrf_rtc_int_enable(COMMON_RTC_INSTANCE, -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER LP_TICKER_INT_MASK | #endif US_TICKER_INT_MASK | @@ -156,7 +156,7 @@ #if defined(TARGET_MCU_NRF51822) OS_TICK_INT_MASK | #endif -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER LP_TICKER_INT_MASK | #endif US_TICKER_INT_MASK); diff --git a/targets/TARGET_NUVOTON/TARGET_M451/lp_ticker.c b/targets/TARGET_NUVOTON/TARGET_M451/lp_ticker.c index 8f1e209..2820059 100644 --- a/targets/TARGET_NUVOTON/TARGET_M451/lp_ticker.c +++ b/targets/TARGET_NUVOTON/TARGET_M451/lp_ticker.c @@ -16,7 +16,7 @@ #include "lp_ticker_api.h" -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER #include "sleep_api.h" #include "mbed_wait_api.h" diff --git a/targets/TARGET_NUVOTON/TARGET_M480/lp_ticker.c b/targets/TARGET_NUVOTON/TARGET_M480/lp_ticker.c index b39587d..a093606 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/lp_ticker.c +++ b/targets/TARGET_NUVOTON/TARGET_M480/lp_ticker.c @@ -16,7 +16,7 @@ #include "lp_ticker_api.h" -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER #include "sleep_api.h" #include "mbed_wait_api.h" diff --git a/targets/TARGET_NUVOTON/TARGET_NANO100/lp_ticker.c b/targets/TARGET_NUVOTON/TARGET_NANO100/lp_ticker.c index aef86aa..6355531 100644 --- a/targets/TARGET_NUVOTON/TARGET_NANO100/lp_ticker.c +++ b/targets/TARGET_NUVOTON/TARGET_NANO100/lp_ticker.c @@ -16,7 +16,7 @@ #include "lp_ticker_api.h" -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER #include "sleep_api.h" #include "mbed_wait_api.h" diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/lp_ticker.c b/targets/TARGET_NUVOTON/TARGET_NUC472/lp_ticker.c index a7c634b..08ce7f8 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/lp_ticker.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/lp_ticker.c @@ -16,7 +16,7 @@ #include "lp_ticker_api.h" -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER #include "sleep_api.h" #include "mbed_wait_api.h" diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_IMX/lp_ticker.c b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_IMX/lp_ticker.c index 163457c..981911c 100644 --- a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_IMX/lp_ticker.c +++ b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_IMX/lp_ticker.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER #include "lp_ticker_api.h" #include "fsl_snvs_hp.h" @@ -131,4 +131,4 @@ GPT_ClearStatusFlags(GPT2, kGPT_OutputCompare1Flag); } -#endif /* DEVICE_LOWPOWERTIMER */ +#endif /* DEVICE_LPTICKER */ diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_lp_ticker_api.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_lp_ticker_api.c index fec4c07..2e80f07 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_lp_ticker_api.c +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_lp_ticker_api.c @@ -7,11 +7,11 @@ * $Rev: $ * $Date: $ ****************************************************************************** - * Copyright 2016 Semiconductor Components Industries LLC (d/b/a �ON Semiconductor�). + * Copyright 2016 Semiconductor Components Industries LLC (d/b/a �ON Semiconductor�). * All rights reserved. This software and/or documentation is licensed by ON Semiconductor * under limited terms and conditions. The terms and conditions pertaining to the software * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf - * (�ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software�) and + * (�ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software�) and * if applicable the software license agreement. Do not use this software and/or * documentation unless you have carefully read and you agree to the limited terms and * conditions. By using this software and/or documentation, you agree to the limited @@ -32,7 +32,7 @@ */ #include "device.h" -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER #include "cmsis_nvic.h" #include "lp_ticker_api.h" @@ -79,4 +79,4 @@ fRtcClearInterrupt(); } -#endif /* DEVICE_LOWPOWERTIMER */ +#endif /* DEVICE_LPTICKER */ diff --git a/targets/TARGET_STM/lp_ticker.c b/targets/TARGET_STM/lp_ticker.c index 7b12b34..e7eea50 100644 --- a/targets/TARGET_STM/lp_ticker.c +++ b/targets/TARGET_STM/lp_ticker.c @@ -28,11 +28,11 @@ ******************************************************************************* */ -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER #include "rtc_api_hal.h" -#if MBED_CONF_TARGET_LOWPOWERTIMER_LPTIM +#if MBED_CONF_TARGET_LPTICKER_LPTIM LPTIM_HandleTypeDef LptimHandle; @@ -283,7 +283,7 @@ __HAL_LPTIM_CLEAR_FLAG(&LptimHandle, LPTIM_FLAG_CMPM); } -#else /* MBED_CONF_TARGET_LOWPOWERTIMER_LPTIM */ +#else /* MBED_CONF_TARGET_LPTICKER_LPTIM */ void lp_ticker_init(void) { @@ -319,6 +319,6 @@ NVIC_ClearPendingIRQ(RTC_WKUP_IRQn); } -#endif /* MBED_CONF_TARGET_LOWPOWERTIMER_LPTIM */ +#endif /* MBED_CONF_TARGET_LPTICKER_LPTIM */ -#endif /* DEVICE_LOWPOWERTIMER */ +#endif /* DEVICE_LPTICKER */ diff --git a/targets/TARGET_STM/rtc_api.c b/targets/TARGET_STM/rtc_api.c index 8c091d5..c11a7ad 100644 --- a/targets/TARGET_STM/rtc_api.c +++ b/targets/TARGET_STM/rtc_api.c @@ -35,14 +35,14 @@ static RTC_HandleTypeDef RtcHandle; -#if DEVICE_LOWPOWERTIMER && !MBED_CONF_TARGET_LOWPOWERTIMER_LPTIM +#if DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM #define GET_TICK_PERIOD(VALUE) (2048 * 1000000 / VALUE) /* 1s / SynchPrediv value * 2^11 (value to get the maximum precision value with no u32 overflow) */ static void (*irq_handler)(void); static void RTC_IRQHandler(void); static uint32_t lp_TickPeriod_us = GET_TICK_PERIOD(4095); /* default SynchPrediv value = 4095 */ -#endif /* DEVICE_LOWPOWERTIMER && !MBED_CONF_TARGET_LOWPOWERTIMER_LPTIM */ +#endif /* DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM */ void rtc_init(void) { @@ -111,14 +111,25 @@ RtcHandle.Init.AsynchPrediv = RTC_AUTO_1_SECOND; #else /* TARGET_STM32F1 */ RtcHandle.Init.HourFormat = RTC_HOURFORMAT_24; - RtcHandle.Init.AsynchPrediv = PREDIV_A_VALUE; - RtcHandle.Init.SynchPrediv = PREDIV_S_VALUE; + + /* PREDIV_A : 7-bit asynchronous prescaler */ +#if DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_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 */ + RtcHandle.Init.AsynchPrediv = 7; +#else + /* PREDIV_A is set to the maximum value to improve the consumption */ + RtcHandle.Init.AsynchPrediv = 0x007F; +#endif + /* PREDIV_S : 15-bit synchronous prescaler */ + /* PREDIV_S is set in order to get a 1 Hz clock */ + RtcHandle.Init.SynchPrediv = RTC_CLOCK / (RtcHandle.Init.AsynchPrediv + 1) - 1; RtcHandle.Init.OutPut = RTC_OUTPUT_DISABLE; RtcHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH; RtcHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN; #endif /* TARGET_STM32F1 */ -#if DEVICE_LOWPOWERTIMER && !MBED_CONF_TARGET_LOWPOWERTIMER_LPTIM +#if DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM lp_TickPeriod_us = GET_TICK_PERIOD(RtcHandle.Init.SynchPrediv); #endif @@ -285,7 +296,7 @@ } } -#if DEVICE_LOWPOWERTIMER && !MBED_CONF_TARGET_LOWPOWERTIMER_LPTIM +#if DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM static void RTC_IRQHandler(void) { @@ -369,6 +380,6 @@ HAL_RTCEx_DeactivateWakeUpTimer(&RtcHandle); } -#endif /* DEVICE_LOWPOWERTIMER && !MBED_CONF_TARGET_LOWPOWERTIMER_LPTIM */ +#endif /* DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM */ #endif /* DEVICE_RTC */ diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c index 9c08b32..0e4d7e7 100644 --- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c +++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c @@ -23,7 +23,7 @@ #include "device.h" #include "clocking.h" -#if DEVICE_LOWPOWERTIMER +#if DEVICE_LPTICKER /******************************************************************************* * The Silicon Labs lp_ticker implementation is mapped on top of an extended RTC diff --git a/targets/targets.json b/targets/targets.json index bf0d045..141fdb0 100755 --- a/targets/targets.json +++ b/targets/targets.json @@ -630,7 +630,7 @@ "macros": ["CPU_MK64FN1M0VMD12", "FSL_RTOS_MBED"], "inherits": ["Target"], "detect_code": ["0240"], - "device_has": ["USTICKER", "LOWPOWERTIMER", "CRC", "ANALOGIN", "ANALOGOUT", "EMAC", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE", "STDIO_MESSAGES", "STORAGE", "TRNG", "FLASH"], + "device_has": ["USTICKER", "LPTICKER", "CRC", "ANALOGIN", "ANALOGOUT", "EMAC", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE", "STDIO_MESSAGES", "STORAGE", "TRNG", "FLASH"], "features": ["LWIP", "STORAGE"], "release_versions": ["2", "5"], "device_name": "MK64FN1M0xxx12", @@ -1095,8 +1095,8 @@ "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1203,8 +1203,8 @@ "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1373,8 +1373,8 @@ "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1405,8 +1405,8 @@ "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1436,8 +1436,8 @@ "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1466,8 +1466,8 @@ "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1489,8 +1489,8 @@ "value": "USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1511,8 +1511,8 @@ "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1533,8 +1533,8 @@ "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1571,8 +1571,8 @@ "value": "USE_PLL_MSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1593,8 +1593,8 @@ "value": "USE_PLL_MSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1635,8 +1635,8 @@ "value": "USE_PLL_MSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1676,8 +1676,8 @@ "value": "USE_PLL_MSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1844,8 +1844,8 @@ "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } @@ -1867,8 +1867,8 @@ "value": "USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1901,8 +1901,8 @@ "help": "Select the USB speed/connector (0=FullSpeed, 1=HighSpeed)", "value": "1" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1927,8 +1927,8 @@ "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1952,8 +1952,8 @@ "value": "USE_PLL_MSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -1975,8 +1975,8 @@ "value": "USE_PLL_MSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, @@ -4001,8 +4001,8 @@ "value": "USE_PLL_MSI", "macro_name": "CLOCK_SOURCE" }, - "lowpowertimer_lptim": { - "help": "This target supports LPTIM. Set value 1 to use LPTIM for LOWPOWERTIMER, or 0 to use RTC wakeup timer", + "lpticker_lptim": { + "help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer", "value": 1 } }, diff --git a/tools/targets/lint.py b/tools/targets/lint.py index 826bbb5..1c09bad 100644 --- a/tools/targets/lint.py +++ b/tools/targets/lint.py @@ -79,7 +79,7 @@ DEVICE_HAS_ALLOWED = ["ANALOGIN", "ANALOGOUT", "CAN", "ETHERNET", "EMAC", "FLASH", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", - "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", + "LPTICKER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "TRNG","SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE", "STORAGE", "STCLK_OFF_DURING_SLEEP"]