Skip to content
Snippets Groups Projects
Unverified Commit 03b71e77 authored by CNLohr's avatar CNLohr Committed by GitHub
Browse files

Merge pull request #52 from emeb/master

Updated for SysTick IRQ example for latest changes in ch32v003fun library.
parents 5e71b663 7df5ddf7
No related branches found
No related tags found
No related merge requests found
......@@ -4,11 +4,11 @@ interrupts for timing. Many bare-metal and RTOS based embedded applications will
use the Systick IRQ for timing, periodic housekeeping and task arbitration so
knowing how to set that up is useful.
Note that this example is *NOT* compatible with the Delay_Ms() function that's
part of the ch32v003fun library - that function uses the Systick counter for
doing busy-wait delays and will interfere with its use in generating predictable
IRQs. Do not use the built-in Delay_Ms() and related functions when using Systick
for IRQs.
Note that this example is *NOT* compatible with the Delay_*() functions that are
part of the ch32v003fun library - those functions use the Systick counter for
doing busy-wait delays and assume that the CNT register rolls over at 32-bit
maximum. Do not use the built-in Delay_Ms() and related functions when using
Systick for IRQs.
Note also the use of the `__attribute__((interrupt))` syntax in declaring the
IRQ handler. Some of the IRQ examples from the WCH HAL library have slightly
......
......@@ -25,6 +25,9 @@ volatile uint32_t systick_cnt;
*/
void systick_init(void)
{
/* disable default SysTick behavior */
SysTick->CTLR = 0;
/* enable the SysTick IRQ */
NVIC_EnableIRQ(SysTicK_IRQn);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment