Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
|
BBC micro:bit display APIs . More...
Data Structures | |
struct | mb_image |
Representation of a BBC micro:bit display image. More... | |
Macros | |
#define | MB_IMAGE(_rows...) |
Generate an image object from a given array rows/columns. | |
Enumerations | |
enum | mb_display_mode { MB_DISPLAY_MODE_DEFAULT , MB_DISPLAY_MODE_SINGLE , MB_DISPLAY_MODE_SCROLL , MB_DISPLAY_FLAG_LOOP = BIT(16) } |
Display mode. More... | |
Functions | |
struct mb_display * | mb_display_get (void) |
Get a pointer to the BBC micro:bit display object. | |
void | mb_display_image (struct mb_display *disp, uint32_t mode, int32_t duration, const struct mb_image *img, uint8_t img_count) |
Display one or more images on the BBC micro:bit LED display. | |
void | mb_display_print (struct mb_display *disp, uint32_t mode, int32_t duration, const char *fmt,...) |
Print a string of characters on the BBC micro:bit LED display. | |
void | mb_display_stop (struct mb_display *disp) |
Stop the ongoing display of an image. | |
BBC micro:bit display APIs .
#define MB_IMAGE | ( | _rows... | ) |
#include <zephyr/display/mb_display.h>
Generate an image object from a given array rows/columns.
This helper takes an array of 5 rows, each consisting of 5 0/1 values which correspond to the columns of that row. The value 0 means the pixel is disabled whereas a 1 means the pixel is enabled.
The pixels go from left to right and top to bottom, i.e. top-left corner is the first row's first value, top-right is the first rows last value, and bottom-right corner is the last value of the last (5th) row. As an example, the following would create a smiley face image:
static const struct mb_image smiley = MB_IMAGE({ 0, 1, 0, 1, 0 }, { 0, 1, 0, 1, 0 }, { 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 1 }, { 0, 1, 1, 1, 0 });
_rows | Each of the 5 rows represented as a 5-value column array. |
enum mb_display_mode |
#include <zephyr/display/mb_display.h>
Display mode.
First 16 bits are reserved for modes, last 16 for flags.
struct mb_display * mb_display_get | ( | void | ) |
#include <zephyr/display/mb_display.h>
Get a pointer to the BBC micro:bit display object.
void mb_display_image | ( | struct mb_display * | disp, |
uint32_t | mode, | ||
int32_t | duration, | ||
const struct mb_image * | img, | ||
uint8_t | img_count ) |
#include <zephyr/display/mb_display.h>
Display one or more images on the BBC micro:bit LED display.
This function takes an array of one or more images and renders them sequentially on the micro:bit display. The call is asynchronous, i.e. the processing of the display happens in the background. If there is another image being displayed it will be canceled and the new one takes over.
disp | Display object. |
mode | One of the MB_DISPLAY_MODE_* options. |
duration | Duration how long to show each image (in milliseconds), or SYS_FOREVER_MS. |
img | Array of image bitmaps (struct mb_image objects). |
img_count | Number of images in 'img' array. |
void mb_display_print | ( | struct mb_display * | disp, |
uint32_t | mode, | ||
int32_t | duration, | ||
const char * | fmt, | ||
... ) |
#include <zephyr/display/mb_display.h>
Print a string of characters on the BBC micro:bit LED display.
This function takes a printf-style format string and outputs it in a scrolling fashion to the display.
The call is asynchronous, i.e. the processing of the display happens in the background. If there is another image or string being displayed it will be canceled and the new one takes over.
disp | Display object. |
mode | One of the MB_DISPLAY_MODE_* options. |
duration | Duration how long to show each character (in milliseconds), or SYS_FOREVER_MS. |
fmt | printf-style format string |
... | Optional list of format arguments. |
void mb_display_stop | ( | struct mb_display * | disp | ) |
#include <zephyr/display/mb_display.h>
Stop the ongoing display of an image.
disp | Display object. |