Wixel SDK
|
Go to the source code of this file.
Macros | |
#define | LED_GREEN(v) {((v) ? (P2DIR |= 0x10) : (P2DIR &= ~0x10));} |
#define | LED_YELLOW(v) {((v) ? (P2DIR |= 0x04) : (P2DIR &= ~0x04));} |
#define | LED_RED(v) {((v) ? (P2DIR |= 0x02) : (P2DIR &= ~0x02));} |
#define | LED_GREEN_STATE ((P2DIR >> 4) & 1) |
#define | LED_YELLOW_STATE ((P2DIR >> 2) & 1) |
#define | LED_RED_STATE ((P2DIR >> 1) & 1) |
#define | LED_GREEN_TOGGLE() {P2DIR ^= 0x10;} |
#define | LED_YELLOW_TOGGLE() {P2DIR ^= 0x04;} |
#define | LED_RED_TOGGLE() {P2DIR ^= 0x02;} |
Functions | |
void | systemInit () |
void | boardIoInit () |
void | boardClockInit () |
void | boardService () |
void | boardStartBootloaderIfNeeded () |
void | boardStartBootloader () |
BIT | usbPowerPresent () |
BIT | vinPowerPresent () |
void | enableUsbPullup () |
void | disableUsbPullup () |
Variables | |
uint8 CODE | serialNumber [4] |
uint16 CODE | serialNumberStringDescriptor [] |
This file provides basic functions for manipulating the hardware on the Wixel, such as the LEDs, power detection pins, and the pullup on the USB D+ line. It also has functions related to the Wixel's bootloader. The implementations of these functions are in wixel.lib
.
Definition in file board.h.
#define LED_GREEN | ( | v | ) | {((v) ? (P2DIR |= 0x10) : (P2DIR &= ~0x10));} |
#define LED_GREEN_STATE ((P2DIR >> 4) & 1) |
#define LED_GREEN_TOGGLE | ( | ) | {P2DIR ^= 0x10;} |
#define LED_RED | ( | v | ) | {((v) ? (P2DIR |= 0x02) : (P2DIR &= ~0x02));} |
#define LED_RED_STATE ((P2DIR >> 1) & 1) |
#define LED_RED_TOGGLE | ( | ) | {P2DIR ^= 0x02;} |
#define LED_YELLOW | ( | v | ) | {((v) ? (P2DIR |= 0x04) : (P2DIR &= ~0x04));} |
#define LED_YELLOW_STATE ((P2DIR >> 2) & 1) |
#define LED_YELLOW_TOGGLE | ( | ) | {P2DIR ^= 0x04;} |
void boardClockInit | ( | ) |
Initializes the board's clock and conifgures the CPU and the timers to run as fast as possible.
This function is called by systemInit().
void boardIoInit | ( | ) |
Initializes the board's I/O lines. Specifically, this function:
This function is called by systemInit().
void boardService | ( | ) |
Takes care of any board-related tasks that need to be performed regularly. Right now all this function does is call boardStartBootloaderIfNeeded() so you should call this function regularly if you want to be able to jump to the bootloader from the application by shorting P2_2 to 3V3.
void boardStartBootloader | ( | ) |
void boardStartBootloaderIfNeeded | ( | ) |
Checks to see if the yellow LED line (P2_2) is connected to 3V3. If they are connected, then it starts the bootloader by calling boardStartBootloader. This function is called by boardService. If you call this function regularly, then it provides a relatively easy way to get into bootloader mode if you can't do it with a USB command. Currently this function only works while the yellow LED is off.
void disableUsbPullup | ( | ) |
void enableUsbPullup | ( | ) |
void systemInit | ( | ) |
Initializes the board's I/O lines, clock and other basic things. You will typically want to call this function at the very beginning of main() before you do anything else. This is a simple function which just calls several other initialization functions so you can look at the documentation of those other functions to find out exactly what this one does.
This function calls:
BIT usbPowerPresent | ( | ) |
This function relies on getMs, so you must call timeInit() before calling this. If this function returns 1, it means that the USB cable is plugged in.
BIT vinPowerPresent | ( | ) |
The 32-bit serial number of this device. The Wixel's serial number is stored in the bootloader's flash section.