18 #define MPL3115_MPERCOUNT 0.0000152587890625F // Convert 32-bit Altitude value to meters 19 #define MPL3115_CPERCOUNT 0.00390625F // Convert 16-bit Temperature value to Celcius 20 #define MPL3115_ACCEL_FIFO_SIZE 32 22 #if F_USING_PRESSURE // driver is only pulled in if the appropriate flag is set in build.h 74 sfg->Pressure.iWhoAmI = reg;
93 sfg->Pressure.isEnabled =
true;
112 sfg->Pressure.iH = (I2C_Buffer[0] << 24) | (I2C_Buffer[1] << 16) | (I2C_Buffer[2] << 8);
113 sfg->Pressure.iT = (I2C_Buffer[3] << 8) | I2C_Buffer[4];
116 sfg->Pressure.fH = (float) sfg->Pressure.iH * sfg->Pressure.fmPerCount;
117 sfg->Pressure.fT = (
float) sfg->Pressure.iT * sfg->Pressure.fCPerCount;
119 sfg->Pressure.fH = 0.0;
120 sfg->Pressure.fT = 0.0;
142 sfg->Pressure.isEnabled =
false;
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.
void * bus_driver
should be of type (ARM_DRIVER_I2C* for I2C-based sensors, ARM_DRIVER_SPI* for SPI) ...
This structure defines the Write command List.
int8_t MPL3115_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
#define MPL3115_ACCEL_FIFO_SIZE
Provides function prototypes for driver level interfaces.
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.
An instance of PhysicalSensor structure type should be allocated for each physical sensors (combo dev...
The mpl3115_drv.h file describes the MPL3115 driver interface and structures.
#define __END_WRITE_DATA__
The top level fusion structure.
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
#define MPL3115_MPERCOUNT
#define F_USING_PRESSURE
nominally 0x0008 if altimeter is to be used, 0x0000 otherwise
#define F_USING_TEMPERATURE
nominally 0x0010 if temp sensor is to be used, 0x0000 otherwise
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.
registerDeviceInfo_t deviceInfo
I2C device context.
int8_t MPL3115_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
The sensor_fusion.h file implements the top level programming interface.
#define __END_READ_DATA__
#define MPL3115_CPERCOUNT
uint16_t isInitialized
Bitfields to indicate sensor is active (use SensorBitFields from build.h)
#define MPL3115_WHOAMI_VALUE
int8_t MPL3115_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
This structure defines the Read command List.
uint16_t addr
I2C address if applicable.
The sensor_io_i2c.h file declares low-level interface functions for reading and writing sensor regist...