xyControl
0.1
Quadrotor Flight Controller on AVR Basis
|
Controls xyControl On-Board Hardware like LEDs. More...
Files | |
file | xycontrol.h |
xyControl API Header. | |
file | xycontrol.c |
xyControl API Implementation. | |
Data Structures | |
struct | Vector3f |
The global 3-Dimensional Floating Point Vector. More... | |
Enumerations | |
enum | LED { LED_RED0 = 0, LED_RED1 = 1, LED_GREEN0 = 2, LED_GREEN1 = 3, LED_ALL = 4, LED_BITMAP = 5, LED_RED = 6, LED_GREEN = 7 } |
Methods of addressing the LEDs. More... | |
enum | LEDState { LED_OFF = 0, LED_ON = 1, LED_TOGGLE = 2 } |
Possible states of the LEDs. More... | |
Functions | |
void | xyInit (void) |
Initialize the xyControl Hardware. More... | |
void | xyLed (LED l, LEDState v) |
Set the LEDs. More... | |
double | getVoltage (void) |
Calculate and return the Battery Voltage. More... | |
void | xySelfReset (void) |
Use the Watchdog to reset yourself after 15ms. More... | |
int64_t | map (int64_t value, int64_t oldMin, int64_t oldMax, int64_t newMin, int64_t newMax) |
Map an Integer from one range to another range. More... | |
int | uartoutput (char c, FILE *f) |
Method used to write to stdout and stderr. More... | |
int | uartinput (FILE *f) |
Method used to read from stdin. More... | |
void | xyLedInternal (uint8_t v, volatile uint8_t *port, uint8_t pin) |
Internal LED Manipulation function. More... | |
Variables | |
char PROGMEM | helpText [] = "Print this Help" |
UART Menu Help Text. More... | |
char PROGMEM | resetText [] = "Reset MCU" |
UART Menu Reset Text. More... | |
FILE | inFile |
FILE for stdin. More... | |
FILE | outFile |
FILE for stdout and stderr. More... | |
Controls xyControl On-Board Hardware like LEDs.
enum LED |
Methods of addressing the LEDs.
Definition at line 44 of file xycontrol.h.
enum LEDState |
Possible states of the LEDs.
Enumerator | |
---|---|
LED_OFF |
LED Off. |
LED_ON |
LED On. |
LED_TOGGLE |
Toggle the LED. |
Definition at line 56 of file xycontrol.h.
double getVoltage | ( | void | ) |
Calculate and return the Battery Voltage.
Definition at line 172 of file xycontrol.c.
References adcGet(), adcReady(), adcStart(), BATT_CHANNEL, and BATT_MAX.
int64_t map | ( | int64_t | value, |
int64_t | oldMin, | ||
int64_t | oldMax, | ||
int64_t | newMin, | ||
int64_t | newMax | ||
) |
Map an Integer from one range to another range.
value | Integer to operate on |
oldMin | Lower Limit of Input range |
oldMax | Upper Limit of Input range |
newMin | Lower Limit of Output range |
newMax | Upper Limit of Output range |
Definition at line 184 of file xycontrol.c.
int uartinput | ( | FILE * | f | ) |
Method used to read from stdin.
Definition at line 81 of file xycontrol.c.
References serialAvailable(), serialGet(), and serialHasChar().
Referenced by xyInit().
int uartoutput | ( | char | c, |
FILE * | f | ||
) |
Method used to write to stdout and stderr.
Definition at line 66 of file xycontrol.c.
References serialAvailable(), and serialWrite().
Referenced by xyInit().
void xyInit | ( | void | ) |
Initialize the xyControl Hardware.
Initializes LEDs, Timer, UART, I2C, SPI, ADC, the UART Menu and prepares stdin and stdout.
Definition at line 91 of file xycontrol.c.
References adcInit(), addMenuCommand(), addTask(), AVCC, BAUD, helpText, inFile, initSystemTimer(), LED0DDR, LED0PIN, LED1DDR, LED1PIN, LED2DDR, LED2PIN, LED3DDR, LED3PIN, MODE_0, outFile, resetText, serialAvailable(), serialInit(), SPEED_2, spiInit(), twiInit(), uartinput(), uartMenuPrintHelp(), uartMenuTask(), uartoutput(), xmemInit(), xyLed(), and xySelfReset().
Set the LEDs.
l | LEDs to set |
v | New LED State |
Referenced by xyInit().
void xyLedInternal | ( | uint8_t | v, |
volatile uint8_t * | port, | ||
uint8_t | pin | ||
) |
Internal LED Manipulation function.
v | New LED State (Off, On, Toggle) |
port | The Corresponding Output Port |
pin | The LED Pin |
Definition at line 134 of file xycontrol.c.
void xySelfReset | ( | void | ) |
Use the Watchdog to reset yourself after 15ms.
Definition at line 179 of file xycontrol.c.
Referenced by orientationTask(), and xyInit().
char PROGMEM helpText[] = "Print this Help" |
FILE inFile |
FILE outFile |
char PROGMEM resetText[] = "Reset MCU" |