Pico Led Controller 1.0.3
A project to control LEDs using Raspberry Pi Pico W
Loading...
Searching...
No Matches
blink.h File Reference
#include <stdint.h>
#include "light_state.h"

Go to the source code of this file.

Functions

void onboard_led_blink (uint32_t on_time, uint32_t off_time)
 Blink the onboard LED.
 
void led_blink (uint32_t on_time, uint32_t off_time)
 Blink the LED strip.
 

Function Documentation

◆ led_blink()

void led_blink ( uint32_t  on_time,
uint32_t  off_time 
)

Blink the LED strip.

Function blinks the LED strip with the given on and off times blocking current thread with sleep.

Parameters
on_timetime in milliseconds the LED is on
off_timetime in milliseconds the LED is off

Definition at line 22 of file blink.c.

23{
24 if (on_time < 10)
25 on_time = 10;
26 if (off_time < 10)
27 off_time = 10;
29 sleep_ms(on_time);
31 sleep_ms(off_time);
32}
void toggle_light_state()
Toggle light state.
Definition light_state.c:10

References toggle_light_state().

◆ onboard_led_blink()

void onboard_led_blink ( uint32_t  on_time,
uint32_t  off_time 
)

Blink the onboard LED.

Function blinks the onboard LED with the given on and off times blocking current thread with sleep.

Parameters
on_timetime in milliseconds the LED is on
off_timetime in milliseconds the LED is off

Definition at line 10 of file blink.c.

11{
12 if (on_time < 10)
13 on_time = 10;
14 if (off_time < 10)
15 off_time = 10;
16 cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
17 sleep_ms(on_time);
18 cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
19 sleep_ms(off_time);
20}