Mark pointers as const
Resulting binaries are identical. Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
committed by
Jeremy Soller
parent
d60a8e4c8e
commit
9fb08ffa46
@ -10,7 +10,7 @@
|
||||
|
||||
#define TIMEOUT (F_CPU / 1000)
|
||||
|
||||
int16_t i2c_start(struct I2C *i2c, uint8_t addr, bool read) {
|
||||
int16_t i2c_start(struct I2C *const i2c, uint8_t addr, bool read) {
|
||||
uint32_t count;
|
||||
|
||||
// reset TWI control register
|
||||
@ -47,12 +47,12 @@ int16_t i2c_start(struct I2C *i2c, uint8_t addr, bool read) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void i2c_stop(struct I2C *i2c) {
|
||||
void i2c_stop(struct I2C *const i2c) {
|
||||
// transmit STOP condition
|
||||
TWCR = BIT(TWINT) | BIT(TWEN) | BIT(TWSTO);
|
||||
}
|
||||
|
||||
int16_t i2c_write(struct I2C *i2c, uint8_t *data, uint16_t length) {
|
||||
int16_t i2c_write(struct I2C *const i2c, uint8_t *const data, uint16_t length) {
|
||||
uint16_t i;
|
||||
for (i = 0; i < length; i++) {
|
||||
// load data into data register
|
||||
@ -74,7 +74,7 @@ int16_t i2c_write(struct I2C *i2c, uint8_t *data, uint16_t length) {
|
||||
return i;
|
||||
}
|
||||
|
||||
int16_t i2c_read(struct I2C *i2c, uint8_t *data, uint16_t length) {
|
||||
int16_t i2c_read(struct I2C *const i2c, uint8_t *const data, uint16_t length) {
|
||||
uint16_t i;
|
||||
for (i = 0; i < length; i++) {
|
||||
if ((i + 1) < length) {
|
||||
|
Reference in New Issue
Block a user