oled.c File Reference

File containing the OLED functions. More...

#include <__cross_studio_io.h>
#include <msp430x16x.h>
#include <stdlib.h>
#include "main.h"
#include "oled.h"
#include "pad.h"
#include "gps.h"
Include dependency graph for oled.c:

Functions

void enableUSARTforOLED (void)
 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 (void)
 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 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_MoveOrigin (int x, int y)
 Move to origin to a position. More...
 
void gfx_ScreenMode (int mode)
 Screen mode (portrait/landscape) More...
 
void txt_FGColor (int color)
 Set the text color. More...
 
void txt_BGColor (int color)
 Set the text background color. More...
 
void setBaudRate ()
 Set the baud rate.
 
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 initOLED ()
 Configure OLED for proper using.
 
void displayMainMenu ()
 Display menu.
 
void updateMenu ()
 Update the menu with currently selected.
 
void displayHeader ()
 Display message header.
 
void displayMessage (char *string)
 Display a string in the center of the screen. More...
 
void displayCompass ()
 Display the compass.
 
void ftoa (char *p, float x)
 Float to string conversion. More...
 
char * calculateDirection ()
 Calculate the direction (N, S, NE, etc.) More...
 

Variables

int displayHasBeenUpdated
 
unsigned int modeDisplay = MD_SHUTDOWN
 
unsigned int oldModeDisplay
 
int answer = 0
 The answer received by the OLED.
 
int flagReceive = 0
 Answer received?
 

Detailed Description

File containing the OLED functions.

Author
Gaƫl Foppolo (gaelfoppolo)

Function Documentation

char* calculateDirection ( )

Calculate the direction (N, S, NE, etc.)

Returns
The direction.

Here is the caller graph for this function:

void displayMessage ( char *  string)

Display a string in the center of the screen.

Parameters
stringThe string to display

Here is the call graph for this function:

Here is the caller graph for this function:

void ftoa ( char *  p,
float  x 
)

Float to string conversion.

Parameters
pThe buffer (string)
[in]xThe float

Here is the caller graph for this function:

void gfx_BGcolour ( int  color)

Set the background color.

Parameters
[in]colorThe color

Here is the call graph for this function:

Here is the caller graph for this function:

void gfx_CalculateOrbit ( int  angle,
int  distance,
int *  x,
int *  y 
)

Calculate the (x,y) pos (orbit) from angle and distance.

Parameters
[in]angleThe angle
[in]distanceThe distance
xThe x pos computed
yThe y pos computed

Here is the call graph for this function:

Here is the caller graph for this function:

void gfx_DrawCircle ( int  x,
int  y,
int  radius,
int  color 
)

Draw a circle.

Parameters
[in]xx pos of center of the circle
[in]yy pos of center of the circle
[in]radiusThe radius
[in]colorThe color

Here is the call graph for this function:

Here is the caller graph for this function:

void gfx_DrawLine ( int  x1,
int  y1,
int  x2,
int  y2,
int  color 
)

Draw a line.

Parameters
[in]x1The x pos of the beginning of the line
[in]y1The y pos of the beginning of the line
[in]x2The x pos of the ending of the line
[in]y2The y pos of the ending of the line
[in]colorThe color

Here is the call graph for this function:

Here is the caller graph for this function:

void gfx_MoveOrigin ( int  x,
int  y 
)

Move to origin to a position.

Parameters
[in]xThe new x pos
[in]yThe new y pos

Here is the call graph for this function:

Here is the caller graph for this function:

void gfx_PutString ( char *  string)

Put a string on the screen.

Parameters
stringThe string

Here is the call graph for this function:

Here is the caller graph for this function:

void gfx_Rectangle ( int  x1,
int  y1,
int  x2,
int  y2,
int  color 
)

Draw a rectangle.

Parameters
[in]x1The x pos of the top left corner
[in]y1The y pos of the top left corner
[in]x2The x pos of the bottom right corner
[in]y2The y pos of the bottom right corner
[in]colorThe color

Here is the call graph for this function:

Here is the caller graph for this function:

void gfx_RectangleFilled ( int  x1,
int  y1,
int  x2,
int  y2,
int  color 
)

Draw a rectangle filled with a color.

Parameters
[in]x1The x pos of the top left corner
[in]y1The y pos of the top left corner
[in]x2The x pos of the bottom right corner
[in]y2The y pos of the bottom right corner
[in]colorThe color

Here is the call graph for this function:

Here is the caller graph for this function:

void gfx_ScreenMode ( int  mode)

Screen mode (portrait/landscape)

Parameters
[in]modeThe mode

Here is the call graph for this function:

Here is the caller graph for this function:

void sendChar ( int  c)

Send char.

Parameters
cThe int to send

Here is the caller graph for this function:

void SSTimeout ( int  t)

Screensave mode.

Parameters
[in]tThe mode

Here is the call graph for this function:

Here is the caller graph for this function:

void toggleOLEDInterrupt ( unsigned int  state)

Toggle OLED interrupt.

1 = interrupt enable for OLED, 0 = disable

Parameters
stateThe new state

Here is the caller graph for this function:

void txt_BGColor ( int  color)

Set the text background color.

Parameters
[in]colorThe color

Here is the call graph for this function:

Here is the caller graph for this function:

void txt_FGColor ( int  color)

Set the text color.

Parameters
[in]colorThe color

Here is the call graph for this function:

Here is the caller graph for this function:

void txt_Width ( int  multi)

Set the width of the text.

Parameters
[in]multiThe multi

Here is the call graph for this function:

Variable Documentation

int displayHasBeenUpdated

Is the display has been updated, aka needed

unsigned int modeDisplay = MD_SHUTDOWN

What mode is selected right now

unsigned int oldModeDisplay

What mode was selected just before