|
- void CmdSendMcuP0(uint8_t *buf)
- {
- uint8_t tmp_cmd_buf;
-
- if(buf == NULL) return ;
-
- memcpy(&m_w2m_controlMcu, buf, sizeof(w2m_controlMcu));
- m_w2m_controlMcu.status_w.motor_speed = exchangeBytes(m_w2m_controlMcu.status_w.motor_speed);
-
- //上报状态
- if(m_w2m_controlMcu.sub_cmd == SUB_CMD_REQUIRE_STATUS) ReportStatus(REQUEST_STATUS);
-
- //控制命令,操作字段顺序依次是: R_on/off, multi Color, R, G, B, motor
- if(m_w2m_controlMcu.sub_cmd == SUB_CMD_CONTROL_MCU){
- //先回复确认,表示收到合法的控制命令了?
- SendCommonCmd(CMD_SEND_MCU_P0_ACK, m_w2m_controlMcu.head_part.sn);
-
- //控制命令标志按照协议表明哪个操作字段有效(对应的位为1)want to control LED R
- if((m_w2m_controlMcu.cmd_tag & 0x01) == 0x01)
- {
- //0 bit, 1: R on, 0: R off;
- if((m_w2m_controlMcu.status_w.cmd_byte & 0x01) == 0x01)
- {
- LED_RGB_Control(254, 0, 0);
- m_m2w_mcuStatus.status_w.cmd_byte = (m_m2w_mcuStatus.status_w.cmd_byte | 0x01);
- }
- else
- {
- LED_RGB_Control(0, 0, 0);
- m_m2w_mcuStatus.status_w.cmd_byte = (m_m2w_mcuStatus.status_w.cmd_byte & 0xFE);
- }
- }
复制代码 这是gokit一代宠物屋中的一段代码,如上代码中if((m_w2m_controlMcu.status_w.cmd_byte & 0x01) == 0x01)
m_m2w_mcuStatus.status_w.cmd_byte = (m_m2w_mcuStatus.status_w.cmd_byte | 0x01);
这些是什么意思啊,能不能帮忙解释一下
|
|