Search
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.
The *IDN? is a request for identification.
Response: Text string with device name and author identification.
The LED is a request for Nucleo User LED control. The command has two variants:
Response: No response is requested.
The BUTTON? is a request to return the state of the User Button.
Response: The response has two variants:
DRAW is the set of commands to control the LCD display.
The SETTEXTCOLOR has one parameter - the number of color. The color coding is as follows:
Example (BSP_LCD_SetTextColor):
The CLEAR redraws the whole display in one collor (color coding is above).
Example (BSP_LCD_Clear):
The PIXEL controls one image element at [iX, iY] on the display (color coding is above).
Example (BSP_LCD_DrawPixel):
The LINE draws a line in between of a start point [iXs, iYs] and end point [iXe, iYe].
Example (BSP_LCD_DrawLine):
The CIRCLE draws a circle with center at [iXs, iYs] and with radius iR.
Example (BSP_LCD_DrawCircle):
The SETFONT selects from available fonts. The available fonts are:
Example (BSP_LCD_SetFont):
The TEXT prints the string at selected location [iX, iY] with specific alignment. The alignment is following:
Example (BSP_LCD_DisplayStringAt):