From 8da206bb5556d35d0c90b88b380e74801b4049fd Mon Sep 17 00:00:00 2001 From: Lisin Dmitriy Date: Wed, 22 May 2019 15:23:41 +0300 Subject: IMPR: [systick] Add deinit to systick # Message format: # ## : [] ## ## # # there can be IMPR | FEAT | FIX | MISC, # can be any `emb`, `release`, `boot`, etc. # is a short description of commit, # (optional) is a long description of commit. # # # # # # # # # # # # # STANDARD GIT COMMENT BELOW # # # # # # # # # # # --- cm3cpp_systick.cpp | 12 +++++++++++- cm3cpp_systick.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3