mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
feat(uart): add uart_detect_bitrate_bps API for data line bitrate measurement
Closes https://github.com/espressif/esp-idf/issues/14721
This commit is contained in:
@@ -29,9 +29,12 @@ extern "C" {
|
||||
// Get UART hardware instance with giving uart num
|
||||
#define UART_LL_GET_HW(num) (((num) == UART_NUM_0) ? (&UART0) : (&UART1))
|
||||
|
||||
#define UART_LL_WAKEUP_EDGE_THRED_MIN (3)
|
||||
#define UART_LL_PULSE_TICK_CNT_MAX UART_LOWPULSE_MIN_CNT_V
|
||||
|
||||
#define UART_LL_WAKEUP_EDGE_THRED_MIN (3)
|
||||
#define UART_LL_WAKEUP_EDGE_THRED_MAX(hw) UART_ACTIVE_THRESHOLD_V
|
||||
|
||||
#define UART_LL_INTR_MASK (0x7ffff) //All interrupt mask
|
||||
#define UART_LL_WAKEUP_EDGE_THRED_MAX(hw) UART_ACTIVE_THRESHOLD_V
|
||||
|
||||
#define UART_LL_FSM_IDLE (0x0)
|
||||
#define UART_LL_FSM_TX_WAIT_SEND (0xf)
|
||||
@@ -994,6 +997,67 @@ FORCE_INLINE_ATTR uint16_t uart_ll_max_tout_thrd(uart_dev_t *hw)
|
||||
return UART_RX_TOUT_THRHD_V;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the auto baudrate.
|
||||
*
|
||||
* @param hw Beginning address of the peripheral registers.
|
||||
* @param enable Boolean marking whether the auto baudrate should be enabled or not.
|
||||
*/
|
||||
FORCE_INLINE_ATTR void uart_ll_set_autobaud_en(uart_dev_t *hw, bool enable)
|
||||
{
|
||||
hw->conf0.autobaud_en = enable ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the RXD edge count.
|
||||
*
|
||||
* @param hw Beginning address of the peripheral registers.
|
||||
*/
|
||||
FORCE_INLINE_ATTR uint32_t uart_ll_get_rxd_edge_cnt(uart_dev_t *hw)
|
||||
{
|
||||
return hw->rxd_cnt.edge_cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the positive pulse minimum count.
|
||||
*
|
||||
* @param hw Beginning address of the peripheral registers.
|
||||
*/
|
||||
FORCE_INLINE_ATTR uint32_t uart_ll_get_pos_pulse_cnt(uart_dev_t *hw)
|
||||
{
|
||||
return hw->pospulse.min_cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the negative pulse minimum count.
|
||||
*
|
||||
* @param hw Beginning address of the peripheral registers.
|
||||
*/
|
||||
FORCE_INLINE_ATTR uint32_t uart_ll_get_neg_pulse_cnt(uart_dev_t *hw)
|
||||
{
|
||||
return hw->negpulse.min_cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the high pulse minimum count.
|
||||
*
|
||||
* @param hw Beginning address of the peripheral registers.
|
||||
*/
|
||||
FORCE_INLINE_ATTR uint32_t uart_ll_get_high_pulse_cnt(uart_dev_t *hw)
|
||||
{
|
||||
return hw->highpulse.min_cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the low pulse minimum count.
|
||||
*
|
||||
* @param hw Beginning address of the peripheral registers.
|
||||
*/
|
||||
FORCE_INLINE_ATTR uint32_t uart_ll_get_low_pulse_cnt(uart_dev_t *hw)
|
||||
{
|
||||
return hw->lowpulse.min_cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Force UART xoff.
|
||||
*
|
||||
|
Reference in New Issue
Block a user