aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32/f1/other
diff options
context:
space:
mode:
authorFelix Ruess2013-02-19 19:22:49 +0100
committerFelix Ruess2013-02-19 19:22:49 +0100
commit3ef44bff54e6f5e94b89bbd8afb5243075b668a0 (patch)
tree4b241454e0ffad662d9101871a0d3521e2c5f215 /examples/stm32/f1/other
parent46263e90b41abd26d3b274a315d2237308db91a4 (diff)
[cm3] fix doxygen for systick_get_value, add systick_get_reload
Fix the reload value in the examples: to get a SysTick interrupt every N clock pulses: set reload to N-1 see http://infocenter.arm.com/help/topic/com.arm.doc.dui0552a/BGBEEJHC.html#BABGACGG
Diffstat (limited to 'examples/stm32/f1/other')
-rw-r--r--examples/stm32/f1/other/systick/systick.c3
-rw-r--r--examples/stm32/f1/other/usb_hid/usbhid.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/examples/stm32/f1/other/systick/systick.c b/examples/stm32/f1/other/systick/systick.c
index c04704d..d9f976a 100644
--- a/examples/stm32/f1/other/systick/systick.c
+++ b/examples/stm32/f1/other/systick/systick.c
@@ -62,7 +62,8 @@ int main(void)
systick_set_clocksource(STK_CTRL_CLKSOURCE_AHB_DIV8);
/* 9000000/9000 = 1000 overflows per second - every 1ms one interrupt */
- systick_set_reload(9000);
+ /* SysTick interrupt every N clock pulses: set reload to N-1 */
+ systick_set_reload(8999);
systick_interrupt_enable();
diff --git a/examples/stm32/f1/other/usb_hid/usbhid.c b/examples/stm32/f1/other/usb_hid/usbhid.c
index a3b78d5..f976c88 100644
--- a/examples/stm32/f1/other/usb_hid/usbhid.c
+++ b/examples/stm32/f1/other/usb_hid/usbhid.c
@@ -238,7 +238,8 @@ static void hid_set_config(usbd_device *usbd_dev, u16 wValue)
#endif
systick_set_clocksource(STK_CTRL_CLKSOURCE_AHB_DIV8);
- systick_set_reload(100000);
+ /* SysTick interrupt every N clock pulses: set reload to N-1 */
+ systick_set_reload(99999);
systick_interrupt_enable();
systick_counter_enable();
}