mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-28 17:11:23 +02:00
Add support for HIGH/LOW LED in ESP32.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -338,7 +338,10 @@ set(PICO_KEYS_SOURCES ${PICO_KEYS_SOURCES}
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(ESP_PLATFORM)
|
if(ESP_PLATFORM)
|
||||||
set(PICO_KEYS_SOURCES ${PICO_KEYS_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/src/led/led_neopixel.c)
|
set(PICO_KEYS_SOURCES ${PICO_KEYS_SOURCES}
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/led/led_neopixel.c
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/led/led_pico.c
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
if (NOT ENABLE_EMULATION)
|
if (NOT ENABLE_EMULATION)
|
||||||
set(PICO_KEYS_SOURCES ${PICO_KEYS_SOURCES}
|
set(PICO_KEYS_SOURCES ${PICO_KEYS_SOURCES}
|
||||||
|
|||||||
@@ -145,14 +145,14 @@ void led_init() {
|
|||||||
#endif
|
#endif
|
||||||
if (phy_data.led_driver_present) {
|
if (phy_data.led_driver_present) {
|
||||||
switch (phy_data.led_driver) {
|
switch (phy_data.led_driver) {
|
||||||
|
case PHY_LED_DRIVER_PICO:
|
||||||
|
led_driver = &led_driver_pico;
|
||||||
|
break;
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
case PHY_LED_DRIVER_NEOPIXEL:
|
case PHY_LED_DRIVER_NEOPIXEL:
|
||||||
led_driver = &led_driver_neopixel;
|
led_driver = &led_driver_neopixel;
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
case PHY_LED_DRIVER_PICO:
|
|
||||||
led_driver = &led_driver_pico;
|
|
||||||
break;
|
|
||||||
#ifdef CYW43_WL_GPIO_LED_PIN
|
#ifdef CYW43_WL_GPIO_LED_PIN
|
||||||
case PHY_LED_DRIVER_CYW43:
|
case PHY_LED_DRIVER_CYW43:
|
||||||
led_driver = &led_driver_cyw43;
|
led_driver = &led_driver_cyw43;
|
||||||
|
|||||||
@@ -23,7 +23,15 @@ static uint8_t gpio = PICO_DEFAULT_LED_PIN;
|
|||||||
static uint8_t gpio = 0;
|
static uint8_t gpio = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PICO_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
|
#include "driver/gpio.h"
|
||||||
|
#define gpio_init gpio_reset_pin
|
||||||
|
#define gpio_set_dir gpio_set_direction
|
||||||
|
#define gpio_put gpio_set_level
|
||||||
|
#define GPIO_OUT GPIO_MODE_OUTPUT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PICO_PLATFORM) || defined(ESP_PLATFORM)
|
||||||
void led_driver_init_pico() {
|
void led_driver_init_pico() {
|
||||||
if (phy_data.led_gpio_present) {
|
if (phy_data.led_gpio_present) {
|
||||||
gpio = phy_data.led_gpio;
|
gpio = phy_data.led_gpio;
|
||||||
|
|||||||
Reference in New Issue
Block a user