From fb571f1c89d0117df5aaa9d354fcd4e8d991efed Mon Sep 17 00:00:00 2001 From: Pawel Dunaj Date: Wed, 6 Mar 2024 14:01:14 +0100 Subject: [PATCH] samples: caf: Add nrf54h20pdk configuration Add configuration for nRF54H20PDK. Signed-off-by: Pawel Dunaj --- .../boards/nrf54h20pdk_nrf54h20_cpuapp.conf | 9 ++++ .../nrf54h20pdk_nrf54h20_cpuapp.overlay | 41 +++++++++++++++++ .../nrf54h20pdk_nrf54h20_cpuapp/buttons_def.h | 23 ++++++++++ .../led_state_def.h | 44 +++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 samples/caf/boards/nrf54h20pdk_nrf54h20_cpuapp.conf create mode 100644 samples/caf/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay create mode 100644 samples/caf/configuration/nrf54h20pdk_nrf54h20_cpuapp/buttons_def.h create mode 100644 samples/caf/configuration/nrf54h20pdk_nrf54h20_cpuapp/led_state_def.h diff --git a/samples/caf/boards/nrf54h20pdk_nrf54h20_cpuapp.conf b/samples/caf/boards/nrf54h20pdk_nrf54h20_cpuapp.conf new file mode 100644 index 00000000000..fa1f8392d78 --- /dev/null +++ b/samples/caf/boards/nrf54h20pdk_nrf54h20_cpuapp.conf @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +################################################################################ + +CONFIG_LED_PWM=n +CONFIG_LED_GPIO=y diff --git a/samples/caf/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay b/samples/caf/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..e4bf804fc09 --- /dev/null +++ b/samples/caf/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + + /{ + /delete-node/ leds; + + leds0 { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + }; + + leds1 { + compatible = "gpio-leds"; + led1: led_1 { + gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; + }; + }; + + leds2 { + compatible = "gpio-leds"; + led2: led_2 { + gpios = <&gpio9 2 GPIO_ACTIVE_HIGH>; + label = "Green LED 2"; + }; + }; + + leds3 { + compatible = "gpio-leds"; + led3: led_3 { + gpios = <&gpio9 3 GPIO_ACTIVE_HIGH>; + label = "Green LED 3"; + }; + }; +}; diff --git a/samples/caf/configuration/nrf54h20pdk_nrf54h20_cpuapp/buttons_def.h b/samples/caf/configuration/nrf54h20pdk_nrf54h20_cpuapp/buttons_def.h new file mode 100644 index 00000000000..6fa91e0720b --- /dev/null +++ b/samples/caf/configuration/nrf54h20pdk_nrf54h20_cpuapp/buttons_def.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include + +/* This configuration file is included only once from button module and holds + * information about pins forming keyboard matrix. + */ + +/* This structure enforces the header file is included only once in the build. + * Violating this requirement triggers a multiple definition error at link time. + */ +const struct {} buttons_def_include_once; + +static const struct gpio_pin col[] = {}; + +static const struct gpio_pin row[] = { + { .port = 0, .pin = DT_GPIO_PIN(DT_NODELABEL(button0), gpios) }, + { .port = 0, .pin = DT_GPIO_PIN(DT_NODELABEL(button1), gpios) } +}; diff --git a/samples/caf/configuration/nrf54h20pdk_nrf54h20_cpuapp/led_state_def.h b/samples/caf/configuration/nrf54h20pdk_nrf54h20_cpuapp/led_state_def.h new file mode 100644 index 00000000000..f655a09beb4 --- /dev/null +++ b/samples/caf/configuration/nrf54h20pdk_nrf54h20_cpuapp/led_state_def.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include + +/* This configuration file is included only once from led_state module and holds + * information about LED effect associated with each state. + */ + +/* This structure enforces the header file is included only once in the build. + * Violating this requirement triggers a multiple definition error at link time. + */ +const struct {} led_state_def_include_once; + +enum led_id { + LED_ID_0, + LED_ID_1, + LED_ID_2, + LED_ID_3, + + LED_ID_COUNT +}; + +enum led_effect_id { + LED_EFFECT_ID_OFF, + LED_EFFECT_ID_BLINK, + LED_EFFECT_ID_BLINK2, + LED_EFFECT_ID_CLOCK, + + LED_EFFECT_ID_COUNT +}; + +/* Map function to led effect */ +static const struct led_effect led_effect[] = { + [LED_EFFECT_ID_OFF] = LED_EFFECT_LED_OFF(), + [LED_EFFECT_ID_BLINK] = LED_EFFECT_LED_BLINK(200, LED_COLOR(255, 255, 255)), + [LED_EFFECT_ID_BLINK2] = LED_EFFECT_LED_BLINK2(10, 90, LED_COLOR(255, 255, 255)), + [LED_EFFECT_ID_CLOCK] = LED_EFFECT_LED_CLOCK(3, LED_COLOR(255, 255, 255)), +}; + +static const struct led_effect led_effect_on = LED_EFFECT_LED_ON(LED_COLOR(255, 255, 255));