File containing the OLED functions. More...

Go to the source code of this file.
Macros | |
#define | CURRENT 1 |
Current. | |
#define | OLD 0 |
OLD. | |
#define | MD_COMPASS 0 |
Mode selected on display is compass. | |
#define | MD_NAVIG 1 |
Mode selected on display is naviguation. | |
#define | MD_RECORD 2 |
Mode selected on display is record. | |
#define | MD_SHUTDOWN 3 |
Mode selected on display is shutdown. | |
#define | NONE "" |
Direction is none. | |
#define | NORTH "N" |
Direction is north. | |
#define | NE "NE" |
Direction is north-east. | |
#define | EAST "E" |
Direction is east. | |
#define | SE "SE" |
Direction is south-east. | |
#define | SOUTH "S" |
Direction is south. | |
#define | SW "SO" |
Direction is south-west. | |
#define | WEST "O" |
Direction is west. | |
#define | NW "NO" |
Direction is north-west. | |
#define | OLED_ANSWER_ACK 6 |
OLED respond is ACK. | |
#define | ALICEBLUE 0xF7DF |
Color. | |
#define | ANTIQUEWHITE 0xFF5A |
Color. | |
#define | AQUA 0x07FF |
Color. | |
#define | AQUAMARINE 0x7FFA |
Color. | |
#define | AZURE 0xF7FF |
Color. | |
#define | BEIGE 0xF7BB |
Color. | |
#define | BISQUE 0xFF38 |
Color. | |
#define | BLACK 0x0000 |
Color. | |
#define | BLANCHEDALMOND 0xFF59 |
Color. | |
#define | BLUE 0x001F |
Color. | |
#define | BLUEVIOLET 0x895C |
Color. | |
#define | BROWN 0xA145 |
Color. | |
#define | BURLYWOOD 0xDDD0 |
Color. | |
#define | CADETBLUE 0x5CF4 |
Color. | |
#define | CHARTREUSE 0x7FE0 |
Color. | |
#define | CHOCOLATE 0xD343 |
Color. | |
#define | CORAL 0xFBEA |
Color. | |
#define | CORNFLOWERBLUE 0x64BD |
Color. | |
#define | CORNSILK 0xFFDB |
Color. | |
#define | CRIMSON 0xD8A7 |
Color. | |
#define | CYAN 0x07FF |
Color. | |
#define | DARKBLUE 0x0011 |
Color. | |
#define | DARKCYAN 0x0451 |
Color. | |
#define | DARKGOLDENROD 0xBC21 |
Color. | |
#define | DARKGRAY 0xAD55 |
Color. | |
#define | DARKGREEN 0x0320 |
Color. | |
#define | DARKKHAKI 0xBDAD |
Color. | |
#define | DARKMAGENTA 0x8811 |
Color. | |
#define | DARKOLIVEGREEN 0x5345 |
Color. | |
#define | DARKORANGE 0xFC60 |
Color. | |
#define | DARKORCHID 0x9999 |
Color. | |
#define | DARKRED 0x8800 |
Color. | |
#define | DARKSALMON 0xECAF |
Color. | |
#define | DARKSEAGREEN 0x8DF1 |
Color. | |
#define | DARKSLATEBLUE 0x49F1 |
Color. | |
#define | DARKSLATEGRAY 0x2A69 |
Color. | |
#define | DARKTURQUOISE 0x067A |
Color. | |
#define | DARKVIOLET 0x901A |
Color. | |
#define | DEEPPINK 0xF8B2 |
Color. | |
#define | DEEPSKYBLUE 0x05FF |
Color. | |
#define | DIMGRAY 0x6B4D |
Color. | |
#define | DODGERBLUE 0x1C9F |
Color. | |
#define | FIREBRICK 0xB104 |
Color. | |
#define | FLORALWHITE 0xFFDE |
Color. | |
#define | FORESTGREEN 0x2444 |
Color. | |
#define | FUCHSIA 0xF81F |
Color. | |
#define | GAINSBORO 0xDEFB |
Color. | |
#define | GHOSTWHITE 0xFFDF |
Color. | |
#define | GOLD 0xFEA0 |
Color. | |
#define | GOLDENROD 0xDD24 |
Color. | |
#define | GRAY 0x8410 |
Color. | |
#define | GREEN 0x0400 |
Color. | |
#define | GREENYELLOW 0xAFE5 |
Color. | |
#define | HONEYDEW 0xF7FE |
Color. | |
#define | HOTPINK 0xFB56 |
Color. | |
#define | INDIANRED 0xCAEB |
Color. | |
#define | INDIGO 0x4810 |
Color. | |
#define | IVORY 0xFFFE |
Color. | |
#define | KHAKI 0xF731 |
Color. | |
#define | LAVENDER 0xE73F |
Color. | |
#define | LAVENDERBLUSH 0xFF9E |
Color. | |
#define | LAWNGREEN 0x7FE0 |
Color. | |
#define | LEMONCHIFFON 0xFFD9 |
Color. | |
#define | LIGHTBLUE 0xAEDC |
Color. | |
#define | LIGHTCORAL 0xF410 |
Color. | |
#define | LIGHTCYAN 0xE7FF |
Color. | |
#define | LIGHTGOLD 0xFFDA |
Color. | |
#define | LIGHTGREEN 0x9772 |
Color. | |
#define | LIGHTGREY 0xD69A |
Color. | |
#define | LIGHTPINK 0xFDB8 |
Color. | |
#define | LIGHTSALMON 0xFD0F |
Color. | |
#define | LIGHTSEAGREEN 0x2595 |
Color. | |
#define | LIGHTSKYBLUE 0x867F |
Color. | |
#define | LIGHTSLATEGRAY 0x7453 |
Color. | |
#define | LIGHTSTEELBLUE 0xB63B |
Color. | |
#define | LIGHTYELLOW 0xFFFC |
Color. | |
#define | LIME 0x07E0 |
Color. | |
#define | LIMEGREEN 0x3666 |
Color. | |
#define | LINEN 0xFF9C |
Color. | |
#define | MAGENTA 0xF81F |
Color. | |
#define | MAROON 0x8000 |
Color. | |
#define | MEDIUMAQUAMARINE 0x6675 |
Color. | |
#define | MEDIUMBLUE 0x0019 |
Color. | |
#define | MEDIUMORCHID 0xBABA |
Color. | |
#define | MEDIUMPURPLE 0x939B |
Color. | |
#define | MEDIUMSEAGREEN 0x3D8E |
Color. | |
#define | MEDIUMSLATEBLUE 0x7B5D |
Color. | |
#define | MEDIUMSPRINGGREEN 0x07D3 |
Color. | |
#define | MEDIUMTURQUOISE 0x4E99 |
Color. | |
#define | MEDIUMVIOLETRED 0xC0B0 |
Color. | |
#define | MIDNIGHTBLUE 0x18CE |
Color. | |
#define | MINTCREAM 0xF7FF |
Color. | |
#define | MISTYROSE 0xFF3C |
Color. | |
#define | MOCCASIN 0xFF36 |
Color. | |
#define | NAVAJOWHITE 0xFEF5 |
Color. | |
#define | NAVY 0x0010 |
Color. | |
#define | OLDLACE 0xFFBC |
Color. | |
#define | OLIVE 0x8400 |
Color. | |
#define | OLIVEDRAB 0x6C64 |
Color. | |
#define | ORANGE 0xFD20 |
Color. | |
#define | ORANGERED 0xFA20 |
Color. | |
#define | ORCHID 0xDB9A |
Color. | |
#define | PALEGOLDENROD 0xEF55 |
Color. | |
#define | PALEGREEN 0x9FD3 |
Color. | |
#define | PALETURQUOISE 0xAF7D |
Color. | |
#define | PALEVIOLETRED 0xDB92 |
Color. | |
#define | PAPAYAWHIP 0xFF7A |
Color. | |
#define | PEACHPUFF 0xFED7 |
Color. | |
#define | PERU 0xCC27 |
Color. | |
#define | PINK 0xFE19 |
Color. | |
#define | PLUM 0xDD1B |
Color. | |
#define | POWDERBLUE 0xB71C |
Color. | |
#define | PURPLE 0x8010 |
Color. | |
#define | RED 0xF800 |
Color. | |
#define | ROSYBROWN 0xBC71 |
Color. | |
#define | ROYALBLUE 0x435C |
Color. | |
#define | SADDLEBROWN 0x8A22 |
Color. | |
#define | SALMON 0xFC0E |
Color. | |
#define | SANDYBROWN 0xF52C |
Color. | |
#define | SEAGREEN 0x2C4A |
Color. | |
#define | SEASHELL 0xFFBD |
Color. | |
#define | SIENNA 0xA285 |
Color. | |
#define | SILVER 0xC618 |
Color. | |
#define | SKYBLUE 0x867D |
Color. | |
#define | SLATEBLUE 0x6AD9 |
Color. | |
#define | SLATEGRAY 0x7412 |
Color. | |
#define | SNOW 0xFFDF |
Color. | |
#define | SPRINGGREEN 0x07EF |
Color. | |
#define | STEELBLUE 0x4416 |
Color. | |
#define | TAN 0xD5B1 |
Color. | |
#define | TEAL 0x0410 |
Color. | |
#define | THISTLE 0xDDFB |
Color. | |
#define | TOMATO 0xFB08 |
Color. | |
#define | TURQUOISE 0x471A |
Color. | |
#define | VIOLET 0xEC1D |
Color. | |
#define | WHEAT 0xF6F6 |
Color. | |
#define | WHITE 0xFFFF |
Color. | |
#define | WHITESMOKE 0xF7BE |
Color. | |
#define | YELLOW 0xFFE0 |
Color. | |
#define | YELLOWGREEN 0x9E66 |
Color. | |
Functions | |
void | enableUSARTforOLED () |
Enable and config USART for OLED. | |
void | resetOLED () |
Reset OLED. | |
void | toggleOLEDInterrupt (unsigned int state) |
Toggle OLED interrupt. More... | |
void | sendChar (int c) |
Send char. More... | |
void | usart1_rx () |
Receive function for OLED data (USART1, interrupt mode) | |
void | gfx_Clean () |
Clean the screen. | |
void | gfx_BGcolour (int color) |
Set the background color. More... | |
void | gfx_PutString (char *string) |
Put a string on the screen. More... | |
void | gfx_RectangleFilled (int x1, int y1, int x2, int y2, int color) |
Draw a rectangle filled with a color. More... | |
void | SSTimeout (int t) |
Screensave mode. More... | |
void | setBaudRate () |
Set the baud rate. | |
void | gfx_CalculateOrbit (int angle, int distance, int *x, int *y) |
Calculate the (x,y) pos (orbit) from angle and distance. More... | |
void | gfx_DrawCircle (int x, int y, int radius, int color) |
Draw a circle. More... | |
void | gfx_DrawLine (int x1, int y1, int x2, int y2, int color) |
Draw a line. More... | |
void | gfx_ScreenMode (int mode) |
Screen mode (portrait/landscape) More... | |
void | gfx_MoveOrigin (int x, int y) |
Move to origin to a position. More... | |
void | gfx_Rectangle (int x1, int y1, int x2, int y2, int color) |
Draw a rectangle. More... | |
void | txt_Width (int multi) |
Set the width of the text. More... | |
void | txt_FGColor (int color) |
Set the text color. More... | |
void | txt_BGColor (int color) |
Set the text background color. More... | |
void | initOLED () |
Configure OLED for proper using. | |
void | displayMainMenu () |
Display menu. | |
void | updateMenu () |
Update the menu with currently selected. | |
void | displayMessage (char *string) |
Display a string in the center of the screen. More... | |
void | displayCompass () |
Display the compass. | |
void | displayHeader () |
Display message header. | |
char * | calculateDirection () |
Calculate the direction (N, S, NE, etc.) More... | |
void | ftoa (char *p, float x) |
Float to string conversion. More... | |
Variables | |
unsigned int | modeDisplay |
unsigned int | oldModeDisplay |
int | displayHasBeenUpdated |
Detailed Description
File containing the OLED functions.
Function Documentation
char* calculateDirection | ( | ) |
Calculate the direction (N, S, NE, etc.)
- Returns
- The direction.

void displayMessage | ( | char * | string | ) |
Display a string in the center of the screen.
- Parameters
-
string The string to display


void ftoa | ( | char * | p, |
float | x | ||
) |
Float to string conversion.
- Parameters
-
p The buffer (string) [in] x The float

void gfx_BGcolour | ( | int | color | ) |
Set the background color.
- Parameters
-
[in] color The color


void gfx_CalculateOrbit | ( | int | angle, |
int | distance, | ||
int * | x, | ||
int * | y | ||
) |
Calculate the (x,y) pos (orbit) from angle and distance.
- Parameters
-
[in] angle The angle [in] distance The distance x The x pos computed y The y pos computed


void gfx_DrawCircle | ( | int | x, |
int | y, | ||
int | radius, | ||
int | color | ||
) |
Draw a circle.
- Parameters
-
[in] x x pos of center of the circle [in] y y pos of center of the circle [in] radius The radius [in] color The color


void gfx_DrawLine | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | color | ||
) |
Draw a line.
- Parameters
-
[in] x1 The x pos of the beginning of the line [in] y1 The y pos of the beginning of the line [in] x2 The x pos of the ending of the line [in] y2 The y pos of the ending of the line [in] color The color


void gfx_MoveOrigin | ( | int | x, |
int | y | ||
) |
Move to origin to a position.
- Parameters
-
[in] x The new x pos [in] y The new y pos


void gfx_PutString | ( | char * | string | ) |
Put a string on the screen.
- Parameters
-
string The string


void gfx_Rectangle | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | color | ||
) |
Draw a rectangle.
- Parameters
-
[in] x1 The x pos of the top left corner [in] y1 The y pos of the top left corner [in] x2 The x pos of the bottom right corner [in] y2 The y pos of the bottom right corner [in] color The color


void gfx_RectangleFilled | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | color | ||
) |
Draw a rectangle filled with a color.
- Parameters
-
[in] x1 The x pos of the top left corner [in] y1 The y pos of the top left corner [in] x2 The x pos of the bottom right corner [in] y2 The y pos of the bottom right corner [in] color The color


void gfx_ScreenMode | ( | int | mode | ) |
Screen mode (portrait/landscape)
- Parameters
-
[in] mode The mode


void sendChar | ( | int | c | ) |
Send char.
- Parameters
-
c The int to send

void SSTimeout | ( | int | t | ) |
Screensave mode.
- Parameters
-
[in] t The mode


void toggleOLEDInterrupt | ( | unsigned int | state | ) |
Toggle OLED interrupt.
1 = interrupt enable for OLED, 0 = disable
- Parameters
-
state The new state

void txt_BGColor | ( | int | color | ) |
Set the text background color.
- Parameters
-
[in] color The color


void txt_FGColor | ( | int | color | ) |
Set the text color.
- Parameters
-
[in] color The color


void txt_Width | ( | int | multi | ) |
Set the width of the text.
- Parameters
-
[in] multi The multi

Variable Documentation
int displayHasBeenUpdated |
Is the display has been updated, aka needed
unsigned int modeDisplay |
What mode is selected right now
unsigned int oldModeDisplay |
What mode was selected just before