Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d638ab0

Browse files
committedJan 19, 2023
Whitespace changes. Sorry!
1 parent 6c9b156 commit d638ab0

File tree

2 files changed

+256
-278
lines changed

2 files changed

+256
-278
lines changed
 

‎src/sfe_bus.cpp

Lines changed: 208 additions & 223 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
//
77
// Do you like this library? Help support SparkFun. Buy a board!
88
//
9-
//SparkFun Triple Axis Accelerometer - KX132/KX134 (Qwiic)
9+
// SparkFun Triple Axis Accelerometer - KX132/KX134 (Qwiic)
1010
// * KX132 - https://www.sparkfun.com/products/17871
1111
// * KX134 - https://www.sparkfun.com/products/17589
1212
//
13-
// Written by Kirk Benell @ SparkFun Electronics
13+
// Written by Kirk Benell @ SparkFun Electronics
1414
// Modified by Elias Santistevan @ SparkFun Electronics, September 2022
1515
//
1616
// Repository:
@@ -40,10 +40,9 @@
4040
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
4141
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4242

43-
4443
// The following classes specify the behavior for communicating
4544
// over the respective data buses: Inter-Integrated Circuit (I2C)
46-
// and Serial Peripheral Interface (SPI).
45+
// and Serial Peripheral Interface (SPI).
4746

4847
#include "sfe_bus.h"
4948
#include <Arduino.h>
@@ -54,325 +53,311 @@ namespace sfe_KX13X
5453
#define kMaxTransferBuffer 32
5554
#define SPI_READ 0x80
5655

57-
// What we use for transfer chunk size
58-
const static uint16_t kChunkSize = kMaxTransferBuffer;
56+
// What we use for transfer chunk size
57+
const static uint16_t kChunkSize = kMaxTransferBuffer;
5958

60-
//////////////////////////////////////////////////////////////////////////////////////////////////
61-
// Constructor
62-
//
59+
//////////////////////////////////////////////////////////////////////////////////////////////////
60+
// Constructor
61+
//
6362

63+
QwI2C::QwI2C(void) : _i2cPort{nullptr}
64+
{
65+
}
6466

65-
QwI2C::QwI2C(void) : _i2cPort{nullptr}
66-
{
67-
}
67+
//////////////////////////////////////////////////////////////////////////////////////////////////
68+
// I2C init()
69+
//
70+
// Methods to init/setup this device. The caller can provide a Wire Port, or this class
71+
// will use the default
6872

69-
//////////////////////////////////////////////////////////////////////////////////////////////////
70-
// I2C init()
71-
//
72-
// Methods to init/setup this device. The caller can provide a Wire Port, or this class
73-
// will use the default
74-
75-
bool QwI2C::init(TwoWire &wirePort, bool bInit)
76-
{
73+
bool QwI2C::init(TwoWire &wirePort, bool bInit)
74+
{
7775

7876
// if we don't have a wire port already
79-
if( !_i2cPort )
77+
if (!_i2cPort)
8078
{
81-
_i2cPort = &wirePort;
79+
_i2cPort = &wirePort;
8280

83-
if( bInit )
84-
_i2cPort->begin();
81+
if (bInit)
82+
_i2cPort->begin();
8583
}
86-
87-
return true;
88-
}
89-
90-
//////////////////////////////////////////////////////////////////////////////////////////////////
91-
// I2C init()
92-
//
93-
// Methods to init/setup this device. The caller can provide a Wire Port, or this class
94-
// will use the default
95-
bool QwI2C::init()
96-
{
97-
if( !_i2cPort )
98-
return init(Wire);
99-
else
100-
return false;
101-
}
102-
10384

85+
return true;
86+
}
87+
88+
//////////////////////////////////////////////////////////////////////////////////////////////////
89+
// I2C init()
90+
//
91+
// Methods to init/setup this device. The caller can provide a Wire Port, or this class
92+
// will use the default
93+
bool QwI2C::init()
94+
{
95+
if (!_i2cPort)
96+
return init(Wire);
97+
else
98+
return false;
99+
}
100+
101+
//////////////////////////////////////////////////////////////////////////////////////////////////
102+
// ping()
103+
//
104+
// Is a device connected?
105+
bool QwI2C::ping(uint8_t i2c_address)
106+
{
104107

105-
//////////////////////////////////////////////////////////////////////////////////////////////////
106-
// ping()
107-
//
108-
// Is a device connected?
109-
bool QwI2C::ping(uint8_t i2c_address)
110-
{
111-
112-
if( !_i2cPort )
113-
return false;
108+
if (!_i2cPort)
109+
return false;
114110

115111
_i2cPort->beginTransmission(i2c_address);
116112
return _i2cPort->endTransmission() == 0;
117-
}
113+
}
118114

119-
//////////////////////////////////////////////////////////////////////////////////////////////////
120-
// writeRegisterByte()
121-
//
122-
// Write a byte to a register
115+
//////////////////////////////////////////////////////////////////////////////////////////////////
116+
// writeRegisterByte()
117+
//
118+
// Write a byte to a register
123119

124-
bool QwI2C::writeRegisterByte(uint8_t i2c_address, uint8_t offset, uint8_t dataToWrite)
125-
{
120+
bool QwI2C::writeRegisterByte(uint8_t i2c_address, uint8_t offset, uint8_t dataToWrite)
121+
{
126122

127123
if (!_i2cPort)
128-
return -1;
124+
return -1;
129125

130126
_i2cPort->beginTransmission(i2c_address);
131127
_i2cPort->write(offset);
132128
_i2cPort->write(dataToWrite);
133129
return (_i2cPort->endTransmission() == 0); // true = success, false = error
134-
}
130+
}
135131

132+
//////////////////////////////////////////////////////////////////////////////////////////////////
133+
// writeRegisterRegion()
134+
//
135+
// Write a block of data to a device.
136136

137-
138-
//////////////////////////////////////////////////////////////////////////////////////////////////
139-
// writeRegisterRegion()
140-
//
141-
// Write a block of data to a device.
142-
143-
int QwI2C::writeRegisterRegion(uint8_t i2c_address, uint8_t offset, const uint8_t *data, uint16_t length)
144-
{
137+
int QwI2C::writeRegisterRegion(uint8_t i2c_address, uint8_t offset, const uint8_t *data, uint16_t length)
138+
{
145139

146140
if (!_i2cPort)
147-
return -1;
141+
return -1;
148142

149143
_i2cPort->beginTransmission(i2c_address);
150144
_i2cPort->write(offset);
151145
_i2cPort->write(data, (int)length);
152146

153147
return _i2cPort->endTransmission() == 0 ? 0 : -1; // 0 = success, -1 = error
154-
}
155-
156-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
157-
// readRegisterRegion()
158-
//
159-
// Reads a block of data from an i2c register on the devices.
160-
//
161-
// For large buffers, the data is chuncked over KMaxI2CBufferLength at a time
162-
//
163-
//
164-
int QwI2C::readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t *data, uint16_t numBytes)
165-
{
148+
}
149+
150+
////////////////////////////////////////////////////////////////////////////////////////////////////////////
151+
// readRegisterRegion()
152+
//
153+
// Reads a block of data from an i2c register on the devices.
154+
//
155+
// For large buffers, the data is chuncked over KMaxI2CBufferLength at a time
156+
//
157+
//
158+
int QwI2C::readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t *data, uint16_t numBytes)
159+
{
166160
uint8_t nChunk;
167161
uint16_t nReturned;
168162

169163
if (!_i2cPort)
170-
return -1;
164+
return -1;
171165

172166
int i; // counter in loop
173167
bool bFirstInter = true; // Flag for first iteration - used to send register
174168

175169
while (numBytes > 0)
176170
{
177-
_i2cPort->beginTransmission(addr);
171+
_i2cPort->beginTransmission(addr);
178172

179-
if (bFirstInter)
180-
{
181-
_i2cPort->write(reg);
182-
bFirstInter = false;
183-
}
173+
if (bFirstInter)
174+
{
175+
_i2cPort->write(reg);
176+
bFirstInter = false;
177+
}
184178

185-
if (_i2cPort->endTransmission() != 0)
186-
return -1; // error with the end transmission
179+
if (_i2cPort->endTransmission() != 0)
180+
return -1; // error with the end transmission
187181

188-
// We're chunking in data - keeping the max chunk to kMaxI2CBufferLength
189-
nChunk = numBytes > kChunkSize ? kChunkSize : numBytes;
182+
// We're chunking in data - keeping the max chunk to kMaxI2CBufferLength
183+
nChunk = numBytes > kChunkSize ? kChunkSize : numBytes;
190184

191-
nReturned = _i2cPort->requestFrom((int)addr, (int)nChunk, (int)true);
185+
nReturned = _i2cPort->requestFrom((int)addr, (int)nChunk, (int)true);
192186

193-
// No data returned, no dice
194-
if (nReturned == 0)
195-
return -1; // error
187+
// No data returned, no dice
188+
if (nReturned == 0)
189+
return -1; // error
196190

197-
// Copy the retrieved data chunk to the current index in the data segment
198-
for (i = 0; i < nReturned; i++){
199-
*data++ = _i2cPort->read();
200-
}
201-
202-
// Decrement the amount of data recieved from the overall data request amount
203-
numBytes = numBytes - nReturned;
191+
// Copy the retrieved data chunk to the current index in the data segment
192+
for (i = 0; i < nReturned; i++)
193+
{
194+
*data++ = _i2cPort->read();
195+
}
196+
197+
// Decrement the amount of data recieved from the overall data request amount
198+
numBytes = numBytes - nReturned;
204199

205200
} // end while
206201

207202
return 0; // Success
208-
}
209-
203+
}
210204

205+
//////////////////////////////////////////////////////////////////////////////////////////////////
206+
// Constructor
207+
//
211208

212-
//////////////////////////////////////////////////////////////////////////////////////////////////
213-
// Constructor
214-
//
215-
216-
SfeSPI::SfeSPI(void) : _spiPort{nullptr}
217-
{
218-
}
219-
220-
////////////////////////////////////////////////////////////////////////////////////////////////
221-
// SPI init()
222-
//
223-
// Methods to init/setup this device. The caller can provide a SPI Port, or this class
224-
// will use the default
209+
SfeSPI::SfeSPI(void) : _spiPort{nullptr}
210+
{
211+
}
225212

213+
////////////////////////////////////////////////////////////////////////////////////////////////
214+
// SPI init()
215+
//
216+
// Methods to init/setup this device. The caller can provide a SPI Port, or this class
217+
// will use the default
226218

227-
bool SfeSPI::init(SPIClass &spiPort, SPISettings& kxSettings, uint8_t cs, bool bInit)
228-
{
219+
bool SfeSPI::init(SPIClass &spiPort, SPISettings &kxSettings, uint8_t cs, bool bInit)
220+
{
229221

230222
// if we don't have a SPI port already
231-
if( !_spiPort )
223+
if (!_spiPort)
232224
{
233-
_spiPort = &spiPort;
225+
_spiPort = &spiPort;
234226

235-
if( bInit )
236-
_spiPort->begin();
227+
if (bInit)
228+
_spiPort->begin();
237229
}
238230

231+
// SPI settings are needed for every transaction
232+
_sfeSPISettings = kxSettings;
239233

240-
// SPI settings are needed for every transaction
241-
_sfeSPISettings = kxSettings;
234+
// The chip select pin can vary from platform to platform and project to project
235+
// and so it must be given by the user.
236+
if (!cs)
237+
return false;
242238

243-
// The chip select pin can vary from platform to platform and project to project
244-
// and so it must be given by the user.
245-
if( !cs )
246-
return false;
247-
248-
_cs = cs;
239+
_cs = cs;
249240

250241
return true;
251-
}
252-
253-
////////////////////////////////////////////////////////////////////////////////////////////////
254-
// SPI init()
255-
//
256-
// Methods to init/setup this device. The caller can provide a SPI Port, or this class
257-
// will use the default
258-
bool SfeSPI::init(uint8_t cs, bool bInit)
259-
{
260-
261-
//If the transaction settings are not provided by the user they are built here.
262-
SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0);
263-
264-
//In addition of the port is not provided by the user, it defaults to SPI here.
265-
return init(SPI, spiSettings, cs, bInit);
266-
267-
}
268-
269-
270-
//////////////////////////////////////////////////////////////////////////////////////////////////
271-
// ping()
272-
//
273-
// Is a device connected? The SPI ping is not relevant but is defined here to keep consistency with
274-
// I2C class i.e. provided for the interface.
275-
//
276-
277-
278-
bool SfeSPI::ping(uint8_t i2c_address)
279-
{
280-
return true;
281-
}
242+
}
243+
244+
////////////////////////////////////////////////////////////////////////////////////////////////
245+
// SPI init()
246+
//
247+
// Methods to init/setup this device. The caller can provide a SPI Port, or this class
248+
// will use the default
249+
bool SfeSPI::init(uint8_t cs, bool bInit)
250+
{
251+
252+
// If the transaction settings are not provided by the user they are built here.
253+
SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0);
254+
255+
// In addition of the port is not provided by the user, it defaults to SPI here.
256+
return init(SPI, spiSettings, cs, bInit);
257+
}
258+
259+
//////////////////////////////////////////////////////////////////////////////////////////////////
260+
// ping()
261+
//
262+
// Is a device connected? The SPI ping is not relevant but is defined here to keep consistency with
263+
// I2C class i.e. provided for the interface.
264+
//
265+
266+
bool SfeSPI::ping(uint8_t i2c_address)
267+
{
268+
return true;
269+
}
282270

283-
//////////////////////////////////////////////////////////////////////////////////////////////////
284-
// writeRegisterByte()
285-
//
286-
// Write a byte to a register
271+
//////////////////////////////////////////////////////////////////////////////////////////////////
272+
// writeRegisterByte()
273+
//
274+
// Write a byte to a register
287275

288-
bool SfeSPI::writeRegisterByte(uint8_t i2c_address, uint8_t offset, uint8_t dataToWrite)
289-
{
276+
bool SfeSPI::writeRegisterByte(uint8_t i2c_address, uint8_t offset, uint8_t dataToWrite)
277+
{
290278

291-
if( !_spiPort )
292-
return false;
279+
if (!_spiPort)
280+
return false;
293281

294-
// Apply settings
282+
// Apply settings
295283
_spiPort->beginTransaction(_sfeSPISettings);
296-
// Signal communication start
297-
digitalWrite(_cs, LOW);
284+
// Signal communication start
285+
digitalWrite(_cs, LOW);
298286

299287
_spiPort->transfer(offset);
300288
_spiPort->transfer(dataToWrite);
301289

302-
// End communcation
303-
digitalWrite(_cs, HIGH);
290+
// End communcation
291+
digitalWrite(_cs, HIGH);
304292
_spiPort->endTransaction();
305293

306-
return true;
307-
}
294+
return true;
295+
}
308296

297+
//////////////////////////////////////////////////////////////////////////////////////////////////
298+
// writeRegisterRegion()
299+
//
300+
// Write a block of data to a device.
309301

310-
//////////////////////////////////////////////////////////////////////////////////////////////////
311-
// writeRegisterRegion()
312-
//
313-
// Write a block of data to a device.
302+
int SfeSPI::writeRegisterRegion(uint8_t i2c_address, uint8_t offset, const uint8_t *data, uint16_t length)
303+
{
314304

315-
int SfeSPI::writeRegisterRegion(uint8_t i2c_address, uint8_t offset, const uint8_t *data, uint16_t length)
316-
{
317-
318-
if( !_spiPort )
319-
return -1;
305+
if (!_spiPort)
306+
return -1;
320307

321-
int i;
308+
int i;
322309

323-
// Apply settings
310+
// Apply settings
324311
_spiPort->beginTransaction(_sfeSPISettings);
325-
// Signal communication start
326-
digitalWrite(_cs, LOW);
312+
// Signal communication start
313+
digitalWrite(_cs, LOW);
327314
_spiPort->transfer(offset);
328315

329-
for(i = 0; i < length; i++)
330-
{
331-
_spiPort->transfer(*data++);
332-
}
316+
for (i = 0; i < length; i++)
317+
{
318+
_spiPort->transfer(*data++);
319+
}
333320

334-
// End communication
335-
digitalWrite(_cs, HIGH);
321+
// End communication
322+
digitalWrite(_cs, HIGH);
336323
_spiPort->endTransaction();
337324

338-
return 0;
339-
}
340-
341-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
342-
// readRegisterRegion()
343-
//
344-
// Reads a block of data from the register on the device.
345-
//
346-
//
347-
//
325+
return 0;
326+
}
348327

328+
////////////////////////////////////////////////////////////////////////////////////////////////////////////
329+
// readRegisterRegion()
330+
//
331+
// Reads a block of data from the register on the device.
332+
//
333+
//
334+
//
349335

350-
int SfeSPI::readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t *data, uint16_t numBytes)
351-
{
336+
int SfeSPI::readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t *data, uint16_t numBytes)
337+
{
352338
if (!_spiPort)
353-
return -1;
339+
return -1;
354340

355341
int i; // counter in loop
356342

357-
// Apply settings
343+
// Apply settings
358344
_spiPort->beginTransaction(_sfeSPISettings);
359-
// Signal communication start
360-
digitalWrite(_cs, LOW);
361-
// A leading "1" must be added to transfer with register to indicate a "read"
362-
reg = (reg | SPI_READ);
345+
// Signal communication start
346+
digitalWrite(_cs, LOW);
347+
// A leading "1" must be added to transfer with register to indicate a "read"
348+
reg = (reg | SPI_READ);
363349
_spiPort->transfer(reg);
364350

365-
for(i = 0; i < numBytes; i++)
366-
{
367-
*data++ = _spiPort->transfer(0x00);
368-
}
351+
for (i = 0; i < numBytes; i++)
352+
{
353+
*data++ = _spiPort->transfer(0x00);
354+
}
369355

370-
// End transaction
371-
digitalWrite(_cs, HIGH);
356+
// End transaction
357+
digitalWrite(_cs, HIGH);
372358
_spiPort->endTransaction();
373359

374-
return 0;
375-
376-
}
360+
return 0;
361+
}
377362

378363
}

‎src/sfe_bus.h

Lines changed: 48 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
//
77
// Do you like this library? Help support SparkFun. Buy a board!
88
//
9-
//SparkFun Triple Axis Accelerometer - KX132/KX134 (Qwiic)
9+
// SparkFun Triple Axis Accelerometer - KX132/KX134 (Qwiic)
1010
// * KX132 - https://www.sparkfun.com/products/17871
1111
// * KX134 - https://www.sparkfun.com/products/17589
1212
//
13-
// Written by Kirk Benell @ SparkFun Electronics
13+
// Written by Kirk Benell @ SparkFun Electronics
1414
// Modified by Elias Santistevan @ SparkFun Electronics, September 2022
1515
//
1616
// Repository:
1717
// https://github.com/sparkfun/SparkFun_KX13X_Arduino_Library
18-
//
18+
//
1919
//
2020
//
2121
// SparkFun code, firmware, and software is released under the MIT
@@ -44,85 +44,78 @@
4444
// The following classes specify the behavior for communicating
4545
// over the respective data buses: Inter-Integrated Circuit (I2C)
4646
// and Serial Peripheral Interface (SPI). For ease of implementation
47-
// an abstract interface (QwIDeviceBus) is used.
47+
// an abstract interface (QwIDeviceBus) is used.
4848

4949
#pragma once
5050

51-
5251
#include <Wire.h>
5352
#include <SPI.h>
5453

5554
namespace sfe_KX13X
5655
{
5756

58-
// The following abstract class is used an interface for upstream implementation.
59-
class QwIDeviceBus
60-
{
61-
public:
62-
63-
virtual bool ping(uint8_t address) = 0;
64-
65-
virtual bool writeRegisterByte(uint8_t address, uint8_t offset, uint8_t data) = 0;
57+
// The following abstract class is used an interface for upstream implementation.
58+
class QwIDeviceBus
59+
{
60+
public:
61+
virtual bool ping(uint8_t address) = 0;
6662

67-
virtual int writeRegisterRegion(uint8_t address, uint8_t offset, const uint8_t* data, uint16_t length) = 0;
63+
virtual bool writeRegisterByte(uint8_t address, uint8_t offset, uint8_t data) = 0;
6864

69-
virtual int readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t* data, uint16_t numBytes) = 0;
65+
virtual int writeRegisterRegion(uint8_t address, uint8_t offset, const uint8_t *data, uint16_t length) = 0;
7066

71-
};
67+
virtual int readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t *data, uint16_t numBytes) = 0;
68+
};
7269

73-
// The QwI2C device defines behavior for I2C implementation based around the TwoWire class (Wire).
74-
// This is Arduino specific.
75-
class QwI2C : public QwIDeviceBus
76-
{
77-
public:
70+
// The QwI2C device defines behavior for I2C implementation based around the TwoWire class (Wire).
71+
// This is Arduino specific.
72+
class QwI2C : public QwIDeviceBus
73+
{
74+
public:
75+
QwI2C(void);
7876

79-
QwI2C(void);
77+
bool init();
8078

81-
bool init();
79+
bool init(TwoWire &wirePort, bool bInit = false);
8280

83-
bool init(TwoWire& wirePort, bool bInit=false);
81+
bool ping(uint8_t address);
8482

85-
bool ping(uint8_t address);
83+
bool writeRegisterByte(uint8_t address, uint8_t offset, uint8_t data);
8684

87-
bool writeRegisterByte(uint8_t address, uint8_t offset, uint8_t data);
85+
int writeRegisterRegion(uint8_t address, uint8_t offset, const uint8_t *data, uint16_t length);
8886

89-
int writeRegisterRegion(uint8_t address, uint8_t offset, const uint8_t* data, uint16_t length);
90-
91-
int readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t* data, uint16_t numBytes);
92-
93-
private:
94-
95-
TwoWire* _i2cPort;
96-
};
97-
98-
// The SfeSPI class defines behavior for SPI implementation based around the SPIClass class (SPI).
99-
// This is Arduino specific.
100-
// Paramaters like "address" are kept although irrelevant to SPI due to the use of the abstract class
101-
// as interface, QwIDeviceBus.
102-
class SfeSPI : public QwIDeviceBus
103-
{
104-
public:
87+
int readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t *data, uint16_t numBytes);
10588

106-
SfeSPI(void);
89+
private:
90+
TwoWire *_i2cPort;
91+
};
10792

108-
bool init(uint8_t cs, bool bInit=false);
93+
// The SfeSPI class defines behavior for SPI implementation based around the SPIClass class (SPI).
94+
// This is Arduino specific.
95+
// Paramaters like "address" are kept although irrelevant to SPI due to the use of the abstract class
96+
// as interface, QwIDeviceBus.
97+
class SfeSPI : public QwIDeviceBus
98+
{
99+
public:
100+
SfeSPI(void);
109101

110-
bool init(SPIClass& spiPort, SPISettings& kxSettings, uint8_t cs, bool bInit=false);
102+
bool init(uint8_t cs, bool bInit = false);
111103

112-
bool ping(uint8_t address);
104+
bool init(SPIClass &spiPort, SPISettings &kxSettings, uint8_t cs, bool bInit = false);
113105

114-
bool writeRegisterByte(uint8_t address, uint8_t offset, uint8_t data);
106+
bool ping(uint8_t address);
115107

116-
int writeRegisterRegion(uint8_t address, uint8_t offset, const uint8_t* data, uint16_t length);
108+
bool writeRegisterByte(uint8_t address, uint8_t offset, uint8_t data);
117109

118-
int readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t* data, uint16_t numBytes);
110+
int writeRegisterRegion(uint8_t address, uint8_t offset, const uint8_t *data, uint16_t length);
119111

120-
private:
112+
int readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t *data, uint16_t numBytes);
121113

122-
SPIClass* _spiPort;
123-
// Settings are used for every transaction.
124-
SPISettings _sfeSPISettings;
125-
uint8_t _cs;
126-
};
114+
private:
115+
SPIClass *_spiPort;
116+
// Settings are used for every transaction.
117+
SPISettings _sfeSPISettings;
118+
uint8_t _cs;
119+
};
127120

128121
};

0 commit comments

Comments
 (0)
Please sign in to comment.