Skip to content

Commit

Permalink
Cast some values to uint8_t to quiet ESP32 compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
PaintYourDragon committed Oct 26, 2022
1 parent 628b7d8 commit 6745896
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Adafruit_ADXL345_U.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void Adafruit_ADXL345_Unified::writeRegister(uint8_t reg, uint8_t value) {
*/
/**************************************************************************/
uint8_t Adafruit_ADXL345_Unified::readRegister(uint8_t reg) {
uint8_t buffer[1] = {i2c_dev ? reg : reg | 0x80};
uint8_t buffer[1] = {i2c_dev ? reg : (uint8_t)(reg | 0x80)};
if (i2c_dev) {
i2c_dev->write(buffer, 1);
i2c_dev->read(buffer, 1);
Expand All @@ -63,7 +63,7 @@ uint8_t Adafruit_ADXL345_Unified::readRegister(uint8_t reg) {
*/
/**************************************************************************/
int16_t Adafruit_ADXL345_Unified::read16(uint8_t reg) {
uint8_t buffer[2] = {i2c_dev ? reg : reg | 0x80 | 0x40, 0};
uint8_t buffer[2] = {i2c_dev ? reg : (uint8_t)(reg | 0x80 | 0x40), 0};
if (i2c_dev) {
i2c_dev->write(buffer, 1);
i2c_dev->read(buffer, 2);
Expand Down

0 comments on commit 6745896

Please sign in to comment.