drivers: ssd1306: convert to new GPIO API
Convert SSD1306 sensor driver to new GPIO API. Signed-off-by: Johann Fischer <j.fischer@phytec.de>
This commit is contained in:
parent
121093f82e
commit
988a681a16
2 changed files with 11 additions and 7 deletions
|
@ -364,14 +364,12 @@ static int ssd1306_init_device(struct device *dev)
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_CONTROLLER
|
#ifdef DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_CONTROLLER
|
||||||
gpio_pin_write(driver->reset,
|
|
||||||
DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN, 1);
|
|
||||||
k_sleep(SSD1306_RESET_DELAY);
|
k_sleep(SSD1306_RESET_DELAY);
|
||||||
gpio_pin_write(driver->reset,
|
gpio_pin_set(driver->reset,
|
||||||
DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN, 0);
|
DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN, 1);
|
||||||
k_sleep(SSD1306_RESET_DELAY);
|
k_sleep(SSD1306_RESET_DELAY);
|
||||||
gpio_pin_write(driver->reset,
|
gpio_pin_set(driver->reset,
|
||||||
DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN, 1);
|
DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Turn display off */
|
/* Turn display off */
|
||||||
|
@ -434,7 +432,8 @@ static int ssd1306_init(struct device *dev)
|
||||||
|
|
||||||
gpio_pin_configure(driver->reset,
|
gpio_pin_configure(driver->reset,
|
||||||
DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN,
|
DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN,
|
||||||
GPIO_DIR_OUT);
|
GPIO_OUTPUT_INACTIVE |
|
||||||
|
DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_FLAGS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ssd1306_init_device(dev)) {
|
if (ssd1306_init_device(dev)) {
|
||||||
|
|
|
@ -61,3 +61,8 @@ properties:
|
||||||
reset-gpios:
|
reset-gpios:
|
||||||
type: phandle-array
|
type: phandle-array
|
||||||
required: false
|
required: false
|
||||||
|
description: RESET pin.
|
||||||
|
|
||||||
|
The RESET pin of SSD1306 is active low.
|
||||||
|
If connected directly the MCU pin should be configured
|
||||||
|
as active low.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue