clang
This commit is contained in:
parent
e6712a5dfe
commit
f1db9d5956
|
|
@ -104,12 +104,14 @@ bool Adafruit_BusIO_Register::write(uint8_t *buffer, uint8_t len) {
|
||||||
if (_spiregtype == ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE) {
|
if (_spiregtype == ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE) {
|
||||||
// very special case!
|
// very special case!
|
||||||
|
|
||||||
// pass the special opcode address which we set as the high byte of the regaddr
|
// pass the special opcode address which we set as the high byte of the
|
||||||
addrbuffer[0] = (uint8_t)(_address >> 8) & ~0x01; // set bottom bit low to write
|
// regaddr
|
||||||
|
addrbuffer[0] =
|
||||||
|
(uint8_t)(_address >> 8) & ~0x01; // set bottom bit low to write
|
||||||
// the 'actual' reg addr is the second byte then
|
// the 'actual' reg addr is the second byte then
|
||||||
addrbuffer[1] = (uint8_t)(_address & 0xFF);
|
addrbuffer[1] = (uint8_t)(_address & 0xFF);
|
||||||
// the address appears to be a byte longer
|
// the address appears to be a byte longer
|
||||||
return _spidevice->write(buffer, len, addrbuffer, _addrwidth+1);
|
return _spidevice->write(buffer, len, addrbuffer, _addrwidth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_spiregtype == ADDRBIT8_HIGH_TOREAD) {
|
if (_spiregtype == ADDRBIT8_HIGH_TOREAD) {
|
||||||
|
|
@ -204,12 +206,15 @@ bool Adafruit_BusIO_Register::read(uint8_t *buffer, uint8_t len) {
|
||||||
if (_spiregtype == ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE) {
|
if (_spiregtype == ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE) {
|
||||||
// very special case!
|
// very special case!
|
||||||
|
|
||||||
// pass the special opcode address which we set as the high byte of the regaddr
|
// pass the special opcode address which we set as the high byte of the
|
||||||
addrbuffer[0] = (uint8_t)(_address >> 8) | 0x01; // set bottom bit high to read
|
// regaddr
|
||||||
|
addrbuffer[0] =
|
||||||
|
(uint8_t)(_address >> 8) | 0x01; // set bottom bit high to read
|
||||||
// the 'actual' reg addr is the second byte then
|
// the 'actual' reg addr is the second byte then
|
||||||
addrbuffer[1] = (uint8_t)(_address & 0xFF);
|
addrbuffer[1] = (uint8_t)(_address & 0xFF);
|
||||||
// the address appears to be a byte longer
|
// 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) {
|
if (_spiregtype == ADDRBIT8_HIGH_TOREAD) {
|
||||||
addrbuffer[0] |= 0x80;
|
addrbuffer[0] |= 0x80;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue