Skip to content

Commit 9fa5a64

Browse files
ci(pre-commit): Apply automatic fixes
1 parent f2fce44 commit 9fa5a64

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

cores/esp32/HardwareI2C.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ class HardwareI2C : public Stream {
3838
virtual size_t requestFrom(uint8_t address, size_t len) = 0;
3939

4040
// Update base class to use std::function
41-
virtual void onReceive(const std::function<void(int)>&) = 0;
42-
virtual void onRequest(const std::function<void()>&) = 0;
41+
virtual void onReceive(const std::function<void(int)> &) = 0;
42+
virtual void onRequest(const std::function<void()> &) = 0;
4343
};

docs/en/api/i2c.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -401,20 +401,20 @@ The callback function must have the signature ``void(int numBytes)`` where ``num
401401
int deviceAddress;
402402
public:
403403
I2CDevice(int addr) : deviceAddress(addr) {}
404-
404+
405405
void handleReceive(int numBytes) {
406406
Serial.printf("Device 0x%02X received %d bytes\n", deviceAddress, numBytes);
407407
}
408-
408+
409409
void setup() {
410410
Wire.onReceive([this](int bytes) {
411411
this->handleReceive(bytes);
412412
});
413413
}
414414
};
415415
416-
.. note::
417-
The ``onReceive`` callback is triggered when the I2C master sends data to this slave device.
416+
.. note::
417+
The ``onReceive`` callback is triggered when the I2C master sends data to this slave device.
418418
Use ``Wire.available()`` and ``Wire.read()`` inside the callback to retrieve the received data.
419419

420420
onRequest
@@ -471,24 +471,24 @@ The callback function must have the signature ``void()`` with no parameters. Thi
471471
void updateTemperature() {
472472
temperature = 25.5; // Read from actual sensor
473473
}
474-
474+
475475
void sendTemperature() {
476476
// Convert float to bytes and send
477477
uint8_t* tempBytes = (uint8_t*)&temperature;
478478
Wire.write(tempBytes, sizeof(float));
479479
}
480-
480+
481481
void setup() {
482482
Wire.onRequest([this]() {
483483
this->sendTemperature();
484484
});
485485
}
486486
};
487487
488-
.. note::
489-
The ``onRequest`` callback is triggered when the I2C master requests data from this slave device.
488+
.. note::
489+
The ``onRequest`` callback is triggered when the I2C master requests data from this slave device.
490490
Use ``Wire.write()`` inside the callback to send response data back to the master.
491-
491+
492492
slaveWrite
493493
^^^^^^^^^^
494494

libraries/Wire/examples/WireSlaveFunctionalCallback/WireSlaveFunctionalCallback.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ void setup() {
1616
Wire.print(" Packets.");
1717
Serial.println("onRequest");
1818
});
19-
19+
2020
Wire.onReceive([](int len) {
21-
Serial.printf("onReceive[%d]: ", len);
21+
Serial.printf("onReceive[%d]: ", len);
2222
while (Wire.available()) {
2323
Serial.write(Wire.read());
2424
}

libraries/Wire/examples/WireSlaveFunctionalCallback/ci.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"requires": [
33
"CONFIG_SOC_I2C_SUPPORT_SLAVE=y"
44
]
5-
}
5+
}

libraries/Wire/src/Wire.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,14 +596,14 @@ void TwoWire::flush() {
596596
//i2cFlush(num); // cleanup
597597
}
598598

599-
void TwoWire::onReceive(const std::function<void(int)>& function) {
599+
void TwoWire::onReceive(const std::function<void(int)> &function) {
600600
#if SOC_I2C_SUPPORT_SLAVE
601601
user_onReceive = function;
602602
#endif
603603
}
604604

605605
// sets function called on slave read
606-
void TwoWire::onRequest(const std::function<void()>& function) {
606+
void TwoWire::onRequest(const std::function<void()> &function) {
607607
#if SOC_I2C_SUPPORT_SLAVE
608608
user_onRequest = function;
609609
#endif

libraries/Wire/src/Wire.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ class TwoWire : public HardwareI2C {
112112
size_t requestFrom(uint8_t address, size_t len, bool stopBit) override;
113113
size_t requestFrom(uint8_t address, size_t len) override;
114114

115-
void onReceive(const std::function<void(int)>&) override;
116-
void onRequest(const std::function<void()>&) override;
115+
void onReceive(const std::function<void(int)> &) override;
116+
void onRequest(const std::function<void()> &) override;
117117

118118
//call setPins() first, so that begin() can be called without arguments from libraries
119119
bool setPins(int sda, int scl);

0 commit comments

Comments
 (0)