1 /*
2  * Copyright (c) 2023 Jamie McCrae
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <string.h>
8 #include <zephyr/kernel.h>
9 #include <zephyr/device.h>
10 #include <zephyr/drivers/auxdisplay.h>
11 #include <zephyr/logging/log.h>
12 
13 LOG_MODULE_REGISTER(auxdisplay_sample, LOG_LEVEL_DBG);
14 
main(void)15 int main(void)
16 {
17 	int rc;
18 	const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(auxdisplay_0));
19 	uint8_t data[64];
20 
21 	if (!device_is_ready(dev)) {
22 		LOG_ERR("Auxdisplay device is not ready.");
23 		return 0;
24 	}
25 
26 	rc = auxdisplay_cursor_set_enabled(dev, true);
27 
28 	if (rc != 0) {
29 		LOG_ERR("Failed to enable cursor: %d", rc);
30 	}
31 
32 	snprintk(data, sizeof(data), "Hello world from %s", CONFIG_BOARD);
33 	rc = auxdisplay_write(dev, data, strlen(data));
34 
35 	if (rc != 0) {
36 		LOG_ERR("Failed to write data: %d", rc);
37 	}
38 	return 0;
39 }
40