Browse Source

Fix mistakes. Work in MDK

Vladimir N. Shilov 3 years ago
parent
commit
236201bac8
8 changed files with 26 additions and 31 deletions
  1. 1 1
      Inc/board.h
  2. 1 1
      Inc/event-system.h
  3. 2 19
      MDK-ARM/MNC-IN12x5.uvoptx
  4. 2 2
      MDK-ARM/MNC-IN12x5.uvprojx
  5. 1 1
      Makefile
  6. 8 2
      Src/clock.c
  7. 1 1
      Src/ds3231.c
  8. 10 4
      Src/main.c

+ 1 - 1
Inc/board.h

@@ -151,6 +151,6 @@ void Board_Init(void);
 void Blink_Start(void);
 void Blink_Stop(void);
 void showDigits(uint8_t * dig);
-void HSV2LED(const int hue, const uint8_t sat, const uint8_t val);
+void HSV2LED(const uint8_t hue, const uint8_t sat, const uint8_t val);
 
 #endif /* _BPARD_H */

+ 1 - 1
Inc/event-system.h

@@ -16,7 +16,7 @@
 #include "main.h"
 #include "list_event.h"
 
-#define SIZE_BUF 20
+#define SIZE_BUF 200
 
 void ES_Init(es_state_t init_state);
 es_state_t ES_GetState(void);

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

@@ -135,7 +135,7 @@
         <SetRegEntry>
           <Number>0</Number>
           <Key>DLGUARM</Key>
-          <Name>ИЪAw</Name>
+          <Name>ИЪxw</Name>
         </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
@@ -153,24 +153,7 @@
           <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>
-        <Bp>
-          <Number>0</Number>
-          <Type>0</Type>
-          <LineNumber>157</LineNumber>
-          <EnabledFlag>0</EnabledFlag>
-          <Address>134221344</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>
-      </Breakpoint>
+      <Breakpoint/>
       <Tracepoint>
         <THDelay>0</THDelay>
       </Tracepoint>

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

@@ -313,7 +313,7 @@
           </ArmAdsMisc>
           <Cads>
             <interw>1</interw>
-            <Optim>0</Optim>
+            <Optim>3</Optim>
             <oTime>0</oTime>
             <SplitLS>0</SplitLS>
             <OneElfS>1</OneElfS>
@@ -325,7 +325,7 @@
             <wLevel>3</wLevel>
             <uThumb>0</uThumb>
             <uSurpInc>0</uSurpInc>
-            <uC99>1</uC99>
+            <uC99>0</uC99>
             <uGnu>1</uGnu>
             <useXO>0</useXO>
             <v6Lang>6</v6Lang>

+ 1 - 1
Makefile

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

+ 8 - 2
Src/clock.c

@@ -162,10 +162,16 @@ void showTime(void) {
   HSV2LED(hue, 255, 255);
 
   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);
 }
 
@@ -280,8 +286,8 @@ void showSensorData(void) {
   tdelay_ms(3000);
 
   showPressure();
-  tdelay_ms(3000);
+  tdelay_ms(2500);
 
   ES_SetState(stShowTime);
-  showTime();
+//  showTime();
 }

+ 1 - 1
Src/ds3231.c

@@ -12,7 +12,7 @@ void RTC_Init(void) {
   /* Clear flags */
   Flag.I2C_TX_End = 0;
 
-  buf[0] = 0x0; //DS3231_1HZ; // set 1 Hz output squware
+  buf[0] = 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 - 4
Src/main.c

@@ -62,15 +62,21 @@ int main(void)
   /* Initialize Scheduler */
   RTOS_Init();
   /* tdelay_ms() work now, I2C can work too */
-  RTC_Init();
-  RTC_ReadAll(&Clock);
-  sensor_Init();
 
   /* Initialize Event State Machine */
   ES_Init(stShowTime);
-  showTime();
+
+  /* Init devices at I2C bus */
+//  RTC_Init();
+//  tdelay_ms(10);
+  RTC_Init();
+  sensor_Init();
+
   es_event_t event = eventNull;
 
+  RTC_ReadAll(&Clock);
+  showTime();
+
   /** Set tasks for Sheduler */
   RTOS_SetTask(btnProcess, 1, BTN_SCAN_PERIOD);