mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-28 17:11:23 +02:00
51 lines
1.5 KiB
C
51 lines
1.5 KiB
C
/*
|
|
* This file is part of the Pico Keys SDK distribution (https://github.com/polhenarejos/pico-keys-sdk).
|
|
* Copyright (c) 2022 Pol Henarejos.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, version 3.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "picokeys.h"
|
|
#include "led/led.h"
|
|
#ifdef PICO_PLATFORM
|
|
#include "hardware/gpio.h"
|
|
#endif
|
|
|
|
#ifdef CYW43_WL_GPIO_LED_PIN
|
|
|
|
#include "pico/cyw43_arch.h"
|
|
|
|
void led_driver_init_cyw43(void);
|
|
void led_driver_color_cyw43(uint8_t color, uint32_t led_brightness, float progress);
|
|
|
|
void led_driver_init_cyw43(void) {
|
|
cyw43_arch_init();
|
|
}
|
|
|
|
void led_driver_color_cyw43(uint8_t color, uint32_t led_brightness, float progress) {
|
|
(void)led_brightness;
|
|
(void)color;
|
|
uint8_t gpio = CYW43_WL_GPIO_LED_PIN;
|
|
if (phy_data.led_gpio_present) {
|
|
gpio = phy_data.led_gpio;
|
|
}
|
|
cyw43_arch_gpio_put(gpio, progress >= 0.5);
|
|
}
|
|
|
|
led_driver_t led_driver_cyw43 = {
|
|
.init = led_driver_init_cyw43,
|
|
.set_color = led_driver_color_cyw43,
|
|
};
|
|
|
|
#endif
|