-
Notifications
You must be signed in to change notification settings - Fork 4
Ref::LEDs
Leo Selavo edited this page Jan 13, 2016
·
6 revisions
LEDs can be turned on and off at will. They are used to give feedback to the users by shining a light of certain color, or not.
For a simple example using LEDs look at the Blink application description - or at: MansOS/apps/demo/Blink
LED names and aliases are defined in the respective platform's directory, in ledslist.h file.
However, the functions they support are created in MansOS/mos/include/leds.h
For example, the redLed has the following functions available:
void redLedInit(void)
void redLedSet(uint8_t val)
void redLedOn(void)
void redLedOff(void)
void redLedToggle(void)
uint_t redLedGet(void)
uint_t redLedMask(void)
Every LED also has the following constants (enums) associated with it:
redLed_num // the number in the order of LEDs
redLed_mask // the mask when addressing this LED in the all-LED configuration bitmask
-
Initialize the LED pins, turn them off
void initLeds() -
Set LEDs from a bitmask
void ledsSet(uint_t led_bitmask) -
Which LEDs are on? Returns a bitmask with the status of all LEDs
uint_t ledsGet(void) -
Turn LEDs on using a bitmask
ledsOn(led_bitmask) -
Turn LEDs off using a bitmask
ledsOff(led_bitmask) -
Toggle LEDs using a bitmask
ledsToggle(led_bitmask)