Documentation ¶
Index ¶
- Constants
- func CalcAltitude(press float64) (altitude float64)
- type BMP280
- func (bmp *BMP280) CalcCompensatedPress(raw_press int64) (press float64)
- func (bmp *BMP280) CalcCompensatedTemp(raw_temp int32) (temp float64)
- func (bmp *BMP280) Close()
- func (bmp *BMP280) GetFilterCoeff() (filterCoeff byte, err error)
- func (bmp *BMP280) GetOversampPress() (oversampPres byte, err error)
- func (bmp *BMP280) GetOversampTemp() (oversampTemp byte, err error)
- func (bmp *BMP280) GetPowerMode() (powerMode byte, err error)
- func (bmp *BMP280) GetStandbyTime() (standbyTime byte, err error)
- func (bmp *BMP280) ReadCorrectionSettings() (err error)
- func (bmp *BMP280) SetFilterCoeff(filterCoeff byte) error
- func (bmp *BMP280) SetOversampPress(oversampPres byte) error
- func (bmp *BMP280) SetOversampTemp(oversampTemp byte) error
- func (bmp *BMP280) SetPowerMode(powerMode byte) error
- func (bmp *BMP280) SetStandbyTime(standbyTime byte) error
Constants ¶
const ( QNH = 1013.25 // Sea level reference pressure in hPa BufSize = 256 // Buffer size for reading data from BMP ExtraReadDelay = time.Millisecond // Delay between chip reading polls )
const ( // I2C Address Definitions Address1 = 0x76 Address2 = 0x77 // Chip ID Definitions ChipID1 = 0x56 ChipID2 = 0x57 ChipID3 = 0x58 // Power Mode Definitions SleepMode = 0x00 ForcedMode = 0x01 NormalMode = 0x03 SoftResetCode = 0xB6 // Standby Time Definitions StandbyTime1ms = 0x00 StandbyTime63ms = 0x01 StandbyTime125ms = 0x02 StandbyTime250ms = 0x03 StandbyTime500ms = 0x04 StandbyTime1000ms = 0x05 StandbyTime2000ms = 0x06 StandbyTime4000ms = 0x07 // Filter Definitions FilterCoeffOff = 0x00 FilterCoeff2 = 0x01 FilterCoeff4 = 0x02 FilterCoeff8 = 0x03 FilterCoeff16 = 0x04 // Oversampling Definitions OversampSkipped = 0x00 Oversamp1x = 0x01 Oversamp2x = 0x02 Oversamp4x = 0x03 Oversamp8x = 0x04 Oversamp16x = 0x05 // Working Mode Definitions UltraLowPowerMode = 0x00 LowPowerMode = 0x01 StandardResolutionMode = 0x02 HighResolutionMode = 0x03 UltraHighResolutionMode = 0x04 // BMP280 registers RegisterCompData = 0x88 RegisterChipID = 0xD0 RegisterSoftReset = 0xE0 RegisterStatus = 0xF3 RegisterControl = 0xF4 RegisterConfig = 0xF5 RegisterPressDataMSB = 0xF7 RegisterPressDataLSB = 0xF8 RegisterPressDataXLSB = 0xF9 RegisterTempDataMSB = 0xFA RegisterTempDataLSB = 0xFB RegisterTempDataXLSB = 0xFC )
Variables ¶
This section is empty.
Functions ¶
func CalcAltitude ¶
CalcAltitude converts pressure in hPa to altitude in ft.
Types ¶
type BMP280 ¶
type BMP280 struct { Address byte ChipID byte Delay time.Duration DigT map[int]int32 DigP map[int]int64 T_fine int32 C <-chan *sensors.BMPData CBuf <-chan *sensors.BMPData // contains filtered or unexported fields }
func NewBMP280 ¶
func NewBMP280(i2cbus *embd.I2CBus, address, powerMode, standby, filter, tempRes, presRes byte) (bmp *BMP280, err error)
NewBMP280 returns a BMP280 object with the chosen settings: address is one of bmp280.Address1 (0x76) or bmp280.Address2 (0x77). powerMode is one of bmp280.SleepMode, bmp280.ForcedMode, or bmp280.NormalMode. standby is one of the bmp280.StandbyTimeX (1ms up to 4000ms). filter is one of bmp280.FilterCoeffX. tempRes is one of bmp280.OversampX (up to 16x). presRes is one of bmp280.XMode (low power mode, etc). See BMP280 datasheet for details.
func (*BMP280) CalcCompensatedPress ¶
CalcCompensatedPress converts the raw measurement from the sensor, a 64-bit int, to an actual float pressure in hPa.
func (*BMP280) CalcCompensatedTemp ¶
CalcCompensatedTemp converts the raw measurement from the sensor, a 32-bit int, to an actual float temperature in deg C.
func (*BMP280) GetFilterCoeff ¶
GetFilterCoeff returns the current filter coefficient of the sensor. Possible values are: bmp280.FilterCoeffOff = 0x00 bmp280.FilterCoeff2 = 0x01 bmp280.FilterCoeff4 = 0x02 bmp280.FilterCoeff8 = 0x03 bmp280.FilterCoeff16 = 0x04 See BMP280 datasheet for explanations.
func (*BMP280) GetOversampPress ¶
GetOversampPress returns the current pressure oversampling setting for the sensor. Possible values are: bmp280.OversampSkipped = 0x00 bmp280.Oversamp1x = 0x01 bmp280.Oversamp2x = 0x02 bmp280.Oversamp4x = 0x03 bmp280.Oversamp8x = 0x04 bmp280.Oversamp16x = 0x05 See BMP280 datasheet for explanations.
func (*BMP280) GetOversampTemp ¶
GetOversampTemp returns the current temperature oversampling setting for the sensor. Possible values are: bmp280.OversampSkipped = 0x00 bmp280.Oversamp1x = 0x01 bmp280.Oversamp2x = 0x02 bmp280.Oversamp4x = 0x03 bmp280.Oversamp8x = 0x04 bmp280.Oversamp16x = 0x05 See BMP280 datasheet for explanations.
func (*BMP280) GetPowerMode ¶
GetPowerMode returns the current power mode of the chip. Possible values are: bmp280.SleepMode = 0x00 bmp280.ForcedMode = 0x01 bmp280.NormalMode = 0x03 See BMP280 datasheet for explanations.
func (*BMP280) GetStandbyTime ¶
GetStandbyTime returns the current standby time between sensor reads. Possible values are: bmp280.StandbyTime1ms = 0x00 bmp280.StandbyTime63ms = 0x01 bmp280.StandbyTime125ms = 0x02 bmp280.StandbyTime250ms = 0x03 bmp280.StandbyTime500ms = 0x04 bmp280.StandbyTime1000ms = 0x05 bmp280.StandbyTime2000ms = 0x06 bmp280.StandbyTime4000ms = 0x07 See BMP280 datasheet for explanations.
func (*BMP280) ReadCorrectionSettings ¶
ReadCorrectionSettings is used to read correction settings for the chip, set at the factory to read properly calibrated temperature and pressure.
func (*BMP280) SetFilterCoeff ¶
SetFilterCoeff sets the current filter coefficient of the sensor. Possible values are: bmp280.FilterCoeffOff = 0x00 bmp280.FilterCoeff2 = 0x01 bmp280.FilterCoeff4 = 0x02 bmp280.FilterCoeff8 = 0x03 bmp280.FilterCoeff16 = 0x04 See BMP280 datasheet for explanations.
func (*BMP280) SetOversampPress ¶
SetOversampPress sets the current pressure oversampling setting for the sensor. Possible values are: bmp280.OversampSkipped = 0x00 bmp280.Oversamp1x = 0x01 bmp280.Oversamp2x = 0x02 bmp280.Oversamp4x = 0x03 bmp280.Oversamp8x = 0x04 bmp280.Oversamp16x = 0x05 See BMP280 datasheet for explanations.
func (*BMP280) SetOversampTemp ¶
SetOversampTemp sets the current temperature oversampling setting for the sensor. Possible values are: bmp280.OversampSkipped = 0x00 bmp280.Oversamp1x = 0x01 bmp280.Oversamp2x = 0x02 bmp280.Oversamp4x = 0x03 bmp280.Oversamp8x = 0x04 bmp280.Oversamp16x = 0x05 See BMP280 datasheet for explanations.
func (*BMP280) SetPowerMode ¶
SetPowerMode sets the power mode of the chip. Possible values are: bmp280.SleepMode = 0x00 bmp280.ForcedMode = 0x01 bmp280.NormalMode = 0x03 bmp280.SoftResetCode = 0xB6 See BMP280 datasheet for explanations.
func (*BMP280) SetStandbyTime ¶
SetStandbyTime sets the standby time between chip reads. Possible values are: bmp280.StandbyTime1ms = 0x00 bmp280.StandbyTime63ms = 0x01 bmp280.StandbyTime125ms = 0x02 bmp280.StandbyTime250ms = 0x03 bmp280.StandbyTime500ms = 0x04 bmp280.StandbyTime1000ms = 0x05 bmp280.StandbyTime2000ms = 0x06 bmp280.StandbyTime4000ms = 0x07 See BMP280 datasheet for explanations.