SPIKE-RT C API Reference [English]
An RTOS-based software platform for LEGO® Education SPIKE™.
Functions
Display

API for the hub built-in display. More...

Functions

pbio_error_t hub_display_orientation (uint8_t up)
 Sets the orientation of the light matrix display. More...
 
pbio_error_t hub_display_off (void)
 Turns off all the pixels. More...
 
pbio_error_t hub_display_pixel (uint8_t row, uint8_t column, uint8_t brightness)
 Turns on one pixel at the specified brightness. More...
 
pbio_error_t hub_display_image (uint8_t *image)
  Displays an image, represented by a matrix of brightness: % values. More...
 
pbio_error_t hub_display_number (const int8_t num)
 Displays a number in the range -99 to 99. A minus sign (-) is shown as a faint dot in the center of the display. More...
 
pbio_error_t hub_display_char (const char c)
 Displays a character or symbol on the light grid. This may be any letter (a–z), capital letter (A–Z) or one of the following symbols: !"#$%&'()*+,-./:;<=>?@[]^_`{|}. More...
 
pbio_error_t hub_display_text (const char *text, uint32_t on, uint32_t off)
 Displays a text string, one character at a time, with a pause between each character. After the last character is shown, all lights turn off. More...
 
pbio_error_t hub_display_text_scroll (const char *text, uint32_t delay)
 Displays a text string in scroll mode. More...
 

Detailed Description

API for the hub built-in display.

Function Documentation

◆ hub_display_char()

pbio_error_t hub_display_char ( const char  c)

Displays a character or symbol on the light grid. This may be any letter (a–z), capital letter (A–Z) or one of the following symbols: !"#$%&'()*+,-./:;<=>?@[]^_`{|}.

Parameters
character(str) The character or symbol to be displayed.
Return values
errError number.

◆ hub_display_image()

pbio_error_t hub_display_image ( uint8_t *  image)

 Displays an image, represented by a matrix of brightness: % values.

Parameters
matrix(Matrix) Matrix of intensities (brightness: %). A 2D list is also accepted.
Return values
errError number.

◆ hub_display_number()

pbio_error_t hub_display_number ( const int8_t  num)

Displays a number in the range -99 to 99. A minus sign (-) is shown as a faint dot in the center of the display.

Parameters
number(int)The number to be displayed.
Return values
errError number.

◆ hub_display_off()

pbio_error_t hub_display_off ( void  )

Turns off all the pixels.

Parameters
None
Return values
errError number.

◆ hub_display_orientation()

pbio_error_t hub_display_orientation ( uint8_t  up)

Sets the orientation of the light matrix display.

Parameters
uptop (Choose PBIO_SIDE_TOP, PBIO_SIDE_LEFT, PBIO_SIDE_RIGHT, PBIO_SIDE_BOTTOM).
Return values
errError number.

◆ hub_display_pixel()

pbio_error_t hub_display_pixel ( uint8_t  row,
uint8_t  column,
uint8_t  brightness 
)

Turns on one pixel at the specified brightness.

Parameters
row(int)Vertical grid index, starting at 0 from the top.
column(int)Horizontal grid index, starting at 0 from the left.
brightness(brightness%) Brightness of the pixel.
Return values
errError number.

◆ hub_display_text()

pbio_error_t hub_display_text ( const char *  text,
uint32_t  on,
uint32_t  off 
)

Displays a text string, one character at a time, with a pause between each character. After the last character is shown, all lights turn off.

Parameters
text(str) The text to be displayed.
on(time: ms) For how long a character is shown.
off(time: ms) For how long the display is off between characters.
Return values
errError number.

◆ hub_display_text_scroll()

pbio_error_t hub_display_text_scroll ( const char *  text,
uint32_t  delay 
)

Displays a text string in scroll mode.

Parameters
text(str) The text to be displayed.
delay(time: ms) Delay between each scroll.
Return values
errError number.