Kaynağa Gözat

Fix some mistakes.

Vladimir N. Shilov 2 yıl önce
ebeveyn
işleme
c5dacc6025
3 değiştirilmiş dosya ile 20 ekleme ve 13 silme
  1. 3 3
      Src/board.c
  2. 15 8
      Src/clock.c
  3. 2 2
      Src/stm32g0xx_it.c

+ 3 - 3
Src/board.c

@@ -368,7 +368,7 @@ static void GPIO_Init(void)
   GPIO_SetPinPull(BTN2_GPIO_Port, BTN2_Pin, GPIO_PUPDR_UP);
   GPIO_SetPinMode(BTN2_GPIO_Port, BTN2_Pin, GPIO_MODE_IN);
   GPIO_SetPinPull(BTN3_GPIO_Port, BTN3_Pin, GPIO_PUPDR_UP);
-  GPIO_SetPinMode(BTN4_GPIO_Port, BTN3_Pin, GPIO_MODE_IN);
+  GPIO_SetPinMode(BTN3_GPIO_Port, BTN3_Pin, GPIO_MODE_IN);
   GPIO_SetPinPull(BTN4_GPIO_Port, BTN4_Pin, GPIO_PUPDR_UP);
   GPIO_SetPinMode(BTN4_GPIO_Port, BTN4_Pin, GPIO_MODE_IN);
 }
@@ -599,8 +599,8 @@ static void TIM14_Init(void)
   TIM14->PSC = TIM14_PSC;
   TIM14->ARR = TIM14_ARR;
 
-  /* Enable:  Auto-reload preload, One-pulse mode, */
-  TIM14->CR1 = (TIM_CR1_ARPE | TIM_CR1_OPM);
+  /* Enable:  Auto-reload preload, no One-pulse mode, */
+  TIM14->CR1 = (TIM_CR1_ARPE); // | TIM_CR1_OPM);
 
   /* OC or PWM? (for pwm - (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1) ) , Output compare 1 preload */
   TIM14->CCMR1 = (TIM_CCMR1_OC1M_0 | TIM_CCMR1_OC1PE);

+ 15 - 8
Src/clock.c

@@ -439,26 +439,28 @@ void showSensorData(void) {
 }
 
 void setTimeShow(void) {
-  MinusFadeIn();
-  RTOS_SetTask(MinusFadeOut, 500, 0);
+	dispWDT =  DISP_WDT_TIME;
 
-  uint8_t hue = bcd2bin(Clock.Sec);
-  HSV2LED(hue, 255, cie[Lvl_Mdl]);
+  in15Minus();
+
+  HSV2LED(1, 255, cie[Lvl_2]);
 
   tube4_t buf;
-  buf.s8.tA = Clock.Hr >> 4;
-  buf.s8.tB = Clock.Hr & 0xf;
-  buf.s8.tD = Clock.Min >> 4;
-  buf.s8.tE = Clock.Min & 0xf;
+  buf.s8.tA = setClock.Hr >> 4;
+  buf.s8.tB = setClock.Hr & 0xf;
+  buf.s8.tD = setClock.Min >> 4;
+  buf.s8.tE = setClock.Min & 0xf;
   showDigits(buf);
 }
 
 void setTimeBegin(void) {
+	dispWDT =  DISP_WDT_TIME;
   RTOS_SetTask(btnProcess, BTN_TIME_HOLDED, BTN_SCAN_PERIOD);
   RTC_ReadAll(&setClock);
 }
 
 void setHHBegin(void) {
+	dispWDT =  DISP_WDT_TIME;
   Flag.Blink_1 = 1;
   Flag.Blink_2 = 1;
   Flag.Blink_4 = 0;
@@ -468,14 +470,17 @@ void setHHBegin(void) {
 }
 
 void setHHInc(void) {
+	dispWDT =  DISP_WDT_TIME;
   valIncrease(&setClock.Hr, 23);
 }
 
 void setHHDec(void) {
+	dispWDT =  DISP_WDT_TIME;
   valDecrease(&setClock.Hr, 23);
 }
 
 void setMMBegin(void) {
+	dispWDT =  DISP_WDT_TIME;
   Flag.Blink_1 = 0;
   Flag.Blink_2 = 0;
   Flag.Blink_4 = 1;
@@ -485,10 +490,12 @@ void setMMBegin(void) {
 }
 
 void setMMInc(void) {
+	dispWDT =  DISP_WDT_TIME;
   valIncrease(&setClock.Min, 59);
 }
 
 void setMMDec(void) {
+	dispWDT =  DISP_WDT_TIME;
   valDecrease(&setClock.Min, 59);
 }
 

+ 2 - 2
Src/stm32g0xx_it.c

@@ -158,14 +158,14 @@ void TIM14_IRQHandler(void)
 {
   if ((TIM14->SR & TIM_SR_UIF) != 0) {
     /* Update interrupt flag */
-    TIM14->SR |= TIM_SR_UIF;
+    TIM14->SR &= ~TIM_SR_UIF;
 
     /* enable all channels */
     TUBE_ALL_ON;
   }
   if ((TIM14->SR & TIM_SR_CC1IF) != 0) {
     /* Capture/Compare Interrupt flag */
-    TIM14->SR |= TIM_SR_CC1IF;
+    TIM14->SR &= ~TIM_SR_CC1IF;
 
     /* disable unneeded channel */
     if (Flag.Blink_1 != 0) {