Browse Source

It works... +/-

Vladimir N. Shilov 3 years ago
parent
commit
2d9337afea
6 changed files with 81 additions and 16 deletions
  1. 67 2
      MDK-ARM/MNC-IN12x5.uvoptx
  2. 1 1
      MDK-ARM/MNC-IN12x5.uvprojx
  3. 1 1
      Makefile
  4. 1 1
      Src/board.c
  5. 1 1
      Src/ds3231.c
  6. 10 10
      Src/main.c

+ 67 - 2
MDK-ARM/MNC-IN12x5.uvoptx

@@ -125,7 +125,7 @@
         <SetRegEntry>
           <Number>0</Number>
           <Key>DLGTARM</Key>
-          <Name>(1010=-1,-1,-1,-1,0)(1007=105,137,302,353,0)(1008=1002,539,1368,765,1)(1009=-1,-1,-1,-1,0)</Name>
+          <Name>(1010=75,104,476,596,0)(1007=105,137,302,353,0)(1008=1002,539,1368,765,0)(1009=-1,-1,-1,-1,0)</Name>
         </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
@@ -153,7 +153,40 @@
           <Name>-U3D18070029135147324D4E00 -O2254 -SF1800 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("") -D00(00000000) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32G0xx_64.FLM -FS08000000 -FL010000 -FP0($$Device:STM32G030K8Tx$CMSIS\Flash\STM32G0xx_64.FLM)</Name>
         </SetRegEntry>
       </TargetDriverDllRegistry>
-      <Breakpoint/>
+      <Breakpoint>
+        <Bp>
+          <Number>0</Number>
+          <Type>0</Type>
+          <LineNumber>157</LineNumber>
+          <EnabledFlag>0</EnabledFlag>
+          <Address>134222080</Address>
+          <ByteObject>0</ByteObject>
+          <HtxType>0</HtxType>
+          <ManyObjects>0</ManyObjects>
+          <SizeOfObject>0</SizeOfObject>
+          <BreakByAccess>0</BreakByAccess>
+          <BreakIfRCount>1</BreakIfRCount>
+          <Filename>..\Src\rtos.c</Filename>
+          <ExecCommand></ExecCommand>
+          <Expression>\\MNC_IN12x5\../Src/rtos.c\157</Expression>
+        </Bp>
+        <Bp>
+          <Number>1</Number>
+          <Type>0</Type>
+          <LineNumber>243</LineNumber>
+          <EnabledFlag>1</EnabledFlag>
+          <Address>134222374</Address>
+          <ByteObject>0</ByteObject>
+          <HtxType>0</HtxType>
+          <ManyObjects>0</ManyObjects>
+          <SizeOfObject>0</SizeOfObject>
+          <BreakByAccess>0</BreakByAccess>
+          <BreakIfRCount>1</BreakIfRCount>
+          <Filename>../Src/stm32g0xx_it.c</Filename>
+          <ExecCommand></ExecCommand>
+          <Expression>\\MNC_IN12x5\../Src/stm32g0xx_it.c\243</Expression>
+        </Bp>
+      </Breakpoint>
       <Tracepoint>
         <THDelay>0</THDelay>
       </Tracepoint>
@@ -201,6 +234,38 @@
           <Name>System Viewer\DMA</Name>
           <WinId>35905</WinId>
         </Entry>
+        <Entry>
+          <Name>System Viewer\DMAMUX</Name>
+          <WinId>35904</WinId>
+        </Entry>
+        <Entry>
+          <Name>System Viewer\EXTI</Name>
+          <WinId>35903</WinId>
+        </Entry>
+        <Entry>
+          <Name>System Viewer\GPIOC</Name>
+          <WinId>35897</WinId>
+        </Entry>
+        <Entry>
+          <Name>System Viewer\I2C1</Name>
+          <WinId>35899</WinId>
+        </Entry>
+        <Entry>
+          <Name>System Viewer\NVIC</Name>
+          <WinId>35902</WinId>
+        </Entry>
+        <Entry>
+          <Name>System Viewer\PWR</Name>
+          <WinId>35901</WinId>
+        </Entry>
+        <Entry>
+          <Name>System Viewer\RCC</Name>
+          <WinId>35900</WinId>
+        </Entry>
+        <Entry>
+          <Name>System Viewer\SPI1</Name>
+          <WinId>35898</WinId>
+        </Entry>
       </SystemViewers>
       <DebugDescription>
         <Enable>1</Enable>

+ 1 - 1
MDK-ARM/MNC-IN12x5.uvprojx

@@ -313,7 +313,7 @@
           </ArmAdsMisc>
           <Cads>
             <interw>1</interw>
-            <Optim>0</Optim>
+            <Optim>5</Optim>
             <oTime>0</oTime>
             <SplitLS>0</SplitLS>
             <OneElfS>1</OneElfS>

+ 1 - 1
Makefile

@@ -22,7 +22,7 @@ TARGET = MNC-IN12x5
 # debug build?
 DEBUG = 0
 # optimization
-OPT = -Os
+OPT = -O2
 OPT += -ffunction-sections -fdata-sections
 OPT += -fno-strict-aliasing
 OPT += -ffast-math -msoft-float -mfloat-abi=soft

+ 1 - 1
Src/board.c

@@ -280,7 +280,7 @@ static void GPIO_Init(void)
   NVIC_EnableIRQ(EXTI4_15_IRQn);
   /* set GPIO modes */
   GPIO_SetPinMode(IRQ_GPIO_Port, IRQ_Pin, GPIO_MODE_IN);
-  //GPIO_SetPinPull(IRQ_GPIO_Port, IRQ_Pin, GPIO_PUPDR_NO);
+  GPIO_SetPinPull(IRQ_GPIO_Port, IRQ_Pin, GPIO_PUPDR_UP);
 
   /* L0, L1, L2, L3 - IN-15 symbols control, PP out, high speed, pull down */
   GPIO_SetPinMode(LC0_GPIO_Port, LC0_Pin, GPIO_MODE_OUT);

+ 1 - 1
Src/ds3231.c

@@ -12,7 +12,7 @@ void RTC_Init(void) {
   /* Clear flags */
   Flag.I2C_TX_End = 0;
 
-  buf[0] = DS3231_1HZ; // set 1 Hz output squware
+  buf[0] = 0x0; //DS3231_1HZ; // set 1 Hz output squware
   buf[1] = 0x0; // disable 32 kHz output
 
   user_i2c_write(DS3231_I2C_ADDR, DS3231_ADDR_CONTROL, buf, 2);

+ 10 - 10
Src/main.c

@@ -94,17 +94,9 @@ int main(void)
   Color_RGB(0xFF, 0x12, 0x0); // Nixie color. FF1200 or FF7E00 or FFBF00
   showTime();
 
-  uint8_t oldsec;
   /* Infinite loop */
   while (1)
   {
-    oldsec = Clock.Sec;
-    RTC_ReadAll(&Clock);
-    if (oldsec != Clock.Sec) {
-      Flag.RTC_IRQ = 1;
-      ES_PlaceEvent(evNewSecond);
-    }
-
     /* new second interrupt from RTC */
     if (Flag.RTC_IRQ != 0) {
       Flag.RTC_IRQ = 0;
@@ -154,8 +146,9 @@ static void Color_RGB(uint8_t r, uint8_t g, uint8_t b) {
 
 /* cheng led color by time seconds */
 static void ColorCircle(void) {
-  static int16_t hue = 0, stage = 0;
-
+  //static
+  int16_t hue = bcd2bin(Clock.Sec) * 6; //0, stage = 0;
+/*
   if (stage == 0) {
     hue = (Clock.Sec * 6) - 6;
     RTOS_SetTask(ColorCircle, 100, 100);
@@ -167,6 +160,7 @@ static void ColorCircle(void) {
     hue ++;
     stage ++;
   }
+*/
   HSV2LED(hue, 255, 255);
 }
 
@@ -362,10 +356,16 @@ void showTime(void) {
   RTOS_SetTask(MinusFadeOut, 500, 0);
 
   uint8_t buf[4];
+/*
   buf[Tube_A] = Clock.Hr >> 4;
   buf[Tube_B] = Clock.Hr & 0xf;
   buf[Tube_D] = Clock.Min >> 4;
   buf[Tube_E] = Clock.Min & 0xf;
+*/
+  buf[Tube_A] = Clock.Min >> 4;
+  buf[Tube_B] = Clock.Min & 0xf;
+  buf[Tube_D] = Clock.Sec >> 4;
+  buf[Tube_E] = Clock.Sec & 0xf;
   showDigits(buf);
 }