if (val_size > BMA400_MAX_SPI_READ) return -EINVAL;
status = spi_write_then_read(spi, reg, 1, result, val_size + 1); if (status) return status;
/* * From the BMA400 datasheet: * * > For a basic read operation two bytes have to be read and the first * > has to be dropped and the second byte must be interpreted.
*/
memcpy(val, result + 1, val_size);
regmap = devm_regmap_init(&spi->dev, &bma400_regmap_bus,
&spi->dev, &bma400_regmap_config); if (IS_ERR(regmap)) {
dev_err(&spi->dev, "failed to create regmap\n"); return PTR_ERR(regmap);
}
/* * Per the bma400 datasheet, the first SPI read may * return garbage. As the datasheet recommends, the * chip ID register will be read here and checked * again in the following probe.
*/
ret = regmap_read(regmap, BMA400_CHIP_ID_REG, &val); if (ret)
dev_err(&spi->dev, "Failed to read chip id register\n");
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.