1 /*
2 * Copyright (c) 2018 Henrik Brix Andersen <henrik@brixandersen.dk>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <zephyr/kernel.h>
8 #include <zephyr/device.h>
9 #include <zephyr/display/cfb.h>
10 #include <zephyr/sys/printk.h>
11
12 #include "cfb_font_dice.h"
13
main(void)14 int main(void)
15 {
16 const struct device *const display = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
17 int err;
18
19 if (!device_is_ready(display)) {
20 printk("Display device not ready\n");
21 }
22
23 if (display_set_pixel_format(display, PIXEL_FORMAT_MONO10) != 0) {
24 if (display_set_pixel_format(display, PIXEL_FORMAT_MONO01) != 0) {
25 printk("Failed to set required pixel format");
26 return 0;
27 }
28 }
29
30 if (display_blanking_off(display) != 0) {
31 printk("Failed to turn off display blanking\n");
32 return 0;
33 }
34
35 err = cfb_framebuffer_init(display);
36 if (err) {
37 printk("Could not initialize framebuffer (err %d)\n", err);
38 }
39
40 err = cfb_framebuffer_clear(display, true);
41 if (err) {
42 printk("Could not clear framebuffer (err %d)\n", err);
43 }
44
45 err = cfb_print(display, "123456", 0, 0);
46 if (err) {
47 printk("Could not display custom font (err %d)\n", err);
48 }
49
50 err = cfb_framebuffer_finalize(display);
51 if (err) {
52 printk("Could not finalize framebuffer (err %d)\n", err);
53 }
54 return 0;
55 }
56