DevLab_ICM20948 1.0.2 ICM-20948 9-Axis Motion Sensor Driver

Loading...
Searching...
No Matches
ICM20948_platform.h
Go to the documentation of this file.
1#ifndef ICM20948_PLATFORM_H
2#define ICM20948_PLATFORM_H
3
4// #include <stdint.h>
5// #include <stddef.h>
6
7/**
8 * 7Semi comment style
9 * - Platform glue for bus IO, delays, and timing
10 * - Implement these for your system (I2C or SPI)
11 */
12
13 typedef struct {
14 /**
15 * - Bus read: read `len` bytes from `reg` into `buf`
16 * - Return 0 on success, nonzero on error
17 */
18 int (*read)(uint8_t reg, uint8_t *buf, size_t len, void *user);
19 /**
20 * - Bus write: write `len` bytes from `buf` to `reg`
21 * - Return 0 on success, nonzero on error
22 */
23 int (*write)(uint8_t reg, const uint8_t *buf, size_t len, void *user);
24 /**
25 * - Optional: SPI transfers may need register R/W bit mangling
26 * - For I2C, leave as NULL
27 */
28 uint8_t (*spi_reg_rw_bits)(uint8_t reg, int is_write);
29 /**
30 * - Millisecond delay
31 */
32 void (*delay_ms)(uint32_t ms);
33 /**
34 * - User context pointer passed to read/write
35 */
36 void *user;
37 /**
38 * - If using SPI: set chip select active (1) or inactive (0)
39 * - For I2C: leave as NULL
40 */
41 void (*spi_cs)(int level, void *user);
42 /**
43 * - Device address (I2C) or ignored for SPI if you wrap inside user
44 */
45 uint8_t i2c_addr;
46} icm_plat_t;
47
48#endif
icm_plat_t
Definition ICM20948_platform.h:13
icm_plat_t::i2c_addr
uint8_t i2c_addr
Definition ICM20948_platform.h:45
icm_plat_t::user
void * user
Definition ICM20948_platform.h:36