51 fd = open(
"/dev/i2c-1", O_RDWR);
53 fprintf(stderr,
"Failed to open i2c-1: %m\n");
58 fprintf(stderr,
"Failed to set slave address: %m\n");
69 fprintf(stderr,
"Failed to write to I2C device. 1\n");
73 fprintf(stderr,
"Failed to write to I2C device. 2\n");
77 fprintf(stderr,
"Failed to write to I2C device. 3\n");
81 fprintf(stderr,
"Failed to write to I2C device. 4\n");
85 fprintf(stderr,
"Failed to write to I2C device. 5\n");
93 unsigned char lsb, msb;
97 int raw_voltage = (lsb >> 6) | (msb << 2);
void bat_voltage_ardrone2_periodic(void)
void electrical_ardrone2_setup(void)
void bat_voltage_ardrone2_init(void)
struct Electrical electrical
Interface for electrical status: supply voltage, current, battery status, etc.
float vsupply
supply voltage in V
static __s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value)
static __s32 i2c_smbus_read_byte_data(int file, __u8 command)