44 #define MPL3115_MPERCOUNT 0.0000152587890625F // Convert 32-bit Altitude value to meters 45 #define MPL3115_CPERCOUNT 0.00390625F // Convert 16-bit Temperature value to Celcius 46 #define MPL3115_ACCEL_FIFO_SIZE 32 48 #if F_USING_PRESSURE // driver is only pulled in if the appropriate flag is set in build.h 100 sfg->Pressure.iWhoAmI = reg;
119 sfg->Pressure.isEnabled =
true;
138 sfg->Pressure.iH = (I2C_Buffer[0] << 24) | (I2C_Buffer[1] << 16) | (I2C_Buffer[2] << 8);
139 sfg->Pressure.iT = (I2C_Buffer[3] << 8) | I2C_Buffer[4];
142 sfg->Pressure.fH = (float) sfg->Pressure.iH * sfg->Pressure.fmPerCount;
143 sfg->Pressure.fT = (
float) sfg->Pressure.iT * sfg->Pressure.fCPerCount;
145 sfg->Pressure.fH = 0.0;
146 sfg->Pressure.fT = 0.0;
168 sfg->Pressure.isEnabled =
false;
#define MPL3115_ACCEL_FIFO_SIZE
#define __END_WRITE_DATA__
void * bus_driver
should be of type (ARM_DRIVER_I2C* for I2C-based sensors, ARM_DRIVER_SPI* for SPI) ...
#define F_USING_PRESSURE
nominally 0x0008 if altimeter is to be used, 0x0000 otherwise
int8_t MPL3115_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
int32_t Sensor_I2C_Read(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, const registerreadlist_t *pReadList, uint8_t *pOutBuffer)
Read register data from a sensor.
#define __END_READ_DATA__
The top level fusion structure.
#define MPL3115_WHOAMI_VALUE
int8_t MPL3115_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
uint16_t addr
I2C address if applicable.
#define MPL3115_MPERCOUNT
#define MPL3115_CPERCOUNT
The sensor_fusion.h file implements the top level programming interface.
uint16_t isInitialized
Bitfields to indicate sensor is active (use SensorBitFields from build.h)
registerDeviceInfo_t deviceInfo
I2C device context.
Provides function prototypes for driver level interfaces.
#define F_USING_TEMPERATURE
nominally 0x0010 if temp sensor is to be used, 0x0000 otherwise
int8_t MPL3115_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
The mpl3115_drv.h file describes the MPL3115 driver interface and structures.
int32_t Register_I2C_Read(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, uint8_t offset, uint8_t length, uint8_t *pOutBuffer)
The interface function to read a sensor register.
This structure defines the Write command List.
This structure defines the Read command List.
An instance of PhysicalSensor structure type should be allocated for each physical sensors (combo dev...
The sensor_io_i2c.h file declares low-level interface functions for reading and writing sensor regist...
int32_t Sensor_I2C_Write(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, const registerwritelist_t *pRegWriteList)
Write register data to a sensor.