1 /*
2  * Copyright (c) 2015, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 /*! \file drivers.h
10     \brief Provides function prototypes for driver level interfaces
11 
12     Users who are not using NXP hardware will need to supply their own drivers
13     in place of those defined here.
14 */
15 
16 #ifndef DRIVERS_H
17 #define DRIVERS_H
18 #include "Driver_I2C.h"
19 #include "Driver_SPI.h"
20 
21 // must #include "sensor_fusion.h" before this file
22 
23 /// @name SysTick Macros
24 /// The ARM SysTick counter is used to time various fusion options.  Timings
25 /// are then conveyed to the NXP Sensor Fusion Toolbox, where they are displayed
26 /// for the developer.  These functions should be portable to any ARM M0+, M3,
27 /// M4 or M4F device.  If you are using a different CPU architecture, you will
28 /// need to provide an equivalent set of macros, remove the macro calls from
29 /// the fusion routines, or define a set of empty macros.
30 ///@{
31 void ARM_systick_enable(void);
32 void ARM_systick_start_ticks(int32_t *pstart);
33 int32_t ARM_systick_elapsed_ticks(int32_t start_ticks);
34 void ARM_systick_delay_ms(uint32_t iSystemCoreClock, uint32_t delay_ms);
35 ///@}
36 
37 /// @name Sensor Drivers
38 /// Each physical sensor must be provided with one initialization function
39 /// and one "read" function.  These must be installed by the user using the
40 /// installSensor method defined in SensorFusionGlobals.  By "physical sensor",
41 /// we mean either individual sensor type (such as a 3-axis accelerometer) or
42 /// a combo-sensor such as the NXP FXOS8700 6-axis accel plus mag.  The init()
43 /// function for each sensor is responsible for initializing all sensors contained
44 /// in that package.  The read() function is responsible for reading those same
45 /// sensors and moving the results into the standard structures contained within
46 /// the SensorFusionGlobals object.
47 ///@{
48 int8_t MPL3115_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
49 int8_t FXOS8700_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
50 int8_t FXAS21002_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
51 int8_t MMA8652_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
52 int8_t FXLS8952_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
53 int8_t MAG3110_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
54 int8_t MMA8451_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
55 int8_t FXLS8471Q_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
56 int8_t FXLS8962_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
57 int8_t FXLS8972_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
58 
59 int8_t MPL3115_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
60 int8_t FXOS8700_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
61 int8_t FXAS21002_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
62 int8_t MMA8652_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
63 int8_t FXLS8952_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
64 int8_t MAG3110_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
65 int8_t MMA8451_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
66 int8_t FXLS8471Q_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
67 int8_t FXLS8962_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
68 int8_t FXLS8972_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
69 
70 int8_t MPL3115_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
71 int8_t FXOS8700_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
72 int8_t FXAS21002_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
73 int8_t MMA8652_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
74 int8_t FXLS8952_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
75 int8_t MAG3110_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
76 int8_t MMA8451_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
77 int8_t FXLS8471Q_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
78 int8_t FXLS8962_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
79 int8_t FXLS8972_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg);
80 
81 ///@}
82 
83 
84 #endif // DRIVERS_H
85