Skip to content

Commit 91ca117

Browse files
nordic-krchmasz-nordic
authored andcommitted
[nrf fromlist] drivers: display: nrf_led_matrix: Align to use GPPI API
Use GPPI API instead of PPI driver. Upstream PR #: 98327 Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 9f8cd61 commit 91ca117

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

drivers/display/Kconfig.nrf_led_matrix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ config DISPLAY_NRF_LED_MATRIX
66
default y
77
depends on DT_HAS_NORDIC_NRF_LED_MATRIX_ENABLED
88
select NRFX_GPIOTE
9-
select NRFX_PPI if HAS_HW_NRF_PPI
9+
select NRFX_GPPI
1010
help
1111
Enable driver for a LED matrix with rows and columns driven by
1212
GPIOs. The driver allows setting one of 256 levels of brightness

drivers/display/display_nrf_led_matrix.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
#include <hal/nrf_pwm.h>
1414
#endif
1515
#include <nrfx_gpiote.h>
16-
#ifdef PPI_PRESENT
17-
#include <nrfx_ppi.h>
18-
#endif
16+
#include <helpers/nrfx_gppi.h>
1917
#include <nrf_peripherals.h>
2018
#include <zephyr/logging/log.h>
2119
#include <zephyr/irq.h>
@@ -438,21 +436,12 @@ static int instance_init(const struct device *dev)
438436
nrf_pwm_shorts_set(dev_config->pwm, NRF_PWM_SHORT_SEQEND0_STOP_MASK);
439437
#else
440438
nrfx_err_t err;
441-
nrf_ppi_channel_t ppi_ch;
439+
nrfx_gppi_handle_t ppi_handle;
440+
int rv;
442441

443442
for (int i = 0; i < GROUP_SIZE; ++i) {
444443
uint8_t *gpiote_ch = &dev_data->gpiote_ch[i];
445444

446-
err = nrfx_ppi_channel_alloc(&ppi_ch);
447-
if (err != NRFX_SUCCESS) {
448-
LOG_ERR("Failed to allocate PPI channel.");
449-
/* Do not bother with freeing resources allocated
450-
* so far. The application needs to be reconfigured
451-
* anyway.
452-
*/
453-
return -ENOMEM;
454-
}
455-
456445
err = nrfx_gpiote_channel_alloc(&dev_config->gpiote, gpiote_ch);
457446
if (err != NRFX_SUCCESS) {
458447
LOG_ERR("Failed to allocate GPIOTE channel.");
@@ -463,12 +452,21 @@ static int instance_init(const struct device *dev)
463452
return -ENOMEM;
464453
}
465454

466-
nrf_ppi_channel_endpoint_setup(NRF_PPI, ppi_ch,
455+
rv = nrfx_gppi_conn_alloc(
467456
nrf_timer_event_address_get(dev_config->timer,
468457
nrf_timer_compare_event_get(1 + i)),
469458
nrf_gpiote_event_address_get(dev_config->gpiote.p_reg,
470-
nrf_gpiote_out_task_get(*gpiote_ch)));
471-
nrf_ppi_channel_enable(NRF_PPI, ppi_ch);
459+
nrf_gpiote_out_task_get(*gpiote_ch)),
460+
&ppi_handle);
461+
if (rv < 0) {
462+
LOG_ERR("Failed to allocate PPI channel.");
463+
/* Do not bother with freeing resources allocated
464+
* so far. The application needs to be reconfigured
465+
* anyway.
466+
*/
467+
return rv;
468+
}
469+
nrfx_gppi_conn_enable(ppi_handle);
472470
}
473471
#endif /* USE_PWM */
474472

0 commit comments

Comments
 (0)