Subversion Repositories HomeAutomation

Rev

Rev 643 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. #ifndef RC_SERVO_H_
  2. #define RC_SERVO_H_
  3.  
  4. /*-----------------------------------------------
  5.  * Includes
  6.  * ---------------------------------------------*/
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <inttypes.h>
  10.  
  11. /*-----------------------------------------------
  12.  * Defines
  13.  * --------------------------------------------*/
  14.  
  15. /*
  16.  * For width of the pulse that control the RC servo.
  17.  * Clock pulses.
  18.  * This is adjusted for a 8 MHz clock, to use different speeds recalculate.
  19.  *
  20.  * MAX and MIN is defined in application config.inc
  21.  */
  22. /*
  23. #define PWM1_MIN_PULSE   550 // 1000
  24. #define PWM1_MAX_PULSE   2750 // 2000
  25. #define PWM2_MIN_PULSE   20
  26. #define PWM2_MAX_PULSE   50
  27. #define PWM3_MIN_PULSE   20
  28. #define PWM3_MAX_PULSE   50
  29. */
  30.  
  31. #define STEP1   ((PWM1_MAX_PULSE - PWM1_MIN_PULSE)/256)
  32. #define STEP2   1
  33. #define STEP3   1
  34.  
  35. #define MAX_POSITION 255
  36. #define MIN_POSITION 0
  37.  
  38. /*-----------------------------------------------
  39.  * Functions
  40.  * ---------------------------------------------*/
  41. void rcServoInit(void);
  42. void setPosition(uint8_t abs_pos, uint8_t servo);
  43. void alterPosition(int8_t rel_pos, uint8_t servo);
  44. uint8_t getPosition(uint8_t servo);
  45. void servoDisable(void);
  46. void servoEnable(void);
  47.  
  48. #endif
  49.