Skip to content

Commit da2281f

Browse files
elrynobjarki-andreasen
authored andcommitted
drivers: mpsl: temp_nrf5_mpsl: Register using sensor API
This allows the sensor to be queried using the shell sensor command. The temp_nrf5_mpsl driver is the default for nRF54L15-DK. The changes follow the pattern used for the temp_nrf5 driver. Signed-off-by: Ryan Smith <[email protected]>
1 parent 53d0c75 commit da2281f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/mpsl/temp_nrf5/temp_nrf5_mpsl.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static int temp_nrf5_mpsl_channel_get(const struct device *dev,
7575
return 0;
7676
}
7777

78-
static const struct sensor_driver_api temp_nrf5_mpsl_driver_api = {
78+
static DEVICE_API(sensor, temp_nrf5_mpsl_driver_api) = {
7979
.sample_fetch = temp_nrf5_mpsl_sample_fetch,
8080
.channel_get = temp_nrf5_mpsl_channel_get,
8181
};
@@ -89,8 +89,11 @@ static int temp_nrf5_mpsl_init(const struct device *dev)
8989
return 0;
9090
}
9191

92-
static struct temp_nrf5_mpsl_data temp_nrf5_mpsl_driver;
92+
#define NRF_TEMP_DEFINE(inst) \
93+
static struct temp_nrf5_mpsl_data temp_nrf5_mpsl_##inst; \
94+
\
95+
SENSOR_DEVICE_DT_INST_DEFINE(inst, temp_nrf5_mpsl_init, NULL, \
96+
&temp_nrf5_mpsl_##inst, NULL, POST_KERNEL, \
97+
CONFIG_SENSOR_INIT_PRIORITY, &temp_nrf5_mpsl_driver_api); \
9398

94-
DEVICE_DT_INST_DEFINE(0, temp_nrf5_mpsl_init, NULL,
95-
&temp_nrf5_mpsl_driver, NULL, POST_KERNEL,
96-
CONFIG_SENSOR_INIT_PRIORITY, &temp_nrf5_mpsl_driver_api);
99+
DT_INST_FOREACH_STATUS_OKAY(NRF_TEMP_DEFINE)

0 commit comments

Comments
 (0)