46 #ifndef GYROL3G4200D_H_
47 #define GYROL3G4200D_H_
49 #include "../drv/i2c-drv.h"
50 #include <util/delay.h>
53 #define L3G4200D_DEV_ADDR_R 0xD3
54 #define L3G4200D_DEV_ADDR_W 0xD2
56 #define L3G4000D_WHO_I_AM_REG 0x0F
57 #define L3G4000D_CTRL_REG1 0x20
58 #define L3G4000D_CTRL_REG2 0x21
59 #define L3G4000D_CTRL_REG3 0x22
60 #define L3G4000D_CTRL_REG4 0x23
61 #define L3G4000D_CTRL_REG5 0x24
63 #define L3G4000D_REFERENCE 0x25
65 #define L3G4000D_OUT_TEMP 0x26
67 #define L3G4000D_STATUS_REG 0x27
69 #define L3G4000D_OUT_X_L 0x28
70 #define L3G4000D_OUT_X_H 0x29
71 #define L3G4000D_OUT_Y_L 0x2A
72 #define L3G4000D_OUT_Y_H 0x2B
73 #define L3G4000D_OUT_Z_L 0x2C
74 #define L3G4000D_OUT_Z_H 0x2D
77 uint16_t angle_x_value;
78 uint16_t angle_y_value;
79 uint16_t angle_z_value;
82 int8_t l3g4200d_init(
void);
83 angle_data_t l3g4200d_get_angle(
void);
84 uint16_t l3g4200d_get_x_angle(
void);
85 uint16_t l3g4200d_get_y_angle(
void);
86 uint16_t l3g4200d_get_z_angle(
void);
87 int8_t l3g4200d_get_temp(
void);
88 uint16_t l3g4200d_read16bit(uint8_t addr);
89 uint8_t l3g4200d_read8bit(uint8_t addr);
90 void l3g4200d_write8bit(uint8_t addr, uint8_t data);