mirror of https://github.com/ARMmbed/mbed-os.git
parent
64b6589439
commit
5b60c2942d
|
@ -21,10 +21,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WEAK void error(const char* format, ...);
|
WEAK void error(const char* format, ...);
|
||||||
WEAK void error(const char* format, ...) {
|
WEAK void error(const char* format, ...) {
|
||||||
#if DEVICE_STDIO_MESSAGES
|
#if DEVICE_STDIO_MESSAGES
|
||||||
|
@ -35,7 +31,3 @@ WEAK void error(const char* format, ...) {
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ void TIMER1_IRQHandler(void){
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
void us_ticker_init(void){
|
void us_ticker_init(void){
|
||||||
if (us_ticker_inited && US_TICKER_TIMER->POWER){
|
if (us_ticker_inited){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,18 +75,18 @@ void us_ticker_init(void){
|
||||||
|
|
||||||
US_TICKER_TIMER->PRESCALER = 4;
|
US_TICKER_TIMER->PRESCALER = 4;
|
||||||
US_TICKER_TIMER->BITMODE = TIMER_BITMODE_BITMODE_16Bit;
|
US_TICKER_TIMER->BITMODE = TIMER_BITMODE_BITMODE_16Bit;
|
||||||
US_TICKER_TIMER->TASKS_CLEAR =1;
|
US_TICKER_TIMER->TASKS_CLEAR =1;
|
||||||
US_TICKER_TIMER->CC[1] = 0xFFFF;
|
US_TICKER_TIMER->CC[1] = 0xFFFF;
|
||||||
US_TICKER_TIMER->INTENSET = TIMER_INTENSET_COMPARE1_Set << TIMER_INTENSET_COMPARE1_Pos;
|
US_TICKER_TIMER->INTENSET = TIMER_INTENSET_COMPARE1_Set << TIMER_INTENSET_COMPARE1_Pos;
|
||||||
|
|
||||||
NVIC_SetPriority(US_TICKER_TIMER_IRQn, 3);
|
NVIC_SetPriority(US_TICKER_TIMER_IRQn, 3);
|
||||||
NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
|
NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
|
||||||
|
|
||||||
US_TICKER_TIMER->TASKS_START = 0x01;
|
US_TICKER_TIMER->TASKS_START = 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t us_ticker_read(){
|
uint32_t us_ticker_read(){
|
||||||
if (!us_ticker_inited || US_TICKER_TIMER->POWER==0){
|
if (!us_ticker_inited){
|
||||||
us_ticker_init();
|
us_ticker_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ uint32_t us_ticker_read(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void us_ticker_set_interrupt(unsigned int timestamp){
|
void us_ticker_set_interrupt(unsigned int timestamp){
|
||||||
if (!us_ticker_inited || US_TICKER_TIMER->POWER==0)
|
if (!us_ticker_inited)
|
||||||
{
|
{
|
||||||
us_ticker_init();
|
us_ticker_init();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue