board.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #ifndef _BOARD_H
  3. #define _BOARD_H
  4. /* Includes */
  5. #include "main.h"
  6. #include "gpio.h"
  7. /* Type Defs */
  8. /* Exported macros */
  9. /* Constants */
  10. #define USE_SERVO_1 true
  11. //#define USE_SERVO_2 true
  12. /* PWM Timers for 50 Hz */
  13. #define TIM1_PSC (24 - 1)
  14. #define TIM1_ARR (20000 - 1)
  15. #define SERVO_INIT_VAL 0
  16. #define SERVO_OPEN_VAL 1000
  17. #define SERVO_CLOSE_VAL 2000
  18. #define TIM3_PSC (24000 - 1)
  19. #define TIM3_ARR (100 - 1)
  20. /* Defines */
  21. #define Select_Pin GPIO_PIN_3
  22. #define Select_Port GPIOA
  23. #define Photo_Pin GPIO_PIN_7
  24. #define Photo_Port GPIOB
  25. #ifdef USE_SERVO_1
  26. #define Servo_1_Pin GPIO_PIN_3
  27. #define Servo_1_Port GPIOB
  28. #define Servo_1_CHNL TIM1->CCR2
  29. #endif
  30. #ifdef USE_SERVO_2
  31. #define Servo_2_Pin GPIO_PIN_8
  32. #define Servo_2_Port GPIOA
  33. #define Servo_2_CHNL TIM1->CCR1
  34. #define Servo_2_ON {}
  35. #endif
  36. /* Variables */
  37. /* Exported funcions */
  38. void SystemClock_Config(void);
  39. void Board_Init(void);
  40. void delay_ms(uint32_t msek);
  41. void SysTick_Handler(void);
  42. #endif /* _BPARD_H */