Skip to content

Commit 2ce9314

Browse files
pillo79soburi
authored andcommitted
warning cleanup: mark unused parameters with ARG_UNUSED macro
Use the ARG_UNUSED macro provided by Zephyr to mark function parameters as intentionally unused to prevent compiler warnings. Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
1 parent 3f29a41 commit 2ce9314

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

libraries/Wire/Wire.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ uint8_t arduino::ZephyrI2C::endTransmission(bool stopBit) {
100100
size_t max = ring_buf_capacity_get(&txRingBuffer.rb);
101101
size_t len = ring_buf_get_claim(&txRingBuffer.rb, &buf, max);
102102

103+
ARG_UNUSED(stopBit);
104+
103105
ret = i2c_write(i2c_dev, buf, len, _address);
104106

105107
// Must be called even if 0 bytes claimed.
@@ -115,8 +117,11 @@ uint8_t arduino::ZephyrI2C::endTransmission(void) {
115117
size_t arduino::ZephyrI2C::requestFrom(uint8_t address, size_t len_in, bool stopBit) {
116118
int ret = -EIO;
117119
uint8_t *buf = NULL;
118-
size_t len = ring_buf_put_claim(&rxRingBuffer.rb, &buf, len_in);
120+
size_t len;
121+
122+
ARG_UNUSED(stopBit);
119123

124+
len = ring_buf_put_claim(&rxRingBuffer.rb, &buf, len_in);
120125
if (len && buf) {
121126
ret = i2c_read(i2c_dev, buf, len, address);
122127
}
@@ -171,6 +176,8 @@ void arduino::ZephyrI2C::onRequest(voidFuncPtr cb) {
171176
}
172177

173178
int arduino::ZephyrI2C::writeRequestedCallback(struct i2c_target_config *config) {
179+
ARG_UNUSED(config);
180+
174181
// Reset the buffer on write requests.
175182
ring_buf_reset(&rxRingBuffer.rb);
176183
return 0;
@@ -180,6 +187,8 @@ int arduino::ZephyrI2C::writeReceivedCallback(struct i2c_target_config *config,
180187
size_t len = ring_buf_size_get(&rxRingBuffer.rb);
181188
size_t max = ring_buf_capacity_get(&rxRingBuffer.rb);
182189

190+
ARG_UNUSED(config);
191+
183192
// If the buffer is about to overflow, invoke the callback
184193
// with the current length.
185194
if (onReceiveCb && ((len + 1) > max)) {
@@ -201,6 +210,8 @@ int arduino::ZephyrI2C::readRequestedCallback(struct i2c_target_config *config,
201210
}
202211

203212
int arduino::ZephyrI2C::readProcessedCallback(struct i2c_target_config *config, uint8_t *val) {
213+
ARG_UNUSED(config);
214+
204215
*val = 0xFF;
205216
ring_buf_get(&txRingBuffer.rb, val, 1);
206217
// Returning a negative value here is not handled gracefully and
@@ -209,6 +220,8 @@ int arduino::ZephyrI2C::readProcessedCallback(struct i2c_target_config *config,
209220
}
210221

211222
int arduino::ZephyrI2C::stopCallback(struct i2c_target_config *config) {
223+
ARG_UNUSED(config);
224+
212225
// If the RX buffer is not empty invoke the callback with the
213226
// remaining data length.
214227
if (onReceiveCb) {

0 commit comments

Comments
 (0)