From 7d48a92734bc937d1299dfce4aa111d415e2fb6d Mon Sep 17 00:00:00 2001 From: suda-morris <362953310@qq.com> Date: Tue, 3 Jan 2023 10:51:21 +0800 Subject: [PATCH] led_strip: support invert output --- led_strip/include/led_strip_types.h | 3 +++ led_strip/src/led_strip_rmt_dev.c | 1 + 2 files changed, 4 insertions(+) diff --git a/led_strip/include/led_strip_types.h b/led_strip/include/led_strip_types.h index ad49c4b..cf507c9 100644 --- a/led_strip/include/led_strip_types.h +++ b/led_strip/include/led_strip_types.h @@ -22,6 +22,9 @@ typedef struct led_strip_t *led_strip_handle_t; typedef struct { uint32_t strip_gpio_num; /*!< GPIO number that used by LED strip */ uint32_t max_leds; /*!< Maximum LEDs in a single strip */ + struct { + uint32_t invert_out: 1; /*!< Invert output signal */ + } flags; } led_strip_config_t; #ifdef __cplusplus diff --git a/led_strip/src/led_strip_rmt_dev.c b/led_strip/src/led_strip_rmt_dev.c index cd88419..61de29b 100644 --- a/led_strip/src/led_strip_rmt_dev.c +++ b/led_strip/src/led_strip_rmt_dev.c @@ -90,6 +90,7 @@ esp_err_t led_strip_new_rmt_device(const led_strip_config_t *led_config, const l .resolution_hz = resolution, .trans_queue_depth = 4, .flags.with_dma = rmt_config->flags.with_dma, + .flags.invert_out = led_config->flags.invert_out, }; ESP_GOTO_ON_ERROR(rmt_new_tx_channel(&rmt_chan_config, &rmt_strip->rmt_chan), err, TAG, "create RMT TX channel failed");