Rleg
2
|
Functions | |
int | acc_write_reg (int i2c_dev, uint8_t reg, uint8_t data) |
WRITE TO REGISTER. More... | |
uint8_t * | acc_read_reg (int i2c_dev, uint8_t reg, uint8_t count) |
READ COUNT 8-BIT REGISTER IN SEQUENCE More... | |
int | acc_init (int i2c_dev, uint8_t full_res, uint16_t rate, uint8_t range) |
INITIALIZE ACCELEROMETER. More... | |
int | acc_read_all_data (int i2c_dev, short int *data) |
READ ALL DATA AT ONCE (X, Y and Z) More... | |
short int | acc_read_data (int i2c_dev, int axis) |
READ DATA (X, Y or Z) More... | |
int | acc_read_all_reg (int i2c_dev) |
Read all accelerometer data and print in stdio. More... | |
int acc_init | ( | int | i2c_dev, |
uint8_t | full_res, | ||
uint16_t | rate, | ||
uint8_t | range | ||
) |
INITIALIZE ACCELEROMETER.
i2c_dev | Communication Port |
full_res | Set resolution to 10 bits if value equal 0 else set to Full resolution |
rate | Set data output rate (Hz), possible values: (3200,1600,800,400,200,100,50,25, 12: 12.5Hz, 6: 6.25Hz) |
range | Set range of read, possible values: (2: +- 2g 4: +- 4g 8: +- 8g anyother: 16g) |
INITIALIZE ACCELEROMETER.
Implements the I2C communication between Gumstix Overo Fire and ADXL345
Definition at line 11 of file acc_functions.c.
References ACC_BW_RATE, ACC_DATA_FORMAT, ACC_POWER_CTL, ACC_POWER_CTL_MEAS_MODE, acc_write_reg(), FAILURE, and SUCCESS.
Referenced by devices_init().
int acc_read_all_data | ( | int | i2c_dev, |
short int * | data | ||
) |
READ ALL DATA AT ONCE (X, Y and Z)
i2c_dev | Communication Port | |
[out] | data | Data's vector |
Definition at line 159 of file acc_functions.c.
References ACC_DATAX0, acc_read_reg(), FAILURE, and SUCCESS.
Referenced by read_all_data().
int acc_read_all_reg | ( | int | i2c_dev | ) |
Read all accelerometer data and print in stdio.
i2c_dev | Communication Port |
Definition at line 196 of file acc_functions.c.
References ACC_DEVID, acc_read_reg(), ACC_THRESH_TAP, and conv_byte_hex_bin().
short int acc_read_data | ( | int | i2c_dev, |
int | axis | ||
) |
READ DATA (X, Y or Z)
i2c_dev | Communication Port | |
[in] | axis | Accelerate's axis to read ('X' or 'Y' or 'Z') |
Definition at line 131 of file acc_functions.c.
References ACC_DATAX0, ACC_DATAY0, ACC_DATAZ0, and acc_read_reg().
uint8_t* acc_read_reg | ( | int | i2c_dev, |
uint8_t | reg, | ||
uint8_t | count | ||
) |
READ COUNT 8-BIT REGISTER IN SEQUENCE
i2c_dev | Communication Port | |
[in] | reg | Register |
[in] | count | Number of register in sequence (1-29) |
Definition at line 109 of file acc_functions.c.
Referenced by acc_read_all_data(), acc_read_all_reg(), and acc_read_data().
int acc_write_reg | ( | int | i2c_dev, |
uint8_t | reg, | ||
uint8_t | data | ||
) |
WRITE TO REGISTER.
i2c_dev | Communication Port | |
[in] | reg | Register |
[in] | data | Data to write |
Definition at line 87 of file acc_functions.c.
References ACC_ACT_TAP_STATUS, ACC_DATAX0, ACC_DATAX1, ACC_DATAY0, ACC_DATAY1, ACC_DATAZ0, ACC_DATAZ1, ACC_DEVID, ACC_FIFO_STATUS, ACC_INT_SOURCE, FAILURE, and SUCCESS.
Referenced by acc_init().