| | |
| | | } |
| | | |
| | | } |
| | | extern uint8_t enable_sleep_count,sleep_flag; |
| | | void UsartParseDataHandler(uint8_t data) |
| | | { |
| | | static UsartRecvPackState usart_receive_state = UsartReceiveWaitHead0; |
| | |
| | | { |
| | | case CMD_WRITE: |
| | | //从mUsartReceivePack中读取pack_length长度的字节,放到全局变量中,赋值保存的参数并且存入flash |
| | | |
| | | enable_sleep_count=0; |
| | | memcpy((uint8_t*)&g_com_map + pack_index, mUsartReceivePack, pack_datalen); |
| | | |
| | | if(mUsartReceivePack[0]==1) |
| | |
| | | NVIC_SystemReset(); |
| | | break; |
| | | case CMD_READ: |
| | | enable_sleep_count=0; |
| | | //read包中data字节,即mUsartReceivePack[0]表示数据长度; |
| | | //从g_com_data结构体中的第index位置读取长度为mUsartReceivePack[0]的字节,发送出来 |
| | | SendComMap0(pack_datalen,pack_index>>1); |