[Cryptech-Commits] [sw/stm32] 01/03: Add a generic SysTick hook, to call a function on every 1ms tick, because it's easier than setting up a dedicated timer.

git at cryptech.is git at cryptech.is
Tue Aug 22 17:29:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository sw/stm32.

commit 9ffead1c015bf05425b78d43b1b4b3e21f109929
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Mon Jul 31 23:23:05 2017 -0400

    Add a generic SysTick hook, to call a function on every 1ms tick, because it's easier than setting up a dedicated timer.
---
 .../TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c           | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c
index 8e5cc73..4629e44 100644
--- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c
+++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c
@@ -64,6 +64,13 @@ void HardFault_Handler(void)
     while (1) { ; }
 }
 
+static void default_SysTick_hook(void) { };
+static void (*SysTick_hook)(void) = default_SysTick_hook;
+void set_SysTick_hook(void (*hook)(void))
+{
+    SysTick_hook = (hook == NULL) ? default_SysTick_hook : hook;
+}
+
 /**
  * @brief  This function handles SysTick Handler.
  * @param  None
@@ -72,6 +79,7 @@ void HardFault_Handler(void)
 void SysTick_Handler(void)
 {
     HAL_IncTick();
+    SysTick_hook();
 }
 
 /******************************************************************************/



More information about the Commits mailing list