Rleg  2
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Modules | Functions
IMU sensors
Collaboration diagram for IMU sensors:

Modules

 Routines to calibrate sensors
 
 Functions for accelerometer ADXL345
 
 Functions for Gyrometer ITG3200
 
 Functions to Magnetometer HMC5883
 

Functions

int mag_write_reg (int i2c_dev, uint8_t reg, uint8_t data)
 WRITE TO REGISTER. More...
 

Detailed Description

Function Documentation

int mag_write_reg ( int  i2c_dev,
uint8_t  reg,
uint8_t  data 
)

WRITE TO REGISTER.

Parameters
i2c_dev
reg
[in]WRITE TO REGISTER.

Implements the I2C communication between Gumstix Overo Fire and HMC5883

Author
Caio Gustavo Mesquita Ângelo

Definition at line 10 of file mag_functions.c.

References MAG_MODE.

Referenced by mag_init().

11 {
12  uint8_t reg_data[2];
13 
14  reg_data[0] = reg;
15  reg_data[1] = data;
16 
17  if( MAG_MODE<reg )
18  {
19  //perror("Write unsucessful: Not a valid writable register");
20  return -1;
21  }
22 
23  if (write(i2c_dev, &reg_data, 2) != 2) {
24  //perror("Write unsuccessful");
25  return -1;
26  }
27 
28  return 1;
29 }
#define MAG_MODE
Definition: imu_regs.h:66

Here is the caller graph for this function: