Skip to content

Commit 33d1b35

Browse files
committed
Remove Read16 and 16-bit register helpers
Delete redundant 16-bit helper functions from lib-gd32/include/i2c.h: Read16, ReadRegister16, and ReadRegister16DelayUs. These helpers duplicated functionality provided by the existing Read/ReadReg APIs (and explicit timing utilities), so the I2C interface is simplified; callers should use Read/ReadReg and perform any required delays themselves.
1 parent 1f456a7 commit 33d1b35

1 file changed

Lines changed: 0 additions & 19 deletions

File tree

lib-gd32/include/i2c.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ inline uint8_t Read(uint8_t address, char* buffer, uint32_t length) {
8585
return Gd32I2cRead(address, buffer, length);
8686
}
8787

88-
inline uint16_t Read16() {
89-
char buf[2] = {0};
90-
Read(buf, 2);
91-
return static_cast<uint16_t>(static_cast<uint16_t>(buf[0]) << 8 | static_cast<uint16_t>(buf[1]));
92-
}
93-
9488
inline bool IsConnected(uint8_t address, uint32_t baudrate = kNormalSpeed) {
9589
return Gd32I2cIsConnected(address, baudrate);
9690
}
@@ -114,19 +108,6 @@ inline void ReadReg(uint8_t reg, uint8_t& value) {
114108
inline void ReadReg(uint8_t address, uint8_t reg, uint8_t& value) {
115109
Gd32I2cReadReg(address, reg, value);
116110
}
117-
118-
inline uint16_t ReadRegister16(uint8_t reg) {
119-
const char kBuffer[] = {static_cast<char>(reg)};
120-
i2c::Write(&kBuffer[0], 1);
121-
return Read16();
122-
}
123-
124-
inline uint16_t ReadRegister16DelayUs(uint8_t reg, uint32_t delay_us) {
125-
const char kBuffer[] = {static_cast<char>(reg)};
126-
i2c::Write(&kBuffer[0], 1);
127-
timing::DelayUs(delay_us);
128-
return Read16();
129-
}
130111
} // namespace i2c
131112

132113
class I2c {

0 commit comments

Comments
 (0)