crust icon indicating copy to clipboard operation
crust copied to clipboard

LED class and GPIO LED driver

Open smaeul opened this issue 6 years ago • 0 comments

Type of issue

Feature

Description

Boards such as the Zero+ and PC2 have LEDs attached to GPIO pins. We should create an LED class and a GPIO LED driver.

LED class

The LED class simply needs a int led_set_state(struct device *dev, uint8_t mode); method, that forwards to an int (*set_state)(struct device *dev, uint8_t mode); driver operation. The available modes are

enum {
    LED_OFF = 0,
    LED_ON = 1,
};

GPIO LED driver

This will need to take a single GPIO pin. It should support both active-high and active-low LEDs. The active level can be set in a member of the struct wrapping struct device, and can be set via a Kconfig option (e.g. { ..., .active_low = CONFIG_GPIO_LED_ACTIVE_LOW }).

smaeul avatar Apr 11 '18 22:04 smaeul