2018年12月22日 星期六

DIY - ESP32:ESP32 LEDC 控制 API 函數結構件及其它(五十七)

DIY - ESP32:ESP32 LEDC 控制 API 函數結構件及其它(五十七):

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

1. Structure
1.1. struct ledc_channel_config_t
Configuration parameters of LEDC channel for ledc_channel_config function.
Public Members
Description
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)]
int hpoint
LEDC channel hpoint value, the max value is 0xfffff

1.2. struct ledc_timer_config_t
Configuration parameters of LEDC Timer timer for ledc_timer_config function.
Public Members
Description
ledc_mode_t speed_mode
LEDC speed speed_mode, high-speed mode or low-speed mode
ledc_timer_bit_t duty_resolution
LEDC channel duty resolution
ledc_timer_bit_t bit_num
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)

2. Macros
Macros
Description
LEDC_APB_CLK_HZ
LEDC_REF_CLK_HZ
LEDC_ERR_DUTY
LEDC_ERR_VAL

3. Type Definitions
Type Definitions
Description
typedef intr_handle_t ledc_isr_handle_t

4. Enumerations
4.1. enum ledc_mode_t
Enumeration
Description
LEDC_HIGH_SPEED_MODE = 0
LEDC high speed speed_mode
LEDC_LOW_SPEED_MODE
LEDC low speed speed_mode
LEDC_SPEED_MODE_MAX
LEDC speed limit

4.2. ledc_intr_type_t
Enumeration
Description
LEDC_INTR_DISABLE = 0
Disable LEDC interrupt
LEDC_INTR_FADE_END
Enable LEDC interrupt

4.3. enum ledc_duty_direction_t
Enumeration
Description
LEDC_DUTY_DIR_DECREASE = 0
LEDC duty decrease direction
LEDC_DUTY_DIR_INCREASE = 1
LEDC duty increase direction
LEDC_DUTY_DIR_MAX

4.4. enum ledc_clk_src_t
Enumeration
Description
LEDC_REF_TICK = 0
LEDC timer clock divided from reference tick (1Mhz)
LEDC_APB_CLK
LEDC timer clock divided from APB clock (80Mhz)

4.5. enum ledc_timer_t
Enumeration
Description
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_MAX

4.6. enum ledc_channel_t
Enumeration
Description
LEDC_CHANNEL_0 = 0
LEDC channel 0
LEDC_CHANNEL_1
LEDC channel 1
LEDC_CHANNEL_2
LEDC channel 2
LEDC_CHANNEL_3
LEDC channel 3
LEDC_CHANNEL_4
LEDC channel 4
LEDC_CHANNEL_5
LEDC channel 5
LEDC_CHANNEL_6
LEDC channel 6
LEDC_CHANNEL_7
LEDC channel 7
LEDC_CHANNEL_MAX

4.7. enum ledc_timer_bit_t
Enumeration
Description
LEDC_TIMER_1_BIT = 1
LEDC PWM duty resolution of 1 bits
LEDC_TIMER_2_BIT
LEDC PWM duty resolution of 2 bits
LEDC_TIMER_3_BIT
LEDC PWM duty resolution of 3 bits
LEDC_TIMER_4_BIT
LEDC PWM duty resolution of 4 bits
LEDC_TIMER_5_BIT
LEDC PWM duty resolution of 5 bits
LEDC_TIMER_6_BIT
LEDC PWM duty resolution of 6 bits
LEDC_TIMER_7_BIT
LEDC PWM duty resolution of 7 bits
LEDC_TIMER_8_BIT
LEDC PWM duty resolution of 8 bits
LEDC_TIMER_9_BIT
LEDC PWM duty resolution of 9 bits
LEDC_TIMER_10_BIT
LEDC PWM duty resolution of 10 bits
LEDC_TIMER_11_BIT
LEDC PWM duty resolution of 11 bits
LEDC_TIMER_12_BIT
LEDC PWM duty resolution of 12 bits
LEDC_TIMER_13_BIT
LEDC PWM duty resolution of 13 bits
LEDC_TIMER_14_BIT
LEDC PWM duty resolution of 14 bits
LEDC_TIMER_15_BIT
LEDC PWM duty resolution of 15 bits
LEDC_TIMER_16_BIT
LEDC PWM duty resolution of 16 bits
LEDC_TIMER_17_BIT
LEDC PWM duty resolution of 17 bits
LEDC_TIMER_18_BIT
LEDC PWM duty resolution of 18 bits
LEDC_TIMER_19_BIT
LEDC PWM duty resolution of 19 bits
LEDC_TIMER_20_BIT
LEDC PWM duty resolution of 20 bits
LEDC_TIMER_BIT_MAX

4.8. enum ledc_fade_mode_t
Enumeration
Description
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_MAX

Header File:driver/include/driver/ledc.h

相關網址:
※ DIY - ESP32:ESP32 LEDC 控制模塊介紹(五十三)
※ DIY - ESP32:ESP32 頻率產生器 Frequency Generator 電路(五十四)
※ DIY - ESP32:ESP32 頻率產生器 Frequency Generator 程式(五十五)
※ DIY - ESP32:ESP32 LEDC 控制 API 函數(五十六)

2018年 12月 22日 天氣報告
氣溫:23.3@ 20:40
相對濕度:百分之 69%
天氣:多雲


沒有留言:

張貼留言