Go to the documentation of this file.
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 #include "drv_i2c_master.h"
52 #define C9DOF_MAP_MIKROBUS( cfg, mikrobus ) \
53 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
54 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
55 cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
56 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
63 #define C9DOF_RETVAL uint8_t
66 #define C9DOF_INIT_ERROR 0xFF
73 #define C9DOF_SLAVE_ADDRESS_ACCEL_GYRO_0 0x6A
74 #define C9DOF_SLAVE_ADDRESS_MAG_0 0x1C
75 #define C9DOF_SLAVE_ADDRESS_ACCEL_GYRO_1 0x6B
76 #define C9DOF_SLAVE_ADDRESS_MAG_1 0x1E
83 #define C9DOF_REG_ACT_THS 0x04
84 #define C9DOF_REG_ACT_DUR 0x05
85 #define C9DOF_REG_INT_GEN_CFG_XL 0x06
86 #define C9DOF_REG_INT_GEN_THS_X_XL 0x07
87 #define C9DOF_REG_INT_GEN_THS_Y_XL 0x08
88 #define C9DOF_REG_INT_GEN_THS_Z_XL 0x09
89 #define C9DOF_REG_INT_GEN_DUR_XL 0x0A
90 #define C9DOF_REG_REFERENCE_G 0x0B
91 #define C9DOF_REG_INT1_CTRL 0x0C
92 #define C9DOF_REG_INT2_CTRL 0x0D
93 #define C9DOF_REG_WHO_AM_I 0x0F
94 #define C9DOF_REG_CTRL_REG1_G 0x10
95 #define C9DOF_REG_CTRL_REG2_G 0x11
96 #define C9DOF_REG_CTRL_REG3_G 0x12
97 #define C9DOF_REG_ORIENT_CFG_G 0x13
98 #define C9DOF_REG_INT_GEN_SRC_G 0x14
99 #define C9DOF_REG_OUT_TEMP_L 0x15
100 #define C9DOF_REG_OUT_TEMP_H 0x16
101 #define C9DOF_REG_STATUS_REG 0x17
102 #define C9DOF_REG_OUT_X_L_G 0x18
103 #define C9DOF_REG_OUT_X_H_G 0x19
104 #define C9DOF_REG_OUT_Y_L_G 0x1A
105 #define C9DOF_REG_OUT_Y_H_G 0x1B
106 #define C9DOF_REG_OUT_Z_L_G 0x1C
107 #define C9DOF_REG_OUT_Z_H_G 0x1D
108 #define C9DOF_REG_CTRL_REG4 0x1E
109 #define C9DOF_REG_CTRL_REG5_XL 0x1F
110 #define C9DOF_REG_CTRL_REG6_XL 0x20
111 #define C9DOF_REG_CTRL_REG7_XL 0x21
112 #define C9DOF_REG_CTRL_REG8 0x22
113 #define C9DOF_REG_CTRL_REG9 0x23
114 #define C9DOF_REG_CTRL_REG10 0x24
115 #define C9DOF_REG_INT_GEN_SRC_XL 0x26
116 #define C9DOF_REG_OUT_X_L_XL 0x28
117 #define C9DOF_REG_OUT_X_H_XL 0x29
118 #define C9DOF_REG_OUT_Y_L_XL 0x2A
119 #define C9DOF_REG_OUT_Y_H_XL 0x2B
120 #define C9DOF_REG_OUT_Z_L_XL 0x2C
121 #define C9DOF_REG_OUT_Z_H_XL 0x2D
122 #define C9DOF_REG_FIFO_CTRL 0x2E
123 #define C9DOF_REG_FIFO_SRC 0x2F
124 #define C9DOF_REG_INT_GEN_CFG_G 0x30
125 #define C9DOF_REG_INT_GEN_THS_XH_G 0x31
126 #define C9DOF_REG_INT_GEN_THS_XL_G 0x32
127 #define C9DOF_REG_INT_GEN_THS_YH_G 0x33
128 #define C9DOF_REG_INT_GEN_THS_YL_G 0x34
129 #define C9DOF_REG_INT_GEN_THS_ZH_G 0x35
130 #define C9DOF_REG_INT_GEN_THS_ZL_G 0x36
131 #define C9DOF_REG_INT_GEN_DUR_G 0x37
138 #define C9DOF_REG_OFFSET_X_REG_L_M 0x05
139 #define C9DOF_REG_OFFSET_X_REG_H_M 0x06
140 #define C9DOF_REG_OFFSET_Y_REG_L_M 0x07
141 #define C9DOF_REG_OFFSET_Y_REG_H_M 0x08
142 #define C9DOF_REG_OFFSET_Z_REG_L_M 0x09
143 #define C9DOF_REG_OFFSET_Z_REG_H_M 0x0A
144 #define C9DOF_REG_CTRL_REG1_M 0x20
145 #define C9DOF_REG_CTRL_REG2_M 0x21
146 #define C9DOF_REG_CTRL_REG3_M 0x22
147 #define C9DOF_REG_CTRL_REG4_M 0x23
148 #define C9DOF_REG_CTRL_REG5_M 0x24
149 #define C9DOF_REG_STATUS_REG_M 0x27
150 #define C9DOF_REG_OUT_X_L_M 0x28
151 #define C9DOF_REG_OUT_X_H_M 0x29
152 #define C9DOF_REG_OUT_Y_L_M 0x2A
153 #define C9DOF_REG_OUT_Y_H_M 0x2B
154 #define C9DOF_REG_OUT_Z_L_M 0x2C
155 #define C9DOF_REG_OUT_Z_H_M 0x2D
156 #define C9DOF_REG_INT_CFG_M 0x30
157 #define C9DOF_REG_INT_SRC_M 0x31
158 #define C9DOF_REG_INT_THS_L_M 0x32
159 #define C9DOF_REG_INT_THS_H_M 0x33
166 #define C9DOF_REG_XG_ID 0x68
167 #define C9DOF_REG_MAG_ID 0x3D
174 #define C9DOF_CTRL_REG4_CONFIG 0x38
175 #define C9DOF_CTRL_REG1_G_CONFIG 0x82
176 #define C9DOF_CTRL_REG5_XL_CONFIG 0x38
177 #define C9DOF_CTRL_REG6_XL_CONFIG 0x83
178 #define C9DOF_CTRL_REG8_CONFIG 0x44
179 #define C9DOF_CTRL_REG1_M_CONFIG 0xD0
180 #define C9DOF_CTRL_REG2_M_CONFIG 0x00
181 #define C9DOF_CTRL_REG3_M_CONFIG 0x00
182 #define C9DOF_CTRL_REG4_M_CONFIG 0x08
183 #define C9DOF_CTRL_REG5_M_CONFIG 0x40
int16_t y
Definition: c9dof.h:275
#define C9DOF_RETVAL
Definition: c9dof.h:63
void c9dof_default_cfg(c9dof_t *ctx)
Click Default Configuration function.
uint8_t c9dof_get_interrupt(c9dof_t *ctx)
Get state of the Magnetic sensor interrupt function.
void c9dof_cfg_setup(c9dof_cfg_t *cfg)
Config Object Initialization function.
digital_out_t en
Definition: c9dof.h:200
int16_t z
Definition: c9dof.h:265
int16_t y
Definition: c9dof.h:253
uint32_t i2c_speed
Definition: c9dof.h:234
int16_t x
Definition: c9dof.h:263
int16_t z
Definition: c9dof.h:254
Magnetometer data object definition.
Definition: c9dof.h:273
uint8_t i2c_address_m
Definition: c9dof.h:236
uint8_t slave_address_ag
Definition: c9dof.h:212
void c9dof_read_mag(c9dof_t *ctx, c9dof_mag_data_t *mag_data)
Get magnetometer data function.
c9dof_accel_data_t accel_data
Definition: main.c:33
i2c_master_t i2c
Definition: c9dof.h:208
int16_t x
Definition: c9dof.h:274
void c9dof_generic_write_accel_gyro(c9dof_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic accel and gyro write function.
Gyro data object definition.
Definition: c9dof.h:262
Click ctx object definition.
Definition: c9dof.h:197
uint8_t i2c_address_ag
Definition: c9dof.h:235
int16_t x
Definition: c9dof.h:252
void c9dof_generic_write_mag(c9dof_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic mag write function.
void c9dof_generic_read_accel_gyro(c9dof_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic accel and gyro read function.
void c9dof_generic_read_mag(c9dof_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic mag read function.
pin_name_t sda
Definition: c9dof.h:225
digital_in_t int_pin
Definition: c9dof.h:204
uint8_t slave_address_m
Definition: c9dof.h:213
void c9dof_read_gyro(c9dof_t *ctx, c9dof_gyro_data_t *gyro_data)
Get gyroscope data function.
pin_name_t scl
Definition: c9dof.h:224
int16_t y
Definition: c9dof.h:264
pin_name_t int_pin
Definition: c9dof.h:230
c9dof_gyro_data_t gyro_data
Definition: main.c:34
Click configuration structure definition.
Definition: c9dof.h:221
pin_name_t en
Definition: c9dof.h:229
int16_t z
Definition: c9dof.h:276
Accel data object definition.
Definition: c9dof.h:251
c9dof_mag_data_t mag_data
Definition: main.c:35
void c9dof_read_accel(c9dof_t *ctx, c9dof_accel_data_t *accel_data)
Get accelerometer data function.
C9DOF_RETVAL c9dof_init(c9dof_t *ctx, c9dof_cfg_t *cfg)
Initialization function.
void c9dof_set_power_mode(c9dof_t *ctx, uint8_t pwr_mode)
Set accel and gyro power mode function.