/* * In SPI mode there are only 7 address bits, a "page" register determines * which part of the 8-bit range is active. This function looks at the address * and writes the page selection bit if needed
*/ staticint bme680_regmap_spi_select_page( struct bme680_spi_bus_context *ctx, u8 reg)
{ struct spi_device *spi = ctx->spi; int ret;
u8 buf[2];
u8 page = (reg & 0x80) ? 0 : 1; /* Page "1" is low range */
if (page == ctx->current_page) return 0;
/* * Data sheet claims we're only allowed to change bit 4, so we must do * a read-modify-write on each and every page select
*/
buf[0] = BME680_REG_STATUS;
ret = spi_write_then_read(spi, buf, 1, buf + 1, 1); if (ret < 0) {
dev_err(&spi->dev, "failed to set page %u\n", page); return ret;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.