• Home
  • History
  • Annotate
Name
Date
Size
#Lines
LOC

..--

README.mdD18-Mar-20253.2 KiB8563

inv_imu_apex.cD18-Mar-202512.1 KiB344236

inv_imu_apex.hD18-Mar-20256 KiB16954

inv_imu_defs.hD18-Mar-202539.9 KiB992644

inv_imu_driver.cD18-Mar-202553.4 KiB1,6761,170

inv_imu_driver.hD18-Mar-202520 KiB533170

inv_imu_extfunc.hD18-Mar-2025749 4012

inv_imu_regmap_rev_a.hD18-Mar-202588.7 KiB3,358617

inv_imu_selftest.cD18-Mar-20256.7 KiB198131

inv_imu_selftest.hD18-Mar-20252.2 KiB7331

inv_imu_transport.cD18-Mar-20256.7 KiB286197

inv_imu_transport.hD18-Mar-20253.2 KiB11040

inv_imu_version.hD18-Mar-2025288 2110

README.md

1# Overview
2
3The eMD driver is TDK Invensense's reference code to drive our IMU from a microcontroller-based system. It is coded in C language and organized around modules.
4
5## Common files
6
7All modules rely on the following files.
8
9Files:
10* `imu/inv_imu_transport.h`: Definition of the abstraction layer used to communicate with the IMU.
11* `imu/inv_imu_transport.c`: Implementation of the abstraction layer used to communicate with the IMU.
12* `imu/inv_imu.h`: Describes IMU specificities and capabilities.
13* `imu/inv_imu_regmap_rev_a.h`: Exposes register map using positions and masks.
14* `imu/inv_imu_defs.h`: Defines possible values for most used registers.
15* `imu/inv_imu_extfunc.h`: Defines system functions required by the driver, which shall be implemented in the application layer.
16
17## Driver
18
19The **driver** contains the generic functionalities required to operate our IMU.
20
21Depends on:
22* **Common files**
23
24Files:
25* `imu/inv_imu_driver.h`: Definition of the driver API.
26* `imu/inv_imu_driver.c`: Implementation of the driver API.
27* `imu/inv_imu_version.h`: Contains the driver's version as a string.
28
29## Self-test
30
31The **self-test** module contains the code required to operate IMU's self-test.
32
33Depends on:
34* **Driver**
35* **Common files**
36
37Files:
38* `imu/inv_imu_selftest.h`: Definition of the self-test module API.
39* `imu/inv_imu_selftest.c`: Implementation of the self-test module API.
40
41## APEX
42
43The **APEX** module provides API to operate algorithm features (APEX) on-chip. The following features are available:
44* Pedometer (step count and step detector)
45* FreeFall detection, including Low-G and High-G detection.
46* Tilt detection
47* Significant Motion Detection
48
49Depends on:
50* **Driver**
51* **Common files**
52
53Files:
54* `imu/inv_imu_apex.h`: Definition of the APEX module API.
55* `imu/inv_imu_apex.c`: Implementation of the APEX module API.
56
57# Initializing driver
58
59Please, follow these steps:
60* On your application code, create a local variable of type `inv_imu_device_t` and another one of type `inv_imu_serif_t`: `inv_imu_device_t imu_dev;` and `inv_imu_serif_t imu_serif;`
61* Initialize serif structure:
62  * Provide an implementation of the `read_reg` and `write_reg` functions and initialize the corresponding pointers.
63  * Configure the `max_read` and `max_write` fields which indicates the maximum numbers of bytes allowed per transaction.
64  * Configure the `serif_type` field which indicates the serial interface used. Available options are listed in `inv_imu_transport.h`.
65  * The `context` field can be set to 0.
66* Initialize sensor event callback pointer in `inv_imu_adv_var_t` structure. This function will be called when a new sensor data will be available.
67* Call the `inv_imu_adv_init` function, providing the device and serif objects as well as a callback which will be executed when a new sample is received.
68
69Example of initialization in C:
70```C
71inv_imu_device_t imu_dev;
72inv_imu_serif_t  imu_serif;
73
74/* Initialize serial interface */
75imu_serif.read_reg   = si_io_imu_read_reg;
76imu_serif.write_reg  = si_io_imu_write_reg;
77imu_serif.max_read   = 32768;
78imu_serif.max_write  = 32768;
79imu_serif.serif_type = SERIF_TYPE;
80imu_serif.context    = 0;
81
82/* Init device */
83rc |= inv_imu_init(&imu_dev, &imu_serif, sensor_event_cb);
84```
85