mirror of https://github.com/ARMmbed/mbed-os.git
parent
feaa789c34
commit
b65e861b20
|
@ -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 lp_ticker_read(void)
|
|||
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_disable_interrupt(void)
|
|||
|
||||
void lp_ticker_clear_interrupt(void)
|
||||
{
|
||||
|
||||
NVIC_ClearPendingIRQ(RTC_WKUP_IRQn);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* DEVICE_LOWPOWERTIMER */
|
||||
|
|
|
@ -33,19 +33,12 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include "rtc_api.h"
|
||||
#include "ticker_api.h"
|
||||
#include "lp_ticker_api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Extend rtc_api.h
|
||||
*/
|
||||
|
||||
/** Set the given function as handler of wakeup timer event.
|
||||
*
|
||||
* @param handler The function to set as handler
|
||||
*/
|
||||
void rtc_set_irq_handler(uint32_t handler);
|
||||
|
||||
/** Read the subsecond register.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue