diff options
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(); |
