let us check i2c connection on register bit reads

This commit is contained in:
Lady Ada 2020-02-22 18:08:14 -05:00
parent 31298baae0
commit 26305c9e25
4 changed files with 5 additions and 5 deletions

View File

@ -274,7 +274,7 @@ uint32_t Adafruit_BusIO_RegisterBits::read(void) {
* @brief Write 4 bytes of data to the register
* @param data The 4 bytes to write
*/
void Adafruit_BusIO_RegisterBits::write(uint32_t data) {
bool Adafruit_BusIO_RegisterBits::write(uint32_t data) {
uint32_t val = _register->read();
// mask off the data before writing
@ -285,7 +285,7 @@ void Adafruit_BusIO_RegisterBits::write(uint32_t data) {
val &= ~mask; // remove the current data at that spot
val |= data << _shift; // and add in the new data
_register->write(val, _register->width());
return _register->write(val, _register->width());
}
/*!

View File

@ -60,7 +60,7 @@ class Adafruit_BusIO_RegisterBits {
public:
Adafruit_BusIO_RegisterBits(Adafruit_BusIO_Register *reg, uint8_t bits,
uint8_t shift);
void write(uint32_t value);
bool write(uint32_t value);
uint32_t read(void);
private:

View File

@ -1,7 +1,7 @@
#include <Adafruit_I2CDevice.h>
#include <Arduino.h>
//#define DEBUG_SERIAL Serial
#define DEBUG_SERIAL Serial
/*!
* @brief Create an I2C device at a given address

View File

@ -1,7 +1,7 @@
#include <Adafruit_SPIDevice.h>
#include <Arduino.h>
//#define DEBUG_SERIAL Serial
#define DEBUG_SERIAL Serial
/*!
* @brief Create an SPI device with the given CS pin and settins