备份-- ch438发送后添加延时

This commit is contained in:
王绪洁 2025-07-03 16:26:50 +08:00
parent a99c50e1d5
commit 10a615ff74
3 changed files with 4412 additions and 4413 deletions

View File

@ -198,7 +198,7 @@
<Ww> <Ww>
<count>9</count> <count>9</count>
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<ItemText>hart_uart,0x0A</ItemText> <ItemText>hart_uart,0x10</ItemText>
</Ww> </Ww>
<Ww> <Ww>
<count>10</count> <count>10</count>
@ -287,7 +287,7 @@
<periodic>1</periodic> <periodic>1</periodic>
<aLwin>1</aLwin> <aLwin>1</aLwin>
<aCover>0</aCover> <aCover>0</aCover>
<aSer1>0</aSer1> <aSer1>1</aSer1>
<aSer2>0</aSer2> <aSer2>0</aSer2>
<aPa>0</aPa> <aPa>0</aPa>
<viewmode>1</viewmode> <viewmode>1</viewmode>

File diff suppressed because it is too large Load Diff

View File

@ -262,8 +262,6 @@ void ch438_send_data(uint8_t uart_num, uint8_t *data, uint16_t len)
{ {
hart_ht1200m_rts_io_send(uart_num); hart_ht1200m_rts_io_send(uart_num);
uint8_t ch438_num = 0; uint8_t ch438_num = 0;
data[len] = 0xFF; // 因为发送数据RHART的RTS需要延时这里用多一个字节的发送来代替延时
data[len + 1] = 0x00; // 因为发送数据RHART的RTS需要延时这里用多两个字节的发送来代替延时
if (uart_num < 8) if (uart_num < 8)
{ {
ch438_num = CH438_CHIP0; ch438_num = CH438_CHIP0;
@ -273,8 +271,8 @@ void ch438_send_data(uint8_t uart_num, uint8_t *data, uint16_t len)
ch438_num = CH438_CHIP1; ch438_num = CH438_CHIP1;
uart_num -= 8; uart_num -= 8;
} }
// ch438_write_reg(ch438_num, offsetadd[uart_num] | REG_THR_ADDR, data[len], 1); HAL_Delay(2); // 等待CH438芯片准备好发送数据
for (uint8_t i = 0; i < len + 2; i++) for (uint8_t i = 0; i < len; i++)
{ {
ch438_write_reg(ch438_num, offsetadd[uart_num] | REG_THR_ADDR, data[i], 1); ch438_write_reg(ch438_num, offsetadd[uart_num] | REG_THR_ADDR, data[i], 1);
} }
@ -341,6 +339,7 @@ void ch438_interrupt_handler_ch438_chip_1(void)
case INT_NOINT: /* 没有中断 */ case INT_NOINT: /* 没有中断 */
break; break;
case INT_THR_EMPTY: /* THR空中断 */ case INT_THR_EMPTY: /* THR空中断 */
HAL_Delay(10);
hart_ht1200m_rts_io_receive(i); hart_ht1200m_rts_io_receive(i);
break; break;
// case INT_RCV_OVERTIME: /* 接收超时中断 */ // case INT_RCV_OVERTIME: /* 接收超时中断 */
@ -397,6 +396,7 @@ void ch438_interrupt_handler_ch438_chip_2(void)
case INT_NOINT: /* 没有中断 */ case INT_NOINT: /* 没有中断 */
break; break;
case INT_THR_EMPTY: /* THR空中断 */ case INT_THR_EMPTY: /* THR空中断 */
HAL_Delay(10);
hart_ht1200m_rts_io_receive(i); hart_ht1200m_rts_io_receive(i);
break; break;
// case INT_RCV_OVERTIME: /* 接收超时中断 */ // case INT_RCV_OVERTIME: /* 接收超时中断 */