From 5bfeb40e4795eb5cf21ea84311936acf97969365 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sun, 5 Sep 2010 23:48:31 -0400 Subject: systick testing and simplification ripped out marti's SystemTick for the sake of simplicity and added a systick_resume function to libmaple. new example program demonstrates the functionality, also demonstrates micros()/USB bug --- libmaple/systick.c | 7 +++++++ libmaple/systick.h | 1 + 2 files changed, 8 insertions(+) (limited to 'libmaple') diff --git a/libmaple/systick.c b/libmaple/systick.c index 456ac2f..9fbb152 100644 --- a/libmaple/systick.c +++ b/libmaple/systick.c @@ -58,6 +58,13 @@ void systick_disable() { __write(SYSTICK_CSR, SYSTICK_SRC_HCLK); } +void systick_resume() { + /* re-enable init registers without changing relead_val */ + __write(SYSTICK_CSR, SYSTICK_SRC_HCLK | + SYSTICK_ENABLE | + SYSTICK_TICKINT); +} + void SysTickHandler(void) { systick_timer_millis++; } diff --git a/libmaple/systick.h b/libmaple/systick.h index 86284f8..80e2fde 100644 --- a/libmaple/systick.h +++ b/libmaple/systick.h @@ -44,6 +44,7 @@ extern "C"{ void systick_init(uint32 reload_val); void systick_disable(); +void systick_resume(); static inline uint32 systick_get_count(void) { return __read(SYSTICK_CNT); -- cgit v1.2.3