Vladimir N. Shilov пре 2 година
родитељ
комит
d3dca13141
3 измењених фајлова са 30 додато и 28 уклоњено
  1. 2 0
      Inc/board.h
  2. 15 15
      Src/board.c
  3. 13 13
      Src/clock.c

+ 2 - 0
Inc/board.h

@@ -108,6 +108,8 @@ typedef union {
 #define TIM17_PSC            (24 - 1)
 #define TIM17_ARR            (1000 - 1)
 
+#define TUBE_BLANK            0xa
+
 /* Defines */
 #define BTN1_GPIO_Port GPIOB
 #define BTN1_Pin GPIO_PIN_2

+ 15 - 15
Src/board.c

@@ -18,11 +18,11 @@
  * {3.3 3.2 3.1 3.0 2.7 2.6 2.5 2.4 2.3 2.2} VL2/B
  * {2.1 2.0 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1.0} VL1/A
  */
-static const uint16_t nixieCathodeMap[4][10] = {
-  {0x8000, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000},
-  {0x2000, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000},
-  {0x0800, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400},
-  {0x0200, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100}
+static const uint16_t nixieCathodeMap[4][11] = {
+  {0x8000, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x0000},
+  {0x2000, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x0000},
+  {0x0800, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0000},
+  {0x0200, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0000}
 };
 //static const uint8_t nixieCathodeMask[4][2] = {{0x00, 0x3f}, {0xc0, 0x0f}, {0xf0, 0x03}, {0xc0, 0x00}};
 static uint8_t tubesBuffer[SPI_BUFFER_SIZE] = {0};
@@ -150,10 +150,10 @@ void slideDigits(tube4_t dig) {
   tube4_t buf;
   const uint8_t pause = 100;;
 
-    buf.s8.tA = 0xf;
-    buf.s8.tB = 0xf;
-    buf.s8.tD = 0xf;
-    buf.s8.tE = 0xf;
+    buf.s8.tA = TUBE_BLANK;
+    buf.s8.tB = TUBE_BLANK;
+    buf.s8.tD = TUBE_BLANK;
+    buf.s8.tE = TUBE_BLANK;
     _show_digits(buf.u32);
     tdelay_ms(pause);
 
@@ -182,22 +182,22 @@ void slideDigits(tube4_t dig) {
     buf.s8.tA = dig.s8.tB;
     buf.s8.tB = dig.s8.tD;
     buf.s8.tD = dig.s8.tE;
-    buf.s8.tE = 0xf;
+    buf.s8.tE = TUBE_BLANK;
     _show_digits(buf.u32);
     tdelay_ms(pause);
 
     buf.s8.tA = dig.s8.tD;
     buf.s8.tB = dig.s8.tE;
-    buf.s8.tD = 0xf;
+    buf.s8.tD = TUBE_BLANK;
     _show_digits(buf.u32);
     tdelay_ms(pause);
 
     buf.s8.tA = dig.s8.tE;
-    buf.s8.tB = 0xf;
+    buf.s8.tB = TUBE_BLANK;
     _show_digits(buf.u32);
     tdelay_ms(pause);
 
-    buf.s8.tA = 0xf;
+    buf.s8.tA = TUBE_BLANK;
     _show_digits(buf.u32);
     tdelay_ms(pause);
 }
@@ -218,7 +218,7 @@ static void _show_digits(const uint32_t digits)
   int i;
   for (i=0; i<4; i++) {
     if (dig.ar[i] > 9) {
-      if (dig.ar[i] != 0xf) {
+      if (dig.ar[i] != TUBE_BLANK) {
         dig.ar[i] = 0;
       }
     }
@@ -240,7 +240,7 @@ static void _show_digits(const uint32_t digits)
 
   /* On/Off tube power */
   for (i=0; i<4; i++) {
-    if (dig.ar[i] == 0xf) {
+    if (dig.ar[i] == TUBE_BLANK) {
       tube_PowerOff((tube_pos_t)i);
     } else {
       tube_PowerOn((tube_pos_t)i);

+ 13 - 13
Src/clock.c

@@ -428,10 +428,10 @@ void showWD(void) {
   IN15_OFF;
 
   tube4_t buf;
-  buf.s8.tA = 0xf;
+  buf.s8.tA = TUBE_BLANK;
   buf.s8.tB = Clock.WD & 0xf;
-  buf.s8.tD = 0xf;
-  buf.s8.tE = 0xf;
+  buf.s8.tD = TUBE_BLANK;
+  buf.s8.tE = TUBE_BLANK;
   showDigits(buf);
 }
 
@@ -468,8 +468,8 @@ void showHumidity(void) {
   tube4_t buf;
   buf.s8.tA = Humidity / 10;
   buf.s8.tB = Humidity % 10;
-  buf.s8.tD = 0xf;
-  buf.s8.tE = 0xf;
+  buf.s8.tD = TUBE_BLANK;
+  buf.s8.tE = TUBE_BLANK;
   showDigits(buf);
 }
 
@@ -482,8 +482,8 @@ void showTemperature(void) {
   IN15_FadeIn();
 
   tube4_t buf;
-  buf.s8.tA = 0xf;
-  buf.s8.tB = 0xf;
+  buf.s8.tA = TUBE_BLANK;
+  buf.s8.tB = TUBE_BLANK;
   buf.s8.tD = Temperature / 10;
   buf.s8.tE = Temperature % 10;
   showDigits(buf);
@@ -497,7 +497,7 @@ void showPressure(void) {
 
   tube4_t buf;
   int tmp;
-  buf.s8.tA = 0xf;
+  buf.s8.tA = TUBE_BLANK;
   buf.s8.tB = Pressure / 100;
   tmp = Pressure % 100;
   buf.s8.tD = tmp / 10;
@@ -618,10 +618,10 @@ void setWDShow(void) {
 	dispWDT = DISP_WDT_TIME;
 
   tube4_t buf;
-  buf.s8.tA = 0xf;
+  buf.s8.tA = TUBE_BLANK;
   buf.s8.tB = setClock.WD & 0xf;
-  buf.s8.tD = 0xf;
-  buf.s8.tE = 0xf;
+  buf.s8.tD = TUBE_BLANK;
+  buf.s8.tE = TUBE_BLANK;
   showDigits(buf);
 }
 
@@ -761,9 +761,9 @@ void showDNmode(void) {
     nm = setLighting.name.NightMode;
   }
 
-  buf.s8.tA = 0xf;
+  buf.s8.tA = TUBE_BLANK;
   buf.s8.tB = dm & 0xf;
-  buf.s8.tD = 0xf;
+  buf.s8.tD = TUBE_BLANK;
   buf.s8.tE = nm & 0xf;
   showDigits(buf);
 }