let us check i2c connection on register bit reads
This commit is contained in:
parent
31298baae0
commit
26305c9e25
|
|
@ -274,7 +274,7 @@ uint32_t Adafruit_BusIO_RegisterBits::read(void) {
|
||||||
* @brief Write 4 bytes of data to the register
|
* @brief Write 4 bytes of data to the register
|
||||||
* @param data The 4 bytes to write
|
* @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();
|
uint32_t val = _register->read();
|
||||||
|
|
||||||
// mask off the data before writing
|
// 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 &= ~mask; // remove the current data at that spot
|
||||||
val |= data << _shift; // and add in the new data
|
val |= data << _shift; // and add in the new data
|
||||||
|
|
||||||
_register->write(val, _register->width());
|
return _register->write(val, _register->width());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class Adafruit_BusIO_RegisterBits {
|
||||||
public:
|
public:
|
||||||
Adafruit_BusIO_RegisterBits(Adafruit_BusIO_Register *reg, uint8_t bits,
|
Adafruit_BusIO_RegisterBits(Adafruit_BusIO_Register *reg, uint8_t bits,
|
||||||
uint8_t shift);
|
uint8_t shift);
|
||||||
void write(uint32_t value);
|
bool write(uint32_t value);
|
||||||
uint32_t read(void);
|
uint32_t read(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Adafruit_I2CDevice.h>
|
#include <Adafruit_I2CDevice.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
//#define DEBUG_SERIAL Serial
|
#define DEBUG_SERIAL Serial
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create an I2C device at a given address
|
* @brief Create an I2C device at a given address
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Adafruit_SPIDevice.h>
|
#include <Adafruit_SPIDevice.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
//#define DEBUG_SERIAL Serial
|
#define DEBUG_SERIAL Serial
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create an SPI device with the given CS pin and settins
|
* @brief Create an SPI device with the given CS pin and settins
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue