Compare commits

...

2 Commits

Author SHA1 Message Date
Arseny Vakhrushev
6624e32477
Merge 2800a0bed5 into 3c99557eee 2024-09-15 12:46:38 +08:00
neoxic
2800a0bed5 Make RS485 mode switching functions consistent across all chips 2023-11-11 17:34:02 -08:00
5 changed files with 11 additions and 46 deletions

View File

@ -721,8 +721,6 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_rs485_app_ctrl(uart_dev_t *hw)
hw->conf0.irda_en = 0;
hw->conf0.sw_rts = 0;
hw->conf0.irda_en = 0;
hw->rs485_conf.dl0_en = 1;
hw->rs485_conf.dl1_en = 1;
hw->rs485_conf.en = 1;
}
@ -739,12 +737,9 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_rs485_half_duplex(uart_dev_t *hw)
hw->conf0.sw_rts = 1;
// Half duplex mode
hw->rs485_conf.tx_rx_en = 0;
// Setting this bit will allow data to be transmitted while receiving data(full-duplex mode).
// But note that this full-duplex mode has no conflict detection function
hw->rs485_conf.rx_busy_tx_en = 0;
// This is to void collision
hw->rs485_conf.rx_busy_tx_en = 1;
hw->conf0.irda_en = 0;
hw->rs485_conf.dl0_en = 1;
hw->rs485_conf.dl1_en = 1;
hw->rs485_conf.en = 1;
}
@ -762,8 +757,6 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_collision_detect(uart_dev_t *hw)
hw->rs485_conf.tx_rx_en = 1;
// Transmitter should send data when the receiver is busy,
hw->rs485_conf.rx_busy_tx_en = 1;
hw->rs485_conf.dl0_en = 1;
hw->rs485_conf.dl1_en = 1;
hw->conf0.sw_rts = 0;
hw->rs485_conf.en = 1;
}

View File

@ -724,8 +724,6 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_rs485_app_ctrl(uart_dev_t *hw)
hw->conf0.irda_en = 0;
hw->conf0.sw_rts = 0;
hw->conf0.irda_en = 0;
hw->rs485_conf.dl0_en = 1;
hw->rs485_conf.dl1_en = 1;
hw->rs485_conf.en = 1;
}
@ -740,14 +738,11 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_rs485_half_duplex(uart_dev_t *hw)
{
// Enable receiver, sw_rts = 1 generates low level on RTS pin
hw->conf0.sw_rts = 1;
// Half duplex mode
// Must be set to 0 to automatically remove echo
hw->rs485_conf.tx_rx_en = 0;
// Setting this bit will allow data to be transmitted while receiving data(full-duplex mode).
// But note that this full-duplex mode has no conflict detection function
hw->rs485_conf.rx_busy_tx_en = 0;
// This is to void collision
hw->rs485_conf.rx_busy_tx_en = 1;
hw->conf0.irda_en = 0;
hw->rs485_conf.dl0_en = 1;
hw->rs485_conf.dl1_en = 1;
hw->rs485_conf.en = 1;
}
@ -765,8 +760,6 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_collision_detect(uart_dev_t *hw)
hw->rs485_conf.tx_rx_en = 1;
// Transmitter should send data when the receiver is busy,
hw->rs485_conf.rx_busy_tx_en = 1;
hw->rs485_conf.dl0_en = 1;
hw->rs485_conf.dl1_en = 1;
hw->conf0.sw_rts = 0;
hw->rs485_conf.en = 1;
}

View File

@ -948,8 +948,6 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_rs485_app_ctrl(uart_dev_t *hw)
hw->conf0_sync.irda_en = 0;
hw->conf0_sync.sw_rts = 0;
hw->conf0_sync.irda_en = 0;
hw->rs485_conf_sync.dl0_en = 1;
hw->rs485_conf_sync.dl1_en = 1;
hw->rs485_conf_sync.rs485_en = 1;
uart_ll_update(hw);
}
@ -971,12 +969,9 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_rs485_half_duplex(uart_dev_t *hw)
hw->conf0_sync.sw_rts = 1;
// Half duplex mode
hw->rs485_conf_sync.rs485tx_rx_en = 0;
// Setting this bit will allow data to be transmitted while receiving data(full-duplex mode).
// But note that this full-duplex mode has no conflict detection function
hw->rs485_conf_sync.rs485rxby_tx_en = 0;
// This is to void collision
hw->rs485_conf_sync.rs485rxby_tx_en = 1;
hw->conf0_sync.irda_en = 0;
hw->rs485_conf_sync.dl0_en = 1;
hw->rs485_conf_sync.dl1_en = 1;
hw->rs485_conf_sync.rs485_en = 1;
uart_ll_update(hw);
}
@ -999,8 +994,6 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_collision_detect(uart_dev_t *hw)
hw->rs485_conf_sync.rs485tx_rx_en = 1;
// Transmitter should send data when the receiver is busy,
hw->rs485_conf_sync.rs485rxby_tx_en = 1;
hw->rs485_conf_sync.dl0_en = 1;
hw->rs485_conf_sync.dl1_en = 1;
hw->conf0_sync.sw_rts = 0;
hw->rs485_conf_sync.rs485_en = 1;
uart_ll_update(hw);

View File

@ -766,8 +766,6 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_rs485_app_ctrl(uart_dev_t *hw)
hw->conf0_sync.irda_en = 0;
hw->conf0_sync.sw_rts = 0;
hw->conf0_sync.irda_en = 0;
hw->rs485_conf_sync.dl0_en = 1;
hw->rs485_conf_sync.dl1_en = 1;
hw->rs485_conf_sync.rs485_en = 1;
uart_ll_update(hw);
}
@ -785,12 +783,9 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_rs485_half_duplex(uart_dev_t *hw)
hw->conf0_sync.sw_rts = 1;
// Half duplex mode
hw->rs485_conf_sync.rs485tx_rx_en = 0;
// Setting this bit will allow data to be transmitted while receiving data(full-duplex mode).
// But note that this full-duplex mode has no conflict detection function
hw->rs485_conf_sync.rs485rxby_tx_en = 0;
// This is to void collision
hw->rs485_conf_sync.rs485rxby_tx_en = 1;
hw->conf0_sync.irda_en = 0;
hw->rs485_conf_sync.dl0_en = 1;
hw->rs485_conf_sync.dl1_en = 1;
hw->rs485_conf_sync.rs485_en = 1;
uart_ll_update(hw);
}
@ -809,8 +804,6 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_collision_detect(uart_dev_t *hw)
hw->rs485_conf_sync.rs485tx_rx_en = 1;
// Transmitter should send data when the receiver is busy,
hw->rs485_conf_sync.rs485rxby_tx_en = 1;
hw->rs485_conf_sync.dl0_en = 1;
hw->rs485_conf_sync.dl1_en = 1;
hw->conf0_sync.sw_rts = 0;
hw->rs485_conf_sync.rs485_en = 1;
uart_ll_update(hw);

View File

@ -1081,8 +1081,6 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_rs485_app_ctrl(uart_dev_t *hw)
hw->conf0_sync.irda_en = 0;
hw->conf0_sync.sw_rts = 0;
hw->conf0_sync.irda_en = 0;
hw->rs485_conf_sync.dl0_en = 1;
hw->rs485_conf_sync.dl1_en = 1;
hw->rs485_conf_sync.rs485_en = 1;
uart_ll_update(hw);
}
@ -1104,12 +1102,9 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_rs485_half_duplex(uart_dev_t *hw)
hw->conf0_sync.sw_rts = 1;
// Half duplex mode
hw->rs485_conf_sync.rs485tx_rx_en = 0;
// Setting this bit will allow data to be transmitted while receiving data(full-duplex mode).
// But note that this full-duplex mode has no conflict detection function
hw->rs485_conf_sync.rs485rxby_tx_en = 0;
// This is to void collision
hw->rs485_conf_sync.rs485rxby_tx_en = 1;
hw->conf0_sync.irda_en = 0;
hw->rs485_conf_sync.dl0_en = 1;
hw->rs485_conf_sync.dl1_en = 1;
hw->rs485_conf_sync.rs485_en = 1;
uart_ll_update(hw);
}
@ -1132,8 +1127,6 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_collision_detect(uart_dev_t *hw)
hw->rs485_conf_sync.rs485tx_rx_en = 1;
// Transmitter should send data when the receiver is busy,
hw->rs485_conf_sync.rs485rxby_tx_en = 1;
hw->rs485_conf_sync.dl0_en = 1;
hw->rs485_conf_sync.dl1_en = 1;
hw->conf0_sync.sw_rts = 0;
hw->rs485_conf_sync.rs485_en = 1;
uart_ll_update(hw);