1515 */
1616
1717#include " Adafruit_GP8403.h"
18+
1819#include < Adafruit_BusIO_Register.h>
1920
2021/* *
@@ -45,7 +46,7 @@ Adafruit_GP8403::~Adafruit_GP8403() {
4546 * @param wire I2C interface to use.
4647 * @return true if the probe and all initialization writes succeeded.
4748 */
48- bool Adafruit_GP8403::begin (uint8_t address, TwoWire * wire) {
49+ bool Adafruit_GP8403::begin (uint8_t address, TwoWire* wire) {
4950 delete _i2c_dev;
5051 _i2c_dev = new Adafruit_I2CDevice (address, wire);
5152
@@ -102,8 +103,7 @@ bool Adafruit_GP8403::setRaw(uint8_t channel, uint16_t value) {
102103 * @return true if both values were valid and the I2C write succeeded.
103104 */
104105bool Adafruit_GP8403::setRawValues (uint16_t channel0, uint16_t channel1) {
105- if (channel0 > GP8403_MAX_RAW_VALUE ||
106- channel1 > GP8403_MAX_RAW_VALUE ) {
106+ if (channel0 > GP8403_MAX_RAW_VALUE || channel1 > GP8403_MAX_RAW_VALUE ) {
107107 return false ;
108108 }
109109
@@ -234,8 +234,8 @@ bool Adafruit_GP8403::writeRawValues(uint16_t channel0, uint16_t channel1) {
234234 uint16_t wireChannel0 = channel0 << 4 ;
235235 uint16_t wireChannel1 = channel1 << 4 ;
236236 uint32_t wireValues = ((uint32_t )wireChannel1 << 16 ) | wireChannel0;
237- Adafruit_BusIO_Register channelRegister (
238- _i2c_dev, GP8403_COMMAND_CHANNEL_0 , 4 , LSBFIRST );
237+ Adafruit_BusIO_Register channelRegister (_i2c_dev, GP8403_COMMAND_CHANNEL_0 , 4 ,
238+ LSBFIRST );
239239 if (!channelRegister.write (wireValues)) {
240240 return false ;
241241 }
@@ -252,7 +252,7 @@ bool Adafruit_GP8403::writeRawValues(uint16_t channel0, uint16_t channel1) {
252252 * @param value Destination for the converted value.
253253 * @return true if the voltage is finite and within the selected range.
254254 */
255- bool Adafruit_GP8403::voltageToRaw (float volts, uint16_t & value) {
255+ bool Adafruit_GP8403::voltageToRaw (float volts, uint16_t & value) {
256256 float fullScale = fullScaleVoltage ();
257257 if (!isfinite (volts) || volts < 0.0 || volts > fullScale) {
258258 return false ;
@@ -279,7 +279,7 @@ namespace {
279279constexpr uint8_t GP8403_NVM_HALF_PERIOD_US = 5 ;
280280
281281class GP8403NVMWriter {
282- public:
282+ public:
283283 GP8403NVMWriter (uint16_t sdaPin, uint16_t sclPin) {
284284 _sdaPin = sdaPin;
285285 _sclPin = sclPin;
@@ -346,8 +346,8 @@ class GP8403NVMWriter {
346346 delayMicroseconds (GP8403_NVM_HALF_PERIOD_US );
347347 release (_sclPin);
348348 delayMicroseconds (GP8403_NVM_HALF_PERIOD_US );
349- bool acknowledged = digitalRead (_sclPin) == HIGH &&
350- digitalRead (_sdaPin) == LOW ;
349+ bool acknowledged =
350+ digitalRead (_sclPin) == HIGH && digitalRead (_sdaPin) == LOW ;
351351 driveLow (_sclPin);
352352 delayMicroseconds (GP8403_NVM_HALF_PERIOD_US );
353353 return clocksHigh && acknowledged;
@@ -363,7 +363,7 @@ class GP8403NVMWriter {
363363 return stop () && waveformOK;
364364 }
365365
366- private:
366+ private:
367367 static void driveLow (uint16_t pin) {
368368 digitalWrite (pin, LOW );
369369 pinMode (pin, OUTPUT );
@@ -449,8 +449,8 @@ bool Adafruit_GP8403::saveToNVM(uint16_t sdaPin, uint16_t sclPin) {
449449 exitStopOK = writer.stop ();
450450 }
451451 }
452- bool exited = exitPreambleOK && exitStartOK && exitCommandACK && exitDataACK &&
453- exitStopOK;
452+ bool exited = exitPreambleOK && exitStartOK && exitCommandACK &&
453+ exitDataACK && exitStopOK;
454454 writer.releaseBus ();
455455 return entered && dataWaveformOK && exited;
456456}
0 commit comments