Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
altineller committed Nov 15, 2024
1 parent 0136a7d commit fe68f7c
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,16 @@ with SMBus(1) as bus:
```c
uint8_t send_hat_command(int fd, uint8_t output) {

int rv_hat = ioctl(fd, I2C_SLAVE, 0x20);
if(rv_hat<0) { return rv_hat; }
int rv_hat = ioctl(fd, I2C_SLAVE, 0x20);
if(rv_hat<0) { return rv_hat; }

unsigned char hat_command[1] = {0};
int rw_hat = I2C_RW_Block(fd, 0x03, I2C_SMBUS_WRITE, 1, hat_command);
unsigned char hat_command[1] = {0};
int rw_hat = I2C_RW_Block(fd, 0x03, I2C_SMBUS_WRITE, 1, hat_command);

hat_command[0] = output;
rw_hat = I2C_RW_Block(fd, 0x01, I2C_SMBUS_WRITE, 1, hat_command);
hat_command[0] = output;
rw_hat = I2C_RW_Block(fd, 0x01, I2C_SMBUS_WRITE, 1, hat_command);

return rw_hat;
return rw_hat;
}
```
Expand All @@ -158,15 +158,15 @@ return rw_hat;
uint8_t send_sysctl(int fd, uint8_t command) {
unsigned char sysctl_buffer[5] = {0};
sysctl_buffer[3] = command;
sysctl_buffer[3] = command;
uint8_t rw = I2C_RW_Block(fd, 0x04, I2C_SMBUS_WRITE, 5, sysctl_buffer);
if(rw == 0) {
return 0;
} else {
uint8_t rw = I2C_RW_Block(fd, 0x04, I2C_SMBUS_WRITE, 5, sysctl_buffer);
if(rw == 0) {
return 0;
} else {
RCLCPP_INFO(this->get_logger(), "I2C Error: %s", strerror(rw));
return rw;
}
}
}
```
Expand Down

0 comments on commit fe68f7c

Please sign in to comment.