diff --git a/pico_hsm_sdk_import.cmake b/pico_hsm_sdk_import.cmake index 436cd53..452f219 100644 --- a/pico_hsm_sdk_import.cmake +++ b/pico_hsm_sdk_import.cmake @@ -184,7 +184,7 @@ else() ${INCLUDES} ) - target_link_libraries(pico_hsm_sdk INTERFACE pico_stdlib pico_multicore hardware_flash hardware_sync hardware_adc pico_unique_id hardware_rtc tinyusb_device tinyusb_board hardware_pio) + target_link_libraries(pico_hsm_sdk INTERFACE pico_stdlib pico_multicore hardware_flash hardware_sync hardware_adc pico_unique_id hardware_rtc tinyusb_device tinyusb_board hardware_pio pico_cyw43_arch_none) endif() endif() diff --git a/src/main.c b/src/main.c index 5f30a48..79dec33 100644 --- a/src/main.c +++ b/src/main.c @@ -46,6 +46,9 @@ #include "random.h" #include "hsm.h" #include "apdu.h" +#ifdef CYW43_WL_GPIO_LED_PIN +#include "pico/cyw43_arch.h" +#endif #ifdef PICO_DEFAULT_WS2812_PIN #include "hardware/pio.h" #include "hardware/clocks.h" @@ -205,7 +208,8 @@ void led_blinking_task() { #ifdef PICO_DEFAULT_LED_PIN static uint8_t led_color = PICO_DEFAULT_LED_PIN; #elif defined(PICO_DEFAULT_WS2812_PIN) - +#elif defined(CYW43_WL_GPIO_LED_PIN) + static uint8_t led_color = CYW43_WL_GPIO_LED_PIN; #endif // Blink every interval ms @@ -223,6 +227,8 @@ void led_blinking_task() { else { pio_sm_put_blocking(pio0, 0, 0xff000000); } +#elif defined(CYW43_WL_GPIO_LED_PIN) + cyw43_arch_gpio_put(led_color, led_state); #endif led_state ^= 1; // toggle } @@ -234,6 +240,8 @@ void led_off_all() { gpio_put(TINY2040_LED_B_PIN, 1); #elif defined(PICO_DEFAULT_LED_PIN) gpio_put(PICO_DEFAULT_LED_PIN, 0); +#elif defined(CYW43_WL_GPIO_LED_PIN) + cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0); #endif #if (PICO_DEFAULT_WS2812_PIN) PIO pio = pio0; @@ -285,11 +293,11 @@ int main(void) { gpio_set_dir(TINY2040_LED_G_PIN, GPIO_OUT); gpio_init(TINY2040_LED_B_PIN); gpio_set_dir(TINY2040_LED_B_PIN, GPIO_OUT); -#else -#ifdef PICO_DEFAULT_LED_PIN +#elif defined(PICO_DEFAULT_LED_PIN) gpio_init(PICO_DEFAULT_LED_PIN); gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT); -#endif +#elif defined(CYW43_WL_GPIO_LED_PIN) + cyw43_arch_init(); #endif led_off_all();