Lines Matching +full:brightness +full:- +full:gpios

4  * SPDX-License-Identifier: Apache-2.0
84 const struct auxdisplay_hd44780_config *const config = dev->config; in hd44780_pulse_enable_line()
86 gpio_pin_set_dt(&config->e_gpio, 1); in hd44780_pulse_enable_line()
87 k_sleep(K_NSEC(config->enable_line_rise_delay)); in hd44780_pulse_enable_line()
88 gpio_pin_set_dt(&config->e_gpio, 0); in hd44780_pulse_enable_line()
89 k_sleep(K_NSEC(config->enable_line_fall_delay)); in hd44780_pulse_enable_line()
94 const struct auxdisplay_hd44780_config *const config = dev->config; in hd44780_set_rs_rw_lines()
96 gpio_pin_set_dt(&config->rs_gpio, rs); in hd44780_set_rs_rw_lines()
97 if (config->rw_gpio.port) { in hd44780_set_rs_rw_lines()
98 gpio_pin_set_dt(&config->rw_gpio, rw); in hd44780_set_rs_rw_lines()
101 k_sleep(K_NSEC(config->rs_line_delay)); in hd44780_set_rs_rw_lines()
107 const struct auxdisplay_hd44780_config *config = dev->config; in hd44780_db_gpios_configure()
110 for (int line = 7; line >= lsb_line; --line) { in hd44780_db_gpios_configure()
111 rc = gpio_pin_configure_dt(&config->db_gpios[line], flags); in hd44780_db_gpios_configure()
124 const struct auxdisplay_hd44780_config *config = dev->config; in auxdisplay_hd44780_command()
128 const bool check_busy_flag = (!config->rw_gpio.port || in auxdisplay_hd44780_command()
137 LOG_ERR("Configuration of db-gpios as inputs failed: %d", rc); in auxdisplay_hd44780_command()
146 busy = gpio_pin_get_dt(&config->db_gpios[7]); in auxdisplay_hd44780_command()
148 if (config->capabilities.mode == AUXDISPLAY_HD44780_MODE_4_BIT) { in auxdisplay_hd44780_command()
156 LOG_ERR("Configuration of db-gpios as outputs failed: %d", rc); in auxdisplay_hd44780_command()
162 while (ncommands--) { in auxdisplay_hd44780_command()
163 for (int8_t line = 7; line >= lsb_line; --line) { in auxdisplay_hd44780_command()
164 gpio_pin_set_dt(&config->db_gpios[line], ((cmd & BIT(i)) ? 1 : 0)); in auxdisplay_hd44780_command()
165 --i; in auxdisplay_hd44780_command()
181 const struct auxdisplay_hd44780_config *config = dev->config; in hd44780_ic_initialize()
201 if (config->capabilities.mode == AUXDISPLAY_HD44780_MODE_4_BIT) { in hd44780_ic_initialize()
202 /* Put display into 4-bit mode */ in hd44780_ic_initialize()
208 if (config->capabilities.rows > 1) { in hd44780_ic_initialize()
211 auxdisplay_hd44780_command(dev, false, cmd, config->capabilities.mode); in hd44780_ic_initialize()
222 const struct auxdisplay_hd44780_config *config = dev->config; in auxdisplay_hd44780_init()
223 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_init()
227 if (config->capabilities.mode > AUXDISPLAY_HD44780_MODE_8_BIT) { in auxdisplay_hd44780_init()
229 LOG_ERR("HD44780 mode must be 4 or 8-bit"); in auxdisplay_hd44780_init()
230 return -EINVAL; in auxdisplay_hd44780_init()
233 /* Configure and set GPIOs */ in auxdisplay_hd44780_init()
234 rc = gpio_pin_configure_dt(&config->rs_gpio, GPIO_OUTPUT); in auxdisplay_hd44780_init()
241 rc = gpio_pin_configure_dt(&config->e_gpio, GPIO_OUTPUT); in auxdisplay_hd44780_init()
248 if (config->capabilities.mode == AUXDISPLAY_HD44780_MODE_4_BIT) { in auxdisplay_hd44780_init()
253 if (config->db_gpios[i].port) { in auxdisplay_hd44780_init()
254 rc = gpio_pin_configure_dt(&config->db_gpios[i], GPIO_OUTPUT); in auxdisplay_hd44780_init()
260 } else if (config->capabilities.mode == AUXDISPLAY_HD44780_MODE_4_BIT && i > 3) { in auxdisplay_hd44780_init()
262 LOG_ERR("Required DB%d pin missing (DB4-DB7 needed for 4-bit mode)", i); in auxdisplay_hd44780_init()
263 return -EINVAL; in auxdisplay_hd44780_init()
264 } else if (config->capabilities.mode == AUXDISPLAY_HD44780_MODE_8_BIT) { in auxdisplay_hd44780_init()
267 return -EINVAL; in auxdisplay_hd44780_init()
273 if (config->rw_gpio.port) { in auxdisplay_hd44780_init()
274 rc = gpio_pin_configure_dt(&config->rw_gpio, GPIO_OUTPUT); in auxdisplay_hd44780_init()
282 if (config->backlight_gpio.port) { in auxdisplay_hd44780_init()
283 rc = gpio_pin_configure_dt(&config->backlight_gpio, GPIO_OUTPUT); in auxdisplay_hd44780_init()
290 gpio_pin_set_dt(&config->backlight_gpio, 0); in auxdisplay_hd44780_init()
293 data->character_x = 0; in auxdisplay_hd44780_init()
294 data->character_y = 0; in auxdisplay_hd44780_init()
295 data->backlight_state = false; in auxdisplay_hd44780_init()
296 data->cursor_enabled = false; in auxdisplay_hd44780_init()
297 data->position_blink_enabled = false; in auxdisplay_hd44780_init()
298 data->direction = AUXDISPLAY_DIRECTION_RIGHT; in auxdisplay_hd44780_init()
300 if (config->boot_delay != 0) { in auxdisplay_hd44780_init()
304 k_sleep(K_MSEC(config->boot_delay)); in auxdisplay_hd44780_init()
315 const struct auxdisplay_hd44780_config *config = dev->config; in auxdisplay_hd44780_capabilities_get()
317 memcpy(capabilities, &config->capabilities, sizeof(struct auxdisplay_capabilities)); in auxdisplay_hd44780_capabilities_get()
324 const struct auxdisplay_hd44780_config *config = dev->config; in auxdisplay_hd44780_clear()
325 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_clear()
328 config->capabilities.mode); in auxdisplay_hd44780_clear()
330 data->character_x = 0; in auxdisplay_hd44780_clear()
331 data->character_y = 0; in auxdisplay_hd44780_clear()
333 k_sleep(K_USEC(config->clear_delay)); in auxdisplay_hd44780_clear()
340 const struct auxdisplay_hd44780_config *config = dev->config; in auxdisplay_hd44780_set_entry_mode()
341 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_set_entry_mode()
344 if (data->direction == AUXDISPLAY_DIRECTION_RIGHT) { in auxdisplay_hd44780_set_entry_mode()
348 if (data->display_shift) { in auxdisplay_hd44780_set_entry_mode()
352 auxdisplay_hd44780_command(dev, false, cmd, config->capabilities.mode); in auxdisplay_hd44780_set_entry_mode()
357 const struct auxdisplay_hd44780_config *config = dev->config; in auxdisplay_hd44780_set_display_mode()
358 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_set_display_mode()
361 if (data->cursor_enabled) { in auxdisplay_hd44780_set_display_mode()
365 if (data->position_blink_enabled) { in auxdisplay_hd44780_set_display_mode()
373 auxdisplay_hd44780_command(dev, false, cmd, config->capabilities.mode); in auxdisplay_hd44780_set_display_mode()
390 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_cursor_set_enabled()
392 data->cursor_enabled = enabled; in auxdisplay_hd44780_cursor_set_enabled()
401 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_position_blinking_set_enabled()
403 data->position_blink_enabled = enabled; in auxdisplay_hd44780_position_blinking_set_enabled()
413 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_cursor_shift_set()
417 return -EINVAL; in auxdisplay_hd44780_cursor_shift_set()
420 data->direction = direction; in auxdisplay_hd44780_cursor_shift_set()
421 data->display_shift = (display_shift ? true : false); in auxdisplay_hd44780_cursor_shift_set()
432 const struct auxdisplay_hd44780_config *config = dev->config; in auxdisplay_hd44780_cursor_position_set()
433 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_cursor_position_set()
437 x += (int16_t)data->character_x; in auxdisplay_hd44780_cursor_position_set()
438 y += (int16_t)data->character_y; in auxdisplay_hd44780_cursor_position_set()
440 if (data->direction == AUXDISPLAY_DIRECTION_RIGHT) { in auxdisplay_hd44780_cursor_position_set()
441 x += (int16_t)data->character_x; in auxdisplay_hd44780_cursor_position_set()
442 y += (int16_t)data->character_y; in auxdisplay_hd44780_cursor_position_set()
444 x -= (int16_t)data->character_x; in auxdisplay_hd44780_cursor_position_set()
445 y -= (int16_t)data->character_y; in auxdisplay_hd44780_cursor_position_set()
451 return -EINVAL; in auxdisplay_hd44780_cursor_position_set()
452 } else if (x >= config->capabilities.columns || y >= config->capabilities.rows) { in auxdisplay_hd44780_cursor_position_set()
453 return -EINVAL; in auxdisplay_hd44780_cursor_position_set()
456 data->character_x = (uint16_t)x; in auxdisplay_hd44780_cursor_position_set()
457 data->character_y = (uint16_t)y; in auxdisplay_hd44780_cursor_position_set()
458 cmd |= config->line_addresses[data->character_y] + data->character_x; in auxdisplay_hd44780_cursor_position_set()
460 auxdisplay_hd44780_command(dev, false, cmd, config->capabilities.mode); in auxdisplay_hd44780_cursor_position_set()
467 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_cursor_position_get()
469 *x = (int16_t)data->character_x; in auxdisplay_hd44780_cursor_position_get()
470 *y = (int16_t)data->character_y; in auxdisplay_hd44780_cursor_position_get()
477 const struct auxdisplay_hd44780_config *config = dev->config; in auxdisplay_hd44780_backlight_get()
478 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_backlight_get()
480 if (!config->backlight_gpio.port) { in auxdisplay_hd44780_backlight_get()
481 return -ENOTSUP; in auxdisplay_hd44780_backlight_get()
484 *backlight = (data->backlight_state == true ? 1 : 0); in auxdisplay_hd44780_backlight_get()
491 const struct auxdisplay_hd44780_config *config = dev->config; in auxdisplay_hd44780_backlight_set()
492 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_backlight_set()
494 if (!config->backlight_gpio.port) { in auxdisplay_hd44780_backlight_set()
495 return -ENOTSUP; in auxdisplay_hd44780_backlight_set()
498 data->backlight_state = (bool)backlight; in auxdisplay_hd44780_backlight_set()
500 gpio_pin_set_dt(&config->backlight_gpio, (uint8_t)data->backlight_state); in auxdisplay_hd44780_backlight_set()
508 const struct auxdisplay_hd44780_config *config = dev->config; in auxdisplay_hd44780_custom_character_set()
509 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_custom_character_set()
511 uint8_t cmd = AUXDISPLAY_HD44780_CMD_CGRAM_SET | (character->index << 3); in auxdisplay_hd44780_custom_character_set()
513 auxdisplay_hd44780_command(dev, false, cmd, config->capabilities.mode); in auxdisplay_hd44780_custom_character_set()
524 if (character->data[(i * 5) + (4 - l)]) { in auxdisplay_hd44780_custom_character_set()
531 auxdisplay_hd44780_command(dev, true, cmd, config->capabilities.mode); in auxdisplay_hd44780_custom_character_set()
536 character->character_code = character->index; in auxdisplay_hd44780_custom_character_set()
540 (config->line_addresses[data->character_y] + in auxdisplay_hd44780_custom_character_set()
541 data->character_x); in auxdisplay_hd44780_custom_character_set()
543 auxdisplay_hd44780_command(dev, false, cmd, config->capabilities.mode); in auxdisplay_hd44780_custom_character_set()
550 const struct auxdisplay_hd44780_config *config = dev->config; in auxdisplay_hd44780_write()
551 struct auxdisplay_hd44780_data *data = dev->data; in auxdisplay_hd44780_write()
555 auxdisplay_hd44780_command(dev, true, text[i], config->capabilities.mode); in auxdisplay_hd44780_write()
558 if (data->direction == AUXDISPLAY_DIRECTION_RIGHT) { in auxdisplay_hd44780_write()
560 ++data->character_x; in auxdisplay_hd44780_write()
562 if (data->character_x == config->capabilities.columns) { in auxdisplay_hd44780_write()
563 data->character_x = 0; in auxdisplay_hd44780_write()
564 ++data->character_y; in auxdisplay_hd44780_write()
566 if (data->character_y == config->capabilities.rows) { in auxdisplay_hd44780_write()
567 data->character_y = 0; in auxdisplay_hd44780_write()
572 config->line_addresses[data->character_y]; in auxdisplay_hd44780_write()
574 config->capabilities.mode); in auxdisplay_hd44780_write()
578 if (data->character_x == 0) { in auxdisplay_hd44780_write()
579 data->character_x = config->capabilities.columns - 1; in auxdisplay_hd44780_write()
581 if (data->character_y == 0) { in auxdisplay_hd44780_write()
582 data->character_y = config->capabilities.rows - 1; in auxdisplay_hd44780_write()
584 --data->character_y; in auxdisplay_hd44780_write()
589 (config->line_addresses[data->character_y] + in auxdisplay_hd44780_write()
590 data->character_x); in auxdisplay_hd44780_write()
592 config->capabilities.mode); in auxdisplay_hd44780_write()
594 --data->character_x; in auxdisplay_hd44780_write()
630 .brightness.minimum = AUXDISPLAY_LIGHT_NOT_SUPPORTED, \
631 .brightness.maximum = AUXDISPLAY_LIGHT_NOT_SUPPORTED, \