]> git.scottworley.com Git - tattlekey/blob - client/blink.c
client: Move blink stuff to separate file
[tattlekey] / client / blink.c
1 #include "pico/cyw43_arch.h"
2 #include "pico/stdlib.h"
3
4 #include "blink.h"
5
6 void one_blink(int duration) {
7 cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
8 sleep_ms(duration);
9 cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
10 sleep_ms(duration);
11 }
12
13 void signal(int count, int duration) {
14 for (int i = 0; i < count; i++)
15 one_blink(duration);
16 sleep_ms(1000);
17 }
18
19 void blink_forever(int duration) {
20 while (true) {
21 one_blink(duration);
22 }
23 }
24
25 void signal_error_by_blinking() { blink_forever(100); }
26 void signal_success_by_blinking() { blink_forever(400); }