| ICM42370P eMD Driver 2.2.7 Documentation of the eMD Driver API

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

inv_imu_transport.h
Go to the documentation of this file.
1 /*
2 * ________________________________________________________________________________________________________
3 * Copyright (c) 2015-2015 InvenSense Inc. All rights reserved.
4 *
5 * This software, related documentation and any modifications thereto (collectively "Software") is subject
6 * to InvenSense and its licensors' intellectual property rights under U.S. and international copyright
7 * and other intellectual property rights laws.
8 *
9 * InvenSense and its licensors retain all intellectual property and proprietary rights in and to the Software
10 * and any use, reproduction, disclosure or distribution of the Software without an express license agreement
11 * from InvenSense is strictly prohibited.
12 *
13 * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, THE SOFTWARE IS
14 * PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
15 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
16 * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, IN NO EVENT SHALL
17 * INVENSENSE BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
18 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
19 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THE SOFTWARE.
21 * ________________________________________________________________________________________________________
22 */
23
31 #ifndef _INV_IMU_TRANSPORT_H_
32 #define _INV_IMU_TRANSPORT_H_
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #include <stdint.h>
39
40 #include "imu/inv_imu_defs.h"
41
42 /* forward declaration */
43 struct inv_imu_device;
44
45 /* Available serial interface type. */
46 #define UI_I2C 0
47 #define UI_SPI4 1
48 #define UI_SPI3 2
54 typedef uint32_t SERIAL_IF_TYPE_t;
55
57 struct inv_imu_serif {
58 void *context;
59 int (*read_reg)(struct inv_imu_serif *serif, uint8_t reg, uint8_t *buf, uint32_t len);
60 int (*write_reg)(struct inv_imu_serif *serif, uint8_t reg, const uint8_t *buf, uint32_t len);
61 uint32_t max_read;
62 uint32_t max_write;
63 uint32_t serif_type;
64 };
65
67 struct inv_imu_transport {
71 struct inv_imu_serif serif;
72
74 struct register_cache {
75 uint8_t pwr_mgmt0_reg;
76 #if ICM_IS_GYRO_SUPPORTED
77 uint8_t gyro_config0_reg;
78 #endif
79 uint8_t accel_config0_reg;
80 uint8_t tmst_config1_reg;
81 } register_cache;
82
84 uint8_t need_mclk_cnt;
85 };
86
91 int inv_imu_init_transport(struct inv_imu_device *s);
92
100 int inv_imu_read_reg(struct inv_imu_device *s, uint32_t reg, uint32_t len, uint8_t *buf);
101
109 int inv_imu_write_reg(struct inv_imu_device *s, uint32_t reg, uint32_t len, const uint8_t *buf);
110
115 int inv_imu_switch_on_mclk(struct inv_imu_device *s);
116
121 int inv_imu_switch_off_mclk(struct inv_imu_device *s);
122
123 #ifdef __cplusplus
124 }
125 #endif
126
127 #endif /* _INV_IMU_TRANSPORT_H_ */
128
inv_imu_defs.h
File exposing the device register map.
SERIAL_IF_TYPE_t
uint32_t SERIAL_IF_TYPE_t
Serif type definition.
Definition: inv_imu_transport.h:54
inv_imu_init_transport
int inv_imu_init_transport(struct inv_imu_device *s)
Init cache variable.
inv_imu_read_reg
int inv_imu_read_reg(struct inv_imu_device *s, uint32_t reg, uint32_t len, uint8_t *buf)
Reads data from a register on IMU.
inv_imu_write_reg
int inv_imu_write_reg(struct inv_imu_device *s, uint32_t reg, uint32_t len, const uint8_t *buf)
Writes data to a register on IMU.
inv_imu_switch_on_mclk
int inv_imu_switch_on_mclk(struct inv_imu_device *s)
Enable MCLK.
inv_imu_switch_off_mclk
int inv_imu_switch_off_mclk(struct inv_imu_device *s)
Disable MCLK.
inv_imu_device
IMU driver states definition.
Definition: inv_imu_driver.h:107
inv_imu_serif
Serial interface definition.
Definition: inv_imu_transport.h:57
inv_imu_serif::read_reg
int(* read_reg)(struct inv_imu_serif *serif, uint8_t reg, uint8_t *buf, uint32_t len)
Definition: inv_imu_transport.h:59
inv_imu_serif::max_write
uint32_t max_write
Definition: inv_imu_transport.h:62
inv_imu_serif::max_read
uint32_t max_read
Definition: inv_imu_transport.h:61
inv_imu_serif::write_reg
int(* write_reg)(struct inv_imu_serif *serif, uint8_t reg, const uint8_t *buf, uint32_t len)
Definition: inv_imu_transport.h:60
inv_imu_serif::serif_type
uint32_t serif_type
Definition: inv_imu_transport.h:63
inv_imu_serif::context
void * context
Definition: inv_imu_transport.h:58
inv_imu_transport
Transport interface definition.
Definition: inv_imu_transport.h:67
inv_imu_transport::serif
struct inv_imu_serif serif
Serial interface object.
Definition: inv_imu_transport.h:71
inv_imu_transport::need_mclk_cnt
uint8_t need_mclk_cnt
Internal counter for MCLK requests.
Definition: inv_imu_transport.h:84
inv_imu_transport::register_cache
struct inv_imu_transport::register_cache register_cache
inv_imu_transport::register_cache
Contains mirrored values of some IP registers.
Definition: inv_imu_transport.h:74
inv_imu_transport::register_cache::pwr_mgmt0_reg
uint8_t pwr_mgmt0_reg
Definition: inv_imu_transport.h:75
inv_imu_transport::register_cache::accel_config0_reg
uint8_t accel_config0_reg
Definition: inv_imu_transport.h:79
inv_imu_transport::register_cache::tmst_config1_reg
uint8_t tmst_config1_reg
Definition: inv_imu_transport.h:80