diff --git a/samples/sid_end_device/boards/nrf52840dk_nrf52840.overlay b/samples/sid_end_device/boards/nrf52840dk_nrf52840.overlay index 1bbf11c31b..390f5d1ba5 100644 --- a/samples/sid_end_device/boards/nrf52840dk_nrf52840.overlay +++ b/samples/sid_end_device/boards/nrf52840dk_nrf52840.overlay @@ -18,6 +18,37 @@ sid_semtech: &spi2 { }; /{ + state_notifier_gpios{ + compatible = "gpio-keys"; + state_notifier_error: error { + gpios = <&gpio1 0x7 0x0>; + label = "Application state error"; + }; + state_notifier_dfu: dfu { + gpios = <&gpio1 0x1 0x0>; + label = "Application state dfu"; + }; + state_notifier_sending: sending { + gpios = <&gpio1 0x3 0x0>; + label = "Application state sending"; + }; + state_notifier_receiving: receiving { + gpios = <&gpio1 0x2 0x0>; + label = "Application state receiving"; + }; + }; + + aliases { + state-notifier-connected = &led0; + state-notifier-time-sync = &led1; + state-notifier-registered = &led2; + state-notifier-working = &led3; + state-notifier-error = &state_notifier_error; + state-notifier-dfu = &state_notifier_dfu; + state-notifier-sending = &state_notifier_sending; + state-notifier-receiving = &state_notifier_receiving; + }; + semtech_sx1262_gpios{ compatible = "gpio-keys"; semtech_sx1262_cs: cs { diff --git a/samples/sid_end_device/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/sid_end_device/boards/nrf5340dk_nrf5340_cpuapp.overlay index 4395ed1812..d0a767987d 100644 --- a/samples/sid_end_device/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/samples/sid_end_device/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -20,6 +20,37 @@ }; /{ + state_notifier_gpios{ + compatible = "gpio-keys"; + state_notifier_error: error { + gpios = <&gpio1 0x8 0x0>; + label = "Application state error"; + }; + state_notifier_dfu: dfu { + gpios = <&gpio1 0x2 0x0>; + label = "Application state dfu"; + }; + state_notifier_sending: sending { + gpios = <&gpio1 0x4 0x0>; + label = "Application state sending"; + }; + state_notifier_receiving: receiving { + gpios = <&gpio1 0x3 0x0>; + label = "Application state receiving"; + }; + }; + + aliases { + state-notifier-connected = &led0; + state-notifier-time-sync = &led1; + state-notifier-registered = &led2; + state-notifier-working = &led3; + state-notifier-error = &state_notifier_error; + state-notifier-dfu = &state_notifier_dfu; + state-notifier-sending = &state_notifier_sending; + state-notifier-receiving = &state_notifier_receiving; + }; + semtech_sx1262_gpios{ compatible = "gpio-keys"; semtech_sx1262_cs: cs { diff --git a/samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp.conf b/samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_0_2_1.conf similarity index 100% rename from samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp.conf rename to samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_0_2_1.conf diff --git a/samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_0_2_1.overlay b/samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_0_2_1.overlay index 16640a3145..94192bf08e 100644 --- a/samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_0_2_1.overlay +++ b/samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_0_2_1.overlay @@ -34,6 +34,13 @@ sid_semtech: &spi00 { }; /{ + aliases { + state-notifier-connected = &led0; + state-notifier-time-sync = &led1; + state-notifier-registered = &led2; + state-notifier-working = &led3; + }; + semtech_sx1262_gpios{ compatible = "gpio-keys"; semtech_sx1262_cs: cs { @@ -57,23 +64,8 @@ sid_semtech: &spi00 { label = "semtech_sx1262 DIO1"; }; }; - aliases { - led0 = &led0; - led1 = &led1; - led2 = &led2; - led3 = &led3; - watchdog0 = &wdt30; - /delete-property/ sw0; - /delete-property/ sw1; - /delete-property/ sw2; - /delete-property/ sw3; - }; -}; -/delete-node/ &button3; -/delete-node/ &button2; -/delete-node/ &button1; -/delete-node/ &button0; +}; &gpiote20 { status = "okay"; diff --git a/samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay b/samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay index 33caec970d..a33c0d96d8 100644 --- a/samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay +++ b/samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay @@ -34,6 +34,13 @@ }; /{ + aliases { + state-notifier-connected = &led0; + state-notifier-time-sync = &led1; + state-notifier-registered = &led2; + state-notifier-working = &led3; + }; + semtech_sx1262_gpios{ compatible = "gpio-keys"; semtech_sx1262_cs: cs { diff --git a/samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_release.conf b/samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_release_0_2_1.conf similarity index 100% rename from samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_release.conf rename to samples/sid_end_device/boards/nrf54l15pdk_nrf54l15_cpuapp_release_0_2_1.conf diff --git a/utils/include/application_states.h b/utils/include/application_states.h index 7ab21b37cd..ba0d6ad6fa 100644 --- a/utils/include/application_states.h +++ b/utils/include/application_states.h @@ -8,39 +8,16 @@ #define APPLICATION_STATES_H #include -/* X(state_name, gpio_port, gpio_pin) */ -#if defined(NRF52840_XXAA) -#define X_APPLICAITON_STATES \ - X(error, gpio1, 7) \ - X(working, gpio0, 16) \ - X(registered, gpio0, 15) \ - X(time_sync, gpio0, 14) \ - X(connected, gpio0, 13) \ - X(dfu, gpio1, 1) \ - X(sending, gpio1, 3) \ - X(receiving, gpio1, 2) -#elif defined(NRF5340_XXAA) -#define X_APPLICAITON_STATES \ - X(error, gpio1, 8) \ - X(working, gpio0, 31) \ - X(registered, gpio0, 30) \ - X(time_sync, gpio0, 29) \ - X(connected, gpio0, 28) \ - X(dfu, gpio1, 2) \ - X(sending, gpio1, 4) \ - X(receiving, gpio1, 3) -#elif defined(NRF54L15_ENGA_XXAA) +/* X(state_name) */ + #define X_APPLICAITON_STATES \ - X(error, not_connected, 0) \ - X(working, not_connected, 0) \ - X(registered, not_connected, 0) \ - X(time_sync, not_connected, 0) \ - X(connected, not_connected, 0) \ - X(dfu, not_connected, 0) \ - X(sending, not_connected, 0) \ - X(receiving, not_connected, 0) -#else -#error "Unknow device application states." -#endif + X(error) \ + X(working) \ + X(registered) \ + X(time_sync) \ + X(connected) \ + X(dfu) \ + X(sending) \ + X(receiving) #endif /* APPLICATION_STATES_H */ diff --git a/utils/include/sidewalk_version.h b/utils/include/sidewalk_version.h index 7502dabd0f..a6e9794bc0 100644 --- a/utils/include/sidewalk_version.h +++ b/utils/include/sidewalk_version.h @@ -27,7 +27,7 @@ extern const char *const sidewalk_version_component[]; LOG_PRINTK("Sidewalk SDK = %d.%d.%d.%d\n", SID_SDK_MAJOR_VERSION, \ SID_SDK_MINOR_VERSION, SID_SDK_PATCH_VERSION, SID_SDK_BUILD_VERSION); \ LOG_PRINTK("build time = %s\n", build_time_stamp); \ - LOG_PRINTK("board = %s\n", CONFIG_BOARD); \ + LOG_PRINTK("board = %s\n", CONFIG_BOARD_TARGET); \ LOG_PRINTK("----------------------------------------------------------------\n") #else #define PRINT_SIDEWALK_VERSION() diff --git a/utils/src/state_notifier_gpio_backend.c b/utils/src/state_notifier_gpio_backend.c index b7210b7e06..defdbf7f6c 100644 --- a/utils/src/state_notifier_gpio_backend.c +++ b/utils/src/state_notifier_gpio_backend.c @@ -12,37 +12,32 @@ #include -struct gpio_pin { - const struct device *port; - gpio_pin_t pin; -}; - -static inline struct gpio_pin state_to_pin_mapper(enum application_state state) +static inline struct gpio_dt_spec state_to_pin_mapper(enum application_state state) { // clang-format off switch (state) { - #define X(name, port_obj, pin_num, ...)\ + #define X(name, ...)\ case APPLICATION_STATE_ENUM(name):\ - return (struct gpio_pin){ .port =COND_CODE_1(DT_NODE_EXISTS(port_obj), DEVICE_DT_GET_OR_NULL(DT_NODELABEL(port_obj)), (NULL)), .pin = pin_num}; + return (struct gpio_dt_spec)GPIO_DT_SPEC_GET_OR(DT_ALIAS(state_notifier_##name), gpios, { 0 }); X_APPLICAITON_STATES #undef X } // clang-format on - return (struct gpio_pin){ NULL, 0 }; + return (struct gpio_dt_spec){ 0 }; } static void gpio_enumerate_state(enum application_state state_id, uint32_t value) { - struct gpio_pin gpio_id = state_to_pin_mapper(state_id); - if (gpio_id.port == NULL) { + struct gpio_dt_spec gpio = state_to_pin_mapper(state_id); + if (gpio.port == NULL) { return; } #if defined(NRF54L15_ENGA_XXAA) - gpio_pin_set_raw(gpio_id.port, gpio_id.pin, value); + gpio_pin_set_raw(gpio.port, gpio.pin, value); #else /* output activated with low state */ - gpio_pin_set_raw(gpio_id.port, gpio_id.pin, !value); + gpio_pin_set_raw(gpio.port, gpio.pin, !value); #endif } @@ -53,7 +48,7 @@ static void state_change_handler_gpio(const struct notifier_state *state) static void gpio_initializer(const enum application_state state_id, const uint32_t value) { - struct gpio_pin pin = state_to_pin_mapper(state_id); + struct gpio_dt_spec pin = state_to_pin_mapper(state_id); if (pin.port == NULL) { return;