BSP430
20141115
Board Support Package for MSP430 microcontrollers
|
Support for platform-independent LED manipulation. More...
Go to the source code of this file.
Data Structures | |
struct | sBSP430halLED |
Macros | |
#define | configBSP430_LED 1 |
#define | BSP430_LED 1 |
#define | BSP430_LED_GREEN include <bsp430/platform.h> |
#define | BSP430_LED_RED include <bsp430/platform.h> |
#define | configBSP430_LED_USE_COMMON 1 |
Typedefs | |
typedef struct sBSP430halLED | sBSP430halLED |
Functions | |
void | vBSP430ledInitialize_ni (void) |
void | vBSP430ledSet (int led_idx, int value) |
int | vBSP430ledGet (int led_idx) |
Variables | |
const sBSP430halLED | xBSP430halLED_ [] |
const unsigned char | nBSP430led |
Support for platform-independent LED manipulation.
#define BSP430_LED 1 |
Indicate that the LED interface is available on the platform. This is normally set by <bsp430/platform.h> when configBSP430_LED is true. If it happens to be false, the LED interface functions are replaced by macros that do nothing.
This flag is defined only if configBSP430_LED is true.
#define BSP430_LED_GREEN include <bsp430/platform.h> |
The platform-specific index for the first green LED.
This macro is defined in the platform-specific header on platforms that include a green LED. It is undefined if no green LED is available. If there are multiple green LEDs, subsequent ones would be numbered beginning with BSP430_LED_GREEN1 to indicate the second (sic) green LED.
Where possible, platforms should define both BSP430_LED_GREEN and BSP430_LED_RED. If one or the other is missing, but multiple LEDs are available, it is appropriate to use a different color for either or both, with the understanding that the inconsistency is specific to that board.
Additional colors may be available and are defined similarly. Availability of an LED color on a platform is determined by checking for the corresponding macro definition.
#define BSP430_LED_RED include <bsp430/platform.h> |
As with BSP430_LED_GREEN, but for red LEDs.
#define configBSP430_LED 1 |
Define to a true value to indicate intent to use the LED interface. Most platforms should support LEDs directly, bypassing any HAL/HPL interfaces.
#define configBSP430_LED_USE_COMMON 1 |
If the development board has LEDs that can be expressed using sBSP430halLED (i.e., controlled through 8-bit digital I/O ports with a single selection register) then the common implementation of the LED interface can be used. In that case, define this to a true value, and provide within a platform file or the application definitions of the xBSP430halLED_ and nBSP430led variables.
Since most platforms can benefit from the shared implementation, those that do not should override the default value.
typedef struct sBSP430halLED sBSP430halLED |
Structure used to define the LED interface.
The assumption is that all MSP430 board LEDs are controlled through GPIO pins. The address of the PxOUT register is provided explicitly; the PxSEL and PxDIR registers are inferred by comparing that address with the known addresses of the PxOUT registers in the initialization loop.
int vBSP430ledGet | ( | int | led_idx | ) |
Return a true value iff the given LED is lit.
led_idx | the index of the LED to test. Non-existent LEDs are considered to be off. |
void vBSP430ledInitialize_ni | ( | void | ) |
Call to initialize the hardware for all LEDs.
The common implementation uses the LEDs defined in xBSP430halLED_.
void vBSP430ledSet | ( | int | led_idx, |
int | value | ||
) |
Invoke to change the state of a given LED.
led_idx | the index to the LED of interest. The call does should simply return if ucLED does not specify a valid LED. |
value | how to set the LED. If positive, the LED is turned on. If zero, the LED is turned off. If negative, the LED state is inverted. |
const unsigned char nBSP430led |
The number of LEDs available on the platform.
If configBSP430_LED_USE_COMMON is true, this is the length of the xBSP430halLED_ configuration array. Otherwise it's just a constant. We'll assume there can't be more than 255 LEDs.
const sBSP430halLED xBSP430halLED_[] |
Platform should define the LED configuration available to it.