Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 8b1a5ae

Browse files
committed
Simplify code
* Remove unused rxBytecount variables * Remove unnecessary ret variable * Remove unnecessary memcpy (memory must be discarded on non-0 return value) * Fix spacing around operators
1 parent 9c78bf9 commit 8b1a5ae

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

sensirion_hw_i2c_implementation.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,17 @@ void sensirion_i2c_init()
5151

5252
s8 sensirion_i2c_read(u8 address, u8* data, u16 count)
5353
{
54-
u8 readData[count];
55-
u8 rxByteCount = 0;
56-
57-
uint8_t ret = I2c.read(address, count, readData);
58-
if (ret != 0) {
59-
return ret;
60-
}
61-
62-
memcpy(data, readData, count);
63-
return 0;
54+
return I2c.read(address, count, data);
6455
}
6556

6657
s8 sensirion_i2c_write(u8 address, const u8* data, u16 count)
6758
{
68-
uint8_t ret = 0;
69-
7059
// the API doesn't forsee calls without register, so we'll use the first
7160
// byte as "register", and pass the rest as data argument
7261
if (count == 0) {
73-
return ret;
62+
return 0;
7463
}
75-
return I2c.write(address, data[0], data+1, count-1);
64+
return I2c.write(address, data[0], data + 1, count - 1);
7665
}
7766

7867
/**

0 commit comments

Comments
 (0)