| ICM-4268x-V Driver API 1.0.1 ICM-4268x-V Driver API

Icm426xxTransport.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
34 #ifndef _INV_ICM426XX_TRANSPORT_H_
35 #define _INV_ICM426XX_TRANSPORT_H_
36
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 #include <stdint.h>
43
44 /* forward declaration */
45 struct inv_icm426xx;
46
47
49 typedef enum
50 {
51 ICM426XX_UI_I2C,
52 ICM426XX_UI_SPI4,
53 ICM426XX_UI_I3C,
54 ICM426XX_AUX1_SPI3,
55 ICM426XX_AUX2_SPI3,
56 ICM426XX_AUX1_SPI4
57
58 } ICM426XX_SERIAL_IF_TYPE_t;
59
62 struct inv_icm426xx_serif {
63 void * context;
64 int (*read_reg)(struct inv_icm426xx_serif * serif, uint8_t reg, uint8_t * buf, uint32_t len);
65 int (*write_reg)(struct inv_icm426xx_serif * serif, uint8_t reg, const uint8_t * buf, uint32_t len);
66 int (*configure)(struct inv_icm426xx_serif * serif);
67 uint32_t max_read;
68 uint32_t max_write;
69 ICM426XX_SERIAL_IF_TYPE_t serif_type;
70 };
71
74 struct inv_icm426xx_transport {
75 struct inv_icm426xx_serif serif;
78 struct register_cache {
79 uint8_t intf_cfg_1_reg;
80 uint8_t pwr_mngt_0_reg;
81 uint8_t gyro_cfg_0_reg;
82 uint8_t accel_cfg_0_reg;
83 uint8_t tmst_cfg_reg;
84 uint8_t bank_sel_reg;
85 } register_cache;
91 };
92
96 int inv_icm426xx_init_transport(struct inv_icm426xx * s);
97
104 int inv_icm426xx_read_reg(struct inv_icm426xx * s, uint8_t reg, uint32_t len, uint8_t * buf);
105
112 int inv_icm426xx_write_reg(struct inv_icm426xx * s, uint8_t reg, uint32_t len, const uint8_t * buf);
113
114
115 #ifdef __cplusplus
116 }
117 #endif
118
119 #endif /* _INV_ICM426XX_TRANSPORT_H_ */
120
inv_icm426xx_read_reg
int inv_icm426xx_read_reg(struct inv_icm426xx *s, uint8_t reg, uint32_t len, uint8_t *buf)
Reads data from a register on Icm426xx.
Definition: Icm426xxTransport.c:54
ICM426XX_SERIAL_IF_TYPE_t
ICM426XX_SERIAL_IF_TYPE_t
enumeration of serial interfaces available on icm426xx
Definition: Icm426xxTransport.h:50
inv_icm426xx_init_transport
int inv_icm426xx_init_transport(struct inv_icm426xx *s)
Init cache variable.
Definition: Icm426xxTransport.c:35
inv_icm426xx_write_reg
int inv_icm426xx_write_reg(struct inv_icm426xx *s, uint8_t reg, uint32_t len, const uint8_t *buf)
Writes data to a register on Icm426xx.
Definition: Icm426xxTransport.c:86
inv_icm426xx
Icm426xx driver states definition.
Definition: Icm426xxDriver_HL.h:168
inv_icm426xx_serif
base sensor serial interface
Definition: Icm426xxTransport.h:62
inv_icm426xx_transport
transport interface
Definition: Icm426xxTransport.h:74
inv_icm426xx_transport::register_cache
struct inv_icm426xx_transport::register_cache register_cache
Store mostly used register values on SRAM.
inv_icm426xx_transport::serif
struct inv_icm426xx_serif serif
Warning : this field MUST be the first one of struct inv_icm426xx_transport.
Definition: Icm426xxTransport.h:75
inv_icm426xx_transport::register_cache
Contains mirrored values of some IP registers.
Definition: Icm426xxTransport.h:78
inv_icm426xx_transport::register_cache::bank_sel_reg
uint8_t bank_sel_reg
MPUREG_REG_BANK_SEL, All banks, Address 0x76.
Definition: Icm426xxTransport.h:84
inv_icm426xx_transport::register_cache::intf_cfg_1_reg
uint8_t intf_cfg_1_reg
INTF_CONFIG1, Bank: 0, Address: 0x4D.
Definition: Icm426xxTransport.h:79
inv_icm426xx_transport::register_cache::accel_cfg_0_reg
uint8_t accel_cfg_0_reg
ACCEL_CONFIG0, Bank: 0, Address: 0x50.
Definition: Icm426xxTransport.h:82
inv_icm426xx_transport::register_cache::pwr_mngt_0_reg
uint8_t pwr_mngt_0_reg
PWR_MGMT_0, Bank: 0, Address: 0x4E.
Definition: Icm426xxTransport.h:80
inv_icm426xx_transport::register_cache::gyro_cfg_0_reg
uint8_t gyro_cfg_0_reg
GYRO_CONFIG0, Bank: 0, Address: 0x4F.
Definition: Icm426xxTransport.h:81
inv_icm426xx_transport::register_cache::tmst_cfg_reg
uint8_t tmst_cfg_reg
TMST_CONFIG, Bank: 0, Address: 0x54.
Definition: Icm426xxTransport.h:83