From 5978c99c313c894fb297e44c3bffecf6adfe5577 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 20 Aug 2015 17:51:07 -0700 Subject: [PATCH] Add API to stop HAL SysTick counter. --- .../chibios-portapack/os/hal/platforms/LPC43xx_M0/hal_lld.c | 4 ++++ .../chibios-portapack/os/hal/platforms/LPC43xx_M0/hal_lld.h | 1 + .../chibios-portapack/os/hal/platforms/LPC43xx_M4/hal_lld.c | 4 ++++ .../chibios-portapack/os/hal/platforms/LPC43xx_M4/hal_lld.h | 1 + 4 files changed, 10 insertions(+) diff --git a/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M0/hal_lld.c b/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M0/hal_lld.c index 3d3bc11f..dfb28c1e 100755 --- a/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M0/hal_lld.c +++ b/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M0/hal_lld.c @@ -89,6 +89,10 @@ void systick_adjust_period(const uint32_t counts_per_tick) { ritimer_start(); } +void systick_stop() { + ritimer_stop(); +} + /** * @brief Low level HAL driver initialization. * diff --git a/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M0/hal_lld.h b/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M0/hal_lld.h index d2ced74b..5a3ee2a0 100755 --- a/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M0/hal_lld.h +++ b/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M0/hal_lld.h @@ -145,6 +145,7 @@ typedef uint32_t halrtcnt_t; extern "C" { #endif void hal_lld_init(void); + void systick_stop(void); void systick_adjust_period(const uint32_t counts_per_tick); halclock_t halLPCGetSystemClock(void); void halLPCSetSystemClock(const halclock_t new_frequency); diff --git a/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M4/hal_lld.c b/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M4/hal_lld.c index b610f250..97c6f8ba 100755 --- a/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M4/hal_lld.c +++ b/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M4/hal_lld.c @@ -63,6 +63,10 @@ void halLPCSetSystemClock(const halclock_t new_frequency) { hal_clock_f = new_frequency; } +void systick_stop() { + SysTick->CTRL &= ~(SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_TICKINT_Msk); +} + void systick_adjust_period(const uint32_t counts_per_tick) { SysTick->LOAD = counts_per_tick; } diff --git a/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M4/hal_lld.h b/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M4/hal_lld.h index 643324d5..d1e48abd 100755 --- a/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M4/hal_lld.h +++ b/firmware/chibios-portapack/os/hal/platforms/LPC43xx_M4/hal_lld.h @@ -164,6 +164,7 @@ typedef uint32_t halrtcnt_t; extern "C" { #endif void hal_lld_init(void); + void systick_stop(void); void systick_adjust_period(const uint32_t counts_per_tick); halclock_t halLPCGetSystemClock(void); void halLPCSetSystemClock(const halclock_t new_frequency);