mirror of https://github.com/ARMmbed/mbed-os.git
Re-init Timer if powered down
parent
35602c21be
commit
21a8a92e87
|
@ -21,6 +21,10 @@
|
|||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
WEAK void error(const char* format, ...);
|
||||
WEAK void error(const char* format, ...) {
|
||||
#if DEVICE_STDIO_MESSAGES
|
||||
|
@ -31,3 +35,7 @@ WEAK void error(const char* format, ...) {
|
|||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -62,7 +62,7 @@ void TIMER1_IRQHandler(void){
|
|||
}
|
||||
#endif
|
||||
void us_ticker_init(void){
|
||||
if (us_ticker_inited){
|
||||
if (us_ticker_inited && US_TICKER_TIMER->POWER){
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ void us_ticker_init(void){
|
|||
}
|
||||
|
||||
uint32_t us_ticker_read(){
|
||||
if (!us_ticker_inited){
|
||||
if (!us_ticker_inited || US_TICKER_TIMER->POWER==0){
|
||||
us_ticker_init();
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ uint32_t us_ticker_read(){
|
|||
}
|
||||
|
||||
void us_ticker_set_interrupt(unsigned int timestamp){
|
||||
if (!us_ticker_inited)
|
||||
if (!us_ticker_inited || US_TICKER_TIMER->POWER==0)
|
||||
{
|
||||
us_ticker_init();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue