NeoPixel - Add support for ESP32-S3 (#4435)

This commit is contained in:
Adam Jacques 2023-02-19 05:38:27 -08:00 committed by GitHub
parent c03b1fae68
commit 66eecd3675
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 1 deletions

View file

@ -15,6 +15,7 @@ from esphome.components.esp32.const import (
VARIANT_ESP32, VARIANT_ESP32,
VARIANT_ESP32S2, VARIANT_ESP32S2,
VARIANT_ESP32C3, VARIANT_ESP32C3,
VARIANT_ESP32S3,
) )
from esphome.core import CORE from esphome.core import CORE
from .const import ( from .const import (
@ -58,6 +59,7 @@ SPI_SPEEDS = [40e6, 20e6, 10e6, 5e6, 2e6, 1e6, 500e3]
def _esp32_rmt_default_channel(): def _esp32_rmt_default_channel():
return { return {
VARIANT_ESP32S2: 1, VARIANT_ESP32S2: 1,
VARIANT_ESP32S3: 1,
VARIANT_ESP32C3: 1, VARIANT_ESP32C3: 1,
}.get(get_esp32_variant(), 6) }.get(get_esp32_variant(), 6)
@ -70,6 +72,7 @@ def _validate_esp32_rmt_channel(value):
variant_channels = { variant_channels = {
VARIANT_ESP32: [0, 1, 2, 3, 4, 5, 6, 7, CHANNEL_DYNAMIC], VARIANT_ESP32: [0, 1, 2, 3, 4, 5, 6, 7, CHANNEL_DYNAMIC],
VARIANT_ESP32S2: [0, 1, 2, 3, CHANNEL_DYNAMIC], VARIANT_ESP32S2: [0, 1, 2, 3, CHANNEL_DYNAMIC],
VARIANT_ESP32S3: [0, 1, 2, 3, CHANNEL_DYNAMIC],
VARIANT_ESP32C3: [0, 1, CHANNEL_DYNAMIC], VARIANT_ESP32C3: [0, 1, CHANNEL_DYNAMIC],
} }
variant = get_esp32_variant() variant = get_esp32_variant()

View file

@ -220,4 +220,5 @@ async def to_code(config):
cg.add(var.set_pixel_order(getattr(ESPNeoPixelOrder, config[CONF_TYPE]))) cg.add(var.set_pixel_order(getattr(ESPNeoPixelOrder, config[CONF_TYPE])))
# https://github.com/Makuna/NeoPixelBus/blob/master/library.json # https://github.com/Makuna/NeoPixelBus/blob/master/library.json
cg.add_library("makuna/NeoPixelBus", "2.6.9") # Version Listed Here: https://registry.platformio.org/libraries/makuna/NeoPixelBus/versions
cg.add_library("makuna/NeoPixelBus", "2.7.3")

View file

@ -11,3 +11,4 @@ esphome compile tests/test2.yaml
esphome compile tests/test3.yaml esphome compile tests/test3.yaml
esphome compile tests/test4.yaml esphome compile tests/test4.yaml
esphome compile tests/test5.yaml esphome compile tests/test5.yaml
esphome compile tests/test8.yaml

View file

@ -26,3 +26,4 @@ Current test_.yaml file contents.
| test5.yaml | ESP32 | wifi | ble_server | test5.yaml | ESP32 | wifi | ble_server
| test6.yaml | RP2040 | wifi | N/A | test6.yaml | RP2040 | wifi | N/A
| test7.yaml | ESP32-C3 | wifi | N/A | test7.yaml | ESP32-C3 | wifi | N/A
| test8.yaml | ESP32-S3 | wifi | None

27
tests/test8.yaml Normal file
View file

@ -0,0 +1,27 @@
# Tests for ESP32-S3 boards
---
wifi:
ssid: "ssid"
esp32:
board: esp32-c3-devkitm-1
variant: ESP32S3
framework:
type: arduino
esphome:
name: "esp32-s3-test"
logger:
light:
- platform: neopixelbus
type: GRB
variant: WS2812
pin: 33
num_leds: 1
id: neopixel
method: esp32_rmt
name: "neopixel-enable"
internal: false
restore_mode: ALWAYS_OFF