Bläddra i källkod

智能海底阀-功能完成提交

guoqiang 1 år sedan
förälder
incheckning
ff85cb0cf0

+ 0 - 2
Device/PressureSensor.c

@@ -177,7 +177,6 @@ uint8_t PressureSensor_Getvalue(float* pressure)
 		
 		*pressure = (1.0*tmp)/256;
 
-		
 		return 0;
 		
 	}else{
@@ -215,7 +214,6 @@ uint8_t PressureSensor_Getvalue2(float* pressure, float* temperature)
 			*temperature = 1.0*(tmp-65535)/256;
 		}
 		
-		
 		return 0;
 		
 	}else{

+ 67 - 3
Device/adc.c

@@ -33,6 +33,7 @@
 /**********<Incldue>**********/
 #include "adc.h"
 #include "timer.h"
+#include "math.h"
 
 /*********<Variable>********/
 uint8_t g_dmaFinish = 0;//DMA传输完成
@@ -187,14 +188,77 @@ void ADC_init()
         1.同步时间为5个APB CLK。
         2.ADC时钟频率 = APB时钟频率 /(分频系数+1)
 	*/
-    ADC_SetRegularGroupChannel(ADC0, ADC_CH_7, ADC_SPT_CLK_7, 0);  //set ADC_CH_7 为第1个采样序列 电池电压监测 
-		ADC_SetRegularGroupChannel(ADC0, ADC_CH_8, ADC_SPT_CLK_7, 1); ///set ADC_CH_8 为第2个采样序列 电机电流监测
+		ADC_SetRegularGroupChannel(ADC0, ADC_CH_0, ADC_SPT_CLK_7, 0);  //set ADC_CH_7 为第1个采样序列 NTC 温度采集
+    ADC_SetRegularGroupChannel(ADC0, ADC_CH_7, ADC_SPT_CLK_7, 1);  //set ADC_CH_7 为第1个采样序列 线性hall 1
+		ADC_SetRegularGroupChannel(ADC0, ADC_CH_8, ADC_SPT_CLK_7, 2); ///set ADC_CH_8 为第2个采样序列 线性hall 2 
     //ADC_SetRegularGroupChannel(ADC0, ADC_CH_BANDGAP, ADC_SPT_CLK_7, 2); ///set ADC_CH_BANDGAP 为第3个采样序列
     //ADC_SetRegularGroupChannel(ADC0, ADC_CH_TSENSOR, ADC_SPT_CLK_7, 3); ///set ADC_CH_TSENSOR 为第4个采样序列
 		
     ADC_DMAInit();   //ADC DMA初始化
 }
 
+float getTemperature(void)
+{
+	uint16_t NtcAdc = 0;
+	uint8_t i;
+	float Rt = 0; 		//NTC 电阻
+	float R = 50000;	//50K 固定阻值电阻 
+	float T0 = 273.15+25;	//转换为开尔文温度 
+	float B=3950;  		//B值 
+	float Ka=273.15;	//K值
+	float Vr=0;	 			//电压值 
+	float temp = 0;
+	
+	for(i=0; i<ADC_FILTER_NUM; i++){
+		NtcAdc += g_ADCValueBuffer[3*i];
+	}
+	
+	NtcAdc = NtcAdc/ADC_FILTER_NUM;
+	
+	Vr = (float)(3.3*NtcAdc/4096);
+	Rt = (3.3-Vr)*50000/Vr;
+	
+	temp=1/(1/T0+log(Rt/R)/B)-Ka+0.5; //计算温度
+	
+	return temp;
+}
+
+void  getHallValue(uint16_t* pHall_1, uint16_t* pHall_2)
+{
+	int16_t hall1_ADC = 0;
+	int16_t hall2_ADC = 0;
+	int8_t i;
+	
+	for(i=0; i<ADC_FILTER_NUM; i++){
+		hall1_ADC += g_ADCValueBuffer[3*i+1];
+		hall2_ADC += g_ADCValueBuffer[3*i+2];
+	}
+	
+	*pHall_1 = hall1_ADC/ADC_FILTER_NUM;
+	*pHall_2 = hall2_ADC/ADC_FILTER_NUM;
+
+}
+
+
+int16_t getHalldiff(void)
+{
+	int16_t hall1_ADC = 0;
+	int16_t hall2_ADC = 0;
+	int8_t i;
+	
+	for(i=0; i<ADC_FILTER_NUM; i++){
+		hall1_ADC += g_ADCValueBuffer[3*i+1];
+		hall2_ADC += g_ADCValueBuffer[3*i+2];
+	}
+	
+	hall1_ADC = hall1_ADC/ADC_FILTER_NUM;
+	hall2_ADC = hall2_ADC/ADC_FILTER_NUM;
+	
+	return (hall1_ADC - hall2_ADC);
+	
+}
+
+
 void printADCValue(void)
 {
    uint8_t index;
@@ -244,7 +308,7 @@ void ADCSample_Init(void)
 {
     CTU_Config();
     ADC_init();
-    //Timer0_Init();
+    Timer0_Init();
 }
 
 /**********<End>*********/

+ 6 - 4
Device/adc.h

@@ -50,14 +50,16 @@ extern "C" {
 #include "ac780x_pwm.h"
 
 
-#define ADC_SAMPLE_CHANNEL               (2)
-#define ADC_FILTER_NUM               		 (8)
+#define ADC_SAMPLE_CHANNEL               (3)
+#define ADC_FILTER_NUM               		 (4)
 
 //void  ADC_DMACallback(void *device, uint32_t wpara, uint32_t lpara);
 //extern uint32_t g_ADCValueBuffer[ADC_SAMPLE_CHANNEL];
 void ADCSample_Init(void);
-float getBatteryVoltage(void);
-float getMotorCurrent(void);
+
+float getTemperature(void);
+void  getHallValue(uint16_t* pHall_1, uint16_t* pHall_2);
+int16_t getHalldiff(void);
 
 void printADCValue(void);
 

+ 11 - 17
Device/gpio.c

@@ -65,21 +65,9 @@
 void GPIO_PortInit(void)
 {
 	
-		GPIO_SetFunc(GPIO_CLOSE_KEY, GPIO_FUN0);
-		GPIO_SetFunc(GPIO_OPEN_KEY, GPIO_FUN0);
-		GPIO_SetFunc(GPIO_COVER_KEY, GPIO_FUN0);
-	
-		GPIO_SetDir(GPIO_CLOSE_KEY, GPIO_IN);
-		GPIO_SetDir(GPIO_OPEN_KEY, GPIO_IN);
-		GPIO_SetDir(GPIO_COVER_KEY, GPIO_IN);
-	
-		GPIO_SetPullup(GPIO_CLOSE_KEY, ENABLE);
-		GPIO_SetPullup(GPIO_OPEN_KEY, ENABLE);
-		GPIO_SetPullup(GPIO_COVER_KEY, ENABLE);
-	
-	//set pin mux uart0
-    GPIO_SetFunc(GPIOA, GPIO_PIN7, GPIO_FUN1);
-    GPIO_SetFunc(GPIOA, GPIO_PIN8, GPIO_FUN1);
+	//set pin mux uart1
+    GPIO_SetFunc(GPIOA, GPIO_PIN4, GPIO_FUN3);
+    GPIO_SetFunc(GPIOA, GPIO_PIN5, GPIO_FUN3);
 	
 	
 	/*初始化引脚功能,如果引脚上电后默认为GPIO,可省略掉初始化步骤.
@@ -90,13 +78,19 @@ void GPIO_PortInit(void)
 		GPIO_SetFunc(GREENLED_PORT, GREENLED_PIN, GPIO_FUN0);
 		GPIO_SetDir(GREENLED_PORT, GREENLED_PIN, GPIO_OUT);
 		
-		//GPIO_SetFunc(REDLED_PORT, REDLED_PIN, GPIO_FUN0);
-		//GPIO_SetDir(REDLED_PORT, REDLED_PIN, GPIO_OUT);
+		GPIO_SetFunc(REDLED_PORT, REDLED_PIN, GPIO_FUN0);
+		GPIO_SetDir(REDLED_PORT, REDLED_PIN, GPIO_OUT);
 		
 		/*初始化Pressure Sensor iic0 */
 		GPIO_SetFunc(GPIOA, GPIO_PIN0, GPIO_FUN3);//I2C0_SCL
 		GPIO_SetFunc(GPIOA, GPIO_PIN1, GPIO_FUN3);//I2C0_sda
 	
+		//adc0 ch7 ch8
+		GPIO_SetFunc(GPIOA, GPIO_PIN2, GPIO_FUN2); 		// adc IN8 hall_2
+    GPIO_SetFunc(GPIOA, GPIO_PIN3, GPIO_FUN2); 		// adc IN7 hall_1
+		GPIO_SetFunc(GPIOA, GPIO_PIN11, GPIO_FUN2); 	// adc IN0 NTC
+		
+		
 	
 }
 

+ 2 - 7
Device/gpio.h

@@ -46,11 +46,6 @@ extern "C" {
 /*************<macro>******************/
 
 /* define key gpio */
-#define GPIO_CLOSE_KEY   GPIOA,GPIO_PIN15
-#define GPIO_OPEN_KEY    GPIOA,GPIO_PIN0
-#define GPIO_COVER_KEY   GPIOA,GPIO_PIN1
-
-
 
 #define RS485CTRL_PORT (GPIOB)
 #define RS485CTRL_PIN  (GPIO_PIN3)
@@ -61,8 +56,8 @@ extern "C" {
 #define GREENLED_PORT			(GPIOA)
 #define GREENLED_PIN			(GPIO_PIN10)
 
-#define REDLED_PORT			(GPIOA)
-#define REDLED_PIN			(GPIO_PIN10)
+#define REDLED_PORT			(GPIOB)
+#define REDLED_PIN			(GPIO_PIN8)
 
 /*RUNLED¶¯×÷¶¨Òå.*/	
 #define GREENLED_ON				do{GPIO_SetPinLevel(GREENLED_PORT, GREENLED_PIN, GPIO_LEVEL_HIGH);}while(0)

+ 10 - 2
Device/timer.c

@@ -113,7 +113,7 @@ void Timer1_Init(void)
 	tmrConfig.periodValue	= TIM_PRD_1ms;
 	tmrConfig.timerEn		= ENABLE;
 	tmrConfig.callBack 		= Timer_Callback;
-	TIMER_Init(TIMER_CHANNEL2, &tmrConfig);
+	TIMER_Init(TIMER_CHANNEL1, &tmrConfig);
 	
 	NVIC_SetPriority(TIMER_CHANNEL1_IRQn, 2);
   NVIC_ClearPendingIRQ(TIMER_CHANNEL1_IRQn);
@@ -134,7 +134,7 @@ void Timer_Callback(void *device, uint32_t wpara, uint32_t lpara)
 				//g_timer0Cnt++;
 		}else if(TIMER_CHANNEL1 == device){
 			
-			if (g_blinkLedTime < 0xFFFF)
+			if(g_blinkLedTime < 0xFFFF)
 			{
 					g_blinkLedTime++;
 			}
@@ -143,6 +143,14 @@ void Timer_Callback(void *device, uint32_t wpara, uint32_t lpara)
 					rs485_info.dmasend_count++;
 			}
 			
+			if(g_mr_Interval < 0xFF){
+					g_mr_Interval++;
+			}
+			
+			if(g_print_interval < 0xFFFF){
+					g_print_interval++;
+			}
+			
 			
 			/*
 			

+ 2 - 2
Device/uart.c

@@ -39,8 +39,8 @@
 
 //#include "Comm.h"
 
-#define UART485   UART0
-#define UART485_IRQn  UART0_IRQn
+#define UART485   		UART1
+#define UART485_IRQn  UART1_IRQn
 
 
 UART_INFO  rs485_info;

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 3817 - 0
Project/AirControlValve.uvguix.JL200


+ 9 - 1
Project/AirControlValve.uvoptx

@@ -120,7 +120,7 @@
         <SetRegEntry>
           <Number>0</Number>
           <Key>DLGUARM</Key>
-          <Name></Name>
+          <Name>d</Name>
         </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
@@ -590,6 +590,14 @@
     </File>
   </Group>
 
+  <Group>
+    <GroupName>::Board Support</GroupName>
+    <tvExp>1</tvExp>
+    <tvExpOptDlg>0</tvExpOptDlg>
+    <cbSel>0</cbSel>
+    <RteFlg>1</RteFlg>
+  </Group>
+
   <Group>
     <GroupName>::CMSIS</GroupName>
     <tvExp>0</tvExp>

+ 32 - 5
Project/AirControlValve.uvprojx

@@ -10,7 +10,7 @@
       <TargetName>AirControlValve</TargetName>
       <ToolsetNumber>0x4</ToolsetNumber>
       <ToolsetName>ARM-ADS</ToolsetName>
-      <pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
+      <pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARM_Compiler_5.06u7</pCCUsed>
       <uAC6>0</uAC6>
       <TargetOption>
         <TargetCommonOption>
@@ -49,7 +49,7 @@
             <InvalidFlash>1</InvalidFlash>
           </TargetStatus>
           <OutputDirectory>.\Objects\</OutputDirectory>
-          <OutputName>SmartSeaValve_20240725</OutputName>
+          <OutputName>SmartSeaValve_20240816</OutputName>
           <CreateExecutable>1</CreateExecutable>
           <CreateLib>0</CreateLib>
           <CreateHexFile>1</CreateHexFile>
@@ -186,6 +186,7 @@
             <RvdsVP>0</RvdsVP>
             <RvdsMve>0</RvdsMve>
             <RvdsCdeCp>0</RvdsCdeCp>
+            <nBranchProt>0</nBranchProt>
             <hadIRAM2>0</hadIRAM2>
             <hadIROM2>0</hadIROM2>
             <StupSel>8</StupSel>
@@ -275,7 +276,7 @@
               </OCR_RVCT3>
               <OCR_RVCT4>
                 <Type>1</Type>
-                <StartAddress>0x8000000</StartAddress>
+                <StartAddress>0x800b000</StartAddress>
                 <Size>0xa800</Size>
               </OCR_RVCT4>
               <OCR_RVCT5>
@@ -550,6 +551,9 @@
             </File>
           </Files>
         </Group>
+        <Group>
+          <GroupName>::Board Support</GroupName>
+        </Group>
         <Group>
           <GroupName>::CMSIS</GroupName>
         </Group>
@@ -563,8 +567,14 @@
   <RTE>
     <apis/>
     <components>
-      <component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.5.0" condition="ARMv6_7_8-M Device">
-        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.8.0"/>
+      <component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.6.0" condition="ARMv6_7_8-M Device">
+        <package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0"/>
+        <targetInfos>
+          <targetInfo name="AirControlValve"/>
+        </targetInfos>
+      </component>
+      <component Cbundle="AC780x Development Kit" Cclass="Board Support" Cgroup="AC780x Development Kit" Csub="Debug" Cvendor="AutoChips" Cversion="1.0.0" condition="AC780x Debug Interface">
+        <package name="AC780x_DFP" schemaVersion="1.4" url="http://fex.autochips.com:90/download/CMSIS_PACK/AC7801/" vendor="AutoChips" version="1.0.6"/>
         <targetInfos>
           <targetInfo name="AirControlValve"/>
         </targetInfos>
@@ -697,6 +707,14 @@
       </component>
     </components>
     <files>
+      <file attr="config" category="source" name="Device\Source\ac780x_debugout.c" version="1.0.0">
+        <instance index="0">RTE\Board_Support\AC78013MDQA\ac780x_debugout.c</instance>
+        <component Cbundle="AC780x Development Kit" Cclass="Board Support" Cgroup="AC780x Development Kit" Csub="Debug" Cvendor="AutoChips" Cversion="1.0.0" condition="AC780x Debug Interface"/>
+        <package name="AC780x_DFP" schemaVersion="1.4" url="http://fex.autochips.com:90/download/CMSIS_PACK/AC7801/" vendor="AutoChips" version="1.0.6"/>
+        <targetInfos>
+          <targetInfo name="AirControlValve"/>
+        </targetInfos>
+      </file>
       <file attr="config" category="header" name="Device\device_assert.h" version="1.0.0">
         <instance index="0">RTE\Device\AC78013MDQA\device_assert.h</instance>
         <component Cclass="Device" Cgroup="Startup" Cvendor="AutoChips" Cversion="1.0.0" condition="AC780x System"/>
@@ -732,4 +750,13 @@
     </files>
   </RTE>
 
+  <LayerInfo>
+    <Layers>
+      <Layer>
+        <LayName>AirControlValve</LayName>
+        <LayPrjMark>1</LayPrjMark>
+      </Layer>
+    </Layers>
+  </LayerInfo>
+
 </Project>

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 5191 - 3562
Project/JLinkLog.txt


+ 156 - 155
Project/Listings/startup_ac780x.lst

@@ -482,11 +482,12 @@ ARM Macro Assembler    Page 8
               00000000 
 Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M0+ --apcs=inter
 work --depend=.\objects\startup_ac780x.d -o.\objects\startup_ac780x.o -I.\RTE\D
-evice\AC78013MDQA -I.\RTE\_AirControlValve -IC:\Users\avans\ARM\CMSIS\5.8.0\CMS
-IS\Core\Include -IC:\Users\avans\AutoChips\AC780x_DFP\1.0.6\ATC_Driver\inc -IC:
-\Users\avans\AutoChips\AC780x_DFP\1.0.6\Device\Include --predefine="__UVISION_V
-ERSION SETA 536" --predefine="_RTE_ SETA 1" --predefine="_RTE_ SETA 1" --list=.
-\listings\startup_ac780x.lst RTE\Device\AC78013MDQA\startup_ac780x.s
+evice\AC78013MDQA -I.\RTE\_AirControlValve -ID:\installed_software\Kiel_v5\Pack
+s\ARM\CMSIS\5.9.0\CMSIS\Core\Include -ID:\installed_software\Kiel_v5\Packs\Auto
+Chips\AC780x_DFP\1.0.6\ATC_Driver\inc -ID:\installed_software\Kiel_v5\Packs\Aut
+oChips\AC780x_DFP\1.0.6\Device\Include --predefine="__UVISION_VERSION SETA 537"
+ --predefine="_RTE_ SETA 1" --predefine="_RTE_ SETA 1" --list=.\listings\startu
+p_ac780x.lst RTE/Device/AC78013MDQA/startup_ac780x.s
 
 
 
@@ -497,7 +498,7 @@ STACK 00000000
 
 Symbol: STACK
    Definitions
-      At line 45 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 45 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
       None
 Comment: STACK unused
@@ -505,18 +506,18 @@ Stack_Mem 00000000
 
 Symbol: Stack_Mem
    Definitions
-      At line 46 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 46 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 279 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 281 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 279 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 281 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 __initial_sp 00000400
 
 Symbol: __initial_sp
    Definitions
-      At line 47 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 47 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 73 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 73 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 Comment: __initial_sp used once
 3 symbols
 
@@ -529,7 +530,7 @@ HEAP 00000000
 
 Symbol: HEAP
    Definitions
-      At line 56 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 56 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
       None
 Comment: HEAP unused
@@ -537,16 +538,16 @@ Heap_Mem 00000000
 
 Symbol: Heap_Mem
    Definitions
-      At line 58 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 58 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 278 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 280 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 278 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 280 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 __heap_base 00000000
 
 Symbol: __heap_base
    Definitions
-      At line 57 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 57 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
       None
 Comment: __heap_base unused
@@ -554,7 +555,7 @@ __heap_limit 00000000
 
 Symbol: __heap_limit
    Definitions
-      At line 59 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 59 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
       None
 Comment: __heap_limit unused
@@ -569,7 +570,7 @@ RESET 00000000
 
 Symbol: RESET
    Definitions
-      At line 68 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 68 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
       None
 Comment: RESET unused
@@ -577,19 +578,19 @@ __Vectors 00000000
 
 Symbol: __Vectors
    Definitions
-      At line 73 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 73 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 69 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 125 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 69 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 125 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 __Vectors_End 000000C0
 
 Symbol: __Vectors_End
    Definitions
-      At line 123 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 123 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 70 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 125 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 70 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 125 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 3 symbols
 
@@ -602,7 +603,7 @@ Relocatable symbols
 
 Symbol: .text
    Definitions
-      At line 127 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 127 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
       None
 Comment: .text unused
@@ -610,52 +611,52 @@ ACMP0_IRQHandler 00000030
 
 Symbol: ACMP0_IRQHandler
    Definitions
-      At line 228 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 228 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 95 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 195 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 95 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 195 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 ADC0_IRQHandler 00000030
 
 Symbol: ADC0_IRQHandler
    Definitions
-      At line 249 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 249 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 116 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 216 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 116 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 216 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 CAN0_Handler 00000030
 
 Symbol: CAN0_Handler
    Definitions
-      At line 248 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 248 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 115 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 215 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 115 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 215 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 DMA0_Channel0_IRQHandler 00000030
 
 Symbol: DMA0_Channel0_IRQHandler
    Definitions
-      At line 237 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 237 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 104 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 204 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 104 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 204 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 DMA0_Channel1_IRQHandler 00000030
 
 Symbol: DMA0_Channel1_IRQHandler
    Definitions
-      At line 238 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 238 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 105 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 205 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 105 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 205 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 DMA0_Channel2_IRQHandler 00000030
 
 Symbol: DMA0_Channel2_IRQHandler
    Definitions
-      At line 239 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 239 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
 
 
@@ -663,23 +664,23 @@ Symbol: DMA0_Channel2_IRQHandler
 ARM Macro Assembler    Page 2 Alphabetic symbol ordering
 Relocatable symbols
 
-      At line 106 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 206 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 106 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 206 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 DMA0_Channel3_IRQHandler 00000030
 
 Symbol: DMA0_Channel3_IRQHandler
    Definitions
-      At line 240 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 240 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 107 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 207 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 107 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 207 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 Default_Handler 00000030
 
 Symbol: Default_Handler
    Definitions
-      At line 189 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 189 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
       None
 Comment: Default_Handler unused
@@ -687,37 +688,37 @@ ECC_SRAM_IRQHandler 00000030
 
 Symbol: ECC_SRAM_IRQHandler
    Definitions
-      At line 250 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 250 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 117 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 217 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 117 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 217 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 EXTI0_IRQHandler 00000030
 
 Symbol: EXTI0_IRQHandler
    Definitions
-      At line 251 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 251 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 118 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 218 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 118 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 218 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 EXTI1_IRQHandler 00000030
 
 Symbol: EXTI1_IRQHandler
    Definitions
-      At line 252 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 252 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 119 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 219 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 119 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 219 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 EXTI2_IRQHandler 00000030
 
 Symbol: EXTI2_IRQHandler
    Definitions
-      At line 253 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 253 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 120 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 220 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 120 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 220 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 EXTI3_8_IRQHandler 00000030
 
@@ -729,64 +730,64 @@ ARM Macro Assembler    Page 3 Alphabetic symbol ordering
 Relocatable symbols
 
    Definitions
-      At line 254 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 254 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 121 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 221 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 121 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 221 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 EXTI9_15_IRQHandler 00000030
 
 Symbol: EXTI9_15_IRQHandler
    Definitions
-      At line 255 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 255 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 122 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 222 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 122 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 222 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 HardFault_Handler 00000028
 
 Symbol: HardFault_Handler
    Definitions
-      At line 172 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 172 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 76 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 173 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 76 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 173 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 I2C0_IRQHandler 00000030
 
 Symbol: I2C0_IRQHandler
    Definitions
-      At line 235 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 235 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 102 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 202 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 102 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 202 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 I2C1_IRQHandler 00000030
 
 Symbol: I2C1_IRQHandler
    Definitions
-      At line 236 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 236 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 103 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 203 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 103 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 203 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 NMI_Handler 00000026
 
 Symbol: NMI_Handler
    Definitions
-      At line 167 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 167 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 75 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 168 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 75 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 168 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 PVD_IRQHandler 00000030
 
 Symbol: PVD_IRQHandler
    Definitions
-      At line 246 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 246 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 113 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 213 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 113 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 213 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 
 
@@ -798,55 +799,55 @@ PWDT0_IRQHandler 00000030
 
 Symbol: PWDT0_IRQHandler
    Definitions
-      At line 224 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 224 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 91 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 191 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 91 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 191 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 PWDT1_IRQHandler 00000030
 
 Symbol: PWDT1_IRQHandler
    Definitions
-      At line 225 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 225 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 92 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 192 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 92 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 192 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 PWM0_IRQHandler 00000030
 
 Symbol: PWM0_IRQHandler
    Definitions
-      At line 226 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 226 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 93 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 193 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 93 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 193 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 PWM1_IRQHandler 00000030
 
 Symbol: PWM1_IRQHandler
    Definitions
-      At line 227 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 227 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 94 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 194 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 94 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 194 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 PendSV_Handler 0000002C
 
 Symbol: PendSV_Handler
    Definitions
-      At line 180 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 180 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 87 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 181 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 87 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 181 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 RTC_IRQHandler 00000030
 
 Symbol: RTC_IRQHandler
    Definitions
-      At line 245 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 245 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 112 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 212 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 112 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 212 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 Reset_Handler 00000000
 
@@ -858,64 +859,64 @@ Symbol: Reset_Handler
 ARM Macro Assembler    Page 5 Alphabetic symbol ordering
 Relocatable symbols
 
-      At line 132 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 132 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 74 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 133 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 74 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 133 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 SPI0_IRQHandler 00000030
 
 Symbol: SPI0_IRQHandler
    Definitions
-      At line 233 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 233 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 100 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 200 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 100 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 200 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 SPI1_IRQHandler 00000030
 
 Symbol: SPI1_IRQHandler
    Definitions
-      At line 234 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 234 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 101 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 201 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 101 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 201 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 SPM_IRQHandler 00000030
 
 Symbol: SPM_IRQHandler
    Definitions
-      At line 247 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 247 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 114 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 214 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 114 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 214 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 SVC_Handler 0000002A
 
 Symbol: SVC_Handler
    Definitions
-      At line 176 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 176 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 84 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 177 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 84 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 177 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 SysTick_Handler 0000002E
 
 Symbol: SysTick_Handler
    Definitions
-      At line 184 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 184 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 88 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 185 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 88 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 185 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 TIMER_Channel0_IRQHandler 00000030
 
 Symbol: TIMER_Channel0_IRQHandler
    Definitions
-      At line 241 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 241 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 108 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 208 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 108 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 208 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 
 
@@ -927,61 +928,61 @@ TIMER_Channel1_IRQHandler 00000030
 
 Symbol: TIMER_Channel1_IRQHandler
    Definitions
-      At line 242 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 242 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 109 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 209 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 109 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 209 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 TIMER_Channel2_IRQHandler 00000030
 
 Symbol: TIMER_Channel2_IRQHandler
    Definitions
-      At line 243 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 243 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 110 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 210 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 110 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 210 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 TIMER_Channel3_IRQHandler 00000030
 
 Symbol: TIMER_Channel3_IRQHandler
    Definitions
-      At line 244 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 244 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 111 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 211 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 111 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 211 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 UART0_IRQHandler 00000030
 
 Symbol: UART0_IRQHandler
    Definitions
-      At line 229 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 229 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 96 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 196 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 96 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 196 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 UART1_IRQHandler 00000030
 
 Symbol: UART1_IRQHandler
    Definitions
-      At line 230 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 230 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 97 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 197 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 97 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 197 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 UART2_IRQHandler 00000030
 
 Symbol: UART2_IRQHandler
    Definitions
-      At line 231 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 231 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 98 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 198 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 98 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 198 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 WDG_IRQHandler 00000030
 
 Symbol: WDG_IRQHandler
    Definitions
-      At line 232 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 232 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 
 
@@ -989,16 +990,16 @@ ARM Macro Assembler    Page 7 Alphabetic symbol ordering
 Relocatable symbols
 
    Uses
-      At line 99 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 199 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 99 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 199 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 __user_initial_stackheap 00000034
 
 Symbol: __user_initial_stackheap
    Definitions
-      At line 277 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 277 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 275 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 275 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 Comment: __user_initial_stackheap used once
 41 symbols
 
@@ -1011,27 +1012,27 @@ Heap_Size 00000000
 
 Symbol: Heap_Size
    Definitions
-      At line 54 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 54 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 58 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 280 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 58 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 280 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 Stack_Size 00000400
 
 Symbol: Stack_Size
    Definitions
-      At line 43 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 43 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 46 in file RTE\Device\AC78013MDQA\startup_ac780x.s
-      At line 279 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 46 in file RTE/Device/AC78013MDQA/startup_ac780x.s
+      At line 279 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 
 __Vectors_Size 000000C0
 
 Symbol: __Vectors_Size
    Definitions
-      At line 125 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 125 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 71 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 71 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 Comment: __Vectors_Size used once
 3 symbols
 
@@ -1044,23 +1045,23 @@ SystemInit 00000000
 
 Symbol: SystemInit
    Definitions
-      At line 134 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 134 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 137 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 137 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 Comment: SystemInit used once
 __main 00000000
 
 Symbol: __main
    Definitions
-      At line 135 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 135 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
-      At line 160 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 160 in file RTE/Device/AC78013MDQA/startup_ac780x.s
 Comment: __main used once
 __use_two_region_memory 00000000
 
 Symbol: __use_two_region_memory
    Definitions
-      At line 274 in file RTE\Device\AC78013MDQA\startup_ac780x.s
+      At line 274 in file RTE/Device/AC78013MDQA/startup_ac780x.s
    Uses
       None
 Comment: __use_two_region_memory unused

+ 5 - 5
Project/RTE/Device/AC78013MDQA/system_ac780x.h

@@ -66,7 +66,7 @@ extern "C" {
 #define IC_CLOCK_SRC_XOSC        2U  /*!< The external OSC to provide 4MHZ ~30MHz  oscillator */
 #define IC_CLOCK_SRC_XOSC_BYPASS 3U  /*!< The external OSC to provide 4MHZ ~30MHz  oscillator */
 
-#define AC780X_CLOCK_SRC  IC_CLOCK_SRC_HSI /*!< define mcu clock source */
+#define AC780X_CLOCK_SRC  IC_CLOCK_SRC_HSE /*!< define mcu clock source */
 
 #define HSI_FREQ      8000000UL   /*!< Internal 8M RC clock */
 #define XTAL_16M     16000000UL   /*!< extern crystal oscillator 16m */
@@ -87,8 +87,8 @@ extern "C" {
 #define PLL_FBKDIV   96U
 #define PLL_PREDIV   PLL_PREDIV_2
 #elif USE_XTAL == XTAL_8M
-#define PLL_POSDIV   PLL_POSDIV_24
-#define PLL_FBKDIV   48U
+#define PLL_POSDIV   PLL_POSDIV_16
+#define PLL_FBKDIV   96U
 #define PLL_PREDIV   PLL_PREDIV_1
 #elif USE_XTAL == XTAL_4M
 #define PLL_POSDIV   PLL_POSDIV_16
@@ -108,8 +108,8 @@ extern "C" {
 */
 #define SYSCLK_DIV   SYSCLK_DIVIDER_1
 #define APBCLK_DIV   APBCLK_DIVIDER_2
-#define SYSCLK_FREQ  16000000UL
-#define APB_BUS_FREQ 8000000UL
+#define SYSCLK_FREQ  48000000UL
+#define APB_BUS_FREQ 24000000UL
 
 #define __SYSTEM_CLOCK    SYSCLK_FREQ
 

+ 2 - 2
User/cfg.c

@@ -24,11 +24,11 @@ int Config_Init(void)
     //EFLASH_StatusType ret = EFLASH_STATUS_SUCCESS;
     memcpy(reflectionBuff, (void *)CONFIG_ADDRESS, sizeof(Config_type));
     if (config->magic != CONFIG_MAGIC)
-    {/* initiliaze config */
+    {
+				/* initiliaze config */
         memset(reflectionBuff, 0xFF, sizeof(Config_type)); 
         //config->magic = CONFIG_MAGIC;
 			
-			
 				Factory_reset();
 			
 				//

+ 6 - 3
User/cfg.h

@@ -40,7 +40,7 @@ extern "C" {
 #include "ac780x.h"
 
 //控制程序,是否编译为  bootloader, hex 格式
-#define IS_BOOTLOADER       (1)   
+//#define IS_BOOTLOADER       (1)   
 
 
 
@@ -58,7 +58,7 @@ extern "C" {
 
 #define CONFIG_MAGIC   		0xA5A5
 
-#define DEFAULT_ADDR     0x20
+#define DEFAULT_ADDR     0x60
 #define BROADCAST_ADDR   0xFF
 
 /* 升级标志 */
@@ -77,7 +77,10 @@ typedef struct
     uint8_t  addr;
     uint8_t  br_index;
 	
-		uint32_t  res[58];
+		int16_t  valvecolse_base;
+		int16_t	 threshold;
+	
+		uint32_t  res[57];
 	
 		uint16_t hw_version;
 		uint16_t devicetype;

+ 8 - 3
User/main.c

@@ -6,7 +6,8 @@
 #include "process.h"
 #include "main_task.h"
 #include "watchdog.h"
-
+#include "PressureSensor.h"
+#include "adc.h"
 
 /*!
 * @brief entry 
@@ -23,6 +24,9 @@ int main(void)
 	#endif
 	
 		InitDelay();
+		InitDebug();
+
+	
 		Config_Init();
 		Watchdog_Init();
 		
@@ -36,12 +40,13 @@ int main(void)
 	
 	
 		Process_Init();
+		PressureSensor_Init();
+		ADCSample_Init();
 	
-		//Timer0_Init(); 
 		Timer1_Init();
 		
     Task_Init();
-	
+
 	
     while (1)
     {

+ 74 - 5
User/main_task.c

@@ -106,14 +106,65 @@ void mb_03_handle(void)
 					g_mb_ctx.exception_code = INVALID_DATA;
 				}
 				break;
-			case Cmd_LockStatus:
+			case Cmd_ReadTemperature:
 				if(4 == read_len){
-					tx_offset += Read_LockStatus(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+					tx_offset += Read_Temperature(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+				}else if(8 == read_len){
+					tx_offset += Read_Temperature(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+					tx_offset += Read_Pressure(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+				}else if(10 == read_len){
+					tx_offset += Read_Temperature(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+					tx_offset += Read_Pressure(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+					tx_offset += Read_Status(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+				}else if(14 == read_len){
+					tx_offset += Read_Temperature(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+					tx_offset += Read_Pressure(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+					tx_offset += Read_Status(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+					tx_offset += Read_Raw(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);					
 				}else{
 					g_mb_ctx.exception_code = INVALID_DATA;
 				}
 				
 				break;
+			case Cmd_ReadPressure:
+				if(4 == read_len){
+					tx_offset += Read_Pressure(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+				}else if(6 == read_len){
+					tx_offset += Read_Pressure(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+					tx_offset += Read_Status(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+				}else if(10 == read_len){
+					tx_offset += Read_Pressure(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+					tx_offset += Read_Status(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+					tx_offset += Read_Raw(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+				}else{
+					g_mb_ctx.exception_code = INVALID_DATA;
+				}
+				break;
+			case Cmd_ReadStatus:
+				if(2 == read_len){
+					tx_offset += Read_Status(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+				}else if(6 == read_len){
+					tx_offset += Read_Status(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+					tx_offset += Read_Raw(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+				}else{
+					g_mb_ctx.exception_code = INVALID_DATA;
+				}
+				break;
+			case Cmd_ReadRaw:
+				if(4 == read_len){
+					tx_offset += Read_Raw(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+				}else{
+					g_mb_ctx.exception_code = INVALID_DATA;
+				}
+				break;
+			case Cmd_ReadThreshold:
+				if(2 == read_len){
+					tx_offset += Read_Threshold(g_mb_ctx.txbuf+tx_offset, g_mb_ctx.txbuf_size-tx_offset);
+				}else{
+					g_mb_ctx.exception_code = INVALID_DATA;
+				}
+				break;
+				
 			default:
 				g_mb_ctx.exception_code = INVALID_COMMAND;
 
@@ -185,6 +236,15 @@ void mb_06_handle(void)
 					g_mb_ctx.exception_code = INVALID_DATA;
 				}
 				break;
+			case Cmd_SetThreshold:
+				if(2 == g_mb_ctx.rx_len-4-2){
+					ret_write = Write_Threshold(g_mb_ctx.rxbuf+4, 2); 
+					if(RET_DATAINVALID == ret_write)
+						g_mb_ctx.exception_code = INVALID_DATA;
+				}else{
+					g_mb_ctx.exception_code = INVALID_DATA;
+				}
+				break;
 			case Cmd_Reboot:
 				//NVIC_SystemReset();
 				ret_write = RET_NEED_REBOOT;
@@ -319,7 +379,17 @@ void mb_10_handle(void)
 						g_mb_ctx.exception_code = INVALID_DATA;
 					}
 					break;
+					
+				case Cmd_SetThreshold:
+					if(2 == g_mb_ctx.rx_len-4-2){
+						ret_write = Write_Threshold(g_mb_ctx.rxbuf+7, 2); 
+						if(ret_write&RET_DATAINVALID)
+							g_mb_ctx.exception_code = INVALID_DATA;
+					}else{
+							g_mb_ctx.exception_code = INVALID_DATA;
+					}
 
+					break;
 				default:
 					g_mb_ctx.exception_code = INVALID_COMMAND;
 					break;
@@ -685,9 +755,8 @@ void Task_Init(void)
 */
 void Task_Handle(void)
 {
-	
-		Process_RunLedPrd();
-		Process_ThreeStatus();
+		Process_RunPeriod();
+
 		Uart0_RxDataHandle();
 
 }

+ 97 - 103
User/process.c

@@ -1,41 +1,70 @@
 #include "process.h"
 #include "gpio.h"
+#include "cfg.h"
 #include "ac780x_gpio.h"
+#include "PressureSensor.h"
+#include "adc.h"
 
 uint16_t	g_blinkLedTime;		/*LED闪烁频率控制时间*/
 uint16_t	g_blinkLedTgtTime;	/*LED目标闪烁频率*/
-uint8_t		g_detectTime;			/*三个开关状态,检测时间*/
+
+uint8_t		g_mr_Interval = 0;			/*  压力传感器更新周期  */
+uint16_t  g_print_interval = 0;   /* 打印周期 */
 
 #define STATUS_DETECTINTERVAL  (40)  /*60ms * 8 == 320ms 去抖动 */
 
-uint8_t g_lockstatus;
-uint8_t g_unlockstatus;
-uint8_t g_coverstatus;
+uint8_t g_runstate; //状态
+uint8_t g_state; 		//状态
+uint8_t g_exception; //异常,主要指IIC 通信 
 
-uint8_t g_state; //状态
+uint8_t close_count =0;
+uint8_t open_count=0;
 
-uint8_t lockbits;
-uint8_t unlockbits;
-uint8_t coverbits;
 
 static void update_state()
 {
-	if((STATUS_CLOSE == g_lockstatus) & (STATUS_OPEN == g_unlockstatus)){
-		g_state = STATE_LOCK;
-	
-	}else if((STATUS_OPEN == g_lockstatus) & (STATUS_CLOSE == g_unlockstatus)){
-		g_state = STATE_UNLOCK;
-	}else if((STATUS_OPEN == g_lockstatus) & (STATUS_OPEN == g_unlockstatus)){
-		g_state = STATE_INTERMEDIATE;
-	}else {
-		g_state = STATE_EXCEPTION;
-	}
+//		//判定阀开状态
+//	if(config->valvecolse_base <= 0){
+//		
+//		if(getHalldiff() > (config->valvecolse_base + config->threshold)){
+//				//g_state = STATUS_OPEN;
+//				if(open_count < 0xFF) open_count++;
+//				close_count=0;
+//		}else{
+//				//g_state = STATUS_CLOSE;
+//				open_count=0;
+//				if(close_count < 0xFF) close_count++;
+//		}
+//	
+//	}else{
+		
+		if(getHalldiff() >= (config->valvecolse_base + config->threshold)){
+			//g_state = STATUS_CLOSE;
+			open_count=0;
+			if(close_count < 0xFF) close_count++;
+		}else{
+			//g_state = STATUS_OPEN;
+			if(open_count < 0xFF)  open_count++;
+			close_count=0;
+		}
 	
-	//if(STATUS_OPEN == g_coverstatus){
-	//	g_state = STATE_OPENCOVER;
-	//}
+//	}
 	
-	g_state = STATE_LOCK;
+	if(close_count >= 10){
+		g_state = STATUS_CLOSE;
+	}else if(open_count >= 10){
+		g_state = STATUS_OPEN;
+	}
+		
+	if(STATUS_OPEN == g_state){
+		g_runstate = STATUS_OPEN;
+	}else if(STATUS_CLOSE == g_state){
+		g_runstate = STATUS_CLOSE;
+	}
+	
+	if(1 == g_exception){
+		g_runstate = STATUS_EXCEPTION;
+	}
 
 }
 
@@ -45,125 +74,90 @@ void Process_Init(void)
 		g_blinkLedTime 	  = 0;
 		g_blinkLedTgtTime = BLINK_LED_DFTT;
 	
-		g_detectTime = 0;
+		g_mr_Interval = 0;
+		g_exception = 0;
 	
-		g_lockstatus = GPIO_LEVEL_HIGH == GPIO_GetPinLevel(GPIO_CLOSE_KEY)? STATUS_OPEN:STATUS_CLOSE;
-		g_unlockstatus = GPIO_LEVEL_HIGH == GPIO_GetPinLevel(GPIO_OPEN_KEY)? STATUS_OPEN:STATUS_CLOSE;
-		g_coverstatus = GPIO_LEVEL_HIGH == GPIO_GetPinLevel(GPIO_COVER_KEY)? STATUS_OPEN:STATUS_CLOSE;
-	
-		lockbits = g_lockstatus == STATUS_OPEN?0xFF:0x00;
-		unlockbits = g_unlockstatus == STATUS_OPEN?0xFF:0x00;
-		coverbits = g_coverstatus == STATUS_OPEN?0xFF:0x00;
-	
-		/*上电默认LED点亮.*/
+		g_state = STATUS_CLOSE;
 
-		//GREENLED_ON;
 		update_state();
+	
+	  printf("process init \r\n");
 }
 
-void Process_RunLedPrd(void)
+void Process_RunPeriod(void)
 {
 	/*周期性地检查LED闪烁,LED2和LED3同时闪烁.*/
 	if (g_blinkLedTime >= g_blinkLedTgtTime)
 	{
 		g_blinkLedTime = 0;
 		
-		//REDLED_OFF;
-		//REDGREEN_TOGGLE;
-		
-		switch(g_state){
-			case STATE_LOCK:
-				//REDLED_OFF;
+		switch(g_runstate){
+			case STATUS_CLOSE:
+				REDLED_OFF;
 				GREENLED_TOGGLE;
 				break;
-			case STATE_UNLOCK:
+			case STATUS_OPEN:
 				GREENLED_OFF;
-				//REDLED_TOGGLE;
-				break;
-			case STATE_INTERMEDIATE:
-				//REDGREEN_TOGGLE;
+				REDLED_TOGGLE;
 				break;
-			case STATE_OPENCOVER:
-				//REDLED_OFF;
-			  GREENLED_ON;
+			case STATUS_UNKNOW:
+				REDLED_OFF;
+				GREENLED_ON;
 				break;
-			case STATE_EXCEPTION:
 			default:
 				GREENLED_OFF;
-			  //REDLED_ON;
+				REDLED_ON;
 				break;
 		
 		};
 		
 	}
 	
-}
-
-
-void Process_ThreeStatus(void)
-{
-	if(g_detectTime >= STATUS_DETECTINTERVAL){
-		g_detectTime = 0;
-		
-		
-		if (GPIO_LEVEL_HIGH == GPIO_GetPinLevel(GPIO_CLOSE_KEY)){
-			lockbits=(lockbits<<1)|0x01;
-		}else{
-			lockbits=(lockbits<<1)|0x00;
-		}
-		
-		if (GPIO_LEVEL_HIGH == GPIO_GetPinLevel(GPIO_OPEN_KEY)){
-			unlockbits=(unlockbits<<1)|0x01;
-		}else{
-			unlockbits=(unlockbits<<1)|0x00;
-		}
-		
-		if (GPIO_LEVEL_HIGH == GPIO_GetPinLevel(GPIO_COVER_KEY)){
-			coverbits=(coverbits<<1)|0x01;
-		}else{
-			coverbits=(coverbits<<1)|0x00;
-		}
-		
-		if(g_lockstatus == STATUS_CLOSE && lockbits == 0xFF){
-				g_lockstatus = STATUS_OPEN;
-		}else if(g_lockstatus == STATUS_OPEN && lockbits == 0x00){
-				g_lockstatus = STATUS_CLOSE;
-		}
-		
-		if(g_unlockstatus == STATUS_CLOSE && unlockbits == 0xFF){
-				g_unlockstatus = STATUS_OPEN;
-		}else if(g_unlockstatus == STATUS_OPEN && unlockbits == 0x00){
-				g_unlockstatus = STATUS_CLOSE;
-		}
-		
-		if(g_coverstatus == STATUS_CLOSE && coverbits == 0xFF){
-				g_coverstatus = STATUS_OPEN;
-		}else if(g_coverstatus == STATUS_OPEN && coverbits == 0x00){
-				g_coverstatus = STATUS_CLOSE;
-		}
+	
+	
+	//压力传感器测量请求  
+	if(g_mr_Interval >= 50){
+		g_mr_Interval=0;
+		g_exception = PressureSensor_MR();
 		
 		update_state();
 		
+	}
 	
+	
+	
+	if(g_print_interval >= 1000){
+		g_print_interval=0;
+		PressureSensor_Print();
+		
+		printf("the NTC temperature: %f \r\n",getTemperature());
+		printf("the DIFF ADC1-ADC2: %d \r\n", getHalldiff());
 	}
 	
-
+	
+	
 }
 
-
-
-uint8_t Process_LockStatus(void)
+uint8_t Process_GetValveStatus(void)
 {
-	return g_lockstatus==STATUS_OPEN?0x00:0x01;
+	return g_state;
 }
 
-uint8_t Process_UnlockStatus(void)
+float Process_GetTemperature(void)
 {
-	return g_unlockstatus==STATUS_OPEN?0x00:0x01;
+	return getTemperature();
 }
 
-uint8_t Process_CoverStatus(void)
+float Process_GetPressure(void)
 {
-	return g_coverstatus==STATUS_OPEN?0x00:0x01;
+	float pressure = 0.0; 
+	float temperature = 0.0;
+	
+	//PressureSensor_Getvalue(&pressure);
+	PressureSensor_Getvalue2(&pressure, &temperature);
+	
+	return pressure;
+	
 }
 
+

+ 12 - 16
User/process.h

@@ -45,31 +45,27 @@ extern "C" {
 /*************<extern>*****************/	
 extern uint16_t		g_blinkLedTime;		/*LED闪烁频率控制时间*/
 extern uint16_t		g_blinkLedTgtTime;	/*LED目标闪烁频率*/
-extern uint8_t		g_detectTime;	
+extern uint8_t		g_mr_Interval;			/*  压力传感器更新周期  */
+extern uint16_t  	g_print_interval;   /* 打印周期 */
+
 
 #define BLINK_LED_MINT		(100)	/*闪烁LED灯最小时间间隔*/
 #define BLINK_LED_MAXT		(2000)	/*闪烁LED灯最大时间间隔*/
 #define BLINK_LED_DFTT		(500)	/*闪烁LED默认时间间隔*/
 
-#define STATUS_OPEN  (0x01)
-#define STATUS_CLOSE (0x00)
-
-#define STATE_LOCK     				  (0x00)  /*锁止状态*/
-#define STATE_UNLOCK   					(0x01)	/*开锁状态*/
-#define STATE_INTERMEDIATE      (0x02)	/*中间状态*/
-#define STATE_OPENCOVER         (0x03)	/*开盖状态*/
-#define STATE_EXCEPTION         (0x04)	/*异常状态*/
 
+#define STATUS_CLOSE 			(0x00)
+#define STATUS_OPEN  			(0x01)
+#define STATUS_UNKNOW 		(0x02)
+#define STATUS_EXCEPTION 	(0x03)
 
 void Process_Init(void);
-void Process_RunLedPrd(void); 
+void Process_RunPeriod(void); 
+uint8_t Process_GetValveStatus(void);
 
-void Process_ThreeStatus(void); 
-
-uint8_t Process_LockStatus(void); 
-uint8_t Process_UnlockStatus(void); 
-uint8_t Process_CoverStatus(void); 
-    
+float Process_GetTemperature(void);
+float Process_GetPressure(void);
+ 
 #ifdef __cplusplus
 }
 #endif

+ 92 - 7
User/protocol.c

@@ -2,12 +2,13 @@
 #include "process.h"
 #include "cfg.h"
 #include "uart.h"
+#include "adc.h"
 
 
 #ifdef IS_BOOTLOADER
-uint32_t Firmware_Version[4] = {1, 0, 0, 20240725};
+uint32_t Firmware_Version[4] = {1, 0, 0, 20240816};
 #else
-uint32_t Firmware_Version[4] = {1, 1, 1, 20240725};
+uint32_t Firmware_Version[4] = {1, 1, 1, 20240816};
 #endif
 
 
@@ -101,21 +102,88 @@ uint16_t Read_Baudrate(uint8_t *pBuf, uint16_t buf_len)
 }
 
 
-uint16_t Read_LockStatus(uint8_t *pBuf, uint16_t buf_len)
+uint16_t Read_Temperature(uint8_t *pBuf, uint16_t buf_len)
 {
+	float temp=0;
 
 	if( buf_len < 4){
 		return 0;
 	}
 	
-	pBuf[0] = Process_LockStatus();
-	pBuf[1] = Process_UnlockStatus();
-	pBuf[2] = Process_CoverStatus();
-	pBuf[3] = 0x00;
+	temp = Process_GetTemperature();
+	
+	pBuf[0] = ((uint8_t*)(&temp))[0];
+	pBuf[1] = ((uint8_t*)(&temp))[1];
+	pBuf[2] = ((uint8_t*)(&temp))[2];
+	pBuf[3] = ((uint8_t*)(&temp))[3];
+	
+	return 4;
+}
+
+uint16_t Read_Pressure(uint8_t *pBuf, uint16_t buf_len)
+{
+	float pressure=0;
+	if( buf_len < 4){
+		return 0;
+	}
+	
+	pressure = Process_GetPressure();
+	
+	pBuf[0] = ((uint8_t*)(&pressure))[0];
+	pBuf[1] = ((uint8_t*)(&pressure))[1];
+	pBuf[2] = ((uint8_t*)(&pressure))[2];
+	pBuf[3] = ((uint8_t*)(&pressure))[3];
+	
+	return 4;
+}
+
+uint16_t Read_Status(uint8_t *pBuf, uint16_t buf_len)
+{
+
+	if( buf_len < 2){
+		return 0;
+	}
+	
+
+	pBuf[0] = Process_GetValveStatus();
+	pBuf[1] = 0x00;
+	
+	return 2;
+}
+
+uint16_t Read_Raw(uint8_t *pBuf, uint16_t buf_len)
+{
+	uint16_t hall_1;
+	uint16_t hall_2;
+	
+	if( buf_len < 4){
+		return 0;
+	}
+	
+	getHallValue(&hall_1, &hall_2);
+	
+	pBuf[0] = (hall_1 >> 8)&0xff;
+	pBuf[1] = (hall_1 >> 0)&0xff;
+	
+	pBuf[2] = (hall_2 >> 8)&0xff;
+	pBuf[3] = (hall_2 >> 0)&0xff;
 	
 	return 4;
 }
 
+uint16_t Read_Threshold(uint8_t *pBuf, uint16_t buf_len)
+{
+
+	if( buf_len < 2){
+		return 0;
+	}
+	
+	pBuf[0] = (config->threshold >> 8)&0xff;
+	pBuf[1] = (config->threshold >> 0)&0xff;
+	
+	return 2;
+}
+
 
 /*=======================================================================================*/
 
@@ -186,4 +254,21 @@ uint8_t Write_Devicetype(uint8_t *pdata, uint8_t len)
 }
 
 
+uint8_t Write_Threshold(uint8_t *pdata, uint8_t len)
+{
+
+	if(len == 2){
+		config->valvecolse_base = getHalldiff();
+		config->threshold = ((uint16_t)pdata[0]<<8) | pdata[1]; 
+		
+		return RET_OK|RET_NEED_SAVE;
+		
+	}else{
+		return RET_DATAINVALID;
+	}
+}
+
+
+
+
 

+ 15 - 5
User/protocol.h

@@ -50,8 +50,14 @@ extern "C" {
 
 #define Cmd_Addr    					 (0x0010)
 #define Cmd_Baudrate    			 (0x0011)
-#define Cmd_LockStatus    		 (0x0020)
-//#define Cmd_FirmwareVersion    (0x0000)
+
+#define Cmd_ReadTemperature    	(0x0020)
+#define Cmd_ReadPressure    	  (0x0022)
+#define Cmd_ReadStatus    	    (0x0024)
+#define Cmd_ReadRaw    	  			(0x0025)
+
+#define Cmd_SetThreshold  			(0x0030)
+#define Cmd_ReadThreshold   	  (0x0031)
 
 #define Cmd_IapUpgrade    		 (0xAABB)
 
@@ -77,8 +83,11 @@ uint16_t Read_Devicetype(uint8_t *pBuf, uint16_t buf_len);
 uint16_t Read_Addr(uint8_t *pBuf, uint16_t buf_len);
 uint16_t Read_Baudrate(uint8_t *pBuf, uint16_t buf_len); 
 
-uint16_t Read_LockStatus(uint8_t *pBuf, uint16_t buf_len);
-
+uint16_t Read_Temperature(uint8_t *pBuf, uint16_t buf_len);
+uint16_t Read_Pressure(uint8_t *pBuf, uint16_t buf_len);
+uint16_t Read_Status(uint8_t *pBuf, uint16_t buf_len);
+uint16_t Read_Raw(uint8_t *pBuf, uint16_t buf_len);
+uint16_t Read_Threshold(uint8_t *pBuf, uint16_t buf_len);
 
 
 #define RET_ERROR_MASK     (0xF0)
@@ -97,7 +106,8 @@ uint8_t Write_Baudrate(uint8_t *pdata, uint8_t len);
 uint8_t Write_HardwareVersion(uint8_t *pdata, uint8_t len); 
 uint8_t Write_Deviceid(uint8_t *pdata, uint8_t len); 
 uint8_t Write_Devicetype(uint8_t *pdata, uint8_t len); 
-  
+
+uint8_t Write_Threshold(uint8_t *pdata, uint8_t len);
     
 #ifdef __cplusplus
 }