Functions

uOLED display

Set of libraries for interfacing the uOLED touchscreen attached to BOA. More...

Functions

struct sercom_datauoled_sercom_init (char *tty, void(*sighandler)(int))
 Initializes and opens serial port (sercom).
void uoled_sercom_close ()
 Close serial port (sercom).
int uoled_read_cmd (uint8_t *buff, int size)
 Read data from serial port (sercom).
int uoled_recieve_cmd (UDE_recieve_cmd_t *cmd)
 Read command from serial port.
int uoled_display_status (UDE_component_t c, UDE_hw_status_t s)
 Send the actual state of components to display.
int uoled_display_fsm (UDE_fsm_t fsm, char *state)
 Send the actual state of FSM to display.
int uoled_display_alive ()
 Used to refresh display indication that comunication is ok.
int uoled_display_voltage (double voltage33, double voltage50, double voltage80, double voltageBAT)
 Used to refresh voltage readings on the display.
int uoled_display_position (double x, double y, double phi)
 Used to refresh actual position on the display.

Detailed Description

Set of libraries for interfacing the uOLED touchscreen attached to BOA.

Parts:

uoled library

Library uoled contains functions, which create control messages in proper format for communication with the display on serial port.

Communication protocol

S displejem se bude komunikovat pomoci zprav. Z robota (ci PC) do displeje bude obsahovat prvni byte identifikator toho co se posila a pak data. Muze se to udelat tak, ze identifikator bude mit vzdy nahozen bit c. 7 (tj. bude betsi nez 128) a data budou mit tento bit vzdy 0 (jen spodnich 7 bitu = ASCII).

I kdyz se nejaky byte po ceste ztrati, displej bude schopen se zasynchronizovat a nestane se to co vloni, ze obcas se to nejak rozsynchronizovalo a displej zobrazoval kraviny.

Dalsi dusledek tohoto bude, ze kdyz se zmeni jen jeden udaj, nebude potreba do displeje posilat vsechno a tim padem bude displej reagovat rychleji na zmeny.

Tedka co bude displej letos zobrazovat. Vzhledem k tomu, ze vnitrni mechanismy robota letos temer zadne nebudou, tak to bude dost jednoduche:

1) Status jednotlivych komponent. Stejne jako vloni, to budou barevne ctverecky s nazvem komponenty. Mozne hodnoty (a barvy budou)

Jednotlive komponenty pro letosni rok budou (cislo udvava ccccc nize):

1. MOT - ridici jednotka motoru 2. ODO - odometrie 3. CAM - kamera 4. PWR - napajeci zdroje 5. HOK - Hokuyo 6. APP - ridici aplikace 7. VID - ovladani vidli a dvirek na vysypavani 8. STA - startovaci tlacitko

Format zpravy pro displej:

| ID | Data | |------+-------------| | 0x81 | 0ssccccc(b) | (b) znamena binarne tj. jednotlive bity |------+-------------|

2) Stav napajeni - stejne jako vloni: hodnoty napeti pro vetve 3.3V (a), 5V (b), 8V (c) a na baterce (d). Pozadi bude cervene (x=1) pokud hodnota klesne pod urcitou mez, a zelene pokud bude OK (x=00). U napeti baterku jeste rozlisujeme 3. stav (varovani = oranzova), ktery je signalizovan bitem w. Pokud je w = 1 a zaroven d = 1, je pozadi cervene.

| ID | Status | ASCII hodnoty napeti | | | (odpovida xx) | | |------+---------------+----------------------| | 0x82 | 000wabcd(b) | AAAABBBBCCCCDDDD | |------+---------------+----------------------|

Priklad:

3) Aktualni stavy stavovych automatu:

| ID | ASCII Nazev stavu (max 20?? znaku ukunceno '') | |------+--------------------------------------------------| | 0x83 | main_fsm_state | |------+--------------------------------------------------| | 0x84 | move_fsm_state | |------+--------------------------------------------------| | 0x85 | act_fsm_state | |------+--------------------------------------------------|

4) Poloha robota

| ID | ASCII hodnoty X, Y a uhel | |------+---------------------------| | 0x86 | XXXYYYAAA | |------+---------------------------|

Priklad: 0x86 "175042122" na displeji bude "X=1.75 Y=0.42 122°" (nebo tak nejak)

Uhel bude v rozsahu 0 - 359. Kdybys chtel bejt frajer, tak by sel uhel zobrazovat graficky jako sipku (kompas).

5) Keep-alive

| ID | |------| | 0x87 | |------|

Po projeti tohto prikazy se na displeji zmeni ukazatel toho, ze funguje komunikace s displejem = napriklad klasicky ASCII mlejnek - postupne zobrazovane znaky '-', '/', '|' a '\'.

6) Rozpoznane kukurice

| ID | Rozpoznane kombinace kukuric | |------+------------------------------| | 0x88 | AB |

A = kombinace bocnich kukuric 1 az 9 B = kombinace strednich kukuric 1 az 4

7) Barva za kterou hrajeme

| ID | Barva | |------+-------| | 0x89 | B |

B barva (0 = modra nebo 1 = zluta)

Data posilana z displeje do PC ------------------------------

Myslim, ze budou stacit nasledujici jednobytove prikazy:

| ID | Vyznam | |------+-------------------| | 0x81 | Vidle dolu | | 0x82 | Vidle nahoru | | 0x83 | Dvere otevrit | | 0x84 | Dvere zavrit | | 0x85 | Valec zapnout | | 0x86 | Valec vypnout | | 0x87 | Posli cely status | | 0x88 | Zmen barvu |


Function Documentation

int uoled_display_alive (  ) 

Used to refresh display indication that comunication is ok.

Here is the call graph for this function:

Here is the caller graph for this function:

int uoled_display_fsm ( UDE_fsm_t  fsm,
char *  state 
)

Send the actual state of FSM to display.

Parameters:
fsm Type of FSM, see enum UDE_fsm_t
state String identifying the state to be indicated

Here is the call graph for this function:

Here is the caller graph for this function:

int uoled_display_position ( double  x,
double  y,
double  phi 
)

Used to refresh actual position on the display.

Parameters:
pos The Structure containing position was replaced be tree parameters
x 
y 
phi in [0, 359]

Here is the call graph for this function:

Here is the caller graph for this function:

int uoled_display_status ( UDE_component_t  c,
UDE_hw_status_t  s 
)

Send the actual state of components to display.

Parameters:
c Type of components, see enum UDE_component_t
s Status of component, see enum UDE_hw_status_t

Here is the call graph for this function:

Here is the caller graph for this function:

int uoled_display_voltage ( double  voltage33,
double  voltage50,
double  voltage80,
double  voltageBAT 
)

Used to refresh voltage readings on the display.

Parameters:
volt Structure containing voltage readings was replaced by four parameters as follows
voltage33 
voltage50 
voltage80 
voltageBAT 

Here is the call graph for this function:

Here is the caller graph for this function:

int uoled_read_cmd ( uint8_t *  buff,
int  size 
)

Read data from serial port (sercom).

*

Parameters:
buff Will be filled by data.
size Length of data, which will be read.

Here is the caller graph for this function:

int uoled_recieve_cmd ( UDE_recieve_cmd_t cmd  ) 

Read command from serial port.

Parameters:
cmd returned command
Returns:
success / errror (-1)

Here is the call graph for this function:

Here is the caller graph for this function:

void uoled_sercom_close (  ) 

Close serial port (sercom).

*

Here is the call graph for this function:

Here is the caller graph for this function:

struct sercom_data* uoled_sercom_init ( char *  tty,
void(*)(int)  sighandler 
) [read]

Initializes and opens serial port (sercom).

*

Parameters:
tty String of device.
Returns:
Pointer to structure (sercom_data) containing serial port data.

Here is the call graph for this function:

Here is the caller graph for this function: