diff --git a/examples/systick_irq/systick.h b/examples/systick_irq/systick.h index 8aaa3ef5e3e9a93390c38233d28d4f8e6ff1b792..53bde7c828e74e77d60ffc8c59b5b7680ee3774f 100644 --- a/examples/systick_irq/systick.h +++ b/examples/systick_irq/systick.h @@ -29,13 +29,8 @@ void systick_init(void) /* Clear any existing IRQ */ SysTick->SR &= ~SYSTICK_SR_CNTIF; -#if 1 /* Set the tick interval to 1ms for normal op */ SysTick->CMP = (SYSTEM_CORE_CLOCK/1000)-1; -#else - /* Set the tick interval to 1s for debug */ - SysTick->CMP = (SYSTEM_CORE_CLOCK)-1; -#endif /* Start at zero */ SysTick->CNT = 0; diff --git a/examples/systick_irq/systick_irq.c b/examples/systick_irq/systick_irq.c index 589ed89287002e0b2a482501ff66e0195b119aa1..ebc0165e190a3aa6f209b216f529e9bc40986e48 100644 --- a/examples/systick_irq/systick_irq.c +++ b/examples/systick_irq/systick_irq.c @@ -28,24 +28,6 @@ int main() systick_init(); printf("done.\n\r"); -#if 0 - // Debugging - does ISR run & inc counter? - // this section shows that IRQs during print will reset system, but during - // inf while() do not. - - // does cnt inc? - uint32_t pcnt = systick_cnt; - while(1) - { - if(pcnt != systick_cnt) - { - printf("CNT = 0x%08X ", SysTick->CNT); - printf("systick_cnt = %d\n\r", systick_cnt); - pcnt = systick_cnt; - } - } -#else - // Testing 1ms Systick // Enable GPIOs RCC->APB2PCENR |= RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOC; @@ -61,16 +43,17 @@ int main() GPIOC->CFGLR &= ~(0xf<<(4*0)); GPIOC->CFGLR |= (GPIO_Speed_10MHz | GPIO_CNF_OUT_PP)<<(4*0); - //printf("looping...\n\r"); + printf("looping...\n\r"); while(1) { GPIOD->BSHR = 1 | (1<<4); // Turn on GPIOs + systick_delay_ms( 250 ); GPIOC->BSHR = 1; systick_delay_ms( 250 ); GPIOD->BSHR = (1<<16) | (1<<(16+4)); // Turn off GPIODs + systick_delay_ms( 250 ); GPIOC->BSHR = (1<<16); systick_delay_ms( 250 ); printf( "Count: %lu\n\r", count++ ); } -#endif }