10 #ifndef IMU_FUNCTIONS_H_INCLUDED
11 #define IMU_FUNCTIONS_H_INCLUDED
19 #include <sys/types.h>
21 #include <sys/ioctl.h>
23 #include <linux/i2c-dev.h>
36 #define ADD_ADXL345 0x53
37 #define ADD_ITG3200 0x68
38 #define ADD_HMC5883 0x1E
70 uint8_t*
acc_read_reg(
int i2c_dev, uint8_t reg, uint8_t count);
89 int acc_init(
int i2c_dev, uint8_t full_res, uint16_t rate, uint8_t range);
148 uint8_t*
gyr_read_reg(
int i2c_dev, uint8_t reg, uint8_t count);
179 int gyr_init(
int i2c_dev,
float rate,
short int lpf_bw,
char clk_source,
char *act);
227 uint8_t*
mag_read_reg(
int i2c_dev, uint8_t reg, uint8_t count);
232 int mag_init(
int i2c_dev, uint8_t rate, uint8_t range, uint8_t samples_avg, uint8_t meas_mode, uint8_t op_mode);
int acc_write_reg(int i2c_dev, uint8_t reg, uint8_t data)
WRITE TO REGISTER.
short int mag_read_data(int i2c_dev, int axis)
READ DATA (X, Y or Z)
short int gyr_read_data(int i2c_dev, int type)
READ DATA (X, Y, Z or T)
int gyr_write_reg(int i2c_dev, uint8_t reg, uint8_t data)
WRITE TO REGISTER.
int mag_write_reg(int i2c_dev, uint8_t reg, uint8_t data)
WRITE TO REGISTER.
int acc_read_all_data(int i2c_dev, short int *data)
READ ALL DATA AT ONCE (X, Y and Z)
uint8_t * acc_read_reg(int i2c_dev, uint8_t reg, uint8_t count)
READ COUNT 8-BIT REGISTER IN SEQUENCE
uint8_t * mag_read_reg(int i2c_dev, uint8_t reg, uint8_t count)
READ COUNT 8-BIT REGISTER IN SEQUENCE.
uint8_t * gyr_read_reg(int i2c_dev, uint8_t reg, uint8_t count)
READ COUNT 8-BIT REGISTER IN SEQUENCE.
short int acc_read_data(int i2c_dev, int axis)
READ DATA (X, Y or Z)
int acc_read_all_reg(int i2c_dev)
Read all accelerometer data and print in stdio.
int mag_init(int i2c_dev, uint8_t rate, uint8_t range, uint8_t samples_avg, uint8_t meas_mode, uint8_t op_mode)
INITIALIZE MAGNETOMETER.
int gyr_init(int i2c_dev, float rate, short int lpf_bw, char clk_source, char *act)
INITIALIZE GYROMETER.
Registers that are present in each device from the IMU (ADXL345, ITG3200 and HMC5883) ...
int gyr_read_all_data(int i2c_dev, short int *data)
READ ALL DATA AT ONCE (X, Y, Z and T)
int mag_read_all_data(int i2c_dev, short int *data)
READ ALL DATA AT ONCE (X, Y and Z)
char * conv_byte_hex_bin(uint8_t *hvalue)
int acc_init(int i2c_dev, uint8_t full_res, uint16_t rate, uint8_t range)
INITIALIZE ACCELEROMETER.