This commit is contained in:
caternuson 2021-06-25 09:20:30 -07:00
parent e6712a5dfe
commit f1db9d5956
1 changed files with 11 additions and 6 deletions

View File

@ -104,8 +104,10 @@ bool Adafruit_BusIO_Register::write(uint8_t *buffer, uint8_t len) {
if (_spiregtype == ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE) {
// very special case!
// pass the special opcode address which we set as the high byte of the regaddr
addrbuffer[0] = (uint8_t)(_address >> 8) & ~0x01; // set bottom bit low to write
// pass the special opcode address which we set as the high byte of the
// regaddr
addrbuffer[0] =
(uint8_t)(_address >> 8) & ~0x01; // set bottom bit low to write
// the 'actual' reg addr is the second byte then
addrbuffer[1] = (uint8_t)(_address & 0xFF);
// the address appears to be a byte longer
@ -204,12 +206,15 @@ bool Adafruit_BusIO_Register::read(uint8_t *buffer, uint8_t len) {
if (_spiregtype == ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE) {
// very special case!
// pass the special opcode address which we set as the high byte of the regaddr
addrbuffer[0] = (uint8_t)(_address >> 8) | 0x01; // set bottom bit high to read
// pass the special opcode address which we set as the high byte of the
// regaddr
addrbuffer[0] =
(uint8_t)(_address >> 8) | 0x01; // set bottom bit high to read
// the 'actual' reg addr is the second byte then
addrbuffer[1] = (uint8_t)(_address & 0xFF);
// the address appears to be a byte longer
return _spidevice->write_then_read(addrbuffer, _addrwidth+1, buffer, len);
return _spidevice->write_then_read(addrbuffer, _addrwidth + 1, buffer,
len);
}
if (_spiregtype == ADDRBIT8_HIGH_TOREAD) {
addrbuffer[0] |= 0x80;