Documentation
¶
Index ¶
- Constants
- type Flag
- type MPL3115A2
- func (v *MPL3115A2) CompensateAltitude(i2c *i2c.I2C, shiftM int8) error
- func (v *MPL3115A2) CompensatePressure(i2c *i2c.I2C, shiftPa int16) error
- func (v *MPL3115A2) CompensateTemperature(i2c *i2c.I2C, shiftTemp float32) error
- func (v *MPL3115A2) GetDefaultSeaLevelPressure() uint32
- func (v *MPL3115A2) MeasureAltitude(i2c *i2c.I2C, oversampleRatio int) (float32, float32, error)
- func (v *MPL3115A2) MeasurePressure(i2c *i2c.I2C, oversampleRation int) (float32, float32, error)
- func (v *MPL3115A2) ModifySeaLevelPressure(i2c *i2c.I2C, pressureAtSeeLevel uint32) error
- func (v *MPL3115A2) Reset(i2c *i2c.I2C) error
- type PressureType
- type RawPressure
- type RawTemperature
Constants ¶
const ( // Alias for DR_STATUS or F_STATUS STATUS = 0x00 // 20-bit realtime pressure sample OUT_PRES_MSB_CSB_LSB = 0x01 OUT_PRES_BYTES = 3 // 12-bit realtime temperature sample OUT_TEMP_MSB_LSB = 0x04 OUT_TEMP_BYTES = 2 // Data ready status information DR_STATUS = 0x06 // 20-bit pressure change data OUT_PRES_DELTA_MSB_CSB_LSB = 0x07 OUT_PRES_DELTA_BYTES = 3 // 12-bit temperature change data OUT_TEMP_DELTA_MSB_LSB = 0x0A OUT_TEMP_DELTA_BYTES = 2 // Fixed device ID number WHO_AM_I = 0x0C // FIFO status: no FIFO event detected F_STATUS = 0x0D // FIFO 8-bit data access F_DATA = 0x0E // FIFO setup F_SETUP = 0x0F // Time since FIFO overflow TIME_DLY = 0x10 // Current system mode SYSMOD = 0x11 // Interrupt status INT_SOURCE = 0x12 // Data event flag configuration PT_DATA_CFG = 0x13 // Barometric input for altitude calculation BAR_IN_MSB_LSB = 0x14 BAR_IN_BYTES = 2 // Pressure/altitude target PRES_TGT_MSB_LSB = 0x16 PRES_TGT_BYTES = 2 // Temperature target value T_TGT = 0x18 // Pressure/altitude window PRES_WND_MSB_LSB = 0x19 PRES_WND_BYTES = 2 // Temperature window TEMP_WND = 0x1B // Minimum pressure/altitude PRES_MIN_MSB_CSB_LSB = 0x1C PRES_MIN_BYTES = 3 // Minimum temperature TEMP_MIN_MSB_LSB = 0x1E TEMP_MIN_BYTES = 2 // Maximum pressure/altitude PRES_MAX_MSB_CSB_LSB = 0x21 PRES_MAX_BYTES = 3 // Maximum temperature TEMP_MAX_MSB_LSB = 0x24 TEMP_MAX_BYTES = 2 // Control register: Modes, oversampling CTRL_REG1 = 0x26 // Control register: Acquisition time step CTRL_REG2 = 0x27 // Control register: Interrupt pin configuration CTRL_REG3 = 0x28 // Control register: Interrupt enables CTRL_REG4 = 0x29 // Control register: Interrupt output pin assignment CTRL_REG5 = 0x2A // Pressure data offset OFF_PRES = 0x2B // Temperature data offset OFF_TEMP = 0x2C // Altitude data offset OFF_H = 0x2D )
Register map
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MPL3115A2 ¶
type MPL3115A2 struct {
}
MPL3115A2 keeps sensor itself.
func (*MPL3115A2) CompensateAltitude ¶
CompensateAltitude shift altitude from -128 to +127 meters. Default value is 0. Can be used for sensor calibration.
func (*MPL3115A2) CompensatePressure ¶
CompensatePressure shift pressure from -512 to +508 Pascal. Default value is 0. Can be user for sensor calibration.
func (*MPL3115A2) CompensateTemperature ¶
CompensateTemperature shift temperature from -8 to +7.9375 *C. Default value is 0. Can be used for sensor calibration.
func (*MPL3115A2) GetDefaultSeaLevelPressure ¶
GetDefaultSeaLevelPressure return average barometric pressure on the sea level defined as 101325 Pa.
func (*MPL3115A2) MeasureAltitude ¶
MeasureAltitude measure altitude in meters with specific precision defined by oversample ratio.
func (*MPL3115A2) MeasurePressure ¶
MeasurePressure measure pressure in Pa with specific precision defined by oversample ratio.
func (*MPL3115A2) ModifySeaLevelPressure ¶
ModifySeaLevelPressure call allow to change default sea level value 101326 Pa to custom one.
type PressureType ¶
type PressureType int
PressureType signify which type of pressure measurement in use.
const ( // Measure pressure in Pa Barometer PressureType = iota + 1 // Measure altitude in m Altimeter )
type RawPressure ¶
RawPressure keeps raw pressure data received from sensor.
func (*RawPressure) ConvertToSignedQ16Dot4 ¶
func (v *RawPressure) ConvertToSignedQ16Dot4() (int16, uint8)
ConvertToSignedQ16Dot4 convert raw data to signed Q16.4, where integer and fraction parts returned in separate fields. Used for altimeter mode.
func (*RawPressure) ConvertToUnsignedQ18Dot2 ¶
func (v *RawPressure) ConvertToUnsignedQ18Dot2() (uint32, uint8)
ConvertToUnsignedQ18Dot2 convert raw data to unsigned Q18.2, where integer and fraction parts returned in separate fields. Used for barometer mode.
type RawTemperature ¶
RawTemperature keeps raw temperature data received from sensor.
func (*RawTemperature) ConvertToSignedQ8Dot4 ¶
func (v *RawTemperature) ConvertToSignedQ8Dot4() (int8, uint8)
ConvertToSignedQ8Dot4 convert raw data to signed Q8.4, where integer and fraction parts returned in separate fields.
