phillip_bourdon234

Servo_Driver.h

Feb 28th, 2021 (edited)
715
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. // This servo driver allows for the use of all the channels on timers 2, 3, and 4
  2.    
  3.  
  4.  
  5. #ifndef Servo_Driver
  6. #define Servo_Driver
  7.  
  8. #include <stdint.h>
  9. #include "stm32f10x.h"
  10.  
  11. //The servo_init function takes in the number of the timer and channel that
  12. //the user wants to use for the pwm output
  13. void servo_init(uint8_t timer, uint8_t channel);
  14.  
  15. //The servo_writeMicroseconds function takes in a value in microseconds (1000-2000)
  16. //and outputs the pwm signal accordingly to the given timer and channel.
  17. //Note that the servo_init function must be called first before this function
  18. //and the timer and channel used in this function must match the timer
  19. //and channel passed into servo_init
  20. void servo_writeMicroseconds(int microseconds, uint8_t timer, uint8_t channel);
  21.  
  22.  
  23. #endif
  24.  
Add Comment
Please, Sign In to add comment