Skip to content
Merged
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
22 changes: 11 additions & 11 deletions drivers/display/display_nrf_led_matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <hal/nrf_pwm.h>
#endif
#include <nrfx_gpiote.h>
#include <gpiote_nrfx.h>
#include <helpers/nrfx_gppi.h>
#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 @@ -89,7 +89,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 @@ -325,7 +325,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 @@ -355,7 +355,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 @@ -435,29 +435,28 @@
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;
nrfx_gppi_handle_t ppi_handle;
int rv;

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

err = nrfx_gpiote_channel_alloc(&dev_config->gpiote, gpiote_ch);
if (err != NRFX_SUCCESS) {
rv = nrfx_gpiote_channel_alloc(dev_config->gpiote, gpiote_ch);
if (rv != 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 rv;
}

rv = nrfx_gppi_conn_alloc(
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)),
&ppi_handle);

Check notice on line 459 in drivers/display/display_nrf_led_matrix.c

View workflow job for this annotation

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

You may want to run clang-format on this change

drivers/display/display_nrf_led_matrix.c:459 - nrf_timer_compare_event_get(1 + i)), + nrf_timer_compare_event_get(1 + i)), nrf_gpiote_event_address_get(dev_config->gpiote->p_reg, - nrf_gpiote_out_task_get(*gpiote_ch)), + nrf_gpiote_out_task_get(*gpiote_ch)),
if (rv < 0) {
LOG_ERR("Failed to allocate PPI channel.");
/* Do not bother with freeing resources allocated
Expand Down Expand Up @@ -535,13 +534,14 @@
[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 537 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:537 do not use C99 // comments

Check notice on line 538 in drivers/display/display_nrf_led_matrix.c

View workflow job for this annotation

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

You may want to run clang-format on this change

drivers/display/display_nrf_led_matrix.c:538 -//NRFX_GPIOTE_INSTANCE(NRF_DT_GPIOTE_INST_BY_IDX(MATRIX_NODE, col_gpios, 0)), +// NRFX_GPIOTE_INSTANCE(NRF_DT_GPIOTE_INST_BY_IDX(MATRIX_NODE, col_gpios, 0)),
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(NRF_DT_GPIOTE_NODE(MATRIX_NODE, col_gpios)),
#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