diff --git a/README.md b/README.md index 85c5768..b06e699 100644 --- a/README.md +++ b/README.md @@ -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; } ``` @@ -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; -} + } } ```