فهرست منبع

New hardware version.

Vladimir N. Shilov 2 ماه پیش
والد
کامیت
19ee474ace
2فایلهای تغییر یافته به همراه12 افزوده شده و 5 حذف شده
  1. 1 1
      inc/board.h
  2. 11 4
      src/main.c

+ 1 - 1
inc/board.h

@@ -11,7 +11,7 @@
 /* Exported macros */
 /* Constants */
 #define USE_SERVO_1         true
-#define USE_SERVO_2         true
+//#define USE_SERVO_2         true
 
 /* PWM Timers for 50 Hz */
 #define TIM1_PSC            (24 - 1)

+ 11 - 4
src/main.c

@@ -47,6 +47,11 @@ int main(void)
   /* Initialize onBoard Hardware */
   Board_Init();
 
+  //GPIO_SetPinMode(Servo_1_Port, Servo_1_Pin, GPIO_MODE_AFF);
+  Servo_1_CHNL = SERVO1_OPEN_VAL;
+  delay_ms(200);
+  //GPIO_SetPinMode(Servo_1_Port, Servo_1_Pin, GPIO_MODE_IN);
+  Servo_1_CHNL = SERVO_INIT_VAL;
   /* if light is on, wait for off */
   while (photo_Value <= PHOTO_LEVEL_OFF) {
     //IWDG->KR = 0xAAAA;
@@ -62,14 +67,16 @@ int main(void)
       __WFI();
     }
     /* open servo 1 */
+    //GPIO_SetPinMode(Servo_1_Port, Servo_1_Pin, GPIO_MODE_AFF);
     Servo_1_CHNL = SERVO1_OPEN_VAL;
-
+    delay_ms(200);
     /* wait for light off */
-    while (photo_Value <= PHOTO_LEVEL_OFF) {
+    //while (photo_Value <= PHOTO_LEVEL_OFF) {
       //IWDG->KR = 0xAAAA;
-      __WFI();
-    }
+    //  __WFI();
+    //}
     /* close servo 1 */
+    //GPIO_SetPinMode(Servo_1_Port, Servo_1_Pin, GPIO_MODE_IN);
     Servo_1_CHNL = SERVO_INIT_VAL;
 #endif