12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #pragma once
- #ifndef _BOARD_H
- #define _BOARD_H
- /* Includes */
- #include "main.h"
- #include "gpio.h"
- /* Type Defs */
- /* Exported macros */
- /* Constants */
- #define USE_SERVO_1 true
- #define USE_SERVO_2 true
- /* PWM Timers for 50 Hz */
- #define TIM1_PSC (24 - 1)
- #define TIM1_ARR (20000 - 1)
- #define SERVO_INIT_VAL 0
- #define SERVO1_OPEN_VAL 1000
- #define SERVO2_OPEN_VAL 2000
- #define TIM3_PSC (24000 - 1)
- #define TIM3_ARR (100 - 1)
- /* Defines */
- #define Select_Pin GPIO_PIN_3
- #define Select_Port GPIOA
- #define Photo_Pin GPIO_PIN_7
- #define Photo_Port GPIOB
- #ifdef USE_SERVO_1
- #define Servo_1_Pin GPIO_PIN_3
- #define Servo_1_Port GPIOB
- #define Servo_1_CHNL TIM1->CCR2
- // #define Servo_1_ON TIM1->CCER |= (TIM_CCER_CC2E | TIM_CCER_CC2P)
- // #define Servo_1_OFF TIM1->CCER &= ~(TIM_CCER_CC2E | TIM_CCER_CC2P)
- #endif
- #ifdef USE_SERVO_2
- #define Servo_2_Pin GPIO_PIN_8
- #define Servo_2_Port GPIOA
- #define Servo_2_CHNL TIM1->CCR1
- // #define Servo_2_ON TIM1->CCER |= (TIM_CCER_CC1E | TIM_CCER_CC1P)
- // #define Servo_2_OFF TIM1->CCER &= ~(TIM_CCER_CC1E | TIM_CCER_CC1P)
- #endif
- #define Servo_1_ON
- #define Servo_1_OFF
- #define Servo_2_ON
- #define Servo_2_OFF
- /* Variables */
- /* Exported funcions */
- void SystemClock_Config(void);
- void Board_Init(void);
- void delay_ms(uint32_t msek);
- void SysTick_Handler(void);
- #endif /* _BPARD_H */
|