See LED Control for documentation.

License#

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

/***************************************************************************/
#ifndef __LED_H__
#define __LED_H__

#ifdef HAL_CONFIG
#include "hal-config.h"
enum HalBoardLedPins {
#if BSP_LED_COUNT <= 1
  BOARDLED0 = 0,
  BOARDLED1 = BOARDLED0,
  BOARDLED2 = BOARDLED0,
  BOARDLED3 = BOARDLED0,
  BOARD_ACTIVITY_LED  = BOARDLED0,
  BOARD_HEARTBEAT_LED = BOARDLED0
#endif
#if BSP_LED_COUNT == 2
  BOARDLED0 = 0,
  BOARDLED1 = 1,
  BOARDLED2 = BOARDLED0,
  BOARDLED3 = BOARDLED1,
  BOARD_ACTIVITY_LED  = BOARDLED0,
  BOARD_HEARTBEAT_LED = BOARDLED1
#endif
#if BSP_LED_COUNT == 3
  BOARDLED0 = 0,
  BOARDLED1 = 1,
  BOARDLED2 = 2,
  BOARDLED3 = BOARDLED1,
  BOARD_ACTIVITY_LED  = BOARDLED0,
  BOARD_HEARTBEAT_LED = BOARDLED1
#endif
#if BSP_LED_COUNT >= 4
  BOARDLED0 = 0,
  BOARDLED1 = 1,
  BOARDLED2 = 2,
  BOARDLED3 = 3,
  BOARD_ACTIVITY_LED  = BOARDLED0,
  BOARD_HEARTBEAT_LED = BOARDLED1
#endif
};
#endif

void halInternalInitLed(void);

#if defined(STACK) || defined(MINIMAL_HAL)
typedef uint8_t HalBoardLed;
#else
typedef enum HalBoardLedPins HalBoardLed;
#endif
// Note: Even though many compilers will use 16 bits for an enum instead of 8,
//  we choose to use an enum here.  The possible compiler inefficiency does not
//  affect stack-based parameters and local variables, which is the
//  general case for led paramters.

void halToggleLed(HalBoardLed led);

void halSetLed(HalBoardLed led);

void halClearLed(HalBoardLed led);

void halStackIndicateActivity(bool turnOn);

#endif // __LED_H__

Typedefs#

typedef enum HalBoardLedPins

Ensures that the definitions from the BOARD_HEADER are always used as parameters to the LED functions.

Functions#

void

Configures GPIOs pertaining to the control of LEDs.

void
halToggleLed(HalBoardLed led)

Atomically wraps an XOR or similar operation for a single GPIO pin attached to an LED.

void
halSetLed(HalBoardLed led)

Turns on (sets) a GPIO pin connected to an LED so that the LED turns on.

void
halClearLed(HalBoardLed led)

Turns off (clears) a GPIO pin connected to an LED, which turns off the LED.

void

Called by the stack to indicate activity over the radio (for both transmission and reception). It is called once with turnOn true and shortly thereafter with turnOn false.

Typedef Documentation#

HalBoardLed#

typedef enum HalBoardLedPins HalBoardLed

Ensures that the definitions from the BOARD_HEADER are always used as parameters to the LED functions.


Definition at line 70 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/led.h

Function Documentation#

halInternalInitLed#

void halInternalInitLed (void )

Configures GPIOs pertaining to the control of LEDs.

Parameters
N/A

Definition at line 70 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/led.h

halToggleLed#

void halToggleLed (HalBoardLed led)

Atomically wraps an XOR or similar operation for a single GPIO pin attached to an LED.

Parameters
N/Aled

Identifier (from BOARD_HEADER) for the LED to be toggled.


Definition at line 90 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/led.h

halSetLed#

void halSetLed (HalBoardLed led)

Turns on (sets) a GPIO pin connected to an LED so that the LED turns on.

Parameters
N/Aled

Identifier (from BOARD_HEADER) for the LED to turn on.


Definition at line 97 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/led.h

halClearLed#

void halClearLed (HalBoardLed led)

Turns off (clears) a GPIO pin connected to an LED, which turns off the LED.

Parameters
N/Aled

Identifier (from BOARD_HEADER) for the LED to turn off.


Definition at line 104 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/led.h

halStackIndicateActivity#

void halStackIndicateActivity (bool turnOn)

Called by the stack to indicate activity over the radio (for both transmission and reception). It is called once with turnOn true and shortly thereafter with turnOn false.

Parameters
N/AturnOn

See Usage.

Typically does something interesting, such as change the state of an LED.


Definition at line 115 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/led.h