sensor: iis2mdc: Add chip select flags

Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
Jordan Yates 2020-06-18 17:40:50 +10:00 committed by Kumar Gala
commit 369f64f6ff
3 changed files with 3 additions and 0 deletions

View file

@ -273,6 +273,7 @@ static const struct iis2mdc_config iis2mdc_dev_config = {
#if DT_INST_SPI_DEV_HAS_CS_GPIOS(0)
.gpio_cs_port = DT_INST_SPI_DEV_CS_GPIOS_LABEL(0),
.cs_gpio = DT_INST_SPI_DEV_CS_GPIOS_PIN(0),
.cs_gpio_flags = DT_INST_SPI_DEV_CS_GPIOS_LABEL(0),
.spi_conf.cs = &iis2mdc_data.cs_ctrl,
#else

View file

@ -42,6 +42,7 @@ struct iis2mdc_config {
#if DT_INST_SPI_DEV_HAS_CS_GPIOS(0)
const char *gpio_cs_port;
uint8_t cs_gpio;
uint8_t cs_gpio_flags;
#endif /* DT_INST_SPI_DEV_HAS_CS_GPIOS(0) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */
};

View file

@ -118,6 +118,7 @@ int iis2mdc_spi_init(struct device *dev)
}
data->cs_ctrl.gpio_pin = cfg->cs_gpio;
data->cs_ctrl.gpio_dt_flags = cfg->cs_gpio_flags;
data->cs_ctrl.delay = 0;
LOG_DBG("SPI GPIO CS configured on %s:%u",