|
@@ -16,7 +16,8 @@
|
|
|
/* PWM Timers for 50 Hz */
|
|
|
#define TIM1_PSC (24 - 1)
|
|
|
#define TIM1_ARR (20000 - 1)
|
|
|
-#define SERVO_INIT_VAL 2000
|
|
|
+#define SERVO_INIT_VAL 0
|
|
|
+//2000
|
|
|
#define SERVO_OPEN_VAL 1000
|
|
|
|
|
|
#define TIM3_PSC (24000 - 1)
|
|
@@ -31,20 +32,20 @@
|
|
|
#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)
|
|
|
+// #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 {}
|
|
|
- //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)
|
|
|
+// #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 */
|
|
|
|