picofuse

Macros | Typedefs | Enumerations
led.h File Reference

Board LED helpers. More...

#include "gpio.h"
#include "pwm.h"
#include <stdint.h>
Include dependency graph for led.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HW_LED_GPIO_NONE   0xFFu
 Value returned when no default board LED GPIO is available.
 
#define HW_LED_POOL_CAPACITY   8u
 Capacity of the LED handle pool. More...
 
#define HW_LED_CONTEXT_SIZE   32
 Size in bytes of the per-handle scratch context space embedded in every hw_led_t, for a backend's own private per-LED state - a GPIO or PWM handle pointer, a NeoPixel chain's length/buffer pointer, a sysfs LED path pointer, and similar. More...
 

Typedefs

typedef struct hw_led_t hw_led_t
 Opaque LED handle.
 

Enumerations

enum  hw_led_type_t {
  hw_led_type_none = 0, hw_led_type_wifi, hw_led_type_neopixel, hw_led_type_gpio,
  hw_led_type_pwm
}
 Default board LED access type. More...
 

Functions

Lifecycle
hw_led_thw_led_init_gpio (hw_gpio_t *gpio)
 Initialize a direct GPIO LED. More...
 
hw_led_thw_led_init_neopixel (hw_gpio_t *gpio, uint8_t led_count)
 Initialize a NeoPixel/WS2812 LED data pin. More...
 
hw_led_thw_led_init_wifi (void)
 Initialize a Wi-Fi controlled LED. More...
 
hw_led_thw_led_init_pwm (hw_pwm_t *pwm)
 Initialize a PWM controlled LED. More...
 
hw_led_thw_led_init_device (const char *name)
 Initialize an LED from a platform-specific device path or name. More...
 
hw_led_thw_led_init_default (void)
 Initialize the default on-board LED. More...
 
void hw_led_deinit (hw_led_t *led)
 Deinitialize an LED handle. More...
 
Properties
uint8_t hw_led_gpio_default (hw_led_type_t *out_type, uint8_t *out_count)
 Return the default board LED's control pin. More...
 
Methods
bool hw_led_set (hw_led_t *led, uint8_t index, bool enabled)
 Set LED state on or off. More...
 
bool hw_led_set_brightness (hw_led_t *led, uint8_t index, float percent)
 Set LED brightness. More...
 
bool hw_led_clear (hw_led_t *led)
 Turn off all LED state, cancelling any active blink. More...
 
bool hw_led_blink (hw_led_t *led, uint8_t index, uint32_t period_ms, bool repeating)
 Blink an LED using a timer. More...
 

Detailed Description

Board LED helpers.

Definition in file led.h.