Jelajahi Sumber

Worked. But understanded...

Vladimir N. Shilov 2 tahun lalu
induk
melakukan
30b7398490
3 mengubah file dengan 34 tambahan dan 19 penghapusan
  1. 17 5
      MDK-ARM/MNC-IN12x5.uvoptx
  2. 16 13
      Src/board.c
  3. 1 1
      Src/clock.c

+ 17 - 5
MDK-ARM/MNC-IN12x5.uvoptx

@@ -140,12 +140,12 @@
         <SetRegEntry>
           <Number>0</Number>
           <Key>DLGUARM</Key>
-          <Name>ИЪ+w</Name>
+          <Name></Name>
         </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
           <Key>JL2CM3</Key>
-          <Name>-U805251123 -O78 -S0 -ZTIFSpeedSel20000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8008 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32G0xx_64.FLM -FS08000000 -FL010000 -FP0($$Device:STM32G030K8Tx$CMSIS\Flash\STM32G0xx_64.FLM)</Name>
+          <Name>-U805251123 -O78 -S1 -ZTIFSpeedSel10000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8008 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32G0xx_64.FLM -FS08000000 -FL010000 -FP0($$Device:STM32G030K8Tx$CMSIS\Flash\STM32G0xx_64.FLM)</Name>
         </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
@@ -163,14 +163,26 @@
         <Ww>
           <count>0</count>
           <WinNumber>1</WinNumber>
-          <ItemText>\\MNC_IN12x5\../Src/clock.c\Clock_Init\flash_res</ItemText>
+          <ItemText>\\MNC_IN12x5\../Src/board.c\lShiftDigits\buf</ItemText>
+        </Ww>
+        <Ww>
+          <count>1</count>
+          <WinNumber>1</WinNumber>
+          <ItemText>\\MNC_IN12x5\../Src/board.c\lShiftDigits\sbuf</ItemText>
         </Ww>
       </WatchWindow1>
+      <WatchWindow2>
+        <Ww>
+          <count>0</count>
+          <WinNumber>2</WinNumber>
+          <ItemText>\\MNC_IN12x5\../Src/clock.c\Clock.Min</ItemText>
+        </Ww>
+      </WatchWindow2>
       <MemoryWindow1>
         <Mm>
           <WinNumber>1</WinNumber>
           <SubType>0</SubType>
-          <ItemText>0x0800F800</ItemText>
+          <ItemText>0x200006AC</ItemText>
           <AccSizeX>0</AccSizeX>
         </Mm>
       </MemoryWindow1>
@@ -178,7 +190,7 @@
         <Mm>
           <WinNumber>2</WinNumber>
           <SubType>0</SubType>
-          <ItemText>\\MNC_IN12x5\../Src/utils.c\Flash_Read\val</ItemText>
+          <ItemText>0x200006F0</ItemText>
           <AccSizeX>0</AccSizeX>
         </Mm>
       </MemoryWindow2>

+ 16 - 13
Src/board.c

@@ -131,27 +131,30 @@ void showDigits(tube4_t dig)
 }
 
 void lShiftDigits(const tube4_t old, const tube4_t dig) {
-  uint32_t * buf;
+  tube4_t buf;
   uint8_t sbuf[12];
 
-  sbuf[0] = old.ar[0];
-  sbuf[1] = old.ar[1];
-  sbuf[2] = old.ar[2];
-  sbuf[3] = old.ar[3];
+  sbuf[0] = dig.ar[0];
+  sbuf[1] = dig.ar[1];
+  sbuf[2] = dig.ar[2];
+  sbuf[3] = dig.ar[3];
   sbuf[4] = TUBE_BLANK;
   sbuf[5] = TUBE_BLANK;
   sbuf[6] = TUBE_BLANK;
   sbuf[7] = TUBE_BLANK;
-  sbuf[8] = dig.ar[0];
-  sbuf[9] = dig.ar[1];
-  sbuf[10] = dig.ar[2];
-  sbuf[11] = dig.ar[3];
+  sbuf[8] = old.ar[0];
+  sbuf[9] = old.ar[1];
+  sbuf[10] = old.ar[2];
+  sbuf[11] = old.ar[3];
 
   int i;
-  for (i=0; i<9; i++) {
-    buf = (uint32_t *)&sbuf[i];
-    _show_digits(* buf);
-    tdelay_ms(200);
+  for (i=11; i>2; i--) {
+    buf.ar[3] = sbuf[i];
+    buf.ar[2] = sbuf[i-1];
+    buf.ar[1] = sbuf[i-2];
+    buf.ar[0] = sbuf[i-3];
+    _show_digits(buf.u32);
+    tdelay_ms(100);
   }
 }
 

+ 1 - 1
Src/clock.c

@@ -402,7 +402,7 @@ void showTime(void) {
   buf.s8.tB = Clock.Hr & 0xf;
   buf.s8.tD = Clock.Min >> 4;
   buf.s8.tE = Clock.Min & 0xf;
-  if (Clock.Min == 0) {
+  if (Clock.Sec == 0) {
     lShiftDigits(old_buf, buf);
     old_buf = buf;
   } else {