phillip_bourdon234

delay.h

Feb 28th, 2021 (edited)
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.53 KB | None | 0 0
  1. //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  2. //                                                                          THIS DRIVER USES TIMER 2
  3. //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  4.  
  5. #ifndef DELAY_H_
  6. #define DELAY_H_
  7.  
  8. #include "stm32f10x.h"
  9.  
  10. //The start_millis function sets the millis_flag and returns the vlaue of ticks_millis
  11. int start_millis(void);
  12.  
  13. //The reset_millis function resets the millis_flag and sets the value of ticks_millis
  14. //to 0
  15. void reset_millis(void);
  16.  
  17. //The play_millis function turns the timer on until the specified amount of time has passed (in Us)
  18. //It is basically the start_millis function and reset_millis function put into one function for
  19. //easier use for the user if they know specifically how long they want
  20. int play_millis(int time);
  21.  
  22. //The init_delay function initizializes the timer of choice for the use of delay   
  23. void init_delay(void);
  24.    
  25. //The delayUs function stops the mcu for (uS) microseconds  
  26. void delayUs(int uS);
  27.    
  28.  
  29. //The delayMs function stops the mcu for (mS) milliseconds
  30. void delayMs(int mS);
  31.  
  32. //The TIM2_IRQHandler increments the ticks_delay variable every time the timer overflows
  33. //(which is approximately every microsecond) if the delay
  34. //flag is set (the delay_flag is set when the functions delayUs and delayMs are called) and increments the
  35. //ticks_millis if the millis_flag is set (the millis_flag is set when the play_millis function is called)
  36. void TIM2_IRQHandler(void);
  37.                                                                        
  38. #endif
  39.  
Add Comment
Please, Sign In to add comment