| | |
| | | checksum = Checksum_u16(&send_frame[2],8); |
| | | memcpy(&send_frame[10],&checksum,2); |
| | | |
| | | USART_puts(send_frame, 12); |
| | | UART_PushFrame(send_frame, 12); |
| | | } |
| | | void SendComMap(uint8_t data_length, uint8_t index) |
| | | { |
| | |
| | | { |
| | | case CMD_WRITE: |
| | | //ä»mUsartReceivePackä¸è¯»åpack_lengthé¿åº¦çåèï¼æ¾å°å
¨å±åéä¸ |
| | | memcpy((uint8_t*)&g_com_map + pack_index, mUsartReceivePack, pack_datalen); |
| | | if(pack_index<512) |
| | | // if(pack_index>100) |
| | | { |
| | | memcpy((uint8_t*)&g_com_map + pack_index, mUsartReceivePack, pack_datalen); |
| | | //è¿åä¸ä¸ªerrorç¶æ |
| | | //SendComMap(pack_datalen,pack_index); |
| | | save_com_map_to_flash(); |
| | | SendConfigConfirm(pack_msgtype,pack_length); |
| | | delay_ms(500); |
| | | SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软å¤ä½åå°bootloader |
| | | SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软å¤ä½åå°bootloader |
| | | |
| | | }else{ |
| | | memcpy((uint8_t*)&g_com_map + pack_index, mUsartReceivePack, pack_datalen); |
| | | //è¿åä¸ä¸ªerrorç¶æ |
| | | //SendComMap(pack_datalen,pack_index); |
| | | //save_com_map_to_flash(); |
| | | SendConfigConfirm(pack_msgtype,pack_length); |
| | | |
| | | } |
| | | break; |
| | | case CMD_READ: |
| | | //readå
ä¸dataåèï¼å³mUsartReceivePack[0]è¡¨ç¤ºæ°æ®é¿åº¦ï¼ |