BSP430  20141115
Board Support Package for MSP430 microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
bootstrap/blink/main.c
/* We're going to use LEDs so we need the interface file */
/* We want to know the nominal clock speed so we can delay. */
#include <bsp430/clock.h>
void main ()
{
int led = 0;
/* First thing you do in main is configure the platform.
* Note that this configures the LEDs. */
while (1) {
/* A common complaint is that "blink doesn't work!" when the issue
* is that the watchdog is resetting the board. Don't let that
* happen to you. */
if (1 < nBSP430led) {
/* If there are multiple LEDs, turn each LED on in turn, wait a
* half second, then turn it off and move to the next LED. If
* there's only one LED, the invert state handles the on as well
* as the off. */
vBSP430ledSet(led, 1);
}
/* -1 means "invert state", which in this case will turn it off */
vBSP430ledSet(led, -1);
if (++led == nBSP430led) {
led = 0;
}
}
}