Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Fix regression: Only write register address with no value. #4

Merged
merged 1 commit into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/107-Arduino-TSL2550.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ bool ArduinoTSL2550::begin(bool const use_extended)
}

if (use_extended)
_io.write(TSL2550::Register::WriteCommandExtendedRange, 0);
_io.write(TSL2550::Register::WriteCommandExtendedRange);
else
_io.write(TSL2550::Register::WriteCommandStandardRange, 0);
_io.write(TSL2550::Register::WriteCommandStandardRange);

return true;
}
Expand Down Expand Up @@ -82,7 +82,7 @@ float ArduinoTSL2550::get_lux()

void ArduinoTSL2550::powerdown()
{
_io.write(TSL2550::Register::PowerDownState, 0);
_io.write(TSL2550::Register::PowerDownState);
}

TSL2550::Error ArduinoTSL2550::error()
Expand Down
6 changes: 6 additions & 0 deletions src/TSL2550/TSL2550_Io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ TSL2550_Io::TSL2550_Io(I2cWriteFunc write, I2cReadFunc read, uint8_t const i2c_s
* PUBLIC MEMBER FUNCTIONS
**************************************************************************************/

void TSL2550_Io::write(Register const reg)
{
uint8_t const val=0;
write(reg, &val, 0);
}

uint8_t TSL2550_Io::read(Register const reg)
{
uint8_t data = 0;
Expand Down
1 change: 1 addition & 0 deletions src/TSL2550/TSL2550_Io.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class TSL2550_Io
TSL2550_Io(I2cWriteFunc write, I2cReadFunc read, uint8_t const i2c_slave_addr);


void write(Register const reg);
uint8_t read (Register const reg);
void write(Register const reg, uint8_t const val);
void read (Register const reg, uint8_t * buf, size_t const bytes);
Expand Down