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


Individual LEDs

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

Multiple LEDs

  • 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

  • Turn LEDs off using a bitmask

  • Toggle LEDs using a bitmask

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.