Skip to content

Commit

Permalink
lib: Add const identifiers
Browse files Browse the repository at this point in the history
Add const identifiers to all const functions.
  • Loading branch information
QuentinCG committed Jul 3, 2016
1 parent 75c3065 commit d267b69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions I2CEEPROM/I2CEEPROM.cpp
Expand Up @@ -17,7 +17,7 @@ I2CEEPROM::I2CEEPROM(int i2c_device_address)
Wire.begin();
}

void I2CEEPROM::write(unsigned int address, byte data)
void I2CEEPROM::write(unsigned int address, byte data) const
{
Wire.beginTransmission(_i2c_device_address);
Wire.write((int)(address >> 8)); // MSB
Expand All @@ -29,7 +29,7 @@ void I2CEEPROM::write(unsigned int address, byte data)
delay(5);
}

byte I2CEEPROM::read(unsigned int address)
byte I2CEEPROM::read(unsigned int address) const
{
byte read_data = 0xFF;

Expand Down
4 changes: 2 additions & 2 deletions I2CEEPROM/I2CEEPROM.h
Expand Up @@ -35,14 +35,14 @@ class I2CEEPROM
* \param address (unsigned int) EEPROM internal address (most of the time, first address is 0x00)
* \param data (byte) Byte to write at EEPROM internal address \p address
*/
void write(unsigned int address, byte data);
void write(unsigned int address, byte data) const;

/*!
* \brief read Read one byte in EEPROM device at EEPROM internal address \p address
* \param address (unsigned int) EEPROM internal address (most of the time, first address is 0x00)
* \return (byte) Read Byte at EEPROM internal address \p address (returns 0xFF if an error occurred)
*/
byte read(unsigned int address);
byte read(unsigned int address) const;

private:
int _i2c_device_address;
Expand Down

0 comments on commit d267b69

Please sign in to comment.