drivers: display: st7735r: add hold-CS transmit()
ST7735S support (separate commits) needs this. Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
81cc13d075
commit
64c46ae56a
1 changed files with 15 additions and 3 deletions
|
@ -75,8 +75,8 @@ static void st7735r_set_cmd(const struct device *dev, int is_cmd)
|
||||||
gpio_pin_set_dt(&config->cmd_data, is_cmd);
|
gpio_pin_set_dt(&config->cmd_data, is_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int st7735r_transmit(const struct device *dev, uint8_t cmd,
|
static int st7735r_transmit_hold(const struct device *dev, uint8_t cmd,
|
||||||
const uint8_t *tx_data, size_t tx_count)
|
const uint8_t *tx_data, size_t tx_count)
|
||||||
{
|
{
|
||||||
const struct st7735r_config *config = dev->config;
|
const struct st7735r_config *config = dev->config;
|
||||||
struct spi_buf tx_buf = { .buf = &cmd, .len = 1 };
|
struct spi_buf tx_buf = { .buf = &cmd, .len = 1 };
|
||||||
|
@ -102,6 +102,17 @@ static int st7735r_transmit(const struct device *dev, uint8_t cmd,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int st7735r_transmit(const struct device *dev, uint8_t cmd,
|
||||||
|
const uint8_t *tx_data, size_t tx_count)
|
||||||
|
{
|
||||||
|
const struct st7735r_config *config = dev->config;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = st7735r_transmit_hold(dev, cmd, tx_data, tx_count);
|
||||||
|
spi_release_dt(&config->bus);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int st7735r_exit_sleep(const struct device *dev)
|
static int st7735r_exit_sleep(const struct device *dev)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -539,7 +550,8 @@ static const struct display_driver_api st7735r_api = {
|
||||||
#define ST7735R_INIT(inst) \
|
#define ST7735R_INIT(inst) \
|
||||||
const static struct st7735r_config st7735r_config_ ## inst = { \
|
const static struct st7735r_config st7735r_config_ ## inst = { \
|
||||||
.bus = SPI_DT_SPEC_INST_GET( \
|
.bus = SPI_DT_SPEC_INST_GET( \
|
||||||
inst, SPI_OP_MODE_MASTER | SPI_WORD_SET(8), 0), \
|
inst, SPI_OP_MODE_MASTER | SPI_WORD_SET(8) | \
|
||||||
|
SPI_HOLD_ON_CS | SPI_LOCK_ON, 0), \
|
||||||
.cmd_data = GPIO_DT_SPEC_INST_GET(inst, cmd_data_gpios), \
|
.cmd_data = GPIO_DT_SPEC_INST_GET(inst, cmd_data_gpios), \
|
||||||
.reset = GPIO_DT_SPEC_INST_GET_OR(inst, reset_gpios, {}), \
|
.reset = GPIO_DT_SPEC_INST_GET_OR(inst, reset_gpios, {}), \
|
||||||
.width = DT_INST_PROP(inst, width), \
|
.width = DT_INST_PROP(inst, width), \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue