Skip to content

Commit

Permalink
fix script mode skipping to_reg_addr (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
RoboSchmied authored Mar 24, 2024
1 parent 96aaa44 commit 9acc7c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/i2cspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static int i2cdump(int argc, char **argv, bool script_mode) {
int fd = prepare_i2c_sensor(i2c_addr);

if (script_mode) {
for (size_t i = from_reg_addr; i < to_reg_addr; ++i)
for (size_t i = from_reg_addr; i <= to_reg_addr; ++i)
printf("ipctool i2cset %#x %#x %#x\n", i2c_addr, i,
i2c_read_register(fd, i2c_addr, i, SELECT_WIDE(i), 1));
} else {
Expand Down Expand Up @@ -243,7 +243,7 @@ static int spidump(int argc, char **argv, bool script_mode) {
int fd = prepare_spi_sensor();

if (script_mode) {
for (size_t i = from_reg_addr; i < to_reg_addr; ++i)
for (size_t i = from_reg_addr; i <= to_reg_addr; ++i)
printf("ipctool spiset %#x %#x\n", i,
spi_read_register(fd, 0, i, SELECT_WIDE(i), 1));
} else {
Expand Down

0 comments on commit 9acc7c7

Please sign in to comment.