mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
feat(driver_twai): add api to get onchip hardware timing limit
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -11,22 +11,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief TWAI hardware-dependent bit-timing constant
|
||||
*
|
||||
* Used for calculating and checking bit-timing parameters
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t brp_min; /* Bit-rate prescaler */
|
||||
uint32_t brp_max;
|
||||
uint8_t prop_max; /* Propagation segment */
|
||||
uint8_t tseg1_min; /* Time segment 1 = prop_seg + phase_seg1 */
|
||||
uint8_t tseg1_max;
|
||||
uint8_t tseg2_min; /* Time segment 2 = phase_seg2 */
|
||||
uint8_t tseg2_max;
|
||||
uint8_t sjw_max; /* Synchronisation jump width */
|
||||
} twai_timing_constraint_t;
|
||||
|
||||
/**
|
||||
* @brief Calculate TWAI timing parameters for a given source frequency and baud rate.
|
||||
*
|
||||
@@ -40,7 +24,7 @@ typedef struct {
|
||||
* @param out_param Pointer to the output structure where the calculated timing parameters will be stored.
|
||||
* @return the actual hardware adopted baudrate.
|
||||
*/
|
||||
uint32_t twai_node_timing_calc_param(const uint32_t source_freq, const twai_timing_basic_config_t *in_param, const twai_timing_constraint_t *hw_limit, twai_timing_advanced_config_t *out_param);
|
||||
uint32_t twai_node_timing_calc_param(const uint32_t source_freq, const twai_timing_basic_config_t *in_param, const twai_timing_limits_t *hw_limit, twai_timing_advanced_config_t *out_param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -101,6 +101,15 @@ static inline twai_mask_filter_config_t twai_make_dual_filter(uint32_t id1, uint
|
||||
return dual_cfg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the hardware-dependent timing limits
|
||||
*
|
||||
* @param[in] is_fd True for FD data timing, false for classic timing
|
||||
* @param[out] timing_limits Pointer to timing limits structure
|
||||
* @return ESP_OK if successful, ESP_ERR_INVALID_ARG if invalid argument
|
||||
*/
|
||||
esp_err_t twai_node_onchip_get_timing_limits(bool is_fd, twai_timing_limits_t *timing_limits);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user