forked from espressif/arduino-esp32
Update IDF to 1c3dd23
* Update mDNS and LEDC * update toolchain * Update IDF to 1c3dd23 * Advertise the board variant for Arduino OTA * Add generic variant definition for mDNS
This commit is contained in:
@ -69,6 +69,13 @@ typedef enum {
|
||||
I2C_ADDR_BIT_MAX,
|
||||
} i2c_addr_mode_t;
|
||||
|
||||
typedef enum {
|
||||
I2C_MASTER_ACK = 0x0, /*!< I2C ack for each byte read */
|
||||
I2C_MASTER_NACK = 0x1, /*!< I2C nack for each byte read */
|
||||
I2C_MASTER_LAST_NACK = 0x2, /*!< I2C nack for the last byte*/
|
||||
I2C_MASTER_ACK_MAX,
|
||||
} i2c_ack_type_t;
|
||||
|
||||
/**
|
||||
* @brief I2C initialization parameters
|
||||
*/
|
||||
@ -288,7 +295,7 @@ esp_err_t i2c_master_write(i2c_cmd_handle_t cmd_handle, uint8_t* data, size_t da
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t i2c_master_read_byte(i2c_cmd_handle_t cmd_handle, uint8_t* data, int ack);
|
||||
esp_err_t i2c_master_read_byte(i2c_cmd_handle_t cmd_handle, uint8_t* data, i2c_ack_type_t ack);
|
||||
|
||||
/**
|
||||
* @brief Queue command for I2C master to read data from I2C bus
|
||||
@ -305,7 +312,7 @@ esp_err_t i2c_master_read_byte(i2c_cmd_handle_t cmd_handle, uint8_t* data, int a
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t i2c_master_read(i2c_cmd_handle_t cmd_handle, uint8_t* data, size_t data_len, int ack);
|
||||
esp_err_t i2c_master_read(i2c_cmd_handle_t cmd_handle, uint8_t* data, size_t data_len, i2c_ack_type_t ack);
|
||||
|
||||
/**
|
||||
* @brief Queue command for I2C master to generate a stop signal
|
||||
|
@ -30,7 +30,7 @@ extern "C" {
|
||||
|
||||
typedef enum {
|
||||
LEDC_HIGH_SPEED_MODE = 0, /*!< LEDC high speed speed_mode */
|
||||
LEDC_LOW_SPEED_MODE, /*!< LEDC low speed speed_mode */
|
||||
LEDC_LOW_SPEED_MODE, /*!< LEDC low speed speed_mode */
|
||||
LEDC_SPEED_MODE_MAX, /*!< LEDC speed limit */
|
||||
} ledc_mode_t;
|
||||
|
||||
@ -45,15 +45,15 @@ typedef enum {
|
||||
} ledc_duty_direction_t;
|
||||
|
||||
typedef enum {
|
||||
LEDC_REF_TICK = 0, /*!< LEDC timer clock divided from reference tick(1Mhz) */
|
||||
LEDC_APB_CLK, /*!< LEDC timer clock divided from APB clock(80Mhz)*/
|
||||
LEDC_REF_TICK = 0, /*!< LEDC timer clock divided from reference tick (1Mhz) */
|
||||
LEDC_APB_CLK, /*!< LEDC timer clock divided from APB clock (80Mhz) */
|
||||
} ledc_clk_src_t;
|
||||
|
||||
typedef enum {
|
||||
LEDC_TIMER_0 = 0, /*!< LEDC source timer TIMER0 */
|
||||
LEDC_TIMER_1, /*!< LEDC source timer TIMER1 */
|
||||
LEDC_TIMER_2, /*!< LEDC source timer TIMER2 */
|
||||
LEDC_TIMER_3, /*!< LEDC source timer TIMER3 */
|
||||
LEDC_TIMER_0 = 0, /*!< LEDC timer 0 */
|
||||
LEDC_TIMER_1, /*!< LEDC timer 1 */
|
||||
LEDC_TIMER_2, /*!< LEDC timer 2 */
|
||||
LEDC_TIMER_3, /*!< LEDC timer 3 */
|
||||
} ledc_timer_t;
|
||||
|
||||
typedef enum {
|
||||
@ -69,46 +69,50 @@ typedef enum {
|
||||
} ledc_channel_t;
|
||||
|
||||
typedef enum {
|
||||
LEDC_TIMER_10_BIT = 10, /*!< LEDC PWM depth 10Bit */
|
||||
LEDC_TIMER_11_BIT = 11, /*!< LEDC PWM depth 11Bit */
|
||||
LEDC_TIMER_12_BIT = 12, /*!< LEDC PWM depth 12Bit */
|
||||
LEDC_TIMER_13_BIT = 13, /*!< LEDC PWM depth 13Bit */
|
||||
LEDC_TIMER_14_BIT = 14, /*!< LEDC PWM depth 14Bit */
|
||||
LEDC_TIMER_15_BIT = 15, /*!< LEDC PWM depth 15Bit */
|
||||
LEDC_TIMER_10_BIT = 10, /*!< LEDC PWM duty resolution of 10 bits */
|
||||
LEDC_TIMER_11_BIT = 11, /*!< LEDC PWM duty resolution of 11 bits */
|
||||
LEDC_TIMER_12_BIT = 12, /*!< LEDC PWM duty resolution of 12 bits */
|
||||
LEDC_TIMER_13_BIT = 13, /*!< LEDC PWM duty resolution of 13 bits */
|
||||
LEDC_TIMER_14_BIT = 14, /*!< LEDC PWM duty resolution of 14 bits */
|
||||
LEDC_TIMER_15_BIT = 15, /*!< LEDC PWM duty resolution of 15 bits */
|
||||
} ledc_timer_bit_t;
|
||||
|
||||
typedef enum {
|
||||
LEDC_FADE_NO_WAIT = 0, /*!< LEDC fade function will return immediately */
|
||||
LEDC_FADE_WAIT_DONE, /*!< LEDC fade function will block until fading to the target duty*/
|
||||
LEDC_FADE_WAIT_DONE, /*!< LEDC fade function will block until fading to the target duty */
|
||||
LEDC_FADE_MAX,
|
||||
} ledc_fade_mode_t;
|
||||
|
||||
/**
|
||||
* @brief Configuration parameters of LEDC channel for ledc_channel_config function
|
||||
*/
|
||||
typedef struct {
|
||||
int gpio_num; /*!< the LEDC output gpio_num, if you want to use gpio16, gpio_num = 16*/
|
||||
ledc_mode_t speed_mode; /*!< LEDC speed speed_mode, high-speed mode or low-speed mode*/
|
||||
ledc_channel_t channel; /*!< LEDC channel(0 - 7)*/
|
||||
ledc_intr_type_t intr_type; /*!< configure interrupt, Fade interrupt enable or Fade interrupt disable*/
|
||||
ledc_timer_t timer_sel; /*!< Select the timer source of channel (0 - 3)*/
|
||||
uint32_t duty; /*!< LEDC channel duty, the duty range is [0, (2**bit_num) - 1], */
|
||||
int gpio_num; /*!< the LEDC output gpio_num, if you want to use gpio16, gpio_num = 16 */
|
||||
ledc_mode_t speed_mode; /*!< LEDC speed speed_mode, high-speed mode or low-speed mode */
|
||||
ledc_channel_t channel; /*!< LEDC channel (0 - 7) */
|
||||
ledc_intr_type_t intr_type; /*!< configure interrupt, Fade interrupt enable or Fade interrupt disable */
|
||||
ledc_timer_t timer_sel; /*!< Select the timer source of channel (0 - 3) */
|
||||
uint32_t duty; /*!< LEDC channel duty, the range of duty setting is [0, (2**duty_resolution) - 1] */
|
||||
} ledc_channel_config_t;
|
||||
|
||||
/**
|
||||
* @brief Configuration parameters of LEDC Timer timer for ledc_timer_config function
|
||||
*/
|
||||
typedef struct {
|
||||
ledc_mode_t speed_mode; /*!< LEDC speed speed_mode, high-speed mode or low-speed mode*/
|
||||
ledc_timer_bit_t bit_num; /*!< LEDC channel duty depth*/
|
||||
ledc_timer_t timer_num; /*!< The timer source of channel (0 - 3)*/
|
||||
uint32_t freq_hz; /*!< LEDC timer frequency(Hz)*/
|
||||
ledc_mode_t speed_mode; /*!< LEDC speed speed_mode, high-speed mode or low-speed mode */
|
||||
union {
|
||||
ledc_timer_bit_t duty_resolution; /*!< LEDC channel duty resolution */
|
||||
ledc_timer_bit_t bit_num __attribute__((deprecated)); /*!< Deprecated in ESP-IDF 3.0. This is an alias to 'duty_resolution' for backward compatibility with ESP-IDF 2.1 */
|
||||
};
|
||||
ledc_timer_t timer_num; /*!< The timer source of channel (0 - 3) */
|
||||
uint32_t freq_hz; /*!< LEDC timer frequency (Hz) */
|
||||
} ledc_timer_config_t;
|
||||
|
||||
typedef intr_handle_t ledc_isr_handle_t;
|
||||
|
||||
/**
|
||||
* @brief LEDC channel configuration
|
||||
* Configure LEDC channel with the given channel/output gpio_num/interrupt/source timer/frequency(Hz)/LEDC depth
|
||||
* Configure LEDC channel with the given channel/output gpio_num/interrupt/source timer/frequency(Hz)/LEDC duty resolution
|
||||
*
|
||||
* @param ledc_conf Pointer of LEDC channel configure struct
|
||||
*
|
||||
@ -120,14 +124,14 @@ esp_err_t ledc_channel_config(const ledc_channel_config_t* ledc_conf);
|
||||
|
||||
/**
|
||||
* @brief LEDC timer configuration
|
||||
* Configure LEDC timer with the given source timer/frequency(Hz)/bit_num
|
||||
* Configure LEDC timer with the given source timer/frequency(Hz)/duty_resolution
|
||||
*
|
||||
* @param timer_conf Pointer of LEDC timer configure struct
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
* - ESP_FAIL Can not find a proper pre-divider number base on the given frequency and the current bit_num.
|
||||
* - ESP_FAIL Can not find a proper pre-divider number base on the given frequency and the current duty_resolution.
|
||||
*/
|
||||
esp_err_t ledc_timer_config(const ledc_timer_config_t* timer_conf);
|
||||
|
||||
@ -137,7 +141,7 @@ esp_err_t ledc_timer_config(const ledc_timer_config_t* timer_conf);
|
||||
* After ledc_set_duty, ledc_set_fade, we need to call this function to update the settings.
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode,
|
||||
* @param channel LEDC channel(0-7), select from ledc_channel_t
|
||||
* @param channel LEDC channel (0-7), select from ledc_channel_t
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
@ -151,7 +155,7 @@ esp_err_t ledc_update_duty(ledc_mode_t speed_mode, ledc_channel_t channel);
|
||||
* Disable LEDC output, and set idle level
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode
|
||||
* @param channel LEDC channel(0-7), select from ledc_channel_t
|
||||
* @param channel LEDC channel (0-7), select from ledc_channel_t
|
||||
* @param idle_level Set output idle level after LEDC stops.
|
||||
*
|
||||
* @return
|
||||
@ -161,24 +165,24 @@ esp_err_t ledc_update_duty(ledc_mode_t speed_mode, ledc_channel_t channel);
|
||||
esp_err_t ledc_stop(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t idle_level);
|
||||
|
||||
/**
|
||||
* @brief LEDC set channel frequency(Hz)
|
||||
* @brief LEDC set channel frequency (Hz)
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode
|
||||
* @param timer_num LEDC timer index(0-3), select from ledc_timer_t
|
||||
* @param timer_num LEDC timer index (0-3), select from ledc_timer_t
|
||||
* @param freq_hz Set the LEDC frequency
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
* - ESP_FAIL Can not find a proper pre-divider number base on the given frequency and the current bit_num.
|
||||
* - ESP_FAIL Can not find a proper pre-divider number base on the given frequency and the current duty_resolution.
|
||||
*/
|
||||
esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_timer_t timer_num, uint32_t freq_hz);
|
||||
|
||||
/**
|
||||
* @brief LEDC get channel frequency(Hz)
|
||||
* @brief LEDC get channel frequency (Hz)
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode
|
||||
* @param timer_num LEDC timer index(0-3), select from ledc_timer_t
|
||||
* @param timer_num LEDC timer index (0-3), select from ledc_timer_t
|
||||
*
|
||||
* @return
|
||||
* - 0 error
|
||||
@ -191,8 +195,8 @@ uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_timer_t timer_num);
|
||||
* Only after calling ledc_update_duty will the duty update.
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode
|
||||
* @param channel LEDC channel(0-7), select from ledc_channel_t
|
||||
* @param duty Set the LEDC duty, the duty range is [0, (2**bit_num) - 1]
|
||||
* @param channel LEDC channel (0-7), select from ledc_channel_t
|
||||
* @param duty Set the LEDC duty, the range of duty setting is [0, (2**duty_resolution) - 1]
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
@ -204,7 +208,7 @@ esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t
|
||||
* @brief LEDC get duty
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode
|
||||
* @param channel LEDC channel(0-7), select from ledc_channel_t
|
||||
* @param channel LEDC channel (0-7), select from ledc_channel_t
|
||||
*
|
||||
* @return
|
||||
* - LEDC_ERR_DUTY if parameter error
|
||||
@ -217,8 +221,8 @@ uint32_t ledc_get_duty(ledc_mode_t speed_mode, ledc_channel_t channel);
|
||||
* Set LEDC gradient, After the function calls the ledc_update_duty function, the function can take effect.
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode
|
||||
* @param channel LEDC channel(0-7), select from ledc_channel_t
|
||||
* @param duty Set the start of the gradient duty, the duty range is [0, (2**bit_num) - 1]
|
||||
* @param channel LEDC channel (0-7), select from ledc_channel_t
|
||||
* @param duty Set the start of the gradient duty, the range of duty setting is [0, (2**duty_resolution) - 1]
|
||||
* @param gradule_direction Set the direction of the gradient
|
||||
* @param step_num Set the number of the gradient
|
||||
* @param duty_cyle_num Set how many LEDC tick each time the gradient lasts
|
||||
@ -253,22 +257,22 @@ esp_err_t ledc_isr_register(void (*fn)(void*), void * arg, int intr_alloc_flags,
|
||||
* @brief Configure LEDC settings
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode
|
||||
* @param timer_sel Timer index(0-3), there are 4 timers in LEDC module
|
||||
* @param div_num Timer clock divide number, the timer clock is divided from the selected clock source
|
||||
* @param bit_num The count number of one period, counter range is 0 ~ ((2 ** bit_num) - 1)
|
||||
* @param timer_sel Timer index (0-3), there are 4 timers in LEDC module
|
||||
* @param clock_divider Timer clock divide value, the timer clock is divided from the selected clock source
|
||||
* @param duty_resolution Resolution of duty setting in number of bits. The range of duty values is [0, (2**duty_resolution) - 1]
|
||||
* @param clk_src Select LEDC source clock.
|
||||
*
|
||||
* @return
|
||||
* - (-1) Parameter error
|
||||
* - Other Current LEDC duty
|
||||
*/
|
||||
esp_err_t ledc_timer_set(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t div_num, uint32_t bit_num, ledc_clk_src_t clk_src);
|
||||
esp_err_t ledc_timer_set(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t clock_divider, uint32_t duty_resolution, ledc_clk_src_t clk_src);
|
||||
|
||||
/**
|
||||
* @brief Reset LEDC timer
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode
|
||||
* @param timer_sel LEDC timer index(0-3), select from ledc_timer_t
|
||||
* @param timer_sel LEDC timer index (0-3), select from ledc_timer_t
|
||||
*
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
@ -280,7 +284,7 @@ esp_err_t ledc_timer_rst(ledc_mode_t speed_mode, uint32_t timer_sel);
|
||||
* @brief Pause LEDC timer counter
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode
|
||||
* @param timer_sel LEDC timer index(0-3), select from ledc_timer_t
|
||||
* @param timer_sel LEDC timer index (0-3), select from ledc_timer_t
|
||||
*
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
@ -293,7 +297,7 @@ esp_err_t ledc_timer_pause(ledc_mode_t speed_mode, uint32_t timer_sel);
|
||||
* @brief Resume LEDC timer
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode
|
||||
* @param timer_sel LEDC timer index(0-3), select from ledc_timer_t
|
||||
* @param timer_sel LEDC timer index (0-3), select from ledc_timer_t
|
||||
*
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
@ -305,8 +309,8 @@ esp_err_t ledc_timer_resume(ledc_mode_t speed_mode, uint32_t timer_sel);
|
||||
* @brief Bind LEDC channel with the selected timer
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode
|
||||
* @param channel LEDC channel index(0-7), select from ledc_channel_t
|
||||
* @param timer_idx LEDC timer index(0-3), select from ledc_timer_t
|
||||
* @param channel LEDC channel index (0-7), select from ledc_channel_t
|
||||
* @param timer_idx LEDC timer index (0-3), select from ledc_timer_t
|
||||
*
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
@ -319,8 +323,8 @@ esp_err_t ledc_bind_channel_timer(ledc_mode_t speed_mode, uint32_t channel, uint
|
||||
* Call ledc_fade_start() after this to start fading.
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode,
|
||||
* @param channel LEDC channel index(0-7), select from ledc_channel_t
|
||||
* @param target_duty Target duty of fading.( 0 - (2 ** bit_num - 1)))
|
||||
* @param channel LEDC channel index (0-7), select from ledc_channel_t
|
||||
* @param target_duty Target duty of fading [0, (2**duty_resolution) - 1]
|
||||
* @param scale Controls the increase or decrease step scale.
|
||||
* @param cycle_num increase or decrease the duty every cycle_num cycles
|
||||
*
|
||||
@ -337,8 +341,8 @@ esp_err_t ledc_set_fade_with_step(ledc_mode_t speed_mode, ledc_channel_t channel
|
||||
* Call ledc_fade_start() after this to start fading.
|
||||
*
|
||||
* @param speed_mode Select the LEDC speed_mode, high-speed mode and low-speed mode,
|
||||
* @param channel LEDC channel index(0-7), select from ledc_channel_t
|
||||
* @param target_duty Target duty of fading.( 0 - (2 ** bit_num - 1)))
|
||||
* @param channel LEDC channel index (0-7), select from ledc_channel_t
|
||||
* @param target_duty Target duty of fading.( 0 - (2 ** duty_resolution - 1)))
|
||||
* @param max_fade_time_ms The maximum time of the fading ( ms ).
|
||||
*
|
||||
* @return
|
||||
|
@ -33,14 +33,14 @@ extern "C" {
|
||||
#define RMT_MEM_ITEM_NUM (RMT_MEM_BLOCK_BYTE_NUM/4)
|
||||
|
||||
typedef enum {
|
||||
RMT_CHANNEL_0=0, /*!< RMT Channel0 */
|
||||
RMT_CHANNEL_1, /*!< RMT Channel1 */
|
||||
RMT_CHANNEL_2, /*!< RMT Channel2 */
|
||||
RMT_CHANNEL_3, /*!< RMT Channel3 */
|
||||
RMT_CHANNEL_4, /*!< RMT Channel4 */
|
||||
RMT_CHANNEL_5, /*!< RMT Channel5 */
|
||||
RMT_CHANNEL_6, /*!< RMT Channel6 */
|
||||
RMT_CHANNEL_7, /*!< RMT Channel7 */
|
||||
RMT_CHANNEL_0 = 0, /*!< RMT Channel 0 */
|
||||
RMT_CHANNEL_1, /*!< RMT Channel 1 */
|
||||
RMT_CHANNEL_2, /*!< RMT Channel 2 */
|
||||
RMT_CHANNEL_3, /*!< RMT Channel 3 */
|
||||
RMT_CHANNEL_4, /*!< RMT Channel 4 */
|
||||
RMT_CHANNEL_5, /*!< RMT Channel 5 */
|
||||
RMT_CHANNEL_6, /*!< RMT Channel 6 */
|
||||
RMT_CHANNEL_7, /*!< RMT Channel 7 */
|
||||
RMT_CHANNEL_MAX
|
||||
} rmt_channel_t;
|
||||
|
||||
@ -51,7 +51,7 @@ typedef enum {
|
||||
}rmt_mem_owner_t;
|
||||
|
||||
typedef enum {
|
||||
RMT_BASECLK_REF = 0, /*!< RMT source clock system reference tick, 1MHz by default(Not supported in this version) */
|
||||
RMT_BASECLK_REF = 0, /*!< RMT source clock system reference tick, 1MHz by default (not supported in this version) */
|
||||
RMT_BASECLK_APB, /*!< RMT source clock is APB CLK, 80Mhz by default */
|
||||
RMT_BASECLK_MAX,
|
||||
} rmt_source_clk_t;
|
||||
@ -63,20 +63,20 @@ typedef enum {
|
||||
} rmt_data_mode_t;
|
||||
|
||||
typedef enum {
|
||||
RMT_MODE_TX=0, /*!< RMT TX mode */
|
||||
RMT_MODE_RX, /*!< RMT RX mode */
|
||||
RMT_MODE_TX = 0, /*!< RMT TX mode */
|
||||
RMT_MODE_RX, /*!< RMT RX mode */
|
||||
RMT_MODE_MAX
|
||||
} rmt_mode_t;
|
||||
|
||||
typedef enum {
|
||||
RMT_IDLE_LEVEL_LOW=0, /*!< RMT TX idle level: low Level */
|
||||
RMT_IDLE_LEVEL_HIGH, /*!< RMT TX idle level: high Level */
|
||||
RMT_IDLE_LEVEL_LOW = 0, /*!< RMT TX idle level: low Level */
|
||||
RMT_IDLE_LEVEL_HIGH, /*!< RMT TX idle level: high Level */
|
||||
RMT_IDLE_LEVEL_MAX,
|
||||
} rmt_idle_level_t;
|
||||
|
||||
typedef enum {
|
||||
RMT_CARRIER_LEVEL_LOW=0, /*!< RMT carrier wave is modulated for low Level output */
|
||||
RMT_CARRIER_LEVEL_HIGH, /*!< RMT carrier wave is modulated for high Level output */
|
||||
RMT_CARRIER_LEVEL_LOW = 0, /*!< RMT carrier wave is modulated for low Level output */
|
||||
RMT_CARRIER_LEVEL_HIGH, /*!< RMT carrier wave is modulated for high Level output */
|
||||
RMT_CARRIER_LEVEL_MAX
|
||||
} rmt_carrier_level_t;
|
||||
|
||||
@ -84,21 +84,21 @@ typedef enum {
|
||||
* @brief Data struct of RMT TX configure parameters
|
||||
*/
|
||||
typedef struct {
|
||||
bool loop_en; /*!< RMT loop output mode*/
|
||||
bool loop_en; /*!< Enable sending RMT items in a loop */
|
||||
uint32_t carrier_freq_hz; /*!< RMT carrier frequency */
|
||||
uint8_t carrier_duty_percent; /*!< RMT carrier duty (%) */
|
||||
rmt_carrier_level_t carrier_level; /*!< RMT carrier level */
|
||||
rmt_carrier_level_t carrier_level; /*!< Level of the RMT output, when the carrier is applied */
|
||||
bool carrier_en; /*!< RMT carrier enable */
|
||||
rmt_idle_level_t idle_level; /*!< RMT idle level */
|
||||
bool idle_output_en; /*!< RMT idle level output enable*/
|
||||
bool idle_output_en; /*!< RMT idle level output enable */
|
||||
}rmt_tx_config_t;
|
||||
|
||||
/**
|
||||
* @brief Data struct of RMT RX configure parameters
|
||||
*/
|
||||
typedef struct {
|
||||
bool filter_en; /*!< RMT receiver filer enable*/
|
||||
uint8_t filter_ticks_thresh; /*!< RMT filter tick number */
|
||||
bool filter_en; /*!< RMT receiver filter enable */
|
||||
uint8_t filter_ticks_thresh; /*!< RMT filter tick number */
|
||||
uint16_t idle_threshold; /*!< RMT RX idle threshold */
|
||||
}rmt_rx_config_t;
|
||||
|
||||
@ -119,6 +119,16 @@ typedef struct {
|
||||
|
||||
typedef intr_handle_t rmt_isr_handle_t;
|
||||
|
||||
typedef void (*rmt_tx_end_fn_t)(rmt_channel_t channel, void *arg);
|
||||
|
||||
/**
|
||||
* @brief Structure encapsulating a RMT TX end callback
|
||||
*/
|
||||
typedef struct {
|
||||
rmt_tx_end_fn_t function; /*!< Function which is called on RMT TX end */
|
||||
void *arg; /*!< Optional argument passed to function */
|
||||
} rmt_tx_end_callback_t;
|
||||
|
||||
/**
|
||||
* @brief Set RMT clock divider, channel clock is divided from source clock.
|
||||
*
|
||||
@ -186,14 +196,16 @@ esp_err_t rmt_get_rx_idle_thresh(rmt_channel_t channel, uint16_t *thresh);
|
||||
* The 8 channels share a 512x32-bit RAM block which can be read and written
|
||||
* by the processor cores over the APB bus, as well as read by the transmitters
|
||||
* and written by the receivers.
|
||||
*
|
||||
* The RAM address range for channel n is start_addr_CHn to end_addr_CHn, which are defined by:
|
||||
* Memory block start address is RMT_CHANNEL_MEM(n) (in soc/rmt_reg.h),
|
||||
* that is, start_addr_chn = RMT base address + 0x800 + 64 ∗ 4 ∗ n, and
|
||||
* end_addr_chn = RMT base address + 0x800 + 64 ∗ 4 ∗ n + 64 ∗ 4 ∗ RMT_MEM_SIZE_CHn mod 512 ∗ 4
|
||||
*
|
||||
* @note
|
||||
* If memory block number of one channel is set to a value greater than 1, this channel will occupy the memory
|
||||
* block of the next channel.
|
||||
* Channel0 can use at most 8 blocks of memory, accordingly channel7 can only use one memory block.
|
||||
* Channel 0 can use at most 8 blocks of memory, accordingly channel 7 can only use one memory block.
|
||||
*
|
||||
* @param channel RMT channel (0-7)
|
||||
*
|
||||
@ -232,11 +244,9 @@ esp_err_t rmt_get_mem_block_num(rmt_channel_t channel, uint8_t* rmt_mem_num);
|
||||
*
|
||||
* @param low_level Low level duration of carrier.
|
||||
*
|
||||
* @param carrier_level Configure the way carrier wave is modulated for channel0-7.
|
||||
*
|
||||
* 1'b1:transmit on low output level
|
||||
*
|
||||
* 1'b0:transmit on high output level
|
||||
* @param carrier_level Configure the way carrier wave is modulated for channel 0-7.
|
||||
* - 1'b1:transmit on low output level
|
||||
* - 1'b0:transmit on high output level
|
||||
*
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
@ -278,7 +288,7 @@ esp_err_t rmt_get_mem_pd(rmt_channel_t channel, bool* pd_en);
|
||||
* @param channel RMT channel (0-7)
|
||||
*
|
||||
* @param tx_idx_rst Set true to reset memory index for TX.
|
||||
* Otherwise, transmitter will continue sending from the last index in memory.
|
||||
* Otherwise, transmitter will continue sending from the last index in memory.
|
||||
*
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
@ -364,10 +374,9 @@ esp_err_t rmt_get_memory_owner(rmt_channel_t channel, rmt_mem_owner_t* owner);
|
||||
*
|
||||
* @param channel RMT channel (0-7)
|
||||
*
|
||||
* @param loop_en To enable RMT transmitter loop sending mode.
|
||||
*
|
||||
* @param loop_en Enable RMT transmitter loop sending mode.
|
||||
* If set true, transmitter will continue sending from the first data
|
||||
* to the last data in channel0-7 again and again.
|
||||
* to the last data in channel 0-7 over and over again in a loop.
|
||||
*
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
@ -391,7 +400,7 @@ esp_err_t rmt_get_tx_loop_mode(rmt_channel_t channel, bool* loop_en);
|
||||
/**
|
||||
* @brief Set RMT RX filter.
|
||||
*
|
||||
* In receive mode, channel0-7 will ignore input pulse when the pulse width is smaller than threshold.
|
||||
* In receive mode, channel 0-7 will ignore input pulse when the pulse width is smaller than threshold.
|
||||
* Counted in source clock, not divided counter clock.
|
||||
*
|
||||
* @param channel RMT channel (0-7)
|
||||
@ -409,9 +418,9 @@ esp_err_t rmt_set_rx_filter(rmt_channel_t channel, bool rx_filter_en, uint8_t th
|
||||
/**
|
||||
* @brief Set RMT source clock
|
||||
*
|
||||
* RMT module has two source clock:
|
||||
* RMT module has two clock sources:
|
||||
* 1. APB clock which is 80Mhz
|
||||
* 2. REF tick clock, which would be 1Mhz( not supported in this version).
|
||||
* 2. REF tick clock, which would be 1Mhz (not supported in this version).
|
||||
*
|
||||
* @param channel RMT channel (0-7)
|
||||
*
|
||||
@ -426,9 +435,9 @@ esp_err_t rmt_set_source_clk(rmt_channel_t channel, rmt_source_clk_t base_clk);
|
||||
/**
|
||||
* @brief Get RMT source clock
|
||||
*
|
||||
* RMT module has two source clock:
|
||||
* RMT module has two clock sources:
|
||||
* 1. APB clock which is 80Mhz
|
||||
* 2. REF tick clock, which would be 1Mhz( not supported in this version).
|
||||
* 2. REF tick clock, which would be 1Mhz (not supported in this version).
|
||||
*
|
||||
* @param channel RMT channel (0-7)
|
||||
*
|
||||
@ -447,7 +456,7 @@ esp_err_t rmt_get_source_clk(rmt_channel_t channel, rmt_source_clk_t* src_clk);
|
||||
*
|
||||
* @param idle_out_en To enable idle level output.
|
||||
*
|
||||
* @param level To set the output signal's level for channel0-7 in idle state.
|
||||
* @param level To set the output signal's level for channel 0-7 in idle state.
|
||||
*
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
@ -526,7 +535,7 @@ esp_err_t rmt_set_tx_intr_en(rmt_channel_t channel, bool en);
|
||||
/**
|
||||
* @brief Set RMT TX threshold event interrupt enable
|
||||
*
|
||||
* Causes an interrupt when a threshold number of items have been transmitted.
|
||||
* An interrupt will be triggered when the number of transmitted items reaches the threshold value
|
||||
*
|
||||
* @param channel RMT channel (0 - 7)
|
||||
*
|
||||
@ -541,7 +550,7 @@ esp_err_t rmt_set_tx_intr_en(rmt_channel_t channel, bool en);
|
||||
esp_err_t rmt_set_tx_thr_intr_en(rmt_channel_t channel, bool en, uint16_t evt_thresh);
|
||||
|
||||
/**
|
||||
* @brief Set RMT pins
|
||||
* @brief Set RMT pin
|
||||
*
|
||||
* @param channel RMT channel (0 - 7)
|
||||
*
|
||||
@ -558,7 +567,7 @@ esp_err_t rmt_set_pin(rmt_channel_t channel, rmt_mode_t mode, gpio_num_t gpio_nu
|
||||
/**
|
||||
* @brief Configure RMT parameters
|
||||
*
|
||||
* @param rmt_param RMT parameter structor
|
||||
* @param rmt_param RMT parameter struct
|
||||
*
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
@ -567,17 +576,18 @@ esp_err_t rmt_set_pin(rmt_channel_t channel, rmt_mode_t mode, gpio_num_t gpio_nu
|
||||
esp_err_t rmt_config(const rmt_config_t* rmt_param);
|
||||
|
||||
/**
|
||||
* @brief register RMT interrupt handler, the handler is an ISR.
|
||||
* @brief Register RMT interrupt handler, the handler is an ISR.
|
||||
*
|
||||
* The handler will be attached to the same CPU core that this function is running on.
|
||||
* @note If you already called rmt_driver_install to use system RMT driver,
|
||||
* please do not register ISR handler again.
|
||||
* The handler will be attached to the same CPU core that this function is running on.
|
||||
*
|
||||
* @note If you already called rmt_driver_install to use system RMT driver,
|
||||
* please do not register ISR handler again.
|
||||
*
|
||||
* @param fn Interrupt handler function.
|
||||
* @param arg Parameter for handler function
|
||||
* @param intr_alloc_flags Flags used to allocate the interrupt. One or multiple (ORred)
|
||||
* ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info.
|
||||
* @param handle If non-zero, a handle to later clean up the ISR gets stored here.
|
||||
* @param arg Parameter for the handler function
|
||||
* @param intr_alloc_flags Flags used to allocate the interrupt. One or multiple (ORred)
|
||||
* ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info.
|
||||
* @param handle If non-zero, a handle to later clean up the ISR gets stored here.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
@ -653,18 +663,18 @@ esp_err_t rmt_driver_uninstall(rmt_channel_t channel);
|
||||
*
|
||||
* @param item_num RMT data item number.
|
||||
*
|
||||
* @param wait_tx_done If set 1, it will block the task and wait for sending done.
|
||||
* @param wait_tx_done
|
||||
* - If set 1, it will block the task and wait for sending done.
|
||||
* - If set 0, it will not wait and return immediately.
|
||||
*
|
||||
* If set 0, it will not wait and return immediately.
|
||||
*
|
||||
* @note
|
||||
* This function will not copy data, instead, it will point to the original items,
|
||||
* and send the waveform items.
|
||||
* If wait_tx_done is set to true, this function will block and will not return until
|
||||
* all items have been sent out.
|
||||
* If wait_tx_done is set to false, this function will return immediately, and the driver
|
||||
* interrupt will continue sending the items. We must make sure the item data will not be
|
||||
* damaged when the driver is still sending items in driver interrupt.
|
||||
* @note
|
||||
* This function will not copy data, instead, it will point to the original items,
|
||||
* and send the waveform items.
|
||||
* If wait_tx_done is set to true, this function will block and will not return until
|
||||
* all items have been sent out.
|
||||
* If wait_tx_done is set to false, this function will return immediately, and the driver
|
||||
* interrupt will continue sending the items. We must make sure the item data will not be
|
||||
* damaged when the driver is still sending items in driver interrupt.
|
||||
*
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
@ -677,24 +687,24 @@ esp_err_t rmt_write_items(rmt_channel_t channel, const rmt_item32_t* rmt_item, i
|
||||
*
|
||||
* @param channel RMT channel (0 - 7)
|
||||
*
|
||||
* @param wait_time Maximum time to wait for transmission to be complete
|
||||
* @param wait_time Maximum time in ticks to wait for transmission to be complete
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK RMT Tx done successfully
|
||||
* - ESP_ERR_TIMEOUT Crossed the 'wait_time' given
|
||||
* - ESP_ERR_TIMEOUT Exceeded the 'wait_time' given
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
* - ESP_FAIL Driver not installed
|
||||
*/
|
||||
esp_err_t rmt_wait_tx_done(rmt_channel_t channel, TickType_t wait_time);
|
||||
|
||||
/**
|
||||
* @brief Get ringbuffer from UART.
|
||||
* @brief Get ringbuffer from RMT.
|
||||
*
|
||||
* Users can get the RMT RX ringbuffer handler, and process the RX data.
|
||||
* Users can get the RMT RX ringbuffer handle, and process the RX data.
|
||||
*
|
||||
* @param channel RMT channel (0 - 7)
|
||||
*
|
||||
* @param buf_handle Pointer to buffer handler to accept RX ringbuffer handler.
|
||||
* @param buf_handle Pointer to buffer handle to accept RX ringbuffer handle.
|
||||
*
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
@ -702,62 +712,22 @@ esp_err_t rmt_wait_tx_done(rmt_channel_t channel, TickType_t wait_time);
|
||||
*/
|
||||
esp_err_t rmt_get_ringbuf_handle(rmt_channel_t channel, RingbufHandle_t* buf_handle);
|
||||
|
||||
/***************************EXAMPLE**********************************
|
||||
/**
|
||||
* @brief Registers a callback that will be called when transmission ends.
|
||||
*
|
||||
* @note
|
||||
* You can also refer to example/09_rmt_nec_tx_rx to have more information about how to use RMT module.
|
||||
* Called by rmt_driver_isr_default in interrupt context.
|
||||
*
|
||||
* ----------------EXAMPLE OF RMT SETTING ---------------------
|
||||
* @code{c}
|
||||
* //1. enable RMT
|
||||
* //enable RMT module, or you can not set any register of it.
|
||||
* //this will be done in rmt_config API.
|
||||
* periph_module_enable(PERIPH_RMT_MODULE);
|
||||
* @endcode
|
||||
* @note Requires rmt_driver_install to install the default ISR handler.
|
||||
*
|
||||
* @code{c}
|
||||
* //2. set RMT transmitter
|
||||
* void rmt_tx_init()
|
||||
* {
|
||||
* rmt_config_t rmt_tx;
|
||||
* rmt_tx.channel = 0;
|
||||
* rmt_tx.gpio_num = 16;
|
||||
* rmt_tx.mem_block_num = 1;
|
||||
* rmt_tx.clk_div = 100;
|
||||
* rmt_tx.tx_config.loop_en = false;
|
||||
* rmt_tx.tx_config.carrier_duty_percent = 50;
|
||||
* rmt_tx.tx_config.carrier_freq_hz = 38000;
|
||||
* rmt_tx.tx_config.carrier_level = 1;
|
||||
* rmt_tx.tx_config.carrier_en = RMT_TX_CARRIER_EN;
|
||||
* rmt_tx.tx_config.idle_level = 0;
|
||||
* rmt_tx.tx_config.idle_output_en = true;
|
||||
* rmt_tx.rmt_mode = 0;
|
||||
* rmt_config(&rmt_tx);
|
||||
*
|
||||
* //install system RMT driver, disable rx ringbuffer for transmitter.
|
||||
* rmt_driver_install(rmt_tx.channel, 0, 0);
|
||||
* }
|
||||
*
|
||||
* @endcode
|
||||
* @code{c}
|
||||
* //3. set RMT receiver
|
||||
* void rmt_rx_init()
|
||||
* {
|
||||
* rmt_config_t rmt_rx;
|
||||
* rmt_rx.channel = 1;
|
||||
* rmt_rx.gpio_num = 19;
|
||||
* rmt_rx.clk_div = 100;
|
||||
* rmt_rx.mem_block_num = 1;
|
||||
* rmt_rx.rmt_mode = RMT_MODE_RX;
|
||||
* rmt_rx.rx_config.filter_en = true;
|
||||
* rmt_rx.rx_config.filter_ticks_thresh = 100;
|
||||
* rmt_rx.rx_config.idle_threshold = 0xffff;
|
||||
* rmt_config(&rmt_rx);
|
||||
*
|
||||
* //install system RMT driver.
|
||||
* rmt_driver_install(rmt_rx.channel, 1000, 0);
|
||||
* }
|
||||
* @param function Function to be called from the default interrupt handler or NULL.
|
||||
* @param arg Argument which will be provided to the callback when it is called.
|
||||
*
|
||||
* @return the previous callback settings (members will be set to NULL if there was none)
|
||||
*/
|
||||
rmt_tx_end_callback_t rmt_register_tx_end_callback(rmt_tx_end_fn_t function, void *arg);
|
||||
|
||||
|
||||
/*
|
||||
* ----------------EXAMPLE OF RMT INTERRUPT ------------------
|
||||
* @code{c}
|
||||
*
|
||||
@ -774,7 +744,7 @@ esp_err_t rmt_get_ringbuf_handle(rmt_channel_t channel, RingbufHandle_t* buf_han
|
||||
* //read RMT interrupt status.
|
||||
* uint32_t intr_st = RMT.int_st.val;
|
||||
*
|
||||
* //you will find which channels have triggered fade_end interrupt here,
|
||||
* //you will find which channels have triggered an interrupt here,
|
||||
* //then, you can post some event to RTOS queue to process the event.
|
||||
* //later we will add a queue in the driver code.
|
||||
*
|
||||
@ -788,8 +758,6 @@ esp_err_t rmt_get_ringbuf_handle(rmt_channel_t channel, RingbufHandle_t* buf_han
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -47,9 +47,9 @@ typedef struct {
|
||||
} rtc_gpio_desc_t;
|
||||
|
||||
typedef enum {
|
||||
RTC_GPIO_MODE_INPUT_ONLY , /*!< Pad output */
|
||||
RTC_GPIO_MODE_OUTPUT_ONLY, /*!< Pad input */
|
||||
RTC_GPIO_MODE_INPUT_OUTUT, /*!< Pad pull output + input */
|
||||
RTC_GPIO_MODE_INPUT_ONLY , /*!< Pad input */
|
||||
RTC_GPIO_MODE_OUTPUT_ONLY, /*!< Pad output */
|
||||
RTC_GPIO_MODE_INPUT_OUTPUT, /*!< Pad pull input + output */
|
||||
RTC_GPIO_MODE_DISABLED, /*!< Pad (output + input) disable */
|
||||
} rtc_gpio_mode_t;
|
||||
|
||||
|
@ -228,6 +228,17 @@ esp_err_t spi_device_get_trans_result(spi_device_handle_t handle, spi_transactio
|
||||
*/
|
||||
esp_err_t spi_device_transmit(spi_device_handle_t handle, spi_transaction_t *trans_desc);
|
||||
|
||||
/**
|
||||
* @brief Calculate the working frequency that is most close to desired frequency, and also the register value.
|
||||
*
|
||||
* @param fapb The frequency of apb clock, should be ``APB_CLK_FREQ``.
|
||||
* @param hz Desired working frequency
|
||||
* @param duty_cycle Duty cycle of the spi clock
|
||||
* @param reg_o Output of value to be set in clock register, or NULL if not needed.
|
||||
* @return Actual working frequency that most fit.
|
||||
*/
|
||||
int spi_cal_clock(int fapb, int hz, int duty_cycle, uint32_t* reg_o);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Reference in New Issue
Block a user