diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2025-10-01 23:38:18 -0400 |
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2025-10-01 23:38:18 -0400 |
| commit | e2ba305068f3045944789bf65e29fb2f2f557879 (patch) | |
| tree | c78a70b4e2641270f0804965b84dcddae38af4c0 /project/Core/Src/demo.c | |
| parent | e50a487f58941c49cace0783f80a3d4dc6de3c2a (diff) | |
| download | 340-repo-Sowgro-e2ba305068f3045944789bf65e29fb2f2f557879.tar.gz 340-repo-Sowgro-e2ba305068f3045944789bf65e29fb2f2f557879.tar.bz2 340-repo-Sowgro-e2ba305068f3045944789bf65e29fb2f2f557879.zip | |
complete homework 4
Diffstat (limited to 'project/Core/Src/demo.c')
| -rw-r--r-- | project/Core/Src/demo.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/project/Core/Src/demo.c b/project/Core/Src/demo.c index d34b7e3..fed34e3 100644 --- a/project/Core/Src/demo.c +++ b/project/Core/Src/demo.c @@ -15,15 +15,16 @@ #include "UART.h" #include "demo.h" #include "stm32l4xx.h" +#include "systick.h" // This function is to create a delay by consuming CPU cycle on counter -static void delay_loop( int value ) -{ - // spin loop consuming CPU to spend time. - for (int i = 0; i < value; i++) - ; -} +//static void delay_loop( int value ) +//{ +// // spin loop consuming CPU to spend time. +// for (int i = 0; i < value; i++) +// ; +//} // This function is to print counter on UART port and toggle LED static void demo_of_UART_print(int counter){ @@ -33,8 +34,10 @@ static void demo_of_UART_print(int counter){ n = sprintf((char *)buffer, "counter = %d\r\n", counter); USART_Write(USART2, buffer, n); - delay_loop( 8000000 ) ; // comment this out when you are ready to test delay_systick - // delay_systick() ; // enable this when you are ready to test + // delay_loop( 8000000 ) ; // comment this out when you are ready to test delay_systick + init_systick(); + delay_systick(); // enable this when you are ready to test + delay_systick(); // Toggle LED LED_Toggle(); |
