From 0136a7d036036f7dc2f4837bc82bb5f917f17aeb Mon Sep 17 00:00:00 2001 From: Can Altineller Date: Sat, 16 Nov 2024 02:23:39 +0300 Subject: [PATCH] fix --- README.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 61ef559..85c5768 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; } ``` @@ -157,16 +157,16 @@ uint8_t send_hat_command(int fd, uint8_t output) { ```c uint8_t send_sysctl(int fd, uint8_t command) { - unsigned char sysctl_buffer[5] = {0}; - sysctl_buffer[3] = command; +unsigned char sysctl_buffer[5] = {0}; +sysctl_buffer[3] = command; - 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; - } +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; +} } ```