기본기능 완료

main
Imbis 6 months ago
parent 83df3d9269
commit 207273236d

@ -1,5 +1,6 @@
{
"files.associations": {
"driver_ds3231.h": "c"
"driver_ds3231.h": "c",
"board_config.h": "c"
}
}

File diff suppressed because one or more lines are too long

@ -152,18 +152,18 @@
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>132</LineNumber>
<LineNumber>403</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>3244</Address>
<Address>2750</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\Application\gpio_switch.c</Filename>
<Filename>.\Application\action_process.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\S_DustSensorView\Application/gpio_switch.c\132</Expression>
<Expression>\\S_DustSensorView\Application/action_process.c\403</Expression>
</Bp>
</Breakpoint>
<WatchWindow1>
@ -177,6 +177,16 @@
<WinNumber>1</WinNumber>
<ItemText>Gpio_Led_Ctrl_Info</ItemText>
</Ww>
<Ww>
<count>2</count>
<WinNumber>1</WinNumber>
<ItemText>KCD_HP100_Result</ItemText>
</Ww>
<Ww>
<count>3</count>
<WinNumber>1</WinNumber>
<ItemText>eeprom_info,0x0A</ItemText>
</Ww>
</WatchWindow1>
<Tracepoint>
<THDelay>0</THDelay>
@ -601,6 +611,18 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>32</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\Application\kcd_hp100.c</PathWithFileName>
<FilenameWithoutPath>kcd_hp100.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
@ -611,7 +633,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>32</FileNumber>
<FileNumber>33</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -623,7 +645,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>33</FileNumber>
<FileNumber>34</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -635,7 +657,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>34</FileNumber>
<FileNumber>35</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -647,7 +669,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>35</FileNumber>
<FileNumber>36</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -659,7 +681,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>36</FileNumber>
<FileNumber>37</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -671,7 +693,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>37</FileNumber>
<FileNumber>38</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -683,7 +705,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>38</FileNumber>
<FileNumber>39</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -695,7 +717,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>39</FileNumber>
<FileNumber>40</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -707,7 +729,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>40</FileNumber>
<FileNumber>41</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -719,7 +741,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>41</FileNumber>
<FileNumber>42</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -731,7 +753,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>42</FileNumber>
<FileNumber>43</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -743,7 +765,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>43</FileNumber>
<FileNumber>44</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -755,7 +777,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>44</FileNumber>
<FileNumber>45</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -767,7 +789,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>45</FileNumber>
<FileNumber>46</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -779,7 +801,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>46</FileNumber>
<FileNumber>47</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -791,7 +813,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>47</FileNumber>
<FileNumber>48</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -803,7 +825,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>48</FileNumber>
<FileNumber>49</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -815,7 +837,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>49</FileNumber>
<FileNumber>50</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -835,7 +857,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>50</FileNumber>
<FileNumber>51</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -855,7 +877,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>51</FileNumber>
<FileNumber>52</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -867,7 +889,7 @@
</File>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>52</FileNumber>
<FileNumber>53</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -879,7 +901,7 @@
</File>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>53</FileNumber>
<FileNumber>54</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -899,7 +921,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>54</FileNumber>
<FileNumber>55</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -919,7 +941,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>55</FileNumber>
<FileNumber>56</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -931,7 +953,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>56</FileNumber>
<FileNumber>57</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -943,7 +965,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>57</FileNumber>
<FileNumber>58</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -955,7 +977,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>58</FileNumber>
<FileNumber>59</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -967,7 +989,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>59</FileNumber>
<FileNumber>60</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -979,7 +1001,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>60</FileNumber>
<FileNumber>61</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>

@ -538,6 +538,11 @@
<FileType>1</FileType>
<FilePath>.\Application\usart11_rs485.c</FilePath>
</File>
<File>
<FileName>kcd_hp100.c</FileName>
<FileType>1</FileType>
<FilePath>.\Application\kcd_hp100.c</FilePath>
</File>
</Files>
</Group>
<Group>

@ -6,13 +6,14 @@
#include "eeprom.h"
#include "buzzer.h"
#include "segment.h"
#include "save_file.h"
#include "kcd_hp100.h"
#include "rtc_process.h"
#include "save_file.h"
#define KEY_POWER KEY_PUSH_SW1
#define KEY_MODE_SET KEY_PUSH_SW2
#define KEY_UP KEY_PUSH_SW3
@ -39,42 +40,54 @@ typedef enum _control_step
CONTROL_STEP_ACTION_RUN_SET_MAX_SENSOR_DATA,
CONTROL_STEP_ACTION_RUN_SET_MIN_SENSOR_DATA,
CONTROL_STEP_ACTION_RUN_COMPLETE,
}CONTROL_STEP;
typedef struct _control_info
{
bool isInitView;
bool isActionRun;
CONTROL_STEP Step;
uint32_t StartTickCount;
uint32_t Co2_Now;
uint32_t Co2_MaxValue;
uint32_t Co2_MinValue;
uint32_t GetSensorDataTickCount;
uint32_t returnMainViewTickCount;
uint16_t Co2_Now;
uint16_t Co2_MaxValue;
uint16_t Co2_MinValue;
uint16_t Co2_TempValue;
SET_INDEX SetIndex;
uint16_t Co2_TempMax;
uint16_t Co2_TempMin;
}CONTROL_INFO;
static CONTROL_INFO Control_Info;
uint8_t SaveCheckSec = 0xFF;
uint16_t SaveSensorIndex;
uint16_t SaveSensorCo2[100];
static CONTROL_INFO Control_Info;
static void Action_Process(void);
static void Action_PowerOn_Init_Process(void);
static void Action_PowerOn_Process(void);
static void Action_Get_SensorData(void);
static void Action_Get_SensorReadProcess(void);
static void Action_SaveSensorData(void);
static void Action_Power_On_Key_Set(void);
static void Action_Power_On_Key_Push_Callback(void);
static void Action_Power_Off_Key_Set(void);
@ -86,6 +99,8 @@ static void Action_Set_Key_Push(void);
static void Action_Up_Key_Push(void);
static void Action_Down_Key_Push(void);
static void Action_ReturnMainViewCheck(void);
#if 0
static void Action_PowerKey_Push(void);
@ -170,6 +185,7 @@ static void Action_PowerOn_Init_Process(void)
break;
case CONTROL_STEP_INIT_COMPLETE:
Control_Info.isInitView = true;
Control_Info.Step = CONTROL_STEP_ACTION_IDLE;
break;
}
}
@ -184,12 +200,19 @@ static void Action_PowerOn_Process(void)
Gpio_Led_OutputSet(GPIO_LED_D1, GPIO_LED_MODE_OFF, 0, 0);
Gpio_Led_OutputSet(GPIO_LED_D2, GPIO_LED_MODE_ON, 0, 0);
Gpio_Led_OutputSet(GPIO_LED_D3, GPIO_LED_MODE_OFF, 0, 0);
GPIO_SENSOR_PWR_ON;
SaveCheckSec = 0xFF;
Action_Get_SensorData();
if(EEPROM_Read_SettingValue(&Control_Info.Co2_MaxValue, &Control_Info.Co2_MinValue) == false)
{
Control_Info.Co2_MaxValue = DEFAULT_SENSOR_MAX_DATA;
Control_Info.Co2_MinValue = DEFAULT_SENSOR_MIN_DATA;
}
Control_Info.Co2_TempMax = 0;
Control_Info.Co2_TempMin = 0xFFFF;
printf("Data, Time, Average(Now)_Co2, Max_Co2, Min_Co2\r\n");
Control_Info.Step = CONTROL_STEP_ACTION_RUN_NOW_SENSOR_DATA;
break;
case CONTROL_STEP_ACTION_RUN_NOW_SENSOR_DATA:
@ -206,19 +229,30 @@ static void Action_PowerOn_Process(void)
break;
case CONTROL_STEP_ACTION_RUN_SET_MAX_SENSOR_DATA:
break;
case CONTROL_STEP_ACTION_RUN_SET_MIN_SENSOR_DATA:
Segment_Show_Time();
Segment_Show_SettingData(Control_Info.SetIndex, Control_Info.Co2_TempValue);
break;
case CONTROL_STEP_ACTION_RUN_COMPLETE:
Gpio_Led_OutputSet(GPIO_LED_LE1, GPIO_LED_MODE_TOGGLE, ACTION_LE1_IDLE_ON_TIME, ACTION_LE1_IDLE_OFF_TIME);
Gpio_Led_OutputSet(GPIO_LED_D1, GPIO_LED_MODE_OFF, 0, 0);
Gpio_Led_OutputSet(GPIO_LED_D2, GPIO_LED_MODE_OFF, 0, 0);
Gpio_Led_OutputSet(GPIO_LED_D3, GPIO_LED_MODE_OFF, 0, 0);
GPIO_SENSOR_PWR_OFF;
Action_Power_On_Key_Set();
Segment_All_Set_Data(0x00);
EEPROM_Write_SettingValue(Control_Info.Co2_MaxValue, Control_Info.Co2_MinValue);
Control_Info.Step = CONTROL_STEP_INIT;
Control_Info.Step = CONTROL_STEP_ACTION_IDLE;
Control_Info.isActionRun = false;
return;
break;
}
////////////////////////////////////////
Action_Get_SensorReadProcess();
Action_ReturnMainViewCheck();
}
static void Action_Power_On_Key_Set(void)
@ -239,16 +273,133 @@ static void Action_Power_On_Key_Push_Callback(void)
Buzzer_On(DEFAULT_KEY_PUSH_BUZZER_TIME_COUNT);
Control_Info.isActionRun = true;
Control_Info.Step = CONTROL_STEP_INIT;
dbg_printf("power on\r\n");
}
static void Action_Power_Off_Key_Push_Callback(void)
{
Buzzer_On(DEFAULT_KEY_PUSH_BUZZER_TIME_COUNT);
Control_Info.Step = CONTROL_STEP_ACTION_RUN_COMPLETE;
dbg_printf("power off\r\n");
}
static void Action_Get_SensorData(void)
{
Control_Info.GetSensorDataTickCount = millis();
KCD_HP100_Tx_Get_MeasurmentData();
}
static void Action_Get_SensorReadProcess(void)
{
KCD_HP100_STATE nowSensorState = KCD_HP100_GetState();
if(nowSensorState == KCD_HP100_SUCCESS)
{
KCD_HP100_Get_Co2((uint16_t *)&Control_Info.Co2_Now);
}
else if(nowSensorState == KCD_HP100_ERROR_TIMEOUT)
{
Control_Info.Co2_Now = 0xFFFF;
}
if(millis() - Control_Info.GetSensorDataTickCount >= ACTION_SENSOR_READ_INTERVAL)
{
if(nowSensorState == KCD_HP100_SUCCESS)
{
RTC_TIME nowTime;
nowTime = RTC_Get_Time();
if(Control_Info.Co2_TempMax < Control_Info.Co2_Now)
Control_Info.Co2_TempMax = Control_Info.Co2_Now;
if(Control_Info.Co2_TempMin > Control_Info.Co2_Now)
Control_Info.Co2_TempMin = Control_Info.Co2_Now;
printf("Now, %04d-%02d-%02d %02d:%02d:%02d, %d, %d, %d\r\n", nowTime.rtc_Year, nowTime.rtc_Month, nowTime.rtc_Date, nowTime.rtc_Hour, nowTime.rtc_Min, nowTime.rtc_Sec, Control_Info.Co2_Now, Control_Info.Co2_TempMax, Control_Info.Co2_TempMin);
}
Action_Get_SensorData();
}
Action_SaveSensorData();
}
static void Action_SaveSensorData(void)
{
RTC_TIME nowTime;
nowTime = RTC_Get_Time();
if(SaveCheckSec != nowTime.rtc_Sec)
{
SaveCheckSec = nowTime.rtc_Sec;
if(nowTime.rtc_Sec == 0)
{
if(Control_Info.Co2_Now != 0xFFFF){
SaveSensorCo2[SaveSensorIndex++] = Control_Info.Co2_Now;
}
if(nowTime.rtc_Min % 5 == 0)
{
if(SaveSensorIndex >= 5)
{
uint8_t i;
uint16_t Sum_Co2, Max_Co2, Min_Co2;
Max_Co2 = 0;
Min_Co2 = 0xFFFF;
Sum_Co2 = 0;
for(i = 0 ; i < SaveSensorIndex ; i++)
{
Sum_Co2 += SaveSensorCo2[i];
if(SaveSensorCo2[i] >= Max_Co2)
{
Max_Co2 = SaveSensorCo2[i];
}
if(SaveSensorCo2[i] <= Min_Co2)
{
Min_Co2 = SaveSensorCo2[i];
}
}
Sum_Co2 -= Max_Co2;
Sum_Co2 -= Min_Co2;
Sum_Co2 /= (SaveSensorIndex - 2);
printf("Save, %04d-%02d-%02d %02d:%02d:%02d, %d, %d, %d\r\n", nowTime.rtc_Year, nowTime.rtc_Month, nowTime.rtc_Date, nowTime.rtc_Hour, nowTime.rtc_Min, nowTime.rtc_Sec, Sum_Co2, Max_Co2, Min_Co2);
if(Save_SensorData_SDCard(Sum_Co2, Max_Co2, Min_Co2, 0xFF) == false)
{
}
}
SaveSensorIndex = 0;
}
}
}
}
static void Action_ReturnMainViewCheck(void)
{
if(Control_Info.Step != CONTROL_STEP_ACTION_RUN_NOW_SENSOR_DATA)
{
if(millis() - Control_Info.returnMainViewTickCount >= ACTION_RETURN_MAINVIEW_TIME)
{
Gpio_Led_OutputSet(GPIO_LED_D1, GPIO_LED_MODE_OFF, 0, 0);
Gpio_Led_OutputSet(GPIO_LED_D2, GPIO_LED_MODE_ON, 0, 0);
Gpio_Led_OutputSet(GPIO_LED_D3, GPIO_LED_MODE_OFF, 0, 0);
Control_Info.returnMainViewTickCount = millis();
Control_Info.Step = CONTROL_STEP_ACTION_RUN_NOW_SENSOR_DATA;
}
}
}
static void Action_Mode_Key_Push(void)
{
switch(Control_Info.Step)
@ -258,6 +409,7 @@ static void Action_Mode_Key_Push(void)
Gpio_Led_OutputSet(GPIO_LED_D1, GPIO_LED_MODE_ON, 0, 0);
Gpio_Led_OutputSet(GPIO_LED_D2, GPIO_LED_MODE_OFF, 0, 0);
Gpio_Led_OutputSet(GPIO_LED_D3, GPIO_LED_MODE_OFF, 0, 0);
Control_Info.returnMainViewTickCount = millis();
Control_Info.Step = CONTROL_STEP_ACTION_RUN_MAX_SENSOR_DATA;
break;
case CONTROL_STEP_ACTION_RUN_MAX_SENSOR_DATA:
@ -265,6 +417,7 @@ static void Action_Mode_Key_Push(void)
Gpio_Led_OutputSet(GPIO_LED_D1, GPIO_LED_MODE_OFF, 0, 0);
Gpio_Led_OutputSet(GPIO_LED_D2, GPIO_LED_MODE_OFF, 0, 0);
Gpio_Led_OutputSet(GPIO_LED_D3, GPIO_LED_MODE_ON, 0, 0);
Control_Info.returnMainViewTickCount = millis();
Control_Info.Step = CONTROL_STEP_ACTION_RUN_MIN_SENSOR_DATA;
break;
case CONTROL_STEP_ACTION_RUN_MIN_SENSOR_DATA:
@ -272,24 +425,157 @@ static void Action_Mode_Key_Push(void)
Gpio_Led_OutputSet(GPIO_LED_D1, GPIO_LED_MODE_OFF, 0, 0);
Gpio_Led_OutputSet(GPIO_LED_D2, GPIO_LED_MODE_ON, 0, 0);
Gpio_Led_OutputSet(GPIO_LED_D3, GPIO_LED_MODE_OFF, 0, 0);
Control_Info.returnMainViewTickCount = millis();
Control_Info.Step = CONTROL_STEP_ACTION_RUN_NOW_SENSOR_DATA;
break;
case CONTROL_STEP_ACTION_RUN_SET_MAX_SENSOR_DATA:
case CONTROL_STEP_ACTION_RUN_SET_MIN_SENSOR_DATA:
Buzzer_On(DEFAULT_KEY_PUSH_BUZZER_TIME_COUNT);
switch(Control_Info.SetIndex)
{
case SET_1000:
case SET_100:
case SET_10:
Control_Info.SetIndex++;
break;
case SET_1:
Control_Info.SetIndex = SET_1000;
break;
}
break;
}
}
static void Action_Set_Key_Push(void)
{
if(Control_Info.Step == CONTROL_STEP_ACTION_RUN_MAX_SENSOR_DATA){
Buzzer_On(DEFAULT_KEY_PUSH_BUZZER_TIME_COUNT);
Control_Info.Co2_TempValue = Control_Info.Co2_MaxValue;
Control_Info.SetIndex = SET_1000;
Control_Info.returnMainViewTickCount = millis();
Control_Info.Step = CONTROL_STEP_ACTION_RUN_SET_MAX_SENSOR_DATA;
}
else if(Control_Info.Step == CONTROL_STEP_ACTION_RUN_MIN_SENSOR_DATA){
Buzzer_On(DEFAULT_KEY_PUSH_BUZZER_TIME_COUNT);
Control_Info.Co2_TempValue = Control_Info.Co2_MinValue;
Control_Info.SetIndex = SET_1000;
Control_Info.returnMainViewTickCount = millis();
Control_Info.Step = CONTROL_STEP_ACTION_RUN_SET_MIN_SENSOR_DATA;
}
else if(Control_Info.Step == CONTROL_STEP_ACTION_RUN_SET_MAX_SENSOR_DATA){
Buzzer_On(DEFAULT_KEY_PUSH_BUZZER_TIME_COUNT);
Control_Info.Co2_MaxValue = Control_Info.Co2_TempValue;
Control_Info.returnMainViewTickCount = millis();
Control_Info.Step = CONTROL_STEP_ACTION_RUN_MAX_SENSOR_DATA;
EEPROM_Write_SettingValue(Control_Info.Co2_MaxValue, Control_Info.Co2_MinValue);
}
else if(Control_Info.Step == CONTROL_STEP_ACTION_RUN_SET_MIN_SENSOR_DATA){
Buzzer_On(DEFAULT_KEY_PUSH_BUZZER_TIME_COUNT);
Control_Info.Co2_MinValue = Control_Info.Co2_TempValue;
Control_Info.returnMainViewTickCount = millis();
Control_Info.Step = CONTROL_STEP_ACTION_RUN_MIN_SENSOR_DATA;
EEPROM_Write_SettingValue(Control_Info.Co2_MaxValue, Control_Info.Co2_MinValue);
}
}
static void Action_Up_Key_Push(void)
{
if(Control_Info.Step == CONTROL_STEP_ACTION_RUN_SET_MAX_SENSOR_DATA || Control_Info.Step == CONTROL_STEP_ACTION_RUN_SET_MIN_SENSOR_DATA)
{
uint16_t temp;
Buzzer_On(DEFAULT_KEY_PUSH_BUZZER_TIME_COUNT);
Control_Info.returnMainViewTickCount = millis();
switch(Control_Info.SetIndex)
{
case SET_1000:
Control_Info.Co2_TempValue += 1000;
if(Control_Info.Co2_TempValue >= 10000){
Control_Info.Co2_TempValue -= 10000;
}
break;
case SET_100:
temp = Control_Info.Co2_TempValue / 100;
temp = temp % 10;
if(temp == 9){
Control_Info.Co2_TempValue -= 900;
}
else{
Control_Info.Co2_TempValue += 100;
}
break;
case SET_10:
temp = Control_Info.Co2_TempValue / 10;
temp = temp % 10;
if(temp == 9){
Control_Info.Co2_TempValue -= 90;
}
else{
Control_Info.Co2_TempValue += 10;
}
break;
case SET_1:
temp = Control_Info.Co2_TempValue % 10;
if(temp == 9){
Control_Info.Co2_TempValue -= 9;
}
else{
Control_Info.Co2_TempValue++;
}
break;
}
}
}
static void Action_Down_Key_Push(void)
{
if(Control_Info.Step == CONTROL_STEP_ACTION_RUN_SET_MAX_SENSOR_DATA || Control_Info.Step == CONTROL_STEP_ACTION_RUN_SET_MIN_SENSOR_DATA)
{
uint16_t temp;
Buzzer_On(DEFAULT_KEY_PUSH_BUZZER_TIME_COUNT);
Control_Info.returnMainViewTickCount = millis();
switch(Control_Info.SetIndex)
{
case SET_1000:
temp = Control_Info.Co2_TempValue / 1000;
if(temp == 0){
Control_Info.Co2_TempValue += 9000;
}
else{
Control_Info.Co2_TempValue -= 1000;
}
break;
case SET_100:
temp = Control_Info.Co2_TempValue / 100;
temp = temp % 10;
if(temp == 0){
Control_Info.Co2_TempValue += 900;
}
else{
Control_Info.Co2_TempValue -= 100;
}
break;
case SET_10:
temp = Control_Info.Co2_TempValue / 10;
temp = temp % 10;
if(temp == 0){
Control_Info.Co2_TempValue += 90;
}
else{
Control_Info.Co2_TempValue -= 10;
}
break;
case SET_1:
temp = Control_Info.Co2_TempValue % 10;
if(temp == 0){
Control_Info.Co2_TempValue += 9;
}
else{
Control_Info.Co2_TempValue--;
}
break;
}
}
}

@ -5,6 +5,14 @@
#include "define.h"
#include "board_config.h"
typedef enum
{
SET_1000,
SET_100,
SET_10,
SET_1,
}SET_INDEX;

@ -70,7 +70,9 @@
#define ACTION_LE1_RUN_ON_TIME 500
#define ACTION_LE1_RUN_OFF_TIME 1500
#define ACTION_SENSOR_READ_INTERVAL 5000
#define ACTION_RETURN_MAINVIEW_TIME 10000
@ -93,6 +95,8 @@
#define DEFAULT_KEY_PUSH_BUZZER_TIME_COUNT 80
#define SEGMENT_TOGGLE_TIME 250
#if 0

@ -3,7 +3,7 @@
#pragma pack(push, 1)
typedef union _eeprom_info
{
struct
@ -16,7 +16,7 @@ typedef union _eeprom_info
}eeprom_data;
uint8_t eeprom_buffer[SECTOR_SIZE_BYTE];
}EEPROM_INFO;
#pragma pack(pop)
static EEPROM_INFO eeprom_info;

@ -0,0 +1,177 @@
#include "kcd_hp100.h"
#include "sw_timer.h"
#include "usart11_rs485.h"
#define STX 0x03
#define ETX 0x04
#define DEFAULT_DEVICE_ID 31
#define MEASUREMENT_DATA_SIZE 26
#define PACKET_RX_TIMEOUT 300
typedef enum
{
PACK_INDEX_STX = 0,
PACK_INDEX_SLAVE_ID = 1,
PACK_INDEX_SIZE = 2,
PACK_INDEX_CHECKSUM = 24,
PACK_INDEX_ETX = 25,
}PACKET_INDEX;
typedef enum
{
CMD_GET_MEASUREMENT_RESULT = 0x0A,
CMD_SET_DEVICE_ID = 0x3A,
CMD_SET_OUTPUT = 0x3B,
CMD_SET_BAUDRATE = 0x3C,
}KCD_HP100_CMD;
#pragma pack(push, 1)
typedef union _kcd_hp100_rx_info
{
struct
{
uint8_t Stx;
uint8_t Slave_ID;
uint8_t PacketSize;
uint8_t Command;
uint8_t System_Classification_Code;
uint8_t System_Name[10];
uint16_t Co2;
uint16_t Temperature;
uint16_t Humidity;
uint16_t VOC;
uint8_t Firmware_Version;
uint8_t CheckSum;
uint8_t Etx;
}Measurement;
uint8_t Rxbuff[26];
}KCD_HP100_RX_INFO;
#pragma pack(pop)
static uint8_t KCD_HP100_DeviceID;
static uint8_t KCD_HP100_TxCommand;
static uint8_t KCD_HP100_RxIndex;
static uint8_t KCD_HP100_CheckSum;
static uint32_t KCD_HP100_TimeoutCount;
static KCD_HP100_STATE KCD_HP100_State;
static KCD_HP100_RX_INFO KCD_HP100_Result;
static uint8_t KCD_HP_Calc_Checksum(uint8_t* pChecksumData, uint8_t DataSize);
static void KCD_HP_Rx_PacketRecv_Process(void);
void KCD_HP100_Initialization(void)
{
KCD_HP100_DeviceID = DEFAULT_DEVICE_ID;
KCD_HP100_State = KCD_HP100_IDLE;
SW_Timer_Callback_Register(SW_TIMER_RUN_CONTINUE, 0, KCD_HP_Rx_PacketRecv_Process);
}
void KCD_HP100_Tx_Get_MeasurmentData(void)
{
uint8_t TxIndex = 0;
uint8_t TxBuff[10];
uint8_t CheckSum;
KCD_HP100_State = KCD_HP100_TRANSMIT;
KCD_HP100_TimeoutCount = millis();
KCD_HP100_TxCommand = CMD_GET_MEASUREMENT_RESULT;
KCD_HP100_RxIndex = 0;
TxBuff[TxIndex++] = STX;
TxBuff[TxIndex++] = KCD_HP100_DeviceID;
TxBuff[TxIndex++] = 0x06;
TxBuff[TxIndex++] = KCD_HP100_TxCommand;
CheckSum = KCD_HP_Calc_Checksum(TxBuff, TxIndex);
TxBuff[TxIndex++] = CheckSum;
TxBuff[TxIndex++] = ETX;
Usart11_TransmitData(TxBuff, TxIndex);
}
KCD_HP100_STATE KCD_HP100_GetState(void)
{
return KCD_HP100_State;
}
bool KCD_HP100_Get_Co2(uint16_t* pGetCo2)
{
if(KCD_HP100_State != KCD_HP100_SUCCESS)
return false;
*pGetCo2 = KCD_HP100_Result.Measurement.Co2;
return true;
}
static uint8_t KCD_HP_Calc_Checksum(uint8_t* pChecksumData, uint8_t DataSize)
{
uint8_t i;
uint8_t checksum = 0;
for(i = 0 ; i < DataSize ; i++)
{
checksum += pChecksumData[i];
}
return checksum;
}
static void KCD_HP_Rx_PacketRecv_Process(void)
{
if(Usart11_Get_RecvDataCount() != 0)
{
uint8_t rxData = Usart11_Get_RecvData();
if(KCD_HP100_RxIndex == PACK_INDEX_STX && rxData == STX){
KCD_HP100_Result.Rxbuff[KCD_HP100_RxIndex++] = rxData;
KCD_HP100_CheckSum = rxData;
}
else if(KCD_HP100_RxIndex == PACK_INDEX_SLAVE_ID && rxData == KCD_HP100_DeviceID){
KCD_HP100_Result.Rxbuff[KCD_HP100_RxIndex++] = rxData;
KCD_HP100_CheckSum += rxData;
}
else if(KCD_HP100_RxIndex == PACK_INDEX_SIZE && rxData == MEASUREMENT_DATA_SIZE){
KCD_HP100_Result.Rxbuff[KCD_HP100_RxIndex++] = rxData;
KCD_HP100_CheckSum += rxData;
}
else if(KCD_HP100_RxIndex < PACK_INDEX_CHECKSUM){
KCD_HP100_Result.Rxbuff[KCD_HP100_RxIndex++] = rxData;
KCD_HP100_CheckSum += rxData;
}
else if(KCD_HP100_RxIndex == PACK_INDEX_CHECKSUM && rxData == KCD_HP100_CheckSum){
KCD_HP100_Result.Rxbuff[KCD_HP100_RxIndex++] = rxData;
}
else if(KCD_HP100_RxIndex == PACK_INDEX_ETX && rxData == ETX){
KCD_HP100_Result.Rxbuff[KCD_HP100_RxIndex++] = rxData;
KCD_HP100_RxIndex = 0;
//dbg_printf("co2 = %d\r\n", KCD_HP100_Result.Measurement.Co2);
KCD_HP100_State = KCD_HP100_SUCCESS;
}
else
{
KCD_HP100_RxIndex = 0;
}
}
if(KCD_HP100_State == KCD_HP100_TRANSMIT)
{
if((millis() - KCD_HP100_TimeoutCount) >= PACKET_RX_TIMEOUT)
{
KCD_HP100_State = KCD_HP100_ERROR_TIMEOUT;
}
}
}

@ -0,0 +1,24 @@
/** \file kcd_hp100.h */
#if !defined(KCD_HP100_H__623A6ED1_F4A3_4BF2_99DE_65E7E10882F3__INCLUDED_)
#define KCD_HP100_H__623A6ED1_F4A3_4BF2_99DE_65E7E10882F3__INCLUDED_
#include "define.h"
#include "board_config.h"
typedef enum
{
KCD_HP100_IDLE,
KCD_HP100_SUCCESS,
KCD_HP100_TRANSMIT,
KCD_HP100_ERROR_TIMEOUT,
}KCD_HP100_STATE;
void KCD_HP100_Initialization(void);
void KCD_HP100_Tx_Get_MeasurmentData(void);
KCD_HP100_STATE KCD_HP100_GetState(void);
bool KCD_HP100_Get_Co2(uint16_t* pGetCo2);
#endif

@ -2,6 +2,7 @@
#include "sw_timer.h"
#include "gpio_state_led.h"
#include "gpio_switch.h"
#include "gpio_sensor.h"
#include "uart1.h"
#include "usart11_rs485.h"
#include "spi10.h"
@ -17,30 +18,11 @@
#include "eeprom.h"
#include "buzzer.h"
#include "uart_packet.h"
#include "kcd_hp100.h"
void timer_test(void)
{
static bool istoggle = true;
uint8_t i;
uint8_t TxBuff[10];
for(i = 0 ; i < 10 ; i++)
TxBuff[i] = i;
Usart11_TransmitData(TxBuff, 10);
#if 0
if(istoggle == true)
{
istoggle = false;
I2C2_SCL_HIGH;
}
else
{
istoggle = true;
I2C2_SCL_LOW;
}
#endif
}
@ -62,7 +44,7 @@ int main(void)
Buzzer_Initialization();
Gpio_Sensor_PWR_Initialization();
Gpio_Switch_Port_Initialization();
Gpio_StateLed_Initialization();
@ -71,13 +53,15 @@ int main(void)
SPI13_Initialization(1000000, SPI13_MODE0, false);
Segment_Initialization();
KCD_HP100_Initialization();
Action_Initialization();
__enable_irq();
SW_Timer_Callback_Register(SW_TIMER_RUN_CONTINUE, 250, timer_test);
//SW_Timer_Callback_Register(SW_TIMER_RUN_CONTINUE, 1000, timer_test);
while(true)
@ -96,7 +80,7 @@ int main(void)
Gpio_Sensor_PWR_Initialization();
GPIO_I2C0_Initialization();
GPIO_I2C1_Initialization();

@ -13,6 +13,7 @@ void RTC_Process_Initialization(void)
{
ds3231_basic_init();
SW_Timer_Callback_Register(SW_TIMER_RUN_CONTINUE, 1000, RTC_Get_IC_Time_Process);
RTC_Get_IC_Time_Process();
}
@ -31,7 +32,7 @@ static void RTC_Get_IC_Time_Process(void)
rtc_Time.rtc_Min = t.minute;
rtc_Time.rtc_Sec = t.second;
dbg_printf("Read RTC : %04d-%02d-%02d %02d:%02d:%02d\r\n", rtc_Time.rtc_Year, rtc_Time.rtc_Month, rtc_Time.rtc_Date, rtc_Time.rtc_Hour, rtc_Time.rtc_Min, rtc_Time.rtc_Sec);
//dbg_printf("Read RTC : %04d-%02d-%02d %02d:%02d:%02d\r\n", rtc_Time.rtc_Year, rtc_Time.rtc_Month, rtc_Time.rtc_Date, rtc_Time.rtc_Hour, rtc_Time.rtc_Min, rtc_Time.rtc_Sec);
}

@ -27,6 +27,7 @@ static uint32_t SaveFileTickCount;
static uint8_t SaveMin;
static FATFS FatFs; //Fatfs handle
static FIL fil; //File handle
static DIR dir;
static FRESULT fres; //Result after operations
uint8_t FileBuffer[512];
@ -38,13 +39,10 @@ static bool isGuidePrint;
static bool isPowerOn;
bool Save_SensorData_SDCard(void)
bool Save_SensorData_SDCard(uint16_t AverageCo2, uint16_t MaxCo2, uint16_t MinCo2, uint8_t State)
{
#if 0
RTC_TIME rtc_time;
SENSOR_SAVE_DATA SaveSensorData;
uint32_t writeByte;
rtc_time = RTC_Get_Time();
MX_FATFS_Init();
fres = f_mount(&FatFs, "", 1); //1=mount now
@ -57,15 +55,31 @@ bool Save_SensorData_SDCard(void)
if(fres != FR_OK)
{
//dbg_printf("sdcard mount errorr\r\n");
return false;
}
rtc_time = RTC_Get_Time();
sprintf((char *)FileBuffer, "%04d%02d%02d", rtc_time.rtc_Year, rtc_time.rtc_Month, rtc_time.rtc_Date);
//dbg_printf("open dir = %s\r\n", FileBuffer);
fres = f_opendir(&dir, FileBuffer);
if(fres != FR_OK)
{
fres = f_mkdir(FileBuffer);
if(fres != FR_OK)
{
//dbg_printf("create directory error\r\n");
return false;
}
}
sprintf((char *)FileBuffer, "%d_%d_%d.csv", rtc_time.rtc_Year, rtc_time.rtc_Month, rtc_time.rtc_Date);
sprintf((char *)FileBuffer, "/%04d%02d%02d/%02d.csv", rtc_time.rtc_Year, rtc_time.rtc_Month, rtc_time.rtc_Date, rtc_time.rtc_Hour);
if(f_open(&fil, FileBuffer, FA_WRITE | FA_READ) != FR_OK)
{
//dbg_printf("file open error, retry\r\n");
if (f_open(&fil, FileBuffer, FA_CREATE_ALWAYS | FA_WRITE) != FR_OK)
{
//dbg_printf("file open error\r\n");
f_closedir(&dir);
return false;
}
else
@ -78,110 +92,39 @@ bool Save_SensorData_SDCard(void)
isGuidePrint = false;
}
fres = f_lseek(&fil, f_size(&fil));
if(fres != FR_OK)
{
f_closedir(&dir);
f_close(&fil);
return false;
}
if(isGuidePrint == true)
{
sprintf((char *)FileBuffer, "Time,In_PM10.0,In_PM4.0,In_PM2.5,In_PM1.0,In_Humidity,In_Temp,In_Voc,Out_PM10.0,Out_PM4.0,Out_PM2.5,Out_PM1.0,Out_Humidity,Out_Temp,Out_Voc\r\n");
sprintf((char *)FileBuffer, "Time,Average_Co2,Max_Co2,Min_Co2,State\r\n");
fres = f_write(&fil, FileBuffer, strlen(FileBuffer), &writeByte);
if(fres != FR_OK)
{
f_closedir(&dir);
f_close(&fil);
return false;
}
}
while(Sensor_RingBuffer_Get_DataSize(&Sensor_RingBuffer_Info) != 0)
{
if(Sensor_RingBuffer_Dequeue(&Sensor_RingBuffer_Info, &SaveSensorData) == true)
{
sprintf((char *)FileBuffer, "%d:%d:%d,", SaveSensorData.rtc_time.rtc_Hour, SaveSensorData.rtc_time.rtc_Min, SaveSensorData.rtc_time.rtc_Sec);
fres = f_write(&fil, FileBuffer, strlen(FileBuffer), &writeByte);
if(fres != FR_OK)
{
f_close(&fil);
return false;
}
if(SaveSensorData.dust_sensor_In_info.isSensorMount == true)
{
sprintf((char *)FileBuffer, "%d,%d,%d,%d,%d,%d,%d,", SaveSensorData.dust_sensor_In_info.Dust_PM10p0,
SaveSensorData.dust_sensor_In_info.Dust_PM4p0,
SaveSensorData.dust_sensor_In_info.Dust_PM2p5,
SaveSensorData.dust_sensor_In_info.Dust_PM1p0,
SaveSensorData.dust_sensor_In_info.Dust_Humidity,
SaveSensorData.dust_sensor_In_info.Dust_Temperature,
SaveSensorData.dust_sensor_In_info.Dust_VOC_Index);
sprintf((char *)FileBuffer, "%d:%d,%d,%d,%d,%d\r\n", rtc_time.rtc_Hour, rtc_time.rtc_Min, AverageCo2, MaxCo2, MinCo2, State);
fres = f_write(&fil, FileBuffer, strlen(FileBuffer), &writeByte);
if(fres != FR_OK)
{
f_closedir(&dir);
f_close(&fil);
return false;
}
#if 0
printf("In,
#endif
}
else
{
sprintf((char *)FileBuffer, "-,-,-,-,-,-,-,");
fres = f_write(&fil, FileBuffer, strlen(FileBuffer), &writeByte);
if(fres != FR_OK)
{
f_close(&fil);
return false;
}
}
f_closedir(&dir);
if(SaveSensorData.dust_sensor_Out_info.isSensorMount == true)
{
sprintf((char *)FileBuffer, "%d,%d,%d,%d,%d,%d,%d\r\n", SaveSensorData.dust_sensor_Out_info.Dust_PM10p0,
SaveSensorData.dust_sensor_Out_info.Dust_PM4p0,
SaveSensorData.dust_sensor_Out_info.Dust_PM2p5,
SaveSensorData.dust_sensor_Out_info.Dust_PM1p0,
SaveSensorData.dust_sensor_Out_info.Dust_Humidity,
SaveSensorData.dust_sensor_Out_info.Dust_Temperature,
SaveSensorData.dust_sensor_Out_info.Dust_VOC_Index);
fres = f_write(&fil, FileBuffer, strlen(FileBuffer), &writeByte);
if(fres != FR_OK)
{
f_close(&fil);
return false;
}
}
else
{
sprintf((char *)FileBuffer, "-,-,-,-,-,-,-\r\n");
fres = f_write(&fil, FileBuffer, strlen(FileBuffer), &writeByte);
if(fres != FR_OK)
{
f_close(&fil);
return false;
}
}
}
}
f_close(&fil);
#endif
return true;
}

@ -5,6 +5,6 @@
#include "define.h"
#include "board_config.h"
bool Save_SensorData_SDCard(void);
bool Save_SensorData_SDCard(uint16_t AverageCo2, uint16_t MaxCo2, uint16_t MinCo2, uint8_t State);
#endif

@ -45,22 +45,8 @@ const uint8_t SegmentData[SEG_INDEX_MAX] =
};
uint8_t Segment_OutputBuff[SEGMENT_SELECT_MAX_INDEX][SEGMENT_MAX_DATA_INDEX];
void Segment_Sensor_Error(void)
{
@ -68,7 +54,6 @@ void Segment_Sensor_Error(void)
Segment_OutputBuff[SEGMENT_100][SEGMENT_F2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_10][SEGMENT_F2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_1][SEGMENT_F2] = SegmentData[SEG_MINUS];
}
@ -146,6 +131,15 @@ void Segment_Show_Time(void)
void Segment_Show_SensorData(uint32_t SensorData)
{
if(SensorData == 0xFFFF)
{
Segment_OutputBuff[SEGMENT_1000][SEGMENT_F2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_100][SEGMENT_F2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_10][SEGMENT_F2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_1][SEGMENT_F2] = SegmentData[SEG_MINUS];
return;
}
if(SensorData >= 9999)
{
Segment_OutputBuff[SEGMENT_1000][SEGMENT_F2] = SegmentData[SEG_9];
@ -184,542 +178,52 @@ void Segment_Show_SensorData(uint32_t SensorData)
}
#if 0
void Segment_In_Set_PM_1p0(uint32_t OutputData)
{
Segment_Toggle_In = false;
if(OutputData >= 9999)
{
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_1] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_1] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_2] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_2] = SegmentData[SEG_9];
}
else if(OutputData >= 1000)
{
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_1] = SegmentData[OutputData/1000];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_1] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_2] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 100)
{
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_1] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_2] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 10)
{
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_2] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
else
{
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_2] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
}
void Segment_In_Set_PM_2p5(uint32_t OutputData)
{
if(OutputData >= 9999)
{
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_1] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_1] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_2] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_2] = SegmentData[SEG_9];
}
else if(OutputData >= 1000)
{
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_1] = SegmentData[OutputData/1000];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_1] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_2] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 100)
{
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_1] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_2] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 10)
{
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_2] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
else
{
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_2] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
}
void Segment_In_Set_PM_4p0(uint32_t OutputData)
{
Segment_Toggle_In = true;
if(OutputData >= 9999)
{
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_1] = SegmentData[SEG_9];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_1] = SegmentData[SEG_9];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_2] = SegmentData[SEG_9];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_2] = SegmentData[SEG_9];
}
else if(OutputData >= 1000)
{
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_1] = SegmentData[OutputData/1000];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_1] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_2] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 100)
{
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_1] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_2] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 10)
{
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_2] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
else
{
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_2] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
}
void Segment_In_Set_PM_10(uint32_t OutputData)
void Segment_Show_SettingData(SET_INDEX index, uint16_t SensorSetData)
{
uint32_t segment_toggle = millis() % (SEGMENT_TOGGLE_TIME *2);;
if(OutputData >= 9999)
{
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_1] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_1] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_2] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_2] = SegmentData[SEG_9];
}
else if(OutputData >= 1000)
{
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_1] = SegmentData[OutputData/1000];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_1] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_2] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 100)
{
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_1] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_2] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 10)
{
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_2] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
else
{
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_2] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_2] = SegmentData[(OutputData%10)];
}
}
uint8_t temp_1000 = SensorSetData / 1000;
uint8_t temp_100 = (SensorSetData / 100) % 10;
uint8_t temp_10 = (SensorSetData / 10) % 10;
uint8_t temp_1 = SensorSetData % 10;
void Segment_In_Set_Humidity(uint32_t OutputData)
if(segment_toggle >= SEGMENT_TOGGLE_TIME)
{
if(OutputData >= 99)
switch (index)
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_1] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_1] = SegmentData[SEG_9];
}
else if(OutputData <= 9)
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_1] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_1] = SegmentData[OutputData%10];
}
else
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_1] = SegmentData[OutputData / 10];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_1] = SegmentData[OutputData % 10];
}
}
void Segment_In_Set_Temperature(int32_t OutputData)
{
if(OutputData >= 99)
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_2] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_2] = SegmentData[SEG_9];
}
else if(OutputData <= -10)
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_2] = SegmentData[SEG_9];
}
else if(OutputData >= -9 && OutputData <= -1)
{
int32_t temp = OutputData * -1;
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_2] = SegmentData[temp%10];
}
else if(OutputData <= 9 && OutputData >= 0)
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_2] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_2] = SegmentData[OutputData%10];
}
else
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_2] = SegmentData[OutputData / 10];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_2] = SegmentData[OutputData % 10];
}
}
void Segment_Out_Set_PM_1p0(uint32_t OutputData)
{
Segment_Toggle_Out = false;
if(OutputData >= 9999)
{
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_3] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_3] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_4] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_4] = SegmentData[SEG_9];
}
else if(OutputData >= 1000)
{
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_3] = SegmentData[OutputData/1000];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_3] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_4] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 100)
{
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_3] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_4] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 10)
{
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_4] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
else
{
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_4] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
}
void Segment_Out_Set_PM_2p5(uint32_t OutputData)
{
if(OutputData >= 9999)
{
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_3] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_3] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_4] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_4] = SegmentData[SEG_9];
}
else if(OutputData >= 1000)
{
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_3] = SegmentData[OutputData/1000];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_3] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_4] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 100)
{
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_3] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_4] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 10)
{
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_4] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
else
{
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_4] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
}
void Segment_Out_Set_PM_4p0(uint32_t OutputData)
{
Segment_Toggle_Out = true;
if(OutputData >= 9999)
{
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_3] = SegmentData[SEG_9];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_3] = SegmentData[SEG_9];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_4] = SegmentData[SEG_9];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_4] = SegmentData[SEG_9];
}
else if(OutputData >= 1000)
{
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_3] = SegmentData[OutputData/1000];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_3] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_4] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 100)
{
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_3] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_4] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 10)
{
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_4] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
else
{
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_1][SEGMENT_DATA_4] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[DUST_SENSOR_PM40_SELECT_2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
}
void Segment_Out_Set_PM_10(uint32_t OutputData)
{
if(OutputData >= 9999)
{
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_3] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_3] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_4] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_4] = SegmentData[SEG_9];
}
else if(OutputData >= 1000)
{
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_3] = SegmentData[OutputData/1000];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_3] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_4] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 100)
{
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_3] = SegmentData[(OutputData%1000)/100];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_4] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
else if(OutputData >= 10)
{
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_4] = SegmentData[(OutputData%100)/10];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
else
{
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_4] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_4] = SegmentData[(OutputData%10)];
}
}
void Segment_Out_Set_Humidity(uint32_t OutputData)
{
if(OutputData >= 99)
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_3] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_3] = SegmentData[SEG_9];
}
else if(OutputData <= 9)
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_3] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_3] = SegmentData[OutputData%10];
}
else
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_3] = SegmentData[OutputData / 10];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_3] = SegmentData[OutputData % 10];
}
}
void Segment_Out_Set_Temperature(int32_t OutputData)
{
if(OutputData >= 99)
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_4] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_4] = SegmentData[SEG_9];
}
else if(OutputData <= -10)
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_4] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_4] = SegmentData[SEG_9];
}
else if(OutputData >= -9 && OutputData <= -1)
{
int32_t temp = OutputData * -1;
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_4] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_4] = SegmentData[temp%10];
case SET_1000:
Segment_OutputBuff[SEGMENT_1000][SEGMENT_F2] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_100][SEGMENT_F2] = SegmentData[temp_100];
Segment_OutputBuff[SEGMENT_10][SEGMENT_F2] = SegmentData[temp_10];
Segment_OutputBuff[SEGMENT_1][SEGMENT_F2] = SegmentData[temp_1];
break;
case SET_100:
Segment_OutputBuff[SEGMENT_1000][SEGMENT_F2] = SegmentData[temp_1000];
Segment_OutputBuff[SEGMENT_100][SEGMENT_F2] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_10][SEGMENT_F2] = SegmentData[temp_10];
Segment_OutputBuff[SEGMENT_1][SEGMENT_F2] = SegmentData[temp_1];
break;
case SET_10:
Segment_OutputBuff[SEGMENT_1000][SEGMENT_F2] = SegmentData[temp_1000];
Segment_OutputBuff[SEGMENT_100][SEGMENT_F2] = SegmentData[temp_100];
Segment_OutputBuff[SEGMENT_10][SEGMENT_F2] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_1][SEGMENT_F2] = SegmentData[temp_1];
break;
case SET_1:
Segment_OutputBuff[SEGMENT_1000][SEGMENT_F2] = SegmentData[temp_1000];
Segment_OutputBuff[SEGMENT_100][SEGMENT_F2] = SegmentData[temp_100];
Segment_OutputBuff[SEGMENT_10][SEGMENT_F2] = SegmentData[temp_10];
Segment_OutputBuff[SEGMENT_1][SEGMENT_F2] = SegmentData[SEG_CLEAR];
break;
}
else if(OutputData <= 9 && OutputData >= 0)
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_4] = SegmentData[SEG_CLEAR];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_4] = SegmentData[OutputData%10];
}
else
{
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_4] = SegmentData[OutputData / 10];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_4] = SegmentData[OutputData % 10];
}
}
void Segment_All_Set_Data(uint8_t SegmentData)
{
uint8_t i;
for(i = SEGMENT_F1C1 ; i < SEGMENT_SELECT_MAX_INDEX ; i++)
{
Segment_OutputBuff[i][SEGMENT_DATA_1] = SegmentData;
Segment_OutputBuff[i][SEGMENT_DATA_2] = SegmentData;
Segment_OutputBuff[i][SEGMENT_DATA_3] = SegmentData;
Segment_OutputBuff[i][SEGMENT_DATA_4] = SegmentData;
}
}
void Segment_Show_Version(void)
{
uint8_t i;
uint16_t temp;
for(i = SEGMENT_F1C1 ; i < SEGMENT_SELECT_MAX_INDEX ; i++)
{
Segment_OutputBuff[i][SEGMENT_DATA_1] = 0x00;
Segment_OutputBuff[i][SEGMENT_DATA_2] = 0x00;
Segment_OutputBuff[i][SEGMENT_DATA_3] = 0x00;
Segment_OutputBuff[i][SEGMENT_DATA_4] = 0x00;
}
//Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_1] = SegmentData[SEG_9];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_1] = SegmentData[SEG_V];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_2] = SegmentData[SEG_E];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_2] = SegmentData[SEG_R];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_3] = SegmentData[VERSION_MAJOR] | 0x80;
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_3] = SegmentData[VERSION_MINOR] | 0x80;
temp = VERSION_PATCH;
if(temp >= 99)
{
temp = 99;
}
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_4] = SegmentData[temp/10];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_4] = SegmentData[temp%10];
}
void Segment_Show_Mode(uint8_t Mode)
{
uint8_t i;
uint16_t temp;
for(i = SEGMENT_F1C1 ; i < SEGMENT_SELECT_MAX_INDEX ; i++)
{
Segment_OutputBuff[i][SEGMENT_DATA_1] = 0x00;
Segment_OutputBuff[i][SEGMENT_DATA_2] = 0x00;
Segment_OutputBuff[i][SEGMENT_DATA_3] = 0x00;
Segment_OutputBuff[i][SEGMENT_DATA_4] = 0x00;
Segment_OutputBuff[SEGMENT_1000][SEGMENT_F2] = SegmentData[temp_1000];
Segment_OutputBuff[SEGMENT_100][SEGMENT_F2] = SegmentData[temp_100];
Segment_OutputBuff[SEGMENT_10][SEGMENT_F2] = SegmentData[temp_10];
Segment_OutputBuff[SEGMENT_1][SEGMENT_F2] = SegmentData[temp_1];
}
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_1] = SegmentData[SEG_M];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_1] = SegmentData[SEG_O];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_2] = SegmentData[SEG_D];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_2] = SegmentData[SEG_E];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_3] = SegmentData[Mode];
}
void Segment_In_Sensor_Error(void)
{
Segment_Toggle_In = false;
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_1] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_1] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_1] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_1] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_1] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_1] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_1] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_1] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_2] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_2] = SegmentData[SEG_MINUS];
}
void Segment_Out_Sensor_Error(void)
{
Segment_Toggle_Out = false;
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_3] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_3] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F1C1][SEGMENT_DATA_4] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F1C2][SEGMENT_DATA_4] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_3] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_3] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F2C1][SEGMENT_DATA_4] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F2C2][SEGMENT_DATA_4] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_3] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_3] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F3C1][SEGMENT_DATA_4] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F3C2][SEGMENT_DATA_4] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_3] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_3] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F4C1][SEGMENT_DATA_4] = SegmentData[SEG_MINUS];
Segment_OutputBuff[SEGMENT_F4C2][SEGMENT_DATA_4] = SegmentData[SEG_MINUS];
}
#endif

@ -2,7 +2,9 @@
#if !defined(SEGMENT_H__CECA83FE_5707_4492_A247_CC6270C87910__INCLUDED_)
#define SEGMENT_H__CECA83FE_5707_4492_A247_CC6270C87910__INCLUDED_
#include "define.h"
#include "board_config.h"
#include "action_process.h"
typedef enum
{
@ -83,5 +85,6 @@ void Segment_All_Set_Data(uint8_t SegmentData);
void Segment_Show_Version(void);
void Segment_Show_Time(void);
void Segment_Show_SensorData(uint32_t SensorData);
void Segment_Show_SettingData(SET_INDEX index, uint16_t SensorSetData);
#endif

@ -1,289 +0,0 @@
#include "uart1_rs485.h"
#include "sw_timer.h"
#include "ring_buffer.h"
#include "gpio_uart_led.h"
//#define UARTn_RS485_TX_INTERRUTP_ENABLE
#define UARTn_RS485_PERIPHERAL UART1
#define UARTn_RS485_INTERRUPT_HANDLER UART1_IRQn
#define UARTn_RS485_INTERRUPT_MASK MSK_UART1
#define UARTn_RS485_INTERRUPT_PRIORITY 3
#define UARTn_RS485_TX_PORT PB
#define UARTn_RS485_TX_PIN_NUM 6
#define UARTn_RS485_RX_PORT PB
#define UARTn_RS485_RX_PIN_NUM 7
#define UARTn_RS485_TX_BUFFER_SIZE 100
#define UARTn_RS485_RX_BUFFER_SIZE 300
#define UARTn_RS485_REDE_PORT (Pn_Type*)PC
#define UARTn_RS485_REDE_NUM 0
#define UARTn_RS485_RECEIVE HAL_GPIO_ClearPin(UARTn_RS485_REDE_PORT, _BIT(UARTn_RS485_REDE_NUM))
#define UARTn_RS485_TRANSMIT HAL_GPIO_SetPin(UARTn_RS485_REDE_PORT, _BIT(UARTn_RS485_REDE_NUM))
static uint8_t Tx_RS485_Buffer[UARTn_RS485_TX_BUFFER_SIZE];
static uint8_t Rx_RS485_Buffer[UARTn_RS485_RX_BUFFER_SIZE];
static RING_BUFFER RingBuffer_RS485_Tx;
static RING_BUFFER RingBuffer_RS485_Rx;
#if defined(UARTn_RS485_TX_INTERRUTP_ENABLE)
static volatile uint8_t Uartn_RS485_TxIntEnable = FALSE;
static void Uart1_RS485_Init_TransmitSet(void);
#else
static void Uart1_RS485_Transmit_Process(void);
#endif
static void Uart1_RS485_Receive_Handler(void);
void Uart1_RS485_Initialization(uint32_t Baudrate, UARTn_DATA_BIT_Type Databit, UARTn_PARITY_BIT_Type Paritybit, UARTn_STOP_BIT_Type Stopbit)
{
UARTn_CFG_Type UARTn_Config;
/*
* Initialize UART0 pin connect
*/
HAL_GPIO_ConfigOutput((Pn_Type*)UARTn_RS485_RX_PORT, UARTn_RS485_RX_PIN_NUM, ALTERN_FUNC );
HAL_GPIO_ConfigFunction((Pn_Type*)UARTn_RS485_RX_PORT, UARTn_RS485_RX_PIN_NUM, AFSRx_AF1 );
HAL_GPIO_ConfigPullup((Pn_Type*)UARTn_RS485_RX_PORT, UARTn_RS485_RX_PIN_NUM, PUPDx_EnablePU );
HAL_GPIO_ConfigOutput((Pn_Type*)UARTn_RS485_TX_PORT, UARTn_RS485_TX_PIN_NUM, ALTERN_FUNC );
HAL_GPIO_ConfigFunction((Pn_Type*)UARTn_RS485_TX_PORT, UARTn_RS485_TX_PIN_NUM, AFSRx_AF1 );
// default: 38400-8-N-1
HAL_UART_ConfigStructInit(&UARTn_Config);
UARTn_Config.Baudrate = Baudrate;
UARTn_Config.Databits = Databit;
UARTn_Config.Parity = Paritybit;
UARTn_Config.Stopbits = Stopbit;
HAL_UART_Init((UARTn_Type*)UARTn_RS485_PERIPHERAL, &UARTn_Config);
HAL_GPIO_ConfigOutput(UARTn_RS485_REDE_PORT, UARTn_RS485_REDE_NUM, PUSH_PULL_OUTPUT);
HAL_GPIO_ConfigPullup(UARTn_RS485_REDE_PORT, UARTn_RS485_REDE_NUM, PUPDx_EnablePU);
UARTn_RS485_RECEIVE;
/* Enable UART Rx interrupt */
HAL_UART_ConfigInterrupt((UARTn_Type*)UARTn_RS485_PERIPHERAL, UARTn_INTCFG_RBR, ENABLE );
#if defined(UARTn_RS485_TX_INTERRUTP_ENABLE)
// Reset Tx Interrupt state
Uartn_RS485_TxIntEnable = RESET;
#else
SW_Timer_Callback_Register(SW_TIMER_RUN_CONTINUE, 0, Uart1_RS485_Transmit_Process);
#endif
RingBuffer_Initialization(&RingBuffer_RS485_Rx, false, UARTn_RS485_RX_BUFFER_SIZE, &Rx_RS485_Buffer[0]);
RingBuffer_Initialization(&RingBuffer_RS485_Tx, false, UARTn_RS485_TX_BUFFER_SIZE, &Tx_RS485_Buffer[0]);
NVIC_SetPriority(UARTn_RS485_INTERRUPT_HANDLER, UARTn_RS485_INTERRUPT_PRIORITY);
NVIC_EnableIRQ(UARTn_RS485_INTERRUPT_HANDLER );
HAL_INT_EInt_MaskDisable(UARTn_RS485_INTERRUPT_MASK);
}
void Uart1_RS485_Transmit(uint8_t TxData)
{
#if defined(UARTn_RS485_TX_INTERRUTP_ENABLE)
/* Temporarily lock out UART transmit interrupts during this read so the UART transmit interrupt won't cause problems with the index values */
HAL_UART_ConfigInterrupt((UARTn_Type*)UARTn_PERIPHERAL, UARTn_INTCFG_THRE, DISABLE );
RingBuffer_Enqueue(&RingBuffer_Tx, TxData);
/*
* Check if current Tx interrupt enable is reset,
* that means the Tx interrupt must be re-enabled
* due to call IntTransmit() function to trigger
* this interrupt type
*/
if(Uartn_RS485_TxIntEnable == RESET)
{
Uart1_RS485_Init_TransmitSet();
}
/*
* Otherwise, re-enables Tx Interrupt
*/
else
{
HAL_UART_ConfigInterrupt((UARTn_Type*)UARTn_PERIPHERAL, UARTn_INTCFG_THRE, ENABLE );
}
#else
RingBuffer_Enqueue(&RingBuffer_RS485_Tx, TxData);
#endif
}
void Uart1_RS485_TransmitData(uint8_t* pTxData, uint32_t TxLen)
{
uint32_t i;
#if defined(UARTn_RS485_TX_INTERRUTP_ENABLE)
HAL_UART_ConfigInterrupt( ( UARTn_Type* )UARTn_RS485_PERIPHERAL, UARTn_INTCFG_THRE, DISABLE );
for(i = 0 ; i < TxLen ; i++)
RingBuffer_Enqueue(&RingBuffer_Tx, pTxData[i]);
if(Uartn_RS485_TxIntEnable == RESET)
{
Uart1_RS485_Init_TransmitSet();
}
else
{
HAL_UART_ConfigInterrupt( ( UARTn_Type* )UARTn_PERIPHERAL, UARTn_INTCFG_THRE, ENABLE );
}
#else
for(i = 0 ; i < TxLen ; i++)
RingBuffer_Enqueue(&RingBuffer_RS485_Tx, pTxData[i]);
#endif
}
#if defined(UARTn_RS485_TX_INTERRUTP_ENABLE)
static void Uart1_RS485_Init_TransmitSet(void)
{
// Disable THRE interrupt
HAL_UART_ConfigInterrupt( ( UARTn_Type* )UARTn_RS485_PERIPHERAL, UARTn_INTCFG_THRE, DISABLE );
/* Wait until THR empty */
while( HAL_UART_CheckBusy( ( UARTn_Type* )UARTn_RS485_PERIPHERAL ) == SET );
while(RingBuffer_Get_DataSize(&RingBuffer_Tx) != 0)
{
uint8_t TxData;
RingBuffer_GetData(&RingBuffer_RS485_Tx, &TxData);
if(HAL_UART_Transmit( ( UARTn_Type* )UARTn_RS485_PERIPHERAL, &TxData, 1, NONE_BLOCKING ) )
{
/* Update transmit ring FIFO tail pointer */
RingBuffer_PopData(&RingBuffer_RS485_Tx);
break;
}
else
{
break;
}
}
/* If there is no more data to send, disable the transmit interrupt - else enable it or keep it enabled */
if(RingBuffer_Get_DataSize(&RingBuffer_RS485_Tx) == 0)
{
HAL_UART_ConfigInterrupt((RingBuffer_RS485_Tx*)UARTn_RS485_PERIPHERAL, UARTn_INTCFG_THRE, DISABLE );
// Reset Tx Interrupt state
Uartn_TxIntEnable = RESET;
}
else
{
// Set Tx Interrupt state
Uartn_TxIntEnable = SET;
HAL_UART_ConfigInterrupt((UARTn_Type*)UARTn_RS485_PERIPHERAL, UARTn_INTCFG_THRE, ENABLE );
}
}
#else
static void Uart1_RS485_Transmit_Process(void)
{
if(RingBuffer_Get_DataSize(&RingBuffer_RS485_Tx) != 0)
{
uint8_t TxData;
UARTn_RS485_TRANSMIT;
GPIO_UART_RS485_TX_LED_ON;
RingBuffer_GetData(&RingBuffer_RS485_Tx, &TxData);
if(HAL_UART_Transmit((UARTn_Type*)UARTn_RS485_PERIPHERAL, &TxData, 1, NONE_BLOCKING))
{
/* Update transmit ring FIFO tail pointer */
RingBuffer_PopData(&RingBuffer_RS485_Tx);
}
}
else
{
if(HAL_UART_CheckBusy((UARTn_Type *)UARTn_RS485_PERIPHERAL) == RESET)
{
UARTn_RS485_RECEIVE;
GPIO_UART_RS485_TX_LED_OFF;
}
}
}
#endif
static void Uart1_RS485_Receive_Handler(void)
{
uint8_t tmpc;
uint32_t rLen;
while(1)
{
rLen = HAL_UART_Receive((UARTn_Type*)UARTn_RS485_PERIPHERAL, &tmpc, 1, NONE_BLOCKING );
if (rLen)
{
RingBuffer_Enqueue(&RingBuffer_RS485_Rx, tmpc);
}
else
{
break;
}
}
}
/*********************************************************************//**
* @brief UART1 interrupt handler sub-routine
* @param[in] None
* @return None
**********************************************************************/
void UART1_Handler(void)
{
uint32_t intsrc, tmp;
/* Determine the interrupt source */
intsrc = UARTn_RS485_PERIPHERAL->IIR;
tmp = intsrc & UARTn_IIR_INTID_MASK;
// Receiver Line Status
if(tmp == UARTn_IIR_INTID_RLS) // error(Overrun, Parity, Framing or Break Error)
{
}
else if(tmp == UARTn_IIR_INTID_RDA) // Receiver Data Available
{
Uart1_RS485_Receive_Handler();
}
else if(tmp == UARTn_IIR_INTID_THRE) // Transmitter Holding Register Empty
{
#if defined(UARTn_RS485_TX_INTERRUTP_ENABLE)
Uart1_RS485_Init_TransmitSet();
#endif
}
else if(tmp == UARTn_IIR_INTID_TXE) // Transmitter Register Empty
{
}
}
void Uart1_RS485_Push_Data(uint8_t RxData)
{
RingBuffer_Enqueue(&RingBuffer_RS485_Rx, RxData);
}
uint32_t Uart1_RS485_Get_RecvDataCount(void)
{
return RingBuffer_Get_DataSize(&RingBuffer_RS485_Rx);
}
uint8_t Uart1_RS485_Get_RecvData(void)
{
uint8_t retData;
RingBuffer_Dequeue(&RingBuffer_RS485_Rx, &retData);
return retData;
}

@ -1,14 +0,0 @@
/** \file uart1_rs485.h */
#if !defined(UART1_RS485_H__43E41896_F8DF_4ED4_B934_92ED846B67D5__INCLUDED_)
#define UART1_RS485_H__43E41896_F8DF_4ED4_B934_92ED846B67D5__INCLUDED_
#include "define.h"
void Uart1_RS485_Initialization(uint32_t Baudrate, UARTn_DATA_BIT_Type Databit, UARTn_PARITY_BIT_Type Paritybit, UARTn_STOP_BIT_Type Stopbit);
void Uart1_RS485_Transmit(uint8_t TxData);
void Uart1_RS485_TransmitData(uint8_t* pTxData, uint32_t TxLen);
uint32_t Uart1_RS485_Get_RecvDataCount(void);
uint8_t Uart1_RS485_Get_RecvData(void);
void Uart1_RS485_Push_Data(uint8_t RxData);
#endif

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save