From 1be0e7fc288acf277854145c960925156a1aa3cb Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Mon, 22 Feb 2021 22:08:12 +0700 Subject: [PATCH] change blink to use PICO_DEFAULT_LED_PIN to support other boards (#57) * change blink to use PICO_DEFAULT_LED_PIN to support other boards * also update pio/pwm and picoboard/blinky system/hello_double_tap --- blink/blink.c | 2 +- picoboard/blinky/blinky.c | 2 +- pio/pwm/pwm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/blink/blink.c b/blink/blink.c index c6367f2..f413d50 100644 --- a/blink/blink.c +++ b/blink/blink.c @@ -7,7 +7,7 @@ #include "pico/stdlib.h" int main() { - const uint LED_PIN = 25; + const uint LED_PIN = PICO_DEFAULT_LED_PIN; gpio_init(LED_PIN); gpio_set_dir(LED_PIN, GPIO_OUT); while (true) { diff --git a/picoboard/blinky/blinky.c b/picoboard/blinky/blinky.c index f9cafcd..eb2c545 100644 --- a/picoboard/blinky/blinky.c +++ b/picoboard/blinky/blinky.c @@ -8,7 +8,7 @@ #include "pico/stdlib.h" #include "hardware/gpio.h" -const uint LED_PIN = 25; +const uint LED_PIN = PICO_DEFAULT_LED_PIN; const uint DOT_PERIOD_MS = 100; const char *morse_letters[] = { diff --git a/pio/pwm/pwm.c b/pio/pwm/pwm.c index 0eef2e0..f1cc46d 100644 --- a/pio/pwm/pwm.c +++ b/pio/pwm/pwm.c @@ -33,7 +33,7 @@ int main() { uint offset = pio_add_program(pio, &pwm_program); printf("Loaded program at %d\n", offset); - pwm_program_init(pio, sm, offset, 25); + pwm_program_init(pio, sm, offset, PICO_DEFAULT_LED_PIN); pio_pwm_set_period(pio, sm, (1u << 16) - 1); int level = 0;