diff options
-rw-r--r-- | cm3cpp_systick.cpp | 12 | ||||
-rw-r--r-- | cm3cpp_systick.h | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/cm3cpp_systick.cpp b/cm3cpp_systick.cpp index 72ed3e7..3aca667 100644 --- a/cm3cpp_systick.cpp +++ b/cm3cpp_systick.cpp @@ -47,7 +47,7 @@ void CM3CPP_SYSTICK_INT_FUNC(void); #define CM3CPP_SYSTICK_INT_FUNC sys_tick_handler #endif -volatile uint32_t counter; +static volatile uint32_t counter; #if CM3CPP_ENABLE_CUSTOM_SYSTICK_SOURCE != 1 void CM3CPP_SYSTICK_INT_FUNC(void) @@ -96,6 +96,16 @@ void init(uint32_t clock_div) #endif } +void deinit() +{ +#if CM3CPP_ENABLE_CUSTOM_SYSTICK_SOURCE == 1 + timer_disable_counter(CM3CPP_INT_SOURCE); +#else + systick_interrupt_disable(); + systick_counter_disable(); +#endif +} + uint32_t get_counter() { #if CM3CPP_ENABLE_CUSTOM_SYSTICK_SOURCE == 1 diff --git a/cm3cpp_systick.h b/cm3cpp_systick.h index 54b06c1..91ae5ae 100644 --- a/cm3cpp_systick.h +++ b/cm3cpp_systick.h @@ -38,6 +38,7 @@ namespace cm3cpp { namespace systick { void init(uint32_t div = CM3CPP_SYSTICK_CLOCK_DIV); +void deinit(); uint32_t get_counter(); void delay_systick(uint32_t ms); |