diff options
author | Lisin Dmitriy <d.lisin@thirdpin.ru> | 2019-05-22 15:23:41 +0300 |
---|---|---|
committer | Lisin Dmitriy <d.lisin@thirdpin.ru> | 2019-05-22 15:23:41 +0300 |
commit | 8da206bb5556d35d0c90b88b380e74801b4049fd (patch) | |
tree | d03661fa704091e4eb29c09bb7d6cc8c63d9a9d5 | |
parent | 63536a47aabfcfe229a3855a44dd540c201d9603 (diff) |
IMPR: [systick] Add deinit to systick
# Message format:
#
## <TYPE>: [<context>] <message header>
##
## <message body>
#
# there <TYPE> can be IMPR | FEAT | FIX | MISC,
# <context> can be any `emb`, `release`, `boot`, etc.
# <message header> is a short description of commit,
# <message body> (optional) is a long description of commit.
#
#
#
#
# # # # # # # # # STANDARD GIT COMMENT BELOW # # # # # # # # # #
#
-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); |