LED周辺機器¶
LED Peripheral
オンとオフの時間を設定できるGPIOに接続されたLEDを点滅またはフェードします。
Blink or fade a LED connected to a GPIO with configurable On and Off times.
アプリケーション例¶
Application Examples
このAPIの実装は、いくつかの例で示されています:
Implementation of this API is demonstrated in couple of examples:
APIリファレンス¶
API Reference
関数¶
Functions
- 
esp_periph_handle_t 
periph_led_init(periph_led_cfg_t *config)¶ esp_peripheralsのLEDペリフェラルハンドルを作成します。
Create the LED peripheral handle for esp_peripherals.
- Note
 - この関数によって作成されたハンドルは、
esp_periph_destroyが呼び出されたときに自動的に破棄されますThe handle was created by this function automatically destroy when
esp_periph_destroyis called - Return
 - espペリフェラルハンドル
 - Parameters
 config: 構成config: The configuration
- 
esp_err_t 
periph_led_blink(esp_periph_handle_t periph, int gpio_num, int time_on_ms, int time_off_ms, bool fade, int loop)¶ Bink LED Peripheral、この関数は、LEDを制御するようにgpio_numを自動的に構成します。
time_on_msはオフからオン(またはフェードが無効な場合はオン)に切り替わる時間(ミリ秒単位)であり、time_off_msはから切り替わる時間(ミリ秒単位)です。 オンからオフ(またはフェードが無効になっている場合はオフ)。 オンから切り替える場合-> オフまたはその逆の場合、ループは1回減少し、ループが0のときにエフェクトをオフにします。ループ値が0未満の場合、LEDエフェクトは無限にループします。 PERIPH_LED_BLINK_FINISHイベントは、ループの両端で送信されます。Bink LED Peripheral, this function will automatically configure the gpio_num to control the LED, with
time_on_msas the time (in milliseconds) switch from OFF to ON (or ON if fade is disabled), andtime_off_msas the time (in milliseconds) switch from ON to OFF (or OFF if fade is disabled). When switching from ON -> OFF and vice versa, the loop decreases once, and will turn off the effect when the loop is 0. With a loop value less than 0, the LED effect will loop endlessly. PERIPH_LED_BLINK_FINISH events will be sent at each end of loop.- Return
 - ESP_OK
 - ESP_FAIL
 
- Parameters
 periph: LEDペリフperiph: The LED periphgpio_num: gpio番号gpio_num: The gpio numbertime_on_ms: ミリ秒単位のオンの時間time_on_ms: The time on millisecondstime_off_ms: ミリ秒単位のオフの時間time_off_ms: The time off millisecondsfade: フェージングが有効fade: Fading enabledloop: ループloop: Loop
- 
esp_err_t 
periph_led_stop(esp_periph_handle_t periph, int gpio_num)¶ LEDの点滅を停止します。
Stop Blink the LED.
- Return
 - ESP_OK
 - ESP_FAIL
 
- Parameters
 periph: ペリフperiph: The periphgpio_num: gpio番号gpio_num: The gpio number
構造体¶
Structures
- 
struct 
periph_led_cfg_t¶ LED周辺機器の構成。
The LED peripheral configuration.
Public Members
- 
ledc_mode_t 
led_speed_mode¶ LEDC速度speed_mode、高速モードまたは低速モード
LEDC speed speed_mode, high-speed mode or low-speed mode
- 
ledc_timer_bit_t 
led_duty_resolution¶ LEDCチャネルデューティ分解能
LEDC channel duty resolution
- 
ledc_timer_t 
led_timer_num¶ チャネルのタイマーソースを選択します(0〜3)
Select the timer source of channel (0 - 3)
- 
uint32_t 
led_freq_hz¶ LEDCタイマー周波数(Hz)
LEDC timer frequency (Hz)
- 
int 
gpio_num¶ オプション、< 0無効なgpio番号
Optional, < 0 invalid gpio number
- 
ledc_mode_t