Table of Contents

Lab10 - The command interface

This exercise is aimed on the interface command protocol implementation. The final data set is described here.

The communication protocol will be based on text commands/strings which are ended by '\r' and '\n' sequence. There are two types of commands: with and withnout question mark '?'. The commnands with question mark requires reply. When reply is not provided a timeout of 5 sec. shall be detected.

An unimplemented command is indicated is the response as UNKNOWN “and the unresolved command”. An error, e.g. parameter, is indicated as ERROR “and the unresolved command”.

The communication schema is Master/Slave. The PC resembles master and Nucleo is slave. As a response to some evens the Slave can send assynchronous packet with information about the event, e.g. joystick movements.

*IDN?

The *IDN? is a request for identification.

Response: Text string with device name and author identification.

LED

The LED is a request for Nucleo User LED control. The command has two variants:

Response: No response is requested.

BUTTON?

The BUTTON? is a request to return the state of the User Button.

Response: The response has two variants:

DRAW

DRAW is the set of commands to control the LCD display.

DRAW:SETTEXTCOLOR

The SETTEXTCOLOR has one parameter - the number of color. The color coding is as follows:

  1. Black
  2. Grey
  3. Blue
  4. Red
  5. Green
  6. Cyan
  7. Magenta
  8. Yellow
  9. White

Example (BSP_LCD_SetTextColor):

Response: No response is requested.

DRAW:CLEAR

The CLEAR redraws the whole display in one collor (color coding is above).

Example (BSP_LCD_Clear):

Response: No response is requested.

DRAW:PIXEL

The PIXEL controls one image element at [iX, iY] on the display (color coding is above).

Example (BSP_LCD_DrawPixel):

Response: No response is requested.

DRAW:LINE

The LINE draws a line in between of a start point [iXs, iYs] and end point [iXe, iYe].

Example (BSP_LCD_DrawLine):

Response: No response is requested.

DRAW:CIRCLE

The CIRCLE draws a circle with center at [iXs, iYs] and with radius iR.

Example (BSP_LCD_DrawCircle):

Response: No response is requested.

DRAW:SETFONT

The SETFONT selects from available fonts. The available fonts are:

Example (BSP_LCD_SetFont):

Response: No response is requested.

DRAW:TEXT

The TEXT prints the string at selected location [iX, iY] with specific alignment. The alignment is following:

  1. Center
  2. Right
  3. Left

Example (BSP_LCD_DisplayStringAt):

Response: No response is requested.