Device driver for InvenSense ITG320X 3-axis gyroscope. More...

Detailed Description

Device driver for InvenSense ITG320X 3-axis gyroscope.

Author
Gunar Schorcht gunar.nosp@m.@sch.nosp@m.orcht.nosp@m..net

Definition in file itg320x.h.

#include <stdbool.h>
#include <stdint.h>
#include "periph/gpio.h"
#include "periph/i2c.h"
+ Include dependency graph for itg320x.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  itg320x_data_t
 Angular rate values in tenths of a degree per second. More...
 
struct  itg320x_raw_data_t
 Raw data set as two complements. More...
 
struct  itg320x_params_t
 ITG320X device initialization parameters. More...
 
struct  itg320x_t
 ITG320X sensor device data structure type. More...
 

Macros

#define ITG320X_ID   (0x68)
 ITG320X chip id defined in Who Am I.
 

Typedefs

typedef void(* itg320x_drdy_int_cb_t) (void *)
 ITG320X data ready interrupt (DRDY) callback function type. More...
 

Enumerations

enum  itg320x_error_codes_t {
  ITG320X_OK = 0, ITG320X_ERROR_I2C = -1, ITG320X_ERROR_WRONG_ID = -2, ITG320X_ERROR_NO_DATA = -3,
  ITG320X_ERROR_RAW_DATA = -4
}
 Named return values. More...
 
enum  itg320x_lpf_bw_t {
  ITG320X_LPF_BW_256 = 0, ITG320X_LPF_BW_188, ITG320X_LPF_BW_98, ITG320X_LPF_BW_42,
  ITG320X_LPF_BW_20, ITG320X_LPF_BW_10, ITG320X_LPF_BW_5
}
 Low pass filter bandwidth. More...
 
enum  itg320x_int_level_t { ITG320X_INT_HIGH = 0x00, ITG320X_INT_LOW = 0x80 }
 Logic level for INT output pin (ITG320X_REG_INT_CFG<7>) More...
 
enum  itg320x_int_drive_t { ITG320X_INT_PUSH_PULL = 0x00, ITG320X_INT_OPEN_DRAIN = 0x40 }
 Drive type for INT output pin (ITG320X_REG_INT_CFG<6>) More...
 
enum  itg320x_clk_sel_t {
  ITG320X_CLK_INTERNAL = 0, ITG320X_CLK_PLL_X_GYRO, ITG320X_CLK_PLL_Y_GYRO, ITG320X_CLK_PLL_Z_GYRO,
  ITG320X_CLK_PLL_32K, ITG320X_CLK_PLL_19M
}
 Clock source selection (ITG320X_REG_PWR_MGM<2:0>) More...
 

Functions

int itg320x_init (itg320x_t *dev, const itg320x_params_t *params)
 Initialize the ITG320X sensor device. More...
 
int itg320x_init_int (const itg320x_t *dev, itg320x_drdy_int_cb_t cb, void *arg)
 Initialize and activate the DRDY interrupt of ITG320X sensor device. More...
 
int itg320x_data_ready (const itg320x_t *dev)
 Data-ready status function. More...
 
int itg320x_read (const itg320x_t *dev, itg320x_data_t *data)
 Read one sample of angular rates in tenths of a degree per second. More...
 
int itg320x_read_raw (const itg320x_t *dev, itg320x_raw_data_t *raw)
 Read one sample of raw sensor data as 16 bit two's complements. More...
 
int itg320x_read_temp (const itg320x_t *dev, int16_t *temp)
 Read temperature in tenths of a degree Celsius. More...
 
int itg320x_power_down (itg320x_t *dev)
 Power down the sensor. More...
 
int itg320x_power_up (itg320x_t *dev)
 Power up the sensor. More...
 

I2C addresses

#define ITG320X_I2C_ADDRESS_1   (0x68)
 AD0 pin low.
 
#define ITG320X_I2C_ADDRESS_2   (0x69)
 AD0 pin high.