parent
							
								
									ff44507e26
								
							
						
					
					
						commit
						9b00f8ac49
					
				
							
								
								
									
										9
									
								
								main.c
								
								
								
								
							
							
						
						
									
										9
									
								
								main.c
								
								
								
								
							| 
						 | 
					@ -16,3 +16,12 @@ void systick_setting(void)
 | 
				
			||||||
    STCTRL |= ENABLE | CLKINT;                 // Enable SysTick with system clock
 | 
					    STCTRL |= ENABLE | CLKINT;                 // Enable SysTick with system clock
 | 
				
			||||||
    STCURRENT = 0;                             // Clear current value
 | 
					    STCURRENT = 0;                             // Clear current value
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void delay(int us) 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    STRELOAD = SYSTICK_RELOAD_VALUE(us);        // RELOAD VALUE FOR REQUIRED DELAY
 | 
				
			||||||
 | 
					    STCURRENT = 0;                              // Clear STCURRENT
 | 
				
			||||||
 | 
					    STCTRL |= ENABLE | CLKINT;                  // Enable SysTick
 | 
				
			||||||
 | 
					    while ((STCTRL & (1 << 16)) == 0);          // Wait until flag is set
 | 
				
			||||||
 | 
					    STCTRL &= ~ENABLE;                          // Stop the timer
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue