|
- #include "stm8l15x.h"
- #include "./Protocol/Protocol.h"
- #include "./LCD/Lcd_Driver.h"
- #include "./RTC_CLK/RTC_CLK.h"
- #include "./InPut/InPut_Driver.h"
- #include "./IIC/I2C_Driver.h"
- #include "./Flash/Flash_Driver.h"
- #include "./UsrData/UsrData.h"
- #include "stdio.h"
- #include "main.h"
- /*
- *****************************************************************/
- System_sContrl SystemCtr;
- Main_sMenu MainMenu;
- PassWdBrand_sContrl PassWordBrand;
- /*
- *****************************************************************/
- /* 測試程序 */
- void System_Delay(uint8_t nCount);
- void Read_RTCTimes();
- uint8_t System_AutoCheck();
- uint8_t Time_Setting(void);
- void ReadPasswdBrand();
- uint8_t ReadPassWDMode();
- uint8_t Recode_Header(uint32_t paddr,uint8_t *uData);
- uint8_t Read_RecodeData(uint32_t paddr,uint8_t *uData);
- uint8_t Verity_PassWord();
- static void TIM4_Config(void);
- static void USART_Config(void);
- static void LCD_RTCConfig(void);
- static void System_MainMenu();
- void System_EventProcess();
- void SystemDeviceInit();
- void Halt_OffDevice();
- void TestBoolMode();
- void main(void)
- {
- CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1);
- while(1)
- {
- /* 判斷是否有輸入 */
- if(InputDevice.uType == NO_INPUT_DEV )
- {
- /* 判斷系統是否激活狀態 */
- if( SystemCtr.uStatus != SYSTEM_ACTIVE )
- {
- /*進入halt模式關閉,外設
- ******************************************/
- Halt_OffDevice();
- /*****************************************/
- halt(); //進入休眠模式
- /*初始化系統外設init()
- ****************************************/
- SystemDeviceInit();
- /****************************************/
- }
- }
-
- InPut_Process();
- /* 系統處理過程
- ****************************************/
- if(SystemCtr.uStatus == SYSTEM_ACTIVE)
- {
- System_MainMenu();
-
- System_EventProcess();
-
- Protocol_Process();
- }
- /****************************************/
- }
-
-
- }
- /***************************************************************
- * 函數名:System_MainMenu()
- * 輸入 :void
- * 輸出 :void
- * 功能 :系統處理菜單
- ****************************************************************/
- static void System_MainMenu()
- {
-
- if(SystemCtr.uStatus != SYSTEM_SLEEP)
- {
- if( ButtonClick.SystemVoiceKey == SET)
- {
- Display_Speeker(ENABLE);
- }
- else
- {
- Display_Speeker(DISABLE);
- }
-
-
- switch(MainMenu.uMenu)
- {
- case TESTING_BOOL_MENU:
- {
- Write_RecodeTest();
- TestBoolMode();
- }break;
- case PASSWORD_BRAND_MENU:
- {
- if(ReadPassWDMode())
- DisplayOutSlaverEro();
- }break;
- case SETTING_TIME_MENU:
- {
- Set_Calendar();
- }break;
- case RECODE_BLEMPTY_MENU:
- {
- DisplayNoneEmptyBool();
- //Read_Recode();
- }break;
- case RECODE_BLNOEMPTY_MENU:
- {
- DisplayNoneUnEmptyBool();
- }break;
- case RECODE_BLINDENTY_MENU:
- {
- DisplayNoneIndentBool();
- }break;
- case ALARM_CLOCK_MENU:
- {
- Display_Alarm(ENABLE);
-
- RTC_ITConfig(RTC_IT_ALRA, ENABLE);
- RTC_AlarmCmd(ENABLE);
- }break;
- default :
- {
- SystemCtr.uStatus = SYSTEM_SLEEP;
- }break;
- }
-
- }
- }
- /***************************************************************
- * 函數名:Halt_OffDevice
- * 輸入 :void
- * 輸出 :void
- * 功能 :進入halt模式前關閉外設
- ****************************************************************/
- void Halt_OffDevice()
- {
- /* 關閉設備前,設置系統主時鐘,和中斷 */
- CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1);
- InPut_Init();
- enableInterrupts();
-
-
- LCD_ClearScreen();
- CalendarSetting_Quit();
- LCD_Cmd(DISABLE); //關閉LCD
- }
- /***************************************************************
- * 函數名:SystemDeviceInit
- * 輸入 :void
- * 輸出 :void
- * 功能 :初始化外設
- ****************************************************************/
- void SystemDeviceInit()
- {
- CLK_SYSCLKSourceSwitchCmd(ENABLE);
- /* System Clock is HSI/1 */
- CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1);
- /*初始化I2C端口*/
-
- I2C_Init();
-
- TIM4_Config();
-
- USART_Config();
-
- LCD_RTCConfig();
-
- LCD_Init();
-
- Protocol_Init();
-
- }
- /*******************************************************************
- * 函數名:ReadPasswdBrand
- * 輸 入:void8
- * 輸 出:void
- * 功 能:讀密碼牌操作
- ********************************************************************/
- void ReadPasswdBrand()
- {
- while(Verity_PassWord())//如果校驗碼與插入讀出的校驗碼不同回寫
- {
- FLASH_SetProgrammingTime( FLASH_ProgramTime_Standard); //設置Flash操作
-
- FLASH_unLock(MCU_EEPROM_DATA); //解鎖數據存儲區
-
- while (!(FLASH->IAPSR & (uint8_t)0x08)); //等待解鎖操作
-
- /* 讀取密碼牌內容,數據搬移臨界區 */
- System_Delay(200);
-
- IIC_SlaveRead_LongBuffer(PassWordBrand.DataBuffer,sizeof(PassWordBrand.DataBuffer));//讀出密碼牌數據
-
- System_Delay(10);
-
- FLASH_WriteLongBuffer(MCU_EEPROM_DATA,PassWordBrand.DataBuffer,sizeof(PassWordBrand.DataBuffer));
-
- System_Delay(200);
- /* ********************************************* */
- while (FLASH_GetFlagStatus( FLASH_FLAG_EOP) == SET);
-
- /* 讀取內容測試
- FLASH_ReadLongBuffer(MCU_EEPROM_DATA,ReadBuffer,sizeof(ReadBuffer));
- while (FLASH_GetFlagStatus( FLASH_FLAG_EOP) == SET);*/
-
-
- }
-
- }
- /*******************************************************************
- * 函數名:ReadPassWDMode
- * 輸 入:void
- * 輸 出:void
- * 功 能:讀密碼牌操作
- ********************************************************************/
- uint8_t Verity_PassWord()
- {
- uint8_t uPassWord = 0;
- uint8_t uFlash = 0;
-
- if(PassWordBrand.uStatus != VERIFY_SUCESS)
- {
- LCD_Cmd(DISABLE); //關閉LCD
-
- FLASH_SetProgrammingTime( FLASH_ProgramTime_Standard); //設置Flash操作
-
- FLASH_unLock(MCU_EEPROM_DATA); //解鎖數據存儲區
-
- while (!(FLASH->IAPSR & (uint8_t)0x08)); //等待解鎖操作
-
- System_Delay(200);
-
- uPassWord =(uint8_t)I2C_ReadByte(SLAVE_BLOCK_START_ADDRESS,SLAVE_START_ADDRESS);
-
- System_Delay(10);
-
- uFlash = (uint8_t)FLASH_ReadByte(MCU_EEPROM_START);
-
- System_Delay(200);
- while (FLASH_GetFlagStatus( FLASH_FLAG_EOP) == SET);
- }
-
- if((uFlash^uPassWord) == 0)
- {
- LCD_Cmd(ENABLE);
- PassWordBrand.uStatus = VERIFY_SUCESS;
- return 0;
- }
- return 1;
- }
- /*******************************************************************
- * 函數名:ReadPassWDMode
- * 輸 入:void
- * 輸 出:void
- * 功 能:讀密碼牌操作
- ********************************************************************/
- uint8_t ReadPassWDMode()
- {
- if(BUTTON_DOWN(GPIOC,PASSWORD_BRAND))
- {
- ReadPasswdBrand();
- if(PassWordBrand.uStatus != VERIFY_FAILD)
- {
- PassWordBrand.Start_Flick = SET;
- if(System_AutoCheck())
- {
- MainMenu.uMenu = NO_OPERATION_MENU;
- PassWordBrand.uStatus = VERIFY_FAILD;
- PassWordBrand.Start_Flick = RESET;
- InputDevice.uProcType = NONE_PROCESS; //
- }
- }
- }
- else
- {
- /* 密碼牌插入不穩 */
- Frame.uEvent = SYSTEM_TESTING_ERROR; //提示密碼牌出錯
- Frame.uValuer.uError = ERROR_E4;
- LCD_ClearScreen();
- InputDevice.uProcType = NONE_PROCESS; //
- return 1;
- }
- return 0;
- }
- /*******************************************************************
- * 函數名:TestBoolMode
- * 輸 入:void
- * 輸 出:void
- * 功 能:讀密碼牌操作
- ********************************************************************/
- void TestBoolMode()
- {
- if(BUTTON_DOWN(GPIOG,TESTING_BOTTLET))
- {
- my_test();
- if(BottlerOpt.BottlerPriority == SET)
- {
- BottlerOpt.BottlerPriority = RESET;
- LCD_ClearScreen();
- }
-
- }
- else
- {
- Frame.uEvent = SYSTEM_BLOTTER_OUT;
- InputDevice.uPriority = NO_PRIORITY;
- MainMenu.uMenu = NO_OPERATION_MENU;
- }
- }
- /*******************************************************************
- * 函數名:void System_AutoCheck()
- * 輸 入:void
- * 輸 出:void
- * 功 能:所有血糖值記錄為空
- ********************************************************************/
- uint8_t System_AutoCheck()
- {
- static uint8_t Calc = 0;
- Display_DataValuer(DISPLAY_BIT_NUM_1,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_2,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_3,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_4,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_5,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_6,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_7,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_8,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_9,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_10,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_11,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_12,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_13,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_14,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_15,(uint8_t)Calc);
- Display_DataValuer(DISPLAY_BIT_NUM_16,(uint8_t)Calc);
-
- if(PassWordBrand.Flick_Calc == SET)
- {
- PassWordBrand.Flick_Calc = RESET;
- Calc++;
-
- if(Calc == 0x0A)
- {
- Calc = 0x00;
- PassWordBrand.DspCalc =0;
- PassWordBrand.Start_Flick = RESET;
-
- return 1;
- }
-
-
- Screen_ClearPostion(DISPLAY_BIT_NUM_1);
- Screen_ClearPostion(DISPLAY_BIT_NUM_2);
- Screen_ClearPostion(DISPLAY_BIT_NUM_3);
- Screen_ClearPostion(DISPLAY_BIT_NUM_4);
- Screen_ClearPostion(DISPLAY_BIT_NUM_5);
- Screen_ClearPostion(DISPLAY_BIT_NUM_6);
- Screen_ClearPostion(DISPLAY_BIT_NUM_7);
- Screen_ClearPostion(DISPLAY_BIT_NUM_8);
- Screen_ClearPostion(DISPLAY_BIT_NUM_9);
- Screen_ClearPostion(DISPLAY_BIT_NUM_10);
- Screen_ClearPostion(DISPLAY_BIT_NUM_11);
- Screen_ClearPostion(DISPLAY_BIT_NUM_12);
- Screen_ClearPostion(DISPLAY_BIT_NUM_13);
- Screen_ClearPostion(DISPLAY_BIT_NUM_14);
- Screen_ClearPostion(DISPLAY_BIT_NUM_15);
- Screen_ClearPostion(DISPLAY_BIT_NUM_16);
-
- }
- return 0;
- }
- /***************************************************************
- * 函數名:USART_Config()
- * 輸入 :void
- * 輸出 :void
- * 功能 :初始化串口
- ****************************************************************/
- static void USART_Config(void)
- {
- /* 配置USART3外圍時鐘源 */
- CLK_PeripheralClockConfig(CLK_Peripheral_USART3, ENABLE);
- /* 配置RX,TX引腳為上拉 */
- GPIO_ExternalPullUpConfig(GPIOG, GPIO_Pin_0|GPIO_Pin_1, ENABLE);
- /* 初始化USART2,波特率,控制和校驗 */
- USART_Init(USART3,(uint32_t)9600, USART_WordLength_8b, USART_StopBits_1,
- USART_Parity_No, (USART_Mode_TypeDef)(USART_Mode_Tx | USART_Mode_Rx));
-
- /* 采用中斷方式接收 */
- // enableInterrupts();
- USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);
-
- /* 啟動USART3 */
- USART_Cmd(USART3, ENABLE);
- }
- /***************************************************************
- * 函數名:TIM4_Config
- * 輸入 :void
- * 輸出 :void
- * 功能 :初始化定時器
- ****************************************************************/
- static void TIM4_Config(void)
- {
- CLK_PeripheralClockConfig(CLK_Peripheral_TIM4, ENABLE);
-
- TIM4_TimeBaseInit(TIM4_Prescaler_16384, 1); //定時1S
- /* Enable TIM4_IT clock */
- TIM4_ITConfig(TIM4_IT_Update,ENABLE);
-
- TIM4_Cmd(ENABLE);
- }
- /***************************************************************
- * 函數名:LCD_Config
- * 輸入 :void
- * 輸出 :void
- * 功能 :初始化LCD顯示器
- ****************************************************************/
- static void LCD_RTCConfig(void)
- {
- /* Enable LSE */
- CLK_LSEConfig(CLK_LSE_ON);
- /* Enable LCD clock */
- CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE);
- CLK_RTCClockConfig(CLK_RTCCLKSource_LSE, CLK_RTCCLKDiv_1);
- /* Enable RTC clock */
- CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
-
- }
- /**************************************************************************************
- * 函數原型:void Read_RTCTimes()
- * 輸 入:void
- * 輸 出:void
- * 功 能:讀取時鐘
- * 描 述:
- ***************************************************************************************/
- void Read_RTCTimes()
- {
- do{
- while (RTC_WaitForSynchro() != SUCCESS);
-
- RTC_GetTime(RTC_Format_BIN, &RTC_TimeStr);
- RTC_GetDate(RTC_Format_BIN, &RTC_DateStr);
-
- Frame.uValuer.uTimes.uFrame_Year = RTC_DateStr.RTC_Year;
- Frame.uValuer.uTimes.uFrame_Month = (((uint8_t)RTC_DateStr.RTC_Month & 0xF0)>>4)*10+((uint8_t)RTC_DateStr.RTC_Month &0x0F);
- Frame.uValuer.uTimes.uFrame_Date = RTC_DateStr.RTC_Date;
- Frame.uValuer.uTimes.uFrame_Hours= RTC_TimeStr.RTC_Hours;
- Frame.uValuer.uTimes.uFrame_Minutes = RTC_TimeStr.RTC_Minutes;
- }
- while(0);
-
- }
- /****************************************************
- * 函數名:Time_Setting
- * 輸 入:void
- * 輸 出:uint8_t
- * 功 能:時間校驗檢查
- * 描 述:
- *****************************************************/
- uint8_t Time_Setting(void)
- {
- RTC_DateStr.RTC_Year = Frame.uValuer.uTimes.uFrame_Year;
- RTC_DateStr.RTC_Month = (RTC_Month_TypeDef)Frame.uValuer.uTimes.uFrame_Month;
- RTC_DateStr.RTC_Date = Frame.uValuer.uTimes.uFrame_Date;
- RTC_TimeStr.RTC_Hours = Frame.uValuer.uTimes.uFrame_Hours;
- RTC_TimeStr.RTC_Minutes = Frame.uValuer.uTimes.uFrame_Minutes;
- RTC_TimeStr.RTC_Seconds = (uint8_t)DATA_EMPTY;
-
- RTC_SetTime(RTC_Format_BIN, &RTC_TimeStr);
- RTC_SetDate(RTC_Format_BIN, &RTC_DateStr);
-
- while (RTC_WaitForSynchro() != SUCCESS);
-
- RTC_GetTime(RTC_Format_BIN, &RTC_TimeStr);
- RTC_GetDate(RTC_Format_BIN, &RTC_DateStr);
-
- if(RTC_DateStr.RTC_Year > 100)
- return 0;
-
- if((((uint8_t)RTC_DateStr.RTC_Month>>4)&0x0F)*10 + ((uint8_t)RTC_DateStr.RTC_Month & 0x0F) > 12)
- return 0;
- if(RTC_DateStr.RTC_Date > 31)
- return 0;
- if(RTC_TimeStr.RTC_Hours > 24)
- return 0;
- if( RTC_TimeStr.RTC_Minutes > 60)
- return 0;
-
- return 1;
- }
- /******************************************************************************************
- * 函數原型:uint8_t Read_RecodeData(uint32_t paddr,uint8_t *uData)
- * 輸 入:uint8_t paddr - 數據記錄首地址
- uint8_t *uData - 讀出數據緩存
- * 輸 出:uint8_t - 讀出數據情況,如果成功返回讀出數據記錄長度、
- 否則為0
- * 功 能: 實現一次數據記錄的讀取操作
- * 描 述:
- ******************************************************************************************/
- uint8_t Read_RecodeData(uint32_t paddr,uint8_t *uData)
- {
- static uint8_t upackge_index = 0x00;
- static uint32_t pStart_addr;
- uint8_t Empty_Calc = 0x00;
- uint8_t uindex = 0x00;
- uint8_t Package_Mum = PACKAGE_SEND_MAX;
-
-
- if(upackge_index == DATA_EMPTY)
- pStart_addr = paddr;
-
- if((uData[DATA_START]-upackge_index) == 0x01) //最后一次數據讀取判斷
- {
- if(Frame.uContrl.uFrame_LastLen !=DATA_EMPTY) //如果是不完整的發送包個數
- Package_Mum = Frame.uContrl.uFrame_LastLen;
-
- Frame.uContrl.uFrame_Next = RESET; //清除后續包標志
- }
-
- for(;uindex < Package_Mum*RECODE_SIGEN_LEN;uindex++)
- {
- if(DATA_EMPTY == *((PointerAttr uint8_t*)(uint16_t)pStart_addr+uindex)) //判斷數據記錄是否為空
- Empty_Calc++;
-
- if(RECODE_SIGEN_LEN <= Empty_Calc ) //如果有一條記錄為空
- return 0;
-
- if((uindex != 0) &&(uindex % RECODE_SIGEN_LEN ==0))
- Empty_Calc = 0x00;
-
- uData[FRAME_START+uindex] = *((PointerAttr uint8_t *)(uint16_t)pStart_addr+ uindex); // 讀取數據到緩沖buffer
- }
- upackge_index++;
-
- uData[DATA_START+0x01] = upackge_index; //當前讀取次數
-
- uData[FRAME_START-0x01] = uindex / RECODE_SIGEN_LEN ; //當前讀取包個數
-
- pStart_addr += (uint32_t)READ_BUFF_MAX; //保存讀取地址
-
-
- if(Frame.uContrl.uFrame_Next == RESET)
- upackge_index = 0x00;
-
- Frame.uContrl.uFrame_DataLen = uindex;
-
- return 1;
- }
- /********************************************************************************************
- * 函數原型:uint8_t Recode_Header(uint32_t paddr,uint8_t *uData)
- * 輸 入:uint8_t paddr - 記錄頭首地址 (數據包個數地址)
- uint8_t *uData - 讀出數據緩存
- * 輸 出:uint8_t - 讀取情況,如果為空返回1 ,如果為0表示記錄不為空
- * 功 能:讀取數據記錄頭信息
- * 描 述:
- ********************************************************************************************/
- uint8_t Recode_Header(uint32_t paddr,uint8_t *uData)
- {
- uint8_t Send_index = (uint8_t)(*((PointerAttr uint8_t*)((uint16_t)paddr))/PACKAGE_SEND_MAX);
-
- if(*((PointerAttr uint8_t *)((uint16_t)paddr)) == 0x00)
- return 0;
-
- if((*((PointerAttr uint8_t*)((uint16_t)paddr))%PACKAGE_SEND_MAX))
- {
- Send_index++;
- Frame.uContrl.uFrame_LastLen = (uint8_t)*((PointerAttr uint8_t*)((uint16_t)paddr))%PACKAGE_SEND_MAX;
- }
-
- uData[DATA_START] = Send_index;
-
- if(uData[DATA_START] > 0x01)
- Frame.uContrl.uFrame_Next = SET;
-
- return 1;
- }
- /********************************************************************************************
- * 函數原型:uint8_t Recode_Header(uint32_t paddr,uint8_t *uData)
- * 輸 入:uint8_t paddr - 記錄頭首地址 (數據包個數地址)
- uint8_t *uData - 讀出數據緩存
- * 輸 出:uint8_t - 讀取情況,如果為空返回1 ,如果為0表示記錄不為空
- * 功 能:讀取數據記錄頭信息
- * 描 述:
- ********************************************************************************************/
- void System_EventProcess()
- {
-
- /* 被動發送測試
- *****************************************************************
- */
- /* 測試連接與讀取ID信息 !*/
- if(Frame.uAction.uEvent == READ_STATE)
- {
- Frame.uAction.uEvent = INVALID_ACTION;
- /* 讀取時間 */
- Read_RTCTimes();
- Frame.uAction.uResult = ACTION_SUCCESS;
- Frame.uEvent = READSYS_STATE_FINSHED;
- }
- /* 測試清除數據 ! */
- if(Frame.uAction.uEvent == ERASE_RECODE)
- {
- Frame.uAction.uEvent = INVALID_ACTION;
-
- /* .........進行清除操作........... */
-
- Frame.uAction.uResult = ACTION_SUCCESS;
- Frame.uEvent = ERASE_RECODE_FINSHED;
- }
- /* 測試設置時間 ! */
- if(Frame.uAction.uEvent == SETING_TIME)
- {
- Frame.uAction.uEvent = INVALID_ACTION;
-
- if(Time_Setting())
- Frame.uAction.uResult = ACTION_SUCCESS;
-
- Frame.uEvent = SETING_TIME_FINSHED;
- }
- /* 讀取血糖測試結果 !*/
- if(Frame.uAction.uEvent == READ_SESULT)
- {
- Frame.uAction.uEvent = INVALID_ACTION;
-
- /* 測試模式讀取血糖測試結果 */
- Frame.uValuer.uTestMode =TESTING_MODE;
- Frame.uValuer.uBool_Result = 0x12;
- /* 測試模式讀取時間 */
- Read_RTCTimes();
-
- Frame.uAction.uResult = ACTION_SUCCESS;
-
- Frame.uEvent = TESTING_RESULT_FINSHED;
- }
-
-
- /* 讀取血糖記錄結果 !*/
- if(Frame.uAction.uEvent == READ_RECODE)
- {
- Frame.uAction.uEvent = INVALID_ACTION;
-
- if(Recode_Header((uint32_t)0x101F,Frame.DataBuffer)) //讀取數據存儲信息頭,并填充到幀緩存數據buffer的首字節
- {
- switch(Frame.uAction.uValuer.uRecodeTyple)
- {
- case RECODE_RECENT_VALUER:
- {
- if(Read_RecodeData((uint32_t)0x1001,Frame.DataBuffer)) //讀取數據存儲信息,并從幀緩存數據buffer的第4個字節開始填充buffer
- {
- Frame.uContrl.uFrame_PackageState = FREE;
- Frame.uAction.uResult = ACTION_SUCCESS;
- Frame.uEvent = READ_RECODE_FINSHED;
- }
- }
- break;
- case RECODE_EMPTY_VALUER:
- {
-
- if(Read_RecodeData((uint32_t)0x1136,Frame.DataBuffer))
- {
- Frame.uContrl.uFrame_PackageState = FREE;
- Frame.uAction.uResult = ACTION_SUCCESS;
- Frame.uEvent = READ_RECODE_FINSHED;
- }
- }
- break;
- case RECODE_NOEMPTY_VALUER :
- {
-
- if(Read_RecodeData((uint32_t)0x1262,Frame.DataBuffer))
- {
- Frame.uContrl.uFrame_PackageState = FREE;
- Frame.uAction.uResult = ACTION_SUCCESS;
- Frame.uEvent = READ_RECODE_FINSHED;
- }
- }
- break;
- default:
- break;
- }
-
- }
-
- }
- /*
- ********************************************************************
- */
- }
- /********************************************************************************************
- * 函數原型:uint8_t Recode_Header(uint32_t paddr,uint8_t *uData)
- * 輸 入:uint8_t paddr - 記錄頭首地址 (數據包個數地址)
- uint8_t *uData - 讀出數據緩存
- * 輸 出:uint8_t - 讀取情況,如果為空返回1 ,如果為0表示記錄不為空
- * 功 能:讀取數據記錄頭信息
- * 描 述:
- ********************************************************************************************/
- void System_Delay(uint8_t nCount)
- {
- uint8_t base = 0xff;
- while (nCount --)
- while(base--);
- }
復制代碼
|
|