/************************************************************************************
* @name : write_to_dwin
* @brief : 串口4向迪文屏写数据
* @param : addr_h 变量地址高字节
addr_l 变量地址低字节
value_h 变量值高字节
value_l 变量值低字节
* @retval :
************************************************************************************/
void write_to_dwin(u8 addr_h, u8 addr_l, u8 value_h, u8 value_l)
{
u8 write_cmd[8] = {0x5A, 0xA5, 0x05, 0x82, addr_h, addr_l, value_h, value_l};
send_buffer(write_cmd, sizeof(write_cmd));
}
void writeu8_to_dwin(u16 addr, u8 data)
{
short_char_unioin m;
m.shortdata = addr;
write_to_dwin(m.chardata[1], m.chardata[0], 0x00, data);
}
void writeu16_to_dwin(u16 addr, u16 data)
{
short_char_unioin m;
m.shortdata = addr;
short_char_unioin n;
n.shortdata = data;
write_to_dwin(m.chardata[1], m.chardata[0], n.chardata[1], n.chardata[0]);
}
void writeu32_to_dwin(u16 addr, u32 data)
{
short_char_unioin m;
m.shortdata = addr;
int_char_unioin n;
n.intdata = data;
u8 write_cmd[10] = {0x5A, 0xA5, 0x07, 0x82, m.chardata[1], m.chardata[0], n.chardata[3], n.chardata[2], n.chardata[1], n.chardata[0]};
send_buffer(write_cmd, sizeof(write_cmd));
}
|