Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mb_display.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2017 Intel Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10
11#ifndef ZEPHYR_INCLUDE_DISPLAY_MB_DISPLAY_H_
12#define ZEPHYR_INCLUDE_DISPLAY_MB_DISPLAY_H_
13
21#include <stdio.h>
22#include <zephyr/types.h>
23#include <stdbool.h>
24#include <zephyr/sys/util.h>
25#include <zephyr/toolchain.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
37struct mb_image {
38 union {
39 struct {
41 c2:1,
42 c3:1,
43 c4:1,
44 c5:1;
45 } r[5];
47 };
48};
49
58
61
64
65 /* Display flags, i.e. modifiers to the chosen mode */
66
69};
70
96#define MB_IMAGE(_rows...) { .r = { _rows } }
97
107struct mb_display;
108
114struct mb_display *mb_display_get(void);
115
132void mb_display_image(struct mb_display *disp, uint32_t mode, int32_t duration,
133 const struct mb_image *img, uint8_t img_count);
134
152__printf_like(4, 5) void mb_display_print(struct mb_display *disp,
153 uint32_t mode, int32_t duration,
154 const char *fmt, ...);
155
161void mb_display_stop(struct mb_display *disp);
162
163#ifdef __cplusplus
164}
165#endif
166
171#endif /* ZEPHYR_INCLUDE_DISPLAY_MB_DISPLAY_H_ */
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.
mb_display_mode
Display mode.
Definition: mb_display.h:55
struct mb_display * mb_display_get(void)
Get a pointer to the BBC micro:bit display object.
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.
@ MB_DISPLAY_MODE_SINGLE
Display images sequentially, one at a time.
Definition: mb_display.h:60
@ MB_DISPLAY_MODE_DEFAULT
Default mode ("single" for images, "scroll" for text).
Definition: mb_display.h:57
@ MB_DISPLAY_MODE_SCROLL
Display images by scrolling.
Definition: mb_display.h:63
@ MB_DISPLAY_FLAG_LOOP
Loop back to the beginning when reaching the last image.
Definition: mb_display.h:68
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Representation of a BBC micro:bit display image.
Definition: mb_display.h:37
uint8_t c1
Definition: mb_display.h:40
struct mb_image::@133::@135 r[5]
uint8_t row[5]
Definition: mb_display.h:46
uint8_t c5
Definition: mb_display.h:44
uint8_t c4
Definition: mb_display.h:43
uint8_t c3
Definition: mb_display.h:42
uint8_t c2
Definition: mb_display.h:41
Macros to abstract toolchain specific capabilities.
Misc utilities.