You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
356 B
C
22 lines
356 B
C
#include <unistd.h> //i2c
|
|
#include <sys/ioctl.h>
|
|
#include <linux/i2c-dev.h>
|
|
#include <i2c/smbus.h>
|
|
#include <stdio.h>
|
|
|
|
#include "htu21d.h"
|
|
|
|
// Reset function
|
|
int i2cReset(int fd){
|
|
if(ioctl(fd, I2C_SLAVE, ADDR)<0){
|
|
perror("Failed to open the I2C bus; reset\n");
|
|
return -1;
|
|
}
|
|
i2c_smbus_write_byte(fd, RESET);
|
|
return 0;
|
|
}
|
|
|
|
// temperature
|
|
|
|
// humidity
|