Browse Source

485 수정

development^2
gudae01 2 months ago
parent
commit
73c54695a7
  1. 36
      r_cg_serial_user.c
  2. 6
      r_main.c

36
r_cg_serial_user.c

@ -156,6 +156,42 @@ static void __near r_uart0_interrupt_send(void)
static void r_uart0_callback_receiveend(void)
{
/* Start user code. Do not edit comment generated here */
uint8_t c = rs485_rx_buffer[rs485_rx_index];
if (g_rs485_bridge_active)
{
RS485_Bridge_Push(c);
g_rs485_bridge_seq++;
rs485_rx_index = 0;
rs485_rx_length = 0;
R_UART0_Receive((uint8_t *)&rs485_rx_buffer[0], 1);
return;
}
if (rs485_rx_index < (UART_RX_BUF_SIZE - 1))
{
rs485_rx_index++;
rs485_rx_length = rs485_rx_index;
}
else
{
rs485_rx_done = 1;
return;
}
if (c == '\r')
{
R_UART0_Receive((uint8_t *)&rs485_rx_buffer[rs485_rx_index], 1);
return;
}
if (c == '\n')
{
rs485_rx_done = 1;
return;
}
R_UART0_Receive((uint8_t *)&rs485_rx_buffer[rs485_rx_index], 1);
/* End user code. Do not edit comment generated here */
}

6
r_main.c

@ -349,13 +349,17 @@ static app_owi_result_t do_stable_owi_read(uint8_t id, uint8_t read_len)
app_owi_result_t r;
if (is_long_owi_read_len(read_len)) {
app_kick_wdt();
delay_us(OWI_LONG_READ_SETTLE_US);
app_kick_wdt();
}
r = app_owi_read_basic(id, (int)read_len);
if ((!r.ok || r.timeout || r.read_len < read_len) && is_long_owi_read_len(read_len)) {
app_kick_wdt();
delay_us(OWI_LONG_READ_RETRY_US);
app_kick_wdt();
r = app_owi_read_basic(id, (int)read_len);
}
@ -2297,4 +2301,4 @@ void R_MAIN_UserInit(void)
g_fixed_addr = DipSwitch_ReadAddr_0to31();
/* End user code. Do not edit comment generated here */
}
}

Loading…
Cancel
Save