From 67e214beaf8721ce27e4bdc638e5577b17d18f81 Mon Sep 17 00:00:00 2001
From: Eric Brombaugh <ebrombaugh1@cox.net>
Date: Sun, 26 Mar 2023 20:09:30 -0700
Subject: [PATCH] Cleaned up, removed debug stuff

---
 examples/systick_irq/systick.h     |  5 -----
 examples/systick_irq/systick_irq.c | 23 +++--------------------
 2 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/examples/systick_irq/systick.h b/examples/systick_irq/systick.h
index 8aaa3ef..53bde7c 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 589ed89..ebc0165 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
 }
-- 
GitLab