Warning
This page is located in archive.

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:

  • LED ON - the LED will be switched on
  • LED OFF - the LED will be switched off

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:

  • BUTTON 1 - the button is pressed
  • BUTTON 0 - the button is released

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):

  • DRAW:SETTEXTCOLOR 1

Response: No response is requested.

DRAW:CLEAR

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

Example (BSP_LCD_Clear):

  • DRAW:CLEAR 9

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):

  • DRAW:PIXEL 30,40,4

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):

  • DRAW:LINE 10,10,30,30

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):

  • DRAW:CIRCLE 64,80,30

Response: No response is requested.

DRAW:SETFONT

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

  • 24 poits
  • 20 points
  • 16 points
  • 12 points
  • 8 points

Example (BSP_LCD_SetFont):

  • DRAW:SETFONT 20

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):

  • DRAW:TEXT 64,80,Nucleo RULEZ!,1

Response: No response is requested.

courses/be5b99cpl/labs/lab10.txt · Last modified: 2018/10/04 15:47 (external edit)