samples: driver: Add auxdisplay sample

Adds a simple auxdisplay sample which outputs hello world and the
name of the board. A sample overlay is provided for the
nucleo_f746zg board with a Hitachi HD44780-compatible display.

Signed-off-by: Jamie McCrae <spam@helper3000.net>
diff --git a/samples/drivers/auxdisplay/CMakeLists.txt b/samples/drivers/auxdisplay/CMakeLists.txt
new file mode 100644
index 0000000..78fabd8
--- /dev/null
+++ b/samples/drivers/auxdisplay/CMakeLists.txt
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: Apache-2.0
+
+cmake_minimum_required(VERSION 3.20.0)
+
+find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
+project(auxdisplay)
+
+target_sources(app PRIVATE src/main.c)
diff --git a/samples/drivers/auxdisplay/README.rst b/samples/drivers/auxdisplay/README.rst
new file mode 100644
index 0000000..2119a7d
--- /dev/null
+++ b/samples/drivers/auxdisplay/README.rst
@@ -0,0 +1,28 @@
+.. _auxdisplay-sample:
+
+Auxiliary display sample
+########################
+
+Overview
+********
+
+This sample shows how to use the auxiliary display drivers by outputting a
+sample "Hello World" text to one.
+
+Building and Running
+********************
+
+Note that this sample requires a board with an auxiliary display setup. A
+sample overlay is provided for the `nucleo_f746zg` board fly-wired to a Hitachi
+HD44780-compatible 20 character by 4 line display. See the overlay file
+:zephyr_file:`samples/drivers/auxdisplayboards/nucleo_f746zg.overlay` for
+wiring configuration.
+
+.. zephyr-app-commands::
+   :zephyr-app: samples/drivers/auxdisplay
+   :host-os: unix
+   :board: nucleo_f746zg
+   :goals: build flash
+   :compact:
+
+If successful, the display will show `Hello World from <board>`.
diff --git a/samples/drivers/auxdisplay/boards/nucleo_f746zg.overlay b/samples/drivers/auxdisplay/boards/nucleo_f746zg.overlay
new file mode 100644
index 0000000..f4f7f4d
--- /dev/null
+++ b/samples/drivers/auxdisplay/boards/nucleo_f746zg.overlay
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2022-2023 Jamie McCrae
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/ {
+	auxdisplay_0: auxdisplay {
+		compatible = "hit,hd44780";
+		status = "okay";
+		columns = <20>;
+		rows = <4>;
+		mode = <4>;
+		register-select-gpios = <&gpiob 8 (GPIO_ACTIVE_HIGH)>;
+		enable-gpios = <&gpiob 9 (GPIO_ACTIVE_HIGH)>;
+		data-bus-gpios = <0>, <0>, <0>, <0>,
+				 <&gpioa 5 (GPIO_ACTIVE_HIGH)>,
+				 <&gpioa 6 (GPIO_ACTIVE_HIGH)>,
+				 <&gpioa 7 (GPIO_ACTIVE_HIGH)>,
+				 <&gpiod 14 (GPIO_ACTIVE_HIGH)>;
+	};
+};
+
+/delete-node/ &spi1;
diff --git a/samples/drivers/auxdisplay/prj.conf b/samples/drivers/auxdisplay/prj.conf
new file mode 100644
index 0000000..7f778e9
--- /dev/null
+++ b/samples/drivers/auxdisplay/prj.conf
@@ -0,0 +1,2 @@
+CONFIG_AUXDISPLAY=y
+CONFIG_LOG=y
diff --git a/samples/drivers/auxdisplay/sample.yaml b/samples/drivers/auxdisplay/sample.yaml
new file mode 100644
index 0000000..ea40db1
--- /dev/null
+++ b/samples/drivers/auxdisplay/sample.yaml
@@ -0,0 +1,7 @@
+sample:
+  description: Demonstration of auxdisplay driver
+  name: Auxiliary display sample
+tests:
+  sample.drivers.auxdisplay:
+    tags: auxdisplay
+    platform_allow: nucleo_f746zg
diff --git a/samples/drivers/auxdisplay/src/main.c b/samples/drivers/auxdisplay/src/main.c
new file mode 100644
index 0000000..a221659
--- /dev/null
+++ b/samples/drivers/auxdisplay/src/main.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2023 Jamie McCrae
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <string.h>
+#include <zephyr/kernel.h>
+#include <zephyr/device.h>
+#include <zephyr/drivers/auxdisplay.h>
+#include <zephyr/logging/log.h>
+
+LOG_MODULE_REGISTER(auxdisplay_sample, LOG_LEVEL_DBG);
+
+void main(void)
+{
+	int rc;
+	const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(auxdisplay_0));
+	uint8_t data[64];
+
+	if (!device_is_ready(dev)) {
+		LOG_ERR("Auxdisplay device is not ready.");
+		return;
+	}
+
+	rc = auxdisplay_cursor_set_enabled(dev, true);
+
+	if (rc != 0) {
+		LOG_ERR("Failed to enable cursor: %d", rc);
+	}
+
+	snprintk(data, sizeof(data), "Hello world from %s", CONFIG_BOARD);
+	rc = auxdisplay_write(dev, data, strlen(data));
+
+	if (rc != 0) {
+		LOG_ERR("Failed to write data: %d", rc);
+	}
+}