dts: Convert from DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP> defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
01e54a5472
commit
a2693975d7
206 changed files with 1480 additions and 1479 deletions
|
@ -18,13 +18,13 @@ LOG_MODULE_REGISTER(display_ili9340);
|
|||
#include <string.h>
|
||||
|
||||
struct ili9340_data {
|
||||
#ifdef DT_ILITEK_ILI9340_0_RESET_GPIOS_CONTROLLER
|
||||
#ifdef DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_CONTROLLER
|
||||
struct device *reset_gpio;
|
||||
#endif
|
||||
struct device *command_data_gpio;
|
||||
struct device *spi_dev;
|
||||
struct spi_config spi_config;
|
||||
#ifdef DT_ILITEK_ILI9340_0_CS_GPIO_CONTROLLER
|
||||
#ifdef DT_INST_0_ILITEK_ILI9340_CS_GPIO_CONTROLLER
|
||||
struct spi_cs_control cs_ctrl;
|
||||
#endif
|
||||
};
|
||||
|
@ -51,55 +51,55 @@ static int ili9340_init(struct device *dev)
|
|||
|
||||
LOG_DBG("Initializing display driver");
|
||||
|
||||
data->spi_dev = device_get_binding(DT_ILITEK_ILI9340_0_BUS_NAME);
|
||||
data->spi_dev = device_get_binding(DT_INST_0_ILITEK_ILI9340_BUS_NAME);
|
||||
if (data->spi_dev == NULL) {
|
||||
LOG_ERR("Could not get SPI device for ILI9340");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
data->spi_config.frequency = DT_ILITEK_ILI9340_0_SPI_MAX_FREQUENCY;
|
||||
data->spi_config.frequency = DT_INST_0_ILITEK_ILI9340_SPI_MAX_FREQUENCY;
|
||||
data->spi_config.operation = SPI_OP_MODE_MASTER | SPI_WORD_SET(8);
|
||||
data->spi_config.slave = DT_ILITEK_ILI9340_0_BASE_ADDRESS;
|
||||
data->spi_config.slave = DT_INST_0_ILITEK_ILI9340_BASE_ADDRESS;
|
||||
|
||||
#ifdef DT_ILITEK_ILI9340_0_CS_GPIO_CONTROLLER
|
||||
#ifdef DT_INST_0_ILITEK_ILI9340_CS_GPIO_CONTROLLER
|
||||
data->cs_ctrl.gpio_dev =
|
||||
device_get_binding(DT_ILITEK_ILI9340_0_CS_GPIO_CONTROLLER);
|
||||
data->cs_ctrl.gpio_pin = DT_ILITEK_ILI9340_0_CS_GPIO_PIN;
|
||||
device_get_binding(DT_INST_0_ILITEK_ILI9340_CS_GPIO_CONTROLLER);
|
||||
data->cs_ctrl.gpio_pin = DT_INST_0_ILITEK_ILI9340_CS_GPIO_PIN;
|
||||
data->cs_ctrl.delay = 0U;
|
||||
data->spi_config.cs = &(data->cs_ctrl);
|
||||
#else
|
||||
data->spi_config.cs = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef DT_ILITEK_ILI9340_0_RESET_GPIOS_CONTROLLER
|
||||
#ifdef DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_CONTROLLER
|
||||
data->reset_gpio =
|
||||
device_get_binding(DT_ILITEK_ILI9340_0_RESET_GPIOS_CONTROLLER);
|
||||
device_get_binding(DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_CONTROLLER);
|
||||
if (data->reset_gpio == NULL) {
|
||||
LOG_ERR("Could not get GPIO port for ILI9340 reset");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
gpio_pin_configure(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN,
|
||||
gpio_pin_configure(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN,
|
||||
GPIO_DIR_OUT);
|
||||
#endif
|
||||
|
||||
data->command_data_gpio =
|
||||
device_get_binding(DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_CONTROLLER);
|
||||
device_get_binding(DT_INST_0_ILITEK_ILI9340_CMD_DATA_GPIOS_CONTROLLER);
|
||||
if (data->command_data_gpio == NULL) {
|
||||
LOG_ERR("Could not get GPIO port for ILI9340 command/data");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
gpio_pin_configure(data->command_data_gpio, DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
|
||||
gpio_pin_configure(data->command_data_gpio, DT_INST_0_ILITEK_ILI9340_CMD_DATA_GPIOS_PIN,
|
||||
GPIO_DIR_OUT);
|
||||
|
||||
#ifdef DT_ILITEK_ILI9340_0_RESET_GPIOS_CONTROLLER
|
||||
#ifdef DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_CONTROLLER
|
||||
LOG_DBG("Resetting display driver");
|
||||
gpio_pin_write(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
|
||||
gpio_pin_write(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN, 1);
|
||||
k_sleep(1);
|
||||
gpio_pin_write(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 0);
|
||||
gpio_pin_write(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN, 0);
|
||||
k_sleep(1);
|
||||
gpio_pin_write(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
|
||||
gpio_pin_write(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN, 1);
|
||||
k_sleep(5);
|
||||
#endif
|
||||
|
||||
|
@ -266,7 +266,7 @@ void ili9340_transmit(struct ili9340_data *data, u8_t cmd, void *tx_data,
|
|||
struct spi_buf tx_buf = { .buf = &cmd, .len = 1 };
|
||||
struct spi_buf_set tx_bufs = { .buffers = &tx_buf, .count = 1 };
|
||||
|
||||
gpio_pin_write(data->command_data_gpio, DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
|
||||
gpio_pin_write(data->command_data_gpio, DT_INST_0_ILITEK_ILI9340_CMD_DATA_GPIOS_PIN,
|
||||
ILI9340_CMD_DATA_PIN_COMMAND);
|
||||
spi_write(data->spi_dev, &data->spi_config, &tx_bufs);
|
||||
|
||||
|
@ -274,7 +274,7 @@ void ili9340_transmit(struct ili9340_data *data, u8_t cmd, void *tx_data,
|
|||
tx_buf.buf = tx_data;
|
||||
tx_buf.len = tx_len;
|
||||
gpio_pin_write(data->command_data_gpio,
|
||||
DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
|
||||
DT_INST_0_ILITEK_ILI9340_CMD_DATA_GPIOS_PIN,
|
||||
ILI9340_CMD_DATA_PIN_DATA);
|
||||
spi_write(data->spi_dev, &data->spi_config, &tx_bufs);
|
||||
}
|
||||
|
@ -295,6 +295,6 @@ static const struct display_driver_api ili9340_api = {
|
|||
|
||||
static struct ili9340_data ili9340_data;
|
||||
|
||||
DEVICE_AND_API_INIT(ili9340, DT_ILITEK_ILI9340_0_LABEL, &ili9340_init,
|
||||
DEVICE_AND_API_INIT(ili9340, DT_INST_0_ILITEK_ILI9340_LABEL, &ili9340_init,
|
||||
&ili9340_data, NULL, APPLICATION,
|
||||
CONFIG_APPLICATION_INIT_PRIORITY, &ili9340_api);
|
||||
|
|
|
@ -226,7 +226,7 @@ static const struct display_driver_api mcux_elcdif_api = {
|
|||
static void mcux_elcdif_config_func_1(struct device *dev);
|
||||
|
||||
static struct mcux_elcdif_config mcux_elcdif_config_1 = {
|
||||
.base = (LCDIF_Type *) DT_FSL_IMX6SX_LCDIF_0_BASE_ADDRESS,
|
||||
.base = (LCDIF_Type *) DT_INST_0_FSL_IMX6SX_LCDIF_BASE_ADDRESS,
|
||||
.irq_config_func = mcux_elcdif_config_func_1,
|
||||
#ifdef CONFIG_MCUX_ELCDIF_PANEL_RK043FN02H
|
||||
.rgb_mode = {
|
||||
|
@ -252,7 +252,7 @@ static struct mcux_elcdif_config mcux_elcdif_config_1 = {
|
|||
|
||||
static struct mcux_elcdif_data mcux_elcdif_data_1;
|
||||
|
||||
DEVICE_AND_API_INIT(mcux_elcdif_1, DT_FSL_IMX6SX_LCDIF_0_LABEL,
|
||||
DEVICE_AND_API_INIT(mcux_elcdif_1, DT_INST_0_FSL_IMX6SX_LCDIF_LABEL,
|
||||
&mcux_elcdif_init,
|
||||
&mcux_elcdif_data_1, &mcux_elcdif_config_1,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
|
@ -260,9 +260,9 @@ DEVICE_AND_API_INIT(mcux_elcdif_1, DT_FSL_IMX6SX_LCDIF_0_LABEL,
|
|||
|
||||
static void mcux_elcdif_config_func_1(struct device *dev)
|
||||
{
|
||||
IRQ_CONNECT(DT_FSL_IMX6SX_LCDIF_0_IRQ_0,
|
||||
DT_FSL_IMX6SX_LCDIF_0_IRQ_0_PRIORITY,
|
||||
IRQ_CONNECT(DT_INST_0_FSL_IMX6SX_LCDIF_IRQ_0,
|
||||
DT_INST_0_FSL_IMX6SX_LCDIF_IRQ_0_PRIORITY,
|
||||
mcux_elcdif_isr, DEVICE_GET(mcux_elcdif_1), 0);
|
||||
|
||||
irq_enable(DT_FSL_IMX6SX_LCDIF_0_IRQ_0);
|
||||
irq_enable(DT_INST_0_FSL_IMX6SX_LCDIF_IRQ_0);
|
||||
}
|
||||
|
|
|
@ -17,19 +17,19 @@ LOG_MODULE_REGISTER(ssd1306);
|
|||
#include "ssd1306_regs.h"
|
||||
#include <display/cfb.h>
|
||||
|
||||
#if DT_SOLOMON_SSD1306FB_0_SEGMENT_REMAP == 1
|
||||
#if DT_INST_0_SOLOMON_SSD1306FB_SEGMENT_REMAP == 1
|
||||
#define SSD1306_PANEL_SEGMENT_REMAP true
|
||||
#else
|
||||
#define SSD1306_PANEL_SEGMENT_REMAP false
|
||||
#endif
|
||||
|
||||
#if DT_SOLOMON_SSD1306FB_0_COM_INVDIR == 1
|
||||
#if DT_INST_0_SOLOMON_SSD1306FB_COM_INVDIR == 1
|
||||
#define SSD1306_PANEL_COM_INVDIR true
|
||||
#else
|
||||
#define SSD1306_PANEL_COM_INVDIR false
|
||||
#endif
|
||||
|
||||
#define SSD1306_PANEL_NUMOF_PAGES (DT_SOLOMON_SSD1306FB_0_HEIGHT / 8)
|
||||
#define SSD1306_PANEL_NUMOF_PAGES (DT_INST_0_SOLOMON_SSD1306FB_HEIGHT / 8)
|
||||
#define SSD1306_CLOCK_DIV_RATIO 0x0
|
||||
#define SSD1306_CLOCK_FREQUENCY 0x8
|
||||
#define SSD1306_PANEL_MUX_RATIO 63
|
||||
|
@ -56,21 +56,21 @@ struct ssd1306_data {
|
|||
static inline int ssd1306_reg_read(struct ssd1306_data *driver,
|
||||
u8_t reg, u8_t * const val)
|
||||
{
|
||||
return i2c_reg_read_byte(driver->i2c, DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS,
|
||||
return i2c_reg_read_byte(driver->i2c, DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS,
|
||||
reg, val);
|
||||
}
|
||||
|
||||
static inline int ssd1306_reg_write(struct ssd1306_data *driver,
|
||||
u8_t reg, u8_t val)
|
||||
{
|
||||
return i2c_reg_write_byte(driver->i2c, DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS,
|
||||
return i2c_reg_write_byte(driver->i2c, DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS,
|
||||
reg, val);
|
||||
}
|
||||
|
||||
static inline int ssd1306_reg_update(struct ssd1306_data *driver, u8_t reg,
|
||||
u8_t mask, u8_t val)
|
||||
{
|
||||
return i2c_reg_update_byte(driver->i2c, DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS,
|
||||
return i2c_reg_update_byte(driver->i2c, DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS,
|
||||
reg, mask, val);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ static inline int ssd1306_set_panel_orientation(struct device *dev)
|
|||
};
|
||||
|
||||
return i2c_write(driver->i2c, cmd_buf, sizeof(cmd_buf),
|
||||
DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS);
|
||||
DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS);
|
||||
}
|
||||
|
||||
static inline int ssd1306_set_timing_setting(struct device *dev)
|
||||
|
@ -103,7 +103,7 @@ static inline int ssd1306_set_timing_setting(struct device *dev)
|
|||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_CHARGE_PERIOD,
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
DT_SOLOMON_SSD1306FB_0_PRECHARGEP,
|
||||
DT_INST_0_SOLOMON_SSD1306FB_PRECHARGEP,
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_VCOM_DESELECT_LEVEL,
|
||||
SSD1306_CONTROL_LAST_BYTE_CMD,
|
||||
|
@ -111,7 +111,7 @@ static inline int ssd1306_set_timing_setting(struct device *dev)
|
|||
};
|
||||
|
||||
return i2c_write(driver->i2c, cmd_buf, sizeof(cmd_buf),
|
||||
DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS);
|
||||
DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS);
|
||||
}
|
||||
|
||||
static inline int ssd1306_set_hardware_config(struct device *dev)
|
||||
|
@ -123,7 +123,7 @@ static inline int ssd1306_set_hardware_config(struct device *dev)
|
|||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_DISPLAY_OFFSET,
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
DT_SOLOMON_SSD1306FB_0_DISPLAY_OFFSET,
|
||||
DT_INST_0_SOLOMON_SSD1306FB_DISPLAY_OFFSET,
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_PADS_HW_CONFIG,
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
|
@ -135,7 +135,7 @@ static inline int ssd1306_set_hardware_config(struct device *dev)
|
|||
};
|
||||
|
||||
return i2c_write(driver->i2c, cmd_buf, sizeof(cmd_buf),
|
||||
DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS);
|
||||
DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS);
|
||||
}
|
||||
|
||||
static inline int ssd1306_set_charge_pump(const struct device *dev)
|
||||
|
@ -159,7 +159,7 @@ static inline int ssd1306_set_charge_pump(const struct device *dev)
|
|||
};
|
||||
|
||||
return i2c_write(driver->i2c, cmd_buf, sizeof(cmd_buf),
|
||||
DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS);
|
||||
DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS);
|
||||
}
|
||||
|
||||
int ssd1306_resume(const struct device *dev)
|
||||
|
@ -191,11 +191,11 @@ int ssd1306_write_page(const struct device *dev, u8_t page, void const *data,
|
|||
#endif
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_LOWER_COL_ADDRESS |
|
||||
(DT_SOLOMON_SSD1306FB_0_SEGMENT_OFFSET &
|
||||
(DT_INST_0_SOLOMON_SSD1306FB_SEGMENT_OFFSET &
|
||||
SSD1306_SET_LOWER_COL_ADDRESS_MASK),
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_HIGHER_COL_ADDRESS |
|
||||
((DT_SOLOMON_SSD1306FB_0_SEGMENT_OFFSET >> 4) &
|
||||
((DT_INST_0_SOLOMON_SSD1306FB_SEGMENT_OFFSET >> 4) &
|
||||
SSD1306_SET_LOWER_COL_ADDRESS_MASK),
|
||||
SSD1306_CONTROL_LAST_BYTE_CMD,
|
||||
SSD1306_SET_PAGE_START_ADDRESS | page
|
||||
|
@ -210,11 +210,11 @@ int ssd1306_write_page(const struct device *dev, u8_t page, void const *data,
|
|||
}
|
||||
|
||||
if (i2c_write(driver->i2c, cmd_buf, sizeof(cmd_buf),
|
||||
DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS)) {
|
||||
DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return i2c_burst_write(driver->i2c, DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS,
|
||||
return i2c_burst_write(driver->i2c, DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS,
|
||||
SSD1306_CONTROL_LAST_BYTE_DATA,
|
||||
data, length);
|
||||
}
|
||||
|
@ -266,27 +266,27 @@ int ssd1306_write(const struct device *dev, const u16_t x, const u16_t y,
|
|||
};
|
||||
|
||||
if (i2c_write(driver->i2c, cmd_buf, sizeof(cmd_buf),
|
||||
DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS)) {
|
||||
DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS)) {
|
||||
LOG_ERR("Failed to write command");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return i2c_burst_write(driver->i2c, DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS,
|
||||
return i2c_burst_write(driver->i2c, DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS,
|
||||
SSD1306_CONTROL_LAST_BYTE_DATA,
|
||||
(u8_t *)buf, desc->buf_size);
|
||||
|
||||
#elif defined(CONFIG_SSD1306_SH1106_COMPATIBLE)
|
||||
if (desc->buf_size !=
|
||||
(SSD1306_PANEL_NUMOF_PAGES * DT_SOLOMON_SSD1306FB_0_WIDTH)) {
|
||||
(SSD1306_PANEL_NUMOF_PAGES * DT_INST_0_SOLOMON_SSD1306FB_WIDTH)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (size_t pidx = 0; pidx < SSD1306_PANEL_NUMOF_PAGES; pidx++) {
|
||||
if (ssd1306_write_page(dev, pidx, buf,
|
||||
DT_SOLOMON_SSD1306FB_0_WIDTH)) {
|
||||
DT_INST_0_SOLOMON_SSD1306FB_WIDTH)) {
|
||||
return -1;
|
||||
}
|
||||
buf = (u8_t *)buf + DT_SOLOMON_SSD1306FB_0_WIDTH;
|
||||
buf = (u8_t *)buf + DT_INST_0_SOLOMON_SSD1306FB_WIDTH;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -326,15 +326,15 @@ int ssd1306_set_contrast(const struct device *dev, const u8_t contrast)
|
|||
};
|
||||
|
||||
return i2c_write(driver->i2c, cmd_buf, sizeof(cmd_buf),
|
||||
DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS);
|
||||
DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS);
|
||||
}
|
||||
|
||||
static void ssd1306_get_capabilities(const struct device *dev,
|
||||
struct display_capabilities *caps)
|
||||
{
|
||||
memset(caps, 0, sizeof(struct display_capabilities));
|
||||
caps->x_resolution = DT_SOLOMON_SSD1306FB_0_WIDTH;
|
||||
caps->y_resolution = DT_SOLOMON_SSD1306FB_0_HEIGHT;
|
||||
caps->x_resolution = DT_INST_0_SOLOMON_SSD1306FB_WIDTH;
|
||||
caps->y_resolution = DT_INST_0_SOLOMON_SSD1306FB_HEIGHT;
|
||||
caps->supported_pixel_formats = PIXEL_FORMAT_MONO10;
|
||||
caps->current_pixel_format = PIXEL_FORMAT_MONO10;
|
||||
caps->screen_info = SCREEN_INFO_MONO_VTILED;
|
||||
|
@ -369,12 +369,12 @@ static int ssd1306_init_device(struct device *dev)
|
|||
SSD1306_SET_NORMAL_DISPLAY,
|
||||
};
|
||||
|
||||
#ifdef DT_SOLOMON_SSD1306FB_0_RESET_GPIOS_CONTROLLER
|
||||
gpio_pin_write(driver->reset, DT_SOLOMON_SSD1306FB_0_RESET_GPIOS_PIN, 1);
|
||||
#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);
|
||||
gpio_pin_write(driver->reset, DT_SOLOMON_SSD1306FB_0_RESET_GPIOS_PIN, 0);
|
||||
gpio_pin_write(driver->reset, DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN, 0);
|
||||
k_sleep(SSD1306_RESET_DELAY);
|
||||
gpio_pin_write(driver->reset, DT_SOLOMON_SSD1306FB_0_RESET_GPIOS_PIN, 1);
|
||||
gpio_pin_write(driver->reset, DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN, 1);
|
||||
#endif
|
||||
|
||||
/* Turn display off */
|
||||
|
@ -400,7 +400,7 @@ static int ssd1306_init_device(struct device *dev)
|
|||
}
|
||||
|
||||
if (i2c_write(driver->i2c, cmd_buf, sizeof(cmd_buf),
|
||||
DT_SOLOMON_SSD1306FB_0_BASE_ADDRESS)) {
|
||||
DT_INST_0_SOLOMON_SSD1306FB_BASE_ADDRESS)) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -419,22 +419,22 @@ static int ssd1306_init(struct device *dev)
|
|||
|
||||
LOG_DBG("");
|
||||
|
||||
driver->i2c = device_get_binding(DT_SOLOMON_SSD1306FB_0_BUS_NAME);
|
||||
driver->i2c = device_get_binding(DT_INST_0_SOLOMON_SSD1306FB_BUS_NAME);
|
||||
if (driver->i2c == NULL) {
|
||||
LOG_ERR("Failed to get pointer to %s device!",
|
||||
DT_SOLOMON_SSD1306FB_0_BUS_NAME);
|
||||
DT_INST_0_SOLOMON_SSD1306FB_BUS_NAME);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#ifdef DT_SOLOMON_SSD1306FB_0_RESET_GPIOS_CONTROLLER
|
||||
driver->reset = device_get_binding(DT_SOLOMON_SSD1306FB_0_RESET_GPIOS_CONTROLLER);
|
||||
#ifdef DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_CONTROLLER
|
||||
driver->reset = device_get_binding(DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_CONTROLLER);
|
||||
if (driver->reset == NULL) {
|
||||
LOG_ERR("Failed to get pointer to %s device!",
|
||||
DT_SOLOMON_SSD1306FB_0_RESET_GPIOS_CONTROLLER);
|
||||
DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_CONTROLLER);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
gpio_pin_configure(driver->reset, DT_SOLOMON_SSD1306FB_0_RESET_GPIOS_PIN,
|
||||
gpio_pin_configure(driver->reset, DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN,
|
||||
GPIO_DIR_OUT);
|
||||
#endif
|
||||
|
||||
|
@ -461,7 +461,7 @@ static struct display_driver_api ssd1306_driver_api = {
|
|||
.set_orientation = ssd1306_set_orientation,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(ssd1306, DT_SOLOMON_SSD1306FB_0_LABEL, ssd1306_init,
|
||||
DEVICE_AND_API_INIT(ssd1306, DT_INST_0_SOLOMON_SSD1306FB_LABEL, ssd1306_init,
|
||||
&ssd1306_driver, NULL,
|
||||
POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY,
|
||||
&ssd1306_driver_api);
|
||||
|
|
|
@ -19,8 +19,8 @@ LOG_MODULE_REGISTER(ssd1673);
|
|||
#include "ssd1673_regs.h"
|
||||
#include <display/cfb.h>
|
||||
|
||||
#define EPD_PANEL_WIDTH DT_SOLOMON_SSD1673FB_0_WIDTH
|
||||
#define EPD_PANEL_HEIGHT DT_SOLOMON_SSD1673FB_0_HEIGHT
|
||||
#define EPD_PANEL_WIDTH DT_INST_0_SOLOMON_SSD1673FB_WIDTH
|
||||
#define EPD_PANEL_HEIGHT DT_INST_0_SOLOMON_SSD1673FB_HEIGHT
|
||||
#define EPD_PANEL_NUMOF_COLUMS EPD_PANEL_WIDTH
|
||||
#define EPD_PANEL_NUMOF_ROWS_PER_PAGE 8
|
||||
#define EPD_PANEL_NUMOF_PAGES (EPD_PANEL_HEIGHT / \
|
||||
|
@ -39,7 +39,7 @@ struct ssd1673_data {
|
|||
struct device *busy;
|
||||
struct device *spi_dev;
|
||||
struct spi_config spi_config;
|
||||
#if defined(DT_SOLOMON_SSD1673FB_0_CS_GPIO_CONTROLLER)
|
||||
#if defined(DT_INST_0_SOLOMON_SSD1673FB_CS_GPIO_CONTROLLER)
|
||||
struct spi_cs_control cs_ctrl;
|
||||
#endif
|
||||
u8_t scan_mode;
|
||||
|
@ -98,7 +98,7 @@ static inline int ssd1673_write_cmd(struct ssd1673_data *driver,
|
|||
struct spi_buf buf = {.buf = &cmd, .len = sizeof(cmd)};
|
||||
struct spi_buf_set buf_set = {.buffers = &buf, .count = 1};
|
||||
|
||||
gpio_pin_write(driver->dc, DT_SOLOMON_SSD1673FB_0_DC_GPIOS_PIN, 0);
|
||||
gpio_pin_write(driver->dc, DT_INST_0_SOLOMON_SSD1673FB_DC_GPIOS_PIN, 0);
|
||||
err = spi_write(driver->spi_dev, &driver->spi_config, &buf_set);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
|
@ -107,7 +107,7 @@ static inline int ssd1673_write_cmd(struct ssd1673_data *driver,
|
|||
if (data != NULL) {
|
||||
buf.buf = data;
|
||||
buf.len = len;
|
||||
gpio_pin_write(driver->dc, DT_SOLOMON_SSD1673FB_0_DC_GPIOS_PIN, 1);
|
||||
gpio_pin_write(driver->dc, DT_INST_0_SOLOMON_SSD1673FB_DC_GPIOS_PIN, 1);
|
||||
err = spi_write(driver->spi_dev, &driver->spi_config, &buf_set);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
|
@ -121,36 +121,36 @@ static inline void ssd1673_busy_wait(struct ssd1673_data *driver)
|
|||
{
|
||||
u32_t val = 0U;
|
||||
|
||||
gpio_pin_read(driver->busy, DT_SOLOMON_SSD1673FB_0_BUSY_GPIOS_PIN, &val);
|
||||
gpio_pin_read(driver->busy, DT_INST_0_SOLOMON_SSD1673FB_BUSY_GPIOS_PIN, &val);
|
||||
while (val) {
|
||||
k_sleep(SSD1673_BUSY_DELAY);
|
||||
gpio_pin_read(driver->busy, DT_SOLOMON_SSD1673FB_0_BUSY_GPIOS_PIN, &val);
|
||||
gpio_pin_read(driver->busy, DT_INST_0_SOLOMON_SSD1673FB_BUSY_GPIOS_PIN, &val);
|
||||
}
|
||||
}
|
||||
|
||||
static inline size_t push_x_param(u8_t *data, u16_t x)
|
||||
{
|
||||
#if DT_SOLOMON_SSD1673FB_0_PP_WIDTH_BITS == 8
|
||||
#if DT_INST_0_SOLOMON_SSD1673FB_PP_WIDTH_BITS == 8
|
||||
data[0] = (u8_t)x;
|
||||
return 1;
|
||||
#elif DT_SOLOMON_SSD1673FB_0_PP_WIDTH_BITS == 16
|
||||
#elif DT_INST_0_SOLOMON_SSD1673FB_PP_WIDTH_BITS == 16
|
||||
sys_put_le16(sys_cpu_to_le16(x), data);
|
||||
return 2;
|
||||
#else
|
||||
#error Unsupported DT_SOLOMON_SSD1673FB_0_PP_WIDTH_BITS value
|
||||
#error Unsupported DT_INST_0_SOLOMON_SSD1673FB_PP_WIDTH_BITS value
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline size_t push_y_param(u8_t *data, u16_t y)
|
||||
{
|
||||
#if DT_SOLOMON_SSD1673FB_0_PP_HEIGHT_BITS == 8
|
||||
#if DT_INST_0_SOLOMON_SSD1673FB_PP_HEIGHT_BITS == 8
|
||||
data[0] = (u8_t)y;
|
||||
return 1;
|
||||
#elif DT_SOLOMON_SSD1673FB_0_PP_HEIGHT_BITS == 16
|
||||
#elif DT_INST_0_SOLOMON_SSD1673FB_PP_HEIGHT_BITS == 16
|
||||
sys_put_le16(sys_cpu_to_le16(y), data);
|
||||
return 2;
|
||||
#else
|
||||
#error Unsupported DT_SOLOMON_SSD1673FB_0_PP_HEIGHT_BITS value
|
||||
#error Unsupported DT_INST_0_SOLOMON_SSD1673FB_PP_HEIGHT_BITS value
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ static inline int ssd1673_set_ram_ptr(struct ssd1673_data *driver,
|
|||
static void ssd1673_set_orientation_internall(struct ssd1673_data *driver)
|
||||
|
||||
{
|
||||
#if DT_SOLOMON_SSD1673FB_0_ORIENTATION_FLIPPED == 1
|
||||
#if DT_INST_0_SOLOMON_SSD1673FB_ORIENTATION_FLIPPED == 1
|
||||
driver->scan_mode = SSD1673_DATA_ENTRY_XIYDY;
|
||||
#else
|
||||
driver->scan_mode = SSD1673_DATA_ENTRY_XDYIY;
|
||||
|
@ -446,7 +446,7 @@ static int ssd1673_clear_and_write_buffer(struct device *dev)
|
|||
return err;
|
||||
}
|
||||
|
||||
gpio_pin_write(driver->dc, DT_SOLOMON_SSD1673FB_0_DC_GPIOS_PIN, 0);
|
||||
gpio_pin_write(driver->dc, DT_INST_0_SOLOMON_SSD1673FB_DC_GPIOS_PIN, 0);
|
||||
|
||||
tmp = SSD1673_CMD_WRITE_RAM;
|
||||
sbuf.buf = &tmp;
|
||||
|
@ -456,7 +456,7 @@ static int ssd1673_clear_and_write_buffer(struct device *dev)
|
|||
return err;
|
||||
}
|
||||
|
||||
gpio_pin_write(driver->dc, DT_SOLOMON_SSD1673FB_0_DC_GPIOS_PIN, 1);
|
||||
gpio_pin_write(driver->dc, DT_INST_0_SOLOMON_SSD1673FB_DC_GPIOS_PIN, 1);
|
||||
|
||||
memset(clear_page, 0xff, sizeof(clear_page));
|
||||
sbuf.buf = clear_page;
|
||||
|
@ -480,9 +480,9 @@ static int ssd1673_controller_init(struct device *dev)
|
|||
|
||||
LOG_DBG("");
|
||||
|
||||
gpio_pin_write(driver->reset, DT_SOLOMON_SSD1673FB_0_RESET_GPIOS_PIN, 0);
|
||||
gpio_pin_write(driver->reset, DT_INST_0_SOLOMON_SSD1673FB_RESET_GPIOS_PIN, 0);
|
||||
k_sleep(SSD1673_RESET_DELAY);
|
||||
gpio_pin_write(driver->reset, DT_SOLOMON_SSD1673FB_0_RESET_GPIOS_PIN, 1);
|
||||
gpio_pin_write(driver->reset, DT_INST_0_SOLOMON_SSD1673FB_RESET_GPIOS_PIN, 1);
|
||||
k_sleep(SSD1673_RESET_DELAY);
|
||||
ssd1673_busy_wait(driver);
|
||||
|
||||
|
@ -499,19 +499,19 @@ static int ssd1673_controller_init(struct device *dev)
|
|||
return err;
|
||||
}
|
||||
|
||||
#if defined(DT_SOLOMON_SSD1673FB_0_SOFTSTART_1)
|
||||
tmp[0] = DT_SOLOMON_SSD1673FB_0_SOFTSTART_1;
|
||||
tmp[1] = DT_SOLOMON_SSD1673FB_0_SOFTSTART_2;
|
||||
tmp[2] = DT_SOLOMON_SSD1673FB_0_SOFTSTART_3;
|
||||
#if defined(DT_INST_0_SOLOMON_SSD1673FB_SOFTSTART_1)
|
||||
tmp[0] = DT_INST_0_SOLOMON_SSD1673FB_SOFTSTART_1;
|
||||
tmp[1] = DT_INST_0_SOLOMON_SSD1673FB_SOFTSTART_2;
|
||||
tmp[2] = DT_INST_0_SOLOMON_SSD1673FB_SOFTSTART_3;
|
||||
err = ssd1673_write_cmd(driver, SSD1673_CMD_SOFTSTART, tmp, 3);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
tmp[0] = DT_SOLOMON_SSD1673FB_0_GDV_A;
|
||||
#if defined(DT_SOLOMON_SSD1673FB_0_GDV_B)
|
||||
tmp[1] = DT_SOLOMON_SSD1673FB_0_GDV_B;
|
||||
tmp[0] = DT_INST_0_SOLOMON_SSD1673FB_GDV_A;
|
||||
#if defined(DT_INST_0_SOLOMON_SSD1673FB_GDV_B)
|
||||
tmp[1] = DT_INST_0_SOLOMON_SSD1673FB_GDV_B;
|
||||
err = ssd1673_write_cmd(driver, SSD1673_CMD_GDV_CTRL, tmp, 2);
|
||||
#else
|
||||
err = ssd1673_write_cmd(driver, SSD1673_CMD_GDV_CTRL, tmp, 1);
|
||||
|
@ -520,13 +520,13 @@ static int ssd1673_controller_init(struct device *dev)
|
|||
return err;
|
||||
}
|
||||
|
||||
tmp[0] = DT_SOLOMON_SSD1673FB_0_SDV;
|
||||
tmp[0] = DT_INST_0_SOLOMON_SSD1673FB_SDV;
|
||||
err = ssd1673_write_cmd(driver, SSD1673_CMD_SDV_CTRL, tmp, 1);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
tmp[0] = DT_SOLOMON_SSD1673FB_0_VCOM;
|
||||
tmp[0] = DT_INST_0_SOLOMON_SSD1673FB_VCOM;
|
||||
err = ssd1673_write_cmd(driver, SSD1673_CMD_VCOM_VOLTAGE, tmp, 1);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
|
@ -544,7 +544,7 @@ static int ssd1673_controller_init(struct device *dev)
|
|||
return err;
|
||||
}
|
||||
|
||||
tmp[0] = DT_SOLOMON_SSD1673FB_0_BORDER_WAVEFORM;
|
||||
tmp[0] = DT_INST_0_SOLOMON_SSD1673FB_BORDER_WAVEFORM;
|
||||
err = ssd1673_write_cmd(driver, SSD1673_CMD_BWF_CTRL, tmp, 1);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
|
@ -582,53 +582,53 @@ static int ssd1673_init(struct device *dev)
|
|||
|
||||
LOG_DBG("");
|
||||
|
||||
driver->spi_dev = device_get_binding(DT_SOLOMON_SSD1673FB_0_BUS_NAME);
|
||||
driver->spi_dev = device_get_binding(DT_INST_0_SOLOMON_SSD1673FB_BUS_NAME);
|
||||
if (driver->spi_dev == NULL) {
|
||||
LOG_ERR("Could not get SPI device for SSD1673");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
driver->spi_config.frequency = DT_SOLOMON_SSD1673FB_0_SPI_MAX_FREQUENCY;
|
||||
driver->spi_config.frequency = DT_INST_0_SOLOMON_SSD1673FB_SPI_MAX_FREQUENCY;
|
||||
driver->spi_config.operation = SPI_OP_MODE_MASTER | SPI_WORD_SET(8);
|
||||
driver->spi_config.slave = DT_SOLOMON_SSD1673FB_0_BASE_ADDRESS;
|
||||
driver->spi_config.slave = DT_INST_0_SOLOMON_SSD1673FB_BASE_ADDRESS;
|
||||
driver->spi_config.cs = NULL;
|
||||
|
||||
driver->reset = device_get_binding(DT_SOLOMON_SSD1673FB_0_RESET_GPIOS_CONTROLLER);
|
||||
driver->reset = device_get_binding(DT_INST_0_SOLOMON_SSD1673FB_RESET_GPIOS_CONTROLLER);
|
||||
if (driver->reset == NULL) {
|
||||
LOG_ERR("Could not get GPIO port for SSD1673 reset");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
gpio_pin_configure(driver->reset, DT_SOLOMON_SSD1673FB_0_RESET_GPIOS_PIN,
|
||||
gpio_pin_configure(driver->reset, DT_INST_0_SOLOMON_SSD1673FB_RESET_GPIOS_PIN,
|
||||
GPIO_DIR_OUT);
|
||||
|
||||
driver->dc = device_get_binding(DT_SOLOMON_SSD1673FB_0_DC_GPIOS_CONTROLLER);
|
||||
driver->dc = device_get_binding(DT_INST_0_SOLOMON_SSD1673FB_DC_GPIOS_CONTROLLER);
|
||||
if (driver->dc == NULL) {
|
||||
LOG_ERR("Could not get GPIO port for SSD1673 DC signal");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
gpio_pin_configure(driver->dc, DT_SOLOMON_SSD1673FB_0_DC_GPIOS_PIN,
|
||||
gpio_pin_configure(driver->dc, DT_INST_0_SOLOMON_SSD1673FB_DC_GPIOS_PIN,
|
||||
GPIO_DIR_OUT);
|
||||
|
||||
driver->busy = device_get_binding(DT_SOLOMON_SSD1673FB_0_BUSY_GPIOS_CONTROLLER);
|
||||
driver->busy = device_get_binding(DT_INST_0_SOLOMON_SSD1673FB_BUSY_GPIOS_CONTROLLER);
|
||||
if (driver->busy == NULL) {
|
||||
LOG_ERR("Could not get GPIO port for SSD1673 busy signal");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
gpio_pin_configure(driver->busy, DT_SOLOMON_SSD1673FB_0_BUSY_GPIOS_PIN,
|
||||
gpio_pin_configure(driver->busy, DT_INST_0_SOLOMON_SSD1673FB_BUSY_GPIOS_PIN,
|
||||
GPIO_DIR_IN);
|
||||
|
||||
#if defined(DT_SOLOMON_SSD1673FB_0_CS_GPIO_CONTROLLER)
|
||||
#if defined(DT_INST_0_SOLOMON_SSD1673FB_CS_GPIO_CONTROLLER)
|
||||
driver->cs_ctrl.gpio_dev = device_get_binding(
|
||||
DT_SOLOMON_SSD1673FB_0_CS_GPIO_CONTROLLER);
|
||||
DT_INST_0_SOLOMON_SSD1673FB_CS_GPIO_CONTROLLER);
|
||||
if (!driver->cs_ctrl.gpio_dev) {
|
||||
LOG_ERR("Unable to get SPI GPIO CS device");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
driver->cs_ctrl.gpio_pin = DT_SOLOMON_SSD1673FB_0_CS_GPIO_PIN;
|
||||
driver->cs_ctrl.gpio_pin = DT_INST_0_SOLOMON_SSD1673FB_CS_GPIO_PIN;
|
||||
driver->cs_ctrl.delay = 0U;
|
||||
driver->spi_config.cs = &driver->cs_ctrl;
|
||||
#endif
|
||||
|
@ -652,7 +652,7 @@ static struct display_driver_api ssd1673_driver_api = {
|
|||
};
|
||||
|
||||
|
||||
DEVICE_AND_API_INIT(ssd1673, DT_SOLOMON_SSD1673FB_0_LABEL, ssd1673_init,
|
||||
DEVICE_AND_API_INIT(ssd1673, DT_INST_0_SOLOMON_SSD1673FB_LABEL, ssd1673_init,
|
||||
&ssd1673_driver, NULL,
|
||||
POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY,
|
||||
&ssd1673_driver_api);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue