Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions drivers/display/display_nrf_led_matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
#include <hal/nrf_pwm.h>
#endif
#include <nrfx_gpiote.h>
#include <gpiote_nrfx.h>
#ifdef PPI_PRESENT
#include <nrfx_ppi.h>
#endif
#include <nrf_peripherals.h>
#include <zephyr/logging/log.h>
#include <zephyr/irq.h>
LOG_MODULE_REGISTER(nrf_led_matrix, CONFIG_DISPLAY_LOG_LEVEL);
Expand Down Expand Up @@ -91,7 +91,7 @@
#if USE_PWM
NRF_PWM_Type *pwm;
#else
nrfx_gpiote_t gpiote;
nrfx_gpiote_t *gpiote;
#endif
uint8_t rows[ROW_COUNT];
uint8_t cols[COL_COUNT];
Expand Down Expand Up @@ -327,7 +327,7 @@

/* First timer channel is used for timing the period of pulses. */
nrf_timer_cc_set(dev_config->timer, 1 + channel_idx, pulse);
dev_config->gpiote.p_reg->CONFIG[dev_data->gpiote_ch[channel_idx]] = gpiote_cfg;
dev_config->gpiote->p_reg->CONFIG[dev_data->gpiote_ch[channel_idx]] = gpiote_cfg;
#endif /* USE_PWM */
}

Expand Down Expand Up @@ -357,7 +357,7 @@
}
#else
for (int i = 0; i < GROUP_SIZE; ++i) {
dev_config->gpiote.p_reg->CONFIG[dev_data->gpiote_ch[i]] = 0;
dev_config->gpiote->p_reg->CONFIG[dev_data->gpiote_ch[i]] = 0;
}
#endif

Expand Down Expand Up @@ -437,7 +437,7 @@
nrf_pwm_loop_set(dev_config->pwm, 0);
nrf_pwm_shorts_set(dev_config->pwm, NRF_PWM_SHORT_SEQEND0_STOP_MASK);
#else
nrfx_err_t err;
int err;
nrf_ppi_channel_t ppi_ch;

for (int i = 0; i < GROUP_SIZE; ++i) {
Expand All @@ -453,20 +453,20 @@
return -ENOMEM;
}

err = nrfx_gpiote_channel_alloc(&dev_config->gpiote, gpiote_ch);
if (err != NRFX_SUCCESS) {
err = nrfx_gpiote_channel_alloc(dev_config->gpiote, gpiote_ch);
if (err < 0) {
LOG_ERR("Failed to allocate GPIOTE channel.");
/* Do not bother with freeing resources allocated
* so far. The application needs to be reconfigured
* anyway.
*/
return -ENOMEM;
return err;
}

nrf_ppi_channel_endpoint_setup(NRF_PPI, ppi_ch,
nrf_timer_event_address_get(dev_config->timer,
nrf_timer_compare_event_get(1 + i)),
nrf_gpiote_event_address_get(dev_config->gpiote.p_reg,
nrf_gpiote_event_address_get(dev_config->gpiote->p_reg,
nrf_gpiote_out_task_get(*gpiote_ch)));
nrf_ppi_channel_enable(NRF_PPI, ppi_ch);
}
Expand Down Expand Up @@ -537,13 +537,15 @@
[GET_DT_ROW_IDX(idx) * COL_COUNT + \
GET_DT_COL_IDX(idx)] = idx,

//NRFX_GPIOTE_INSTANCE(NRF_DT_GPIOTE_INST_BY_IDX(MATRIX_NODE, col_gpios, 0)),

Check failure on line 540 in drivers/display/display_nrf_led_matrix.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

C99_COMMENTS

drivers/display/display_nrf_led_matrix.c:540 do not use C99 // comments

static const struct display_drv_config instance_config = {
.timer = (NRF_TIMER_Type *)DT_REG_ADDR(TIMER_NODE),
#if USE_PWM
.pwm = (NRF_PWM_Type *)DT_REG_ADDR(PWM_NODE),
#else
.gpiote = NRFX_GPIOTE_INSTANCE(
NRF_DT_GPIOTE_INST_BY_IDX(MATRIX_NODE, col_gpios, 0)),
.gpiote = &GPIOTE_NRFX_INST_BY_NODE( \

Check warning on line 547 in drivers/display/display_nrf_led_matrix.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LINE_CONTINUATIONS

drivers/display/display_nrf_led_matrix.c:547 Avoid unnecessary line continuations
DT_PHANDLE(DT_GPIO_CTLR_BY_IDX(MATRIX_NODE, col_gpios, 0), gpiote_instance)),
#endif
.rows = { DT_FOREACH_PROP_ELEM(MATRIX_NODE, row_gpios, GET_PIN_INFO) },
.cols = { DT_FOREACH_PROP_ELEM(MATRIX_NODE, col_gpios, GET_PIN_INFO) },
Expand Down
Loading
Loading