const qualifier for sendBytes

This commit is contained in:
Alessandro Mauri 2026-04-24 01:55:20 +02:00
parent f5dfa7960b
commit 48f1656540
2 changed files with 4 additions and 4 deletions

View File

@ -86,7 +86,7 @@ void i2c_scan(I2C_TypeDef* I2Cx, void (*onPingFound)(u8 address)) {
//! I2C SEND FUNCTION //! I2C SEND FUNCTION
//! #################################### //! ####################################
u8 i2c_sendBytes_noStop(I2C_TypeDef* I2Cx, u8 i2cAddress, u8* buffer, u8 len) { u8 i2c_sendBytes_noStop(I2C_TypeDef* I2Cx, u8 i2cAddress, const u8* buffer, u8 len) {
u8 err = i2c_start(I2Cx, i2cAddress, 0); // Write mode u8 err = i2c_start(I2Cx, i2cAddress, 0); // Write mode
if (err) return err; if (err) return err;
u32 timeout; u32 timeout;
@ -107,7 +107,7 @@ u8 i2c_sendBytes_noStop(I2C_TypeDef* I2Cx, u8 i2cAddress, u8* buffer, u8 len) {
return 0; return 0;
} }
u8 i2c_sendBytes(I2C_TypeDef* I2Cx, u8 i2cAddress, u8* buffer, u8 len) { u8 i2c_sendBytes(I2C_TypeDef* I2Cx, u8 i2cAddress, const u8* buffer, u8 len) {
u8 err = i2c_sendBytes_noStop(I2Cx, i2cAddress, buffer, len); u8 err = i2c_sendBytes_noStop(I2Cx, i2cAddress, buffer, len);
//# Generate STOP condition //# Generate STOP condition
I2Cx->CTLR1 |= I2C_CTLR1_STOP; I2Cx->CTLR1 |= I2C_CTLR1_STOP;

View File

@ -23,8 +23,8 @@ void i2c_scan(I2C_TypeDef* I2Cx, void (*onPingFound)(u8 address));
//! I2C SEND FUNCTION //! I2C SEND FUNCTION
//! #################################### //! ####################################
u8 i2c_sendBytes_noStop(I2C_TypeDef* I2Cx, u8 i2cAddress, u8* buffer, u8 len); u8 i2c_sendBytes_noStop(I2C_TypeDef* I2Cx, u8 i2cAddress, const u8* buffer, u8 len);
u8 i2c_sendBytes(I2C_TypeDef* I2Cx, u8 i2cAddress, u8* buffer, u8 len); u8 i2c_sendBytes(I2C_TypeDef* I2Cx, u8 i2cAddress, const u8* buffer, u8 len);
u8 i2c_sendByte(I2C_TypeDef* I2Cx, u8 i2cAddress, u8 data); u8 i2c_sendByte(I2C_TypeDef* I2Cx, u8 i2cAddress, u8 data);
//! #################################### //! ####################################