#pragma once #ifndef _BOARD_H #define _BOARD_H /* Includes */ #include "main.h" #include "gpio.h" //#include "xprintf.h" /* Type Defs */ /* Exported macros */ /* Constants */ /* PWM Timers for 50 Hz */ #define TIM1_PSC (24 - 1) #define TIM1_ARR (20000 - 1) #define SERVO_INIT_VAL 2000 #define SERVO_OPEN_VAL 1000 #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 #define Servo_1_Pin GPIO_PIN_3 #define Servo_1_Port GPIOB #define Servo_1_CHNL TIM1->CCR2 #define Servo_1_ON GPIO_SetPinMode(Servo_1_Port, Servo_1_Pin, GPIO_MODE_AFF) #define Servo_1_OFF GPIO_SetPinMode(Servo_1_Port, Servo_1_Pin, GPIO_MODE_IN) #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 GPIO_SetPinMode(Servo_2_Port, Servo_2_Pin, GPIO_MODE_AFF) #define Servo_2_OFF GPIO_SetPinMode(Servo_2_Port, Servo_2_Pin, GPIO_MODE_IN) #endif /* Variables */ /* Exported funcions */ void SystemClock_Config(void); void Board_Init(void); void delay_ms(uint32_t msek); void SysTick_Handler(void); #endif /* _BPARD_H */