Module capsules::led [] [src]

Provides userspace access to LEDs on a board.

This allows for much more cross platform controlling of LEDs without having to know which of the GPIO pins exposed across the syscall interface are LEDs.

This capsule takes an array of pins and the polarity of the LED (active high or active low). This allows the board to configure how the underlying GPIO must be controlled to turn on and off LEDs, such that the syscall driver interface can be agnostic to the LED polarity.

Usage

let led_pins = static_init!(
    [(&'static sam4l::gpio::GPIOPin, capsules::led::ActivationMode); 3],
    [(&sam4l::gpio::PA[13], capsules::led::ActivationMode::ActiveLow),   // Red
     (&sam4l::gpio::PA[15], capsules::led::ActivationMode::ActiveLow),   // Green
     (&sam4l::gpio::PA[14], capsules::led::ActivationMode::ActiveLow)]); // Blue
let led = static_init!(
    capsules::led::LED<'static, sam4l::gpio::GPIOPin>,
    capsules::led::LED::new(led_pins));

Syscall Interface

Command

All LED operations are synchronous, so this capsule only uses the command syscall.

command_num

Reexports

use kernel::AppId;
use kernel::Driver;
use kernel::ReturnCode;
use kernel::hil;

Structs

LED

Holds the array of GPIO pins attached to the LEDs and implements a Driver interface to control them.

Enums

ActivationMode

Whether the LEDs are active high or active low on this platform.

Constants

DRIVER_NUM

Syscall driver number.