wu le
/
CubeFine
test
Fork of CubeFine by
Embed:
(wiki syntax)
Show/hide line numbers
Protocol.h
00001 #include "Microduino_Protocol_HardSer.h" 00002 00003 //BLE////////////////////// 00004 Serial pc(D3, D2); 00005 00006 Protocol bleProtocol(&pc, TYPE_NUM); //软串口,校验数据类 00007 00008 #define this_node 1 //设置本机ID 00009 #define other_node 0 00010 struct send_a { //发送 00011 uint32_t node_ms; //节点运行时间 00012 }; 00013 struct receive_a { //接收 00014 uint32_t ms; 00015 uint16_t rf_CH[CHANNEL_NUM]; 00016 }; 00017 00018 //Mode////////////////////// 00019 enum _Mode { 00020 NRF, 00021 BLE 00022 }; 00023 00024 bool protocolSetup(void) 00025 { 00026 bleProtocol.begin(BLE_SPEED); 00027 return BLE; 00028 } 00029 00030 bool protocolRead(uint16_t *_channel, bool _mode) 00031 { 00032 switch (bleProtocol.parse(_channel, MODE_WHILE)) { 00033 case P_NONE: //DATA NONE 00034 break; 00035 case P_FINE: //DATA OK 00036 return true; 00037 case P_ERROR: //DATA ERROR 00038 00039 break; 00040 case P_TIMEOUT: //DATA TIMEOUT 00041 00042 break; 00043 } 00044 return false; 00045 }
Generated on Wed Jul 20 2022 02:00:50 by 1.7.2