aht20 icon indicating copy to clipboard operation
aht20 copied to clipboard

Error in Raspberry Interface ?

Open luciantin opened this issue 1 year ago • 0 comments

Hi, i had a problem communicating with the aht20, my problem was fixed when i removed the shift operation in file iic.c

After removing the shift operation, ex. msgs[0].addr = addr; i got the correct measurements, I also had to change the same line in the iic_write_cmd function.

I am interested in the reason for the shift operation, is this a raspberry thing or is there some special reason for it ?

uint8_t iic_read_cmd(int fd, uint8_t addr, uint8_t *buf, uint16_t len)
{
    struct i2c_rdwr_ioctl_data i2c_rdwr_data;
    struct i2c_msg msgs[1];
    
    memset(&i2c_rdwr_data, 0, sizeof(struct i2c_rdwr_ioctl_data));        /* clear ioctl data */
    memset(msgs, 0, sizeof(struct i2c_msg) * 1);                          /* clear msgs data */

    msgs[0].addr = addr >> 1;   <---- HERE

Also, great library, thanks 👍

luciantin avatar Nov 15 '22 08:11 luciantin