Lines Matching +full:row +full:- +full:gpios

4  * SPDX-License-Identifier: Apache-2.0
9 #include <zephyr/dt-bindings/gpio/gpio.h>
31 #if (GROUP_SIZE > DT_PROP(TIMER_NODE, cc_num) - 1) || \
33 #error "Invalid pixel-group-size configured."
40 #error "Invalid length of pixel-mapping."
48 _GET_ROW_IDX(dev_config->pixel_mapping[pixel_idx])
54 _GET_COL_IDX(dev_config->pixel_mapping[pixel_idx])
59 "Invalid row index in pixel-mapping["#idx"]."); \
61 "Invalid column index in pixel-mapping["#idx"].");
77 #error "Invalid pixel period. Change refresh-frequency or pixel-group-size."
129 struct display_drv_data *dev_data = dev->data; in api_blanking_on()
130 const struct display_drv_config *dev_config = dev->config; in api_blanking_on()
132 if (!dev_data->blanking) { in api_blanking_on()
133 nrf_timer_task_trigger(dev_config->timer, NRF_TIMER_TASK_STOP); in api_blanking_on()
135 set_pin(dev_config->rows[i], false); in api_blanking_on()
138 set_pin(dev_config->cols[i], false); in api_blanking_on()
141 dev_data->blanking = true; in api_blanking_on()
149 struct display_drv_data *dev_data = dev->data; in api_blanking_off()
150 const struct display_drv_config *dev_config = dev->config; in api_blanking_off()
152 if (dev_data->blanking) { in api_blanking_off()
153 dev_data->iteration = ITERATION_COUNT - 1; in api_blanking_off()
155 nrf_timer_task_trigger(dev_config->timer, NRF_TIMER_TASK_CLEAR); in api_blanking_off()
156 nrf_timer_task_trigger(dev_config->timer, NRF_TIMER_TASK_START); in api_blanking_off()
158 dev_data->blanking = false; in api_blanking_off()
166 struct display_drv_data *dev_data = dev->data; in api_get_framebuffer()
168 return dev_data->framebuf; in api_get_framebuffer()
174 struct display_drv_data *dev_data = dev->data; in api_set_brightness()
176 int16_t delta = (int16_t)new_brightness - dev_data->brightness; in api_set_brightness()
178 dev_data->brightness = new_brightness; in api_set_brightness()
181 uint8_t old_val = dev_data->framebuf[i]; in api_set_brightness()
186 dev_data->framebuf[i] = in api_set_brightness()
201 return -ENOTSUP; in api_set_pixel_format()
212 return -ENOTSUP; in api_set_orientation()
219 caps->x_resolution = X_PIXELS; in api_get_capabilities()
220 caps->y_resolution = Y_PIXELS; in api_get_capabilities()
221 caps->supported_pixel_formats = PIXEL_FORMAT_MONO01; in api_get_capabilities()
222 caps->screen_info = 0; in api_get_capabilities()
223 caps->current_pixel_format = PIXEL_FORMAT_MONO01; in api_get_capabilities()
224 caps->current_orientation = DISPLAY_ORIENTATION_NORMAL; in api_get_capabilities()
242 struct display_drv_data *dev_data = dev->data; in api_write()
244 uint16_t end_x = x + desc->width; in api_write()
245 uint16_t end_y = y + desc->height; in api_write()
249 return -EINVAL; in api_write()
252 if (desc->pitch < desc->width) { in api_write()
253 return -EINVAL; in api_write()
256 uint16_t to_skip = desc->pitch - desc->width; in api_write()
263 dev_data->framebuf[px + (py * X_PIXELS)] = in api_write()
264 (data & mask) ? dev_data->brightness : 0; in api_write()
272 } while (--cnt); in api_write()
294 struct display_drv_data *dev_data = dev->data; in prepare_pixel_pulse()
295 const struct display_drv_config *dev_config = dev->config; in prepare_pixel_pulse()
298 uint8_t col_pin_info = dev_config->cols[col_idx]; in prepare_pixel_pulse()
301 uint16_t pulse = dev_data->framebuf[pixel_idx] * QUANTUM; in prepare_pixel_pulse()
304 dev_config->pwm->PSEL.OUT[channel_idx] = col_psel; in prepare_pixel_pulse()
305 dev_data->seq[channel_idx] = pulse | (col_active_low ? 0 : BIT(15)); in prepare_pixel_pulse()
329 nrf_timer_cc_set(dev_config->timer, 1 + channel_idx, pulse); in prepare_pixel_pulse()
330 dev_config->gpiote.p_reg->CONFIG[dev_data->gpiote_ch[channel_idx]] = gpiote_cfg; in prepare_pixel_pulse()
338 struct display_drv_data *dev_data = dev->data; in timer_irq_handler()
339 const struct display_drv_config *dev_config = dev->config; in timer_irq_handler()
340 uint8_t iteration = dev_data->iteration; in timer_irq_handler()
348 nrf_timer_event_clear(dev_config->timer, NRF_TIMER_EVENT_COMPARE0); in timer_irq_handler()
350 /* Disable the row that was enabled in the previous iteration. */ in timer_irq_handler()
351 set_pin(dev_config->rows[dev_data->prev_row_idx], false); in timer_irq_handler()
354 nrf_pwm_disable(dev_config->pwm); in timer_irq_handler()
356 dev_config->pwm->PSEL.OUT[i] = NRF_PWM_PIN_NOT_CONNECTED; in timer_irq_handler()
360 dev_config->gpiote.p_reg->CONFIG[dev_data->gpiote_ch[i]] = 0; in timer_irq_handler()
372 pixel_idx = dev_config->refresh_order[iteration]; in timer_irq_handler()
386 /* If the next pixel is in a different row, it cannot in timer_irq_handler()
394 dev_data->iteration = iteration; in timer_irq_handler()
399 /* Enable the row drive for the current pixel. */ in timer_irq_handler()
400 set_pin(dev_config->rows[row_idx], true); in timer_irq_handler()
402 dev_data->prev_row_idx = row_idx; in timer_irq_handler()
406 nrf_pwm_enable(dev_config->pwm); in timer_irq_handler()
407 nrf_pwm_task_trigger(dev_config->pwm, NRF_PWM_TASK_SEQSTART0); in timer_irq_handler()
411 nrf_timer_task_trigger(dev_config->timer, NRF_TIMER_TASK_START); in timer_irq_handler()
416 struct display_drv_data *dev_data = dev->data; in instance_init()
417 const struct display_drv_config *dev_config = dev->config; in instance_init()
427 .values.p_raw = dev_data->seq, in instance_init()
431 nrf_pwm_pins_set(dev_config->pwm, out_psels); in instance_init()
432 nrf_pwm_configure(dev_config->pwm, in instance_init()
434 nrf_pwm_decoder_set(dev_config->pwm, in instance_init()
436 nrf_pwm_sequence_set(dev_config->pwm, 0, &sequence); in instance_init()
437 nrf_pwm_loop_set(dev_config->pwm, 0); in instance_init()
438 nrf_pwm_shorts_set(dev_config->pwm, NRF_PWM_SHORT_SEQEND0_STOP_MASK); in instance_init()
444 uint8_t *gpiote_ch = &dev_data->gpiote_ch[i]; in instance_init()
453 return -ENOMEM; in instance_init()
456 err = nrfx_gpiote_channel_alloc(&dev_config->gpiote, gpiote_ch); in instance_init()
463 return -ENOMEM; in instance_init()
467 nrf_timer_event_address_get(dev_config->timer, in instance_init()
469 nrf_gpiote_event_address_get(dev_config->gpiote.p_reg, in instance_init()
476 uint8_t row_pin_info = dev_config->rows[i]; in instance_init()
488 uint8_t col_pin_info = dev_config->cols[i]; in instance_init()
499 nrf_timer_bit_width_set(dev_config->timer, NRF_TIMER_BIT_WIDTH_16); in instance_init()
500 nrf_timer_prescaler_set(dev_config->timer, TIMER_CLK_CONFIG); in instance_init()
501 nrf_timer_cc_set(dev_config->timer, 0, PIXEL_PERIOD); in instance_init()
502 nrf_timer_shorts_set(dev_config->timer, in instance_init()
505 nrf_timer_event_clear(dev_config->timer, NRF_TIMER_EVENT_COMPARE0); in instance_init()
506 nrf_timer_int_enable(dev_config->timer, NRF_TIMER_INT_COMPARE0_MASK); in instance_init()
524 "All column GPIOs must use the same GPIOTE instance");
553 * for the actually used row/columns pairs are overwritten (using