Bläddra i källkod

Some redesign.

Vladimir N. Shilov 2 år sedan
förälder
incheckning
f4ed806b05
3 ändrade filer med 95 tillägg och 24 borttagningar
  1. 3 3
      Inc/event-system.h
  2. 4 4
      Src/board.c
  3. 88 17
      Src/clock.c

+ 3 - 3
Inc/event-system.h

@@ -57,10 +57,10 @@ void setMMInc(void);
 void setMMDec(void);
 void setTimeEnd(void);
 
-/*
 void setDateBegin(void);
 void setDateEnd(void);
-void setWDMShow(void);
+void setWShow(void);
+void setDMShow(void);
 void setYearShow(void);
 void setWDayBegin(void);
 void setMDayBegin(void);
@@ -74,7 +74,7 @@ void setDecWDay(void);
 void setDecMDay(void);
 void setDecMonth(void);
 void setDecYear(void);
-
+/*
 void showBright(void);
 void incBright(void);
 void decBright(void);

+ 4 - 4
Src/board.c

@@ -184,7 +184,7 @@ static void _show_digits(const uint32_t digits)
  */
 void HSV2LED(const uint8_t hue, const uint8_t sat, const uint8_t val) {
   int base;
-  uint8_t r=0, g=0, b=0;
+  uint32_t r=0, g=0, b=0;
 
   if (sat == 0)
   { // Achromatic color (gray).
@@ -228,9 +228,9 @@ void HSV2LED(const uint8_t hue, const uint8_t sat, const uint8_t val) {
     }
   }
 
-  COLOR_R(r);
-  COLOR_G(g);
-  COLOR_B(b);
+  COLOR_R((uint8_t)r);
+  COLOR_G((uint8_t)g);
+  COLOR_B((uint8_t)b);
 }
 
 void tube_PowerOn(tube_pos_t tube)

+ 88 - 17
Src/clock.c

@@ -18,7 +18,8 @@ static btn_t Button[BTN_NUM] = {
   {0, evBTN3Pressed, evBTN3Pressed, BTN3_PIN},
   {0, evBTN4Pressed, evBTN4Holded,  BTN4_PIN}
 };
-static volatile uint8_t dispWDT = 0;
+volatile static uint8_t dispWDT = 0;
+static in15_pin_t symToFade = 0;
 
 /* function prototypes */
 //static void Color_RGB(const uint8_t r, const uint8_t g, const uint8_t b);
@@ -27,8 +28,8 @@ static void MinusFadeOut(void);
 static void PlusFadeIn(void);
 static void PercentFadeIn(void);
 static void PressureFadeIn(void);
-//static void IN15_FadeIn(in15_pin_t pin);
-//static void IN15_FadeOut(in15_pin_t pin);
+static void IN15_FadeIn(void);
+static void IN15_FadeOut(void);
 static void valIncrease(uint8_t * val, uint8_t max);
 static void valDecrease(uint8_t * val, uint8_t max);
 
@@ -234,20 +235,19 @@ static void PressureFadeIn(void) {
   }
 }
 
-#ifdef NEW_SHED
-static void IN15_FadeIn(in15_pin_t pin) {
+static void IN15_FadeIn(void) {
   static uint8_t on = FADE_START;
   static uint8_t off = FADE_STOP;
   static uint8_t st = 0;
 
   if (st == 0) {
     st = 1;
-    GPIOA->BSRR = pin;
+    GPIOA->BSRR = symToFade;
     on += FADE_STEP;
     if (on < FADE_STOP) {
       RTOS_SetTask(IN15_FadeIn, on, 0);
     } else {
-      on = FADE_START; off = FADE_STOP; st = 0;
+      on = FADE_START; off = FADE_STOP; st = 0; symToFade = 0;
     }
   } else {
     st = 0;
@@ -257,7 +257,7 @@ static void IN15_FadeIn(in15_pin_t pin) {
   }
 }
 
-static void IN15_FadeOut(in15_pin_t pin) {
+static void IN15_FadeOut(void) {
   static uint8_t off = FADE_START;
   static uint8_t on = FADE_STOP;
   static uint8_t st = 0;
@@ -269,16 +269,15 @@ static void IN15_FadeOut(in15_pin_t pin) {
     if (off < FADE_STOP) {
       RTOS_SetTask(IN15_FadeOut, off, 0);
     } else {
-      off = FADE_START; on = FADE_STOP; st = 0;
+      off = FADE_START; on = FADE_STOP; st = 0; symToFade = 0;
     }
   } else {
     st = 0;
-    GPIOA->BSRR = pin;
+    GPIOA->BSRR = symToFade;
     on -= FADE_STEP;
     RTOS_SetTask(IN15_FadeOut, on, 0);
   }
 }
-#endif /* NewShed */
 
 /**
   * Show info on tubes.
@@ -376,8 +375,9 @@ void showYear(void) {
 void showHumidity(void) {
   dispWDT = DISP_WDT_TIME;
   //in15Percent();
-  //IN15_FadeIn(sym_Percent);
-  PercentFadeIn();
+  symToFade = sym_Percent;
+  IN15_FadeIn();
+  //PercentFadeIn();
 
   tube4_t buf;
   buf.s8.tA = Humidity / 10;
@@ -390,8 +390,9 @@ void showHumidity(void) {
 void showTemperature(void) {
   dispWDT = DISP_WDT_TIME;
   //in15Plus();
-  //IN15_FadeIn(sym_Plus);
-  PlusFadeIn();
+  symToFade = sym_Plus;
+  IN15_FadeIn();
+  //PlusFadeIn();
 
   tube4_t buf;
   buf.s8.tA = 0xf;
@@ -404,8 +405,9 @@ void showTemperature(void) {
 void showPressure(void) {
   dispWDT = DISP_WDT_TIME;
   //in15P();
-  //IN15_FadeIn(sym_Pressure);
-  PressureFadeIn();
+  symToFade = sym_Pressure;
+  IN15_FadeIn();
+  //PressureFadeIn();
 
   tube4_t buf;
   int tmp;
@@ -514,6 +516,75 @@ void setTimeEnd(void) {
   RTC_ReadAll(&Clock);
 }
 
+void setDateBegin(void) {
+
+}
+
+void setDateEnd(void) {
+
+}
+
+void setWShow(void) {
+
+}
+
+void setDMShow(void) {
+
+}
+
+void setYearShow(void) {
+
+}
+
+void setWDayBegin(void) {
+
+}
+
+void setMDayBegin(void) {
+
+}
+
+void setMonthBegin(void) {
+
+}
+
+void setYearBegin(void) {
+
+}
+
+void setIncWDay(void) {
+
+}
+
+void setIncMDay(void) {
+
+}
+
+void setIncMonth(void) {
+
+}
+
+void setIncYear(void) {
+
+}
+
+void setDecWDay(void) {
+
+}
+
+void setDecMDay(void) {
+
+}
+
+void setDecMonth(void) {
+
+}
+
+void setDecYear(void) {
+
+}
+
+
 /**
   * @brief  Increase BCD value.
   * @param  : val, max