2018年11月24日 星期六

DIY - ESP32:ESP32 RMT API 函數結構件及其它(三十七)

DIY - ESP32:ESP32 RMT API 函數結構件及其它(三十七):

除了 ESP32 RMT (Remote Control) API 外,還提供了結構件(Structures)、巨集(Marco)、 泛型型別定義(Type Definitions)和枚舉(Enumerations)。

1. Structure
1.1. struct rmt_tx_config_t
Data struct of RMT TX configure parameters.
Public Members
Description
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
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

1.2. struct rmt_rx_config_t
Data struct of RMT RX configure parameters.
Public Members
Description
bool filter_en
RMT receiver filter enable
uint8_t filter_ticks_thresh
RMT filter tick number
uint16_t idle_threshold
RMT RX idle threshold

1.3. struct rmt_config_t
Data struct of RMT configure parameters.
Public Members
Description
rmt_mode_t rmt_mode
RMT mode: transmitter or receiver
rmt_channel_t channel
RMT channel
uint8_t clk_div
RMT channel counter divider
gpio_num_t gpio_num
RMT GPIO number
uint8_t mem_block_num
RMT memory block number
rmt_tx_config_t tx_config
RMT TX parameter
rmt_rx_config_t rx_config
RMT RX parameter

1.4. struct rmt_tx_end_callback_t
Structure encapsulating a RMT TX end callback
Public Members
Description
rmt_tx_end_fn_t function
Function which is called on RMT TX end
void *arg
Optional argument passed to function

2. Macros
Macros
Description
RMT_MEM_BLOCK_BYTE_NUM
RMT_MEM_ITEM_NUM

3. Type Definitions
Type Definitions
Description
typedef intr_handle_t rmt_isr_handle_t
typedef void (*rmt_tx_end_fn_t)(rmt_channel_t channel, void *arg)
typedef void (*sample_to_rmt_t)(const void *src, rmt_item32_t *dest, size_t src_size, size_t wanted_num, size_t *translated_size, size_t *item_num)
User callback function to convert uint8_t type data to rmt format(rmt_item32_t).

This function may be called from an ISR, so, the code should be short and efficient.

src: Pointer to the buffer storing the raw data that needs to be converted to rmt format.
dest: Pointer to the buffer storing the rmt format data.
src_size: The raw data size.
wanted_num: The number of rmt format data that wanted to get.
translated_size: The size of the raw data that has been converted to rmt format, it should return 0 if no data is converted in user callback.
item_num: The number of the rmt format data that actually converted to, it can be less than wanted_num if there is not enough raw data, but cannot exceed wanted_num. it should return 0 if no data was converted.

4. Enumerations
4.1. enum rmt_channel_t
Enumeration
Description
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

4.2. enum rmt_mem_owner_t
Enumeration
Description
RMT_MEM_OWNER_TX = 0
RMT RX mode, RMT transmitter owns the memory block
RMT_MEM_OWNER_RX = 1
RMT RX mode, RMT receiver owns the memory block
RMT_MEM_OWNER_MAX

4.3. enum rmt_source_clk_t
Enumeration
Description
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

4.4. enum rmt_data_mode_t
Enumeration
Description
RMT_DATA_MODE_FIFO = 0
RMT_DATA_MODE_MEM = 1
RMT_DATA_MODE_MAX

4.5. enum rmt_mode_t
Enumeration
Description
RMT_MODE_TX = 0
RMT TX mode
RMT_MODE_RX
RMT RX mode
RMT_MODE_MAX

4.6. enum rmt_idle_level_t
Enumeration
Description
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

4.7. enum rmt_carrier_level_t
Enumeration
Description
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

相關網址:
※ DIY - ESP32:ESP32 紅外線接收器發射器電路(三十三)
※ DIY - ESP32:ESP32 紅外線接收器發射器程式(三十四)
※ DIY - ESP32:ESP32 RMT API 函數介紹(三十五)
※ DIY - ESP32:ESP32 RMT API 函數(三十六)

2018年 11月 24日 天氣報告
氣溫:21.4@ 21:50
相對濕度:百分之 82%
天氣:天色大致良好

沒有留言:

張貼留言