| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <cstdint> | ||
| 4 | #include "esp_err.h" | ||
| 5 | #include "driver/gpio.h" | ||
| 6 | |||
| 7 | // LEDC modes | ||
| 8 | typedef enum { | ||
| 9 | LEDC_HIGH_SPEED_MODE = 0, | ||
| 10 | LEDC_LOW_SPEED_MODE = 1, | ||
| 11 | } ledc_mode_t; | ||
| 12 | |||
| 13 | // LEDC channels | ||
| 14 | typedef enum { | ||
| 15 | LEDC_CHANNEL_0 = 0, | ||
| 16 | LEDC_CHANNEL_1 = 1, | ||
| 17 | LEDC_CHANNEL_2 = 2, | ||
| 18 | LEDC_CHANNEL_3 = 3, | ||
| 19 | } ledc_channel_t; | ||
| 20 | |||
| 21 | // LEDC timers | ||
| 22 | typedef enum { | ||
| 23 | LEDC_TIMER_0 = 0, | ||
| 24 | LEDC_TIMER_1 = 1, | ||
| 25 | } ledc_timer_t; | ||
| 26 | |||
| 27 | // LEDC timer resolution | ||
| 28 | typedef enum { | ||
| 29 | LEDC_TIMER_13_BIT = 13, | ||
| 30 | LEDC_TIMER_14_BIT = 14, | ||
| 31 | LEDC_TIMER_15_BIT = 15, | ||
| 32 | } ledc_timer_bit_t; | ||
| 33 | |||
| 34 | // LEDC clock source | ||
| 35 | typedef enum { | ||
| 36 | LEDC_AUTO_CLK = 0, | ||
| 37 | } ledc_clk_cfg_t; | ||
| 38 | |||
| 39 | // LEDC interrupt types | ||
| 40 | typedef enum { | ||
| 41 | LEDC_INTR_DISABLE = 0, | ||
| 42 | LEDC_INTR_FADE_END = 1, | ||
| 43 | } ledc_intr_type_t; | ||
| 44 | |||
| 45 | // LEDC duty direction | ||
| 46 | typedef enum { | ||
| 47 | LEDC_DUTY_DIR_DECREASE = 0, | ||
| 48 | LEDC_DUTY_DIR_INCREASE = 1, | ||
| 49 | } ledc_duty_direction_t; | ||
| 50 | |||
| 51 | // LEDC timer configuration | ||
| 52 | typedef struct { | ||
| 53 | ledc_mode_t speed_mode; | ||
| 54 | ledc_timer_bit_t duty_resolution; | ||
| 55 | ledc_timer_t timer_num; | ||
| 56 | uint32_t freq_hz; | ||
| 57 | ledc_clk_cfg_t clk_cfg; | ||
| 58 | bool deconfigure; | ||
| 59 | } ledc_timer_config_t; | ||
| 60 | |||
| 61 | // LEDC channel configuration | ||
| 62 | typedef struct { | ||
| 63 | int gpio_num; | ||
| 64 | ledc_mode_t speed_mode; | ||
| 65 | ledc_channel_t channel; | ||
| 66 | ledc_intr_type_t intr_type; | ||
| 67 | ledc_timer_t timer_sel; | ||
| 68 | uint32_t duty; | ||
| 69 | int hpoint; | ||
| 70 | union { | ||
| 71 | uint32_t output_invert; | ||
| 72 | } flags; | ||
| 73 | } ledc_channel_config_t; | ||
| 74 | |||
| 75 | // LEDC functions (stubs) | ||
| 76 | ✗ | inline esp_err_t ledc_timer_config(const ledc_timer_config_t* timer_conf) { | |
| 77 | ✗ | return ESP_OK; | |
| 78 | } | ||
| 79 | |||
| 80 | ✗ | inline esp_err_t ledc_channel_config(const ledc_channel_config_t* ledc_conf) { | |
| 81 | ✗ | return ESP_OK; | |
| 82 | } | ||
| 83 | |||
| 84 | ✗ | inline esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t duty) { | |
| 85 | ✗ | return ESP_OK; | |
| 86 | } | ||
| 87 | |||
| 88 | ✗ | inline esp_err_t ledc_update_duty(ledc_mode_t speed_mode, ledc_channel_t channel) { | |
| 89 | ✗ | return ESP_OK; | |
| 90 | } | ||
| 91 | |||
| 92 | ✗ | inline esp_err_t ledc_stop(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t idle_level) { | |
| 93 | ✗ | return ESP_OK; | |
| 94 | } | ||
| 95 |