bme280

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_SPI_SPEED = 4 * 1e6   // 4Mhz
	DEFAULT_I2C_SPEED = 100 * 1e3 // 100 kHz
	DEFAULT_I2C_SLAVE = 0x77
)
View Source
const (
	BME280_SOFTRESET_VALUE    = 0xB6
	BME280_SKIPTEMP_VALUE     = 0x80000
	BME280_SKIPPRESSURE_VALUE = 0x80000
	BME280_SKIPHUMID_VALUE    = 0x8000
)
View Source
const (
	BME280_REG_DIG_T1       register = 0x88
	BME280_REG_DIG_T2       register = 0x8A
	BME280_REG_DIG_T3       register = 0x8C
	BME280_REG_DIG_P1       register = 0x8E
	BME280_REG_DIG_P2       register = 0x90
	BME280_REG_DIG_P3       register = 0x92
	BME280_REG_DIG_P4       register = 0x94
	BME280_REG_DIG_P5       register = 0x96
	BME280_REG_DIG_P6       register = 0x98
	BME280_REG_DIG_P7       register = 0x9A
	BME280_REG_DIG_P8       register = 0x9C
	BME280_REG_DIG_P9       register = 0x9E
	BME280_REG_DIG_H1       register = 0xA1
	BME280_REG_DIG_H2       register = 0xE1
	BME280_REG_DIG_H3       register = 0xE3
	BME280_REG_DIG_H4       register = 0xE4
	BME280_REG_DIG_H5       register = 0xE5
	BME280_REG_DIG_H6       register = 0xE7
	BME280_REG_CHIPID       register = 0xD0
	BME280_REG_VERSION      register = 0xD1
	BME280_REG_SOFTRESET    register = 0xE0
	BME280_REG_CAL26        register = 0xE1 // R calibration stored in 0xE1-0xF0
	BME280_REG_CONTROLHUMID register = 0xF2
	BME280_REG_STATUS       register = 0xF3
	BME280_REG_CONTROL      register = 0xF4
	BME280_REG_CONFIG       register = 0xF5
	BME280_REG_PRESSUREDATA register = 0xF7
	BME280_REG_TEMPDATA     register = 0xFA
	BME280_REG_HUMIDDATA    register = 0xFD
)
View Source
const (
	// Write mask
	BME280_REG_SPI_WRITE register = 0x7F

	// Timeout for measuring
	BME280_TIMEOUT = time.Millisecond * 500
)
View Source
const (
	BME280_PRESSURE_SEALEVEL float64 = 103090 // in Pascals
)

Sealevel pressure approximation http://resource.npl.co.uk/pressure/pressure.html

Variables

This section is empty.

Functions

func New

func New(cfg Config, ch chan<- Event) *device

Create new BME280 device, with channel. Panics on error

Types

type Config

type Config struct {
	SPI   SPI
	I2C   I2C
	Slave uint8 // I2C Slave address, optional
}

func (Config) New

func (cfg Config) New(ch chan<- Event) (*device, error)

Create new BME280 device, with channel

type Filter

type Filter uint8
const (
	BME280_FILTER_OFF Filter = 0x00
	BME280_FILTER_2   Filter = 0x01
	BME280_FILTER_4   Filter = 0x02
	BME280_FILTER_8   Filter = 0x03
	BME280_FILTER_16  Filter = 0x04
	BME280_FILTER_MAX Filter = 0x07
)

BME280 Filter Co-efficient

func (Filter) String

func (f Filter) String() string

type Mode

type Mode uint8
const (
	BME280_MODE_SLEEP   Mode = 0x00
	BME280_MODE_FORCED  Mode = 0x01
	BME280_MODE_FORCED2 Mode = 0x02
	BME280_MODE_NORMAL  Mode = 0x03
	BME280_MODE_MAX     Mode = 0x03
)

BME280 Mode

func (Mode) String

func (m Mode) String() string

type Oversample

type Oversample uint8
const (
	BME280_OVERSAMPLE_SKIP Oversample = 0x00
	BME280_OVERSAMPLE_1    Oversample = 0x01
	BME280_OVERSAMPLE_2    Oversample = 0x02
	BME280_OVERSAMPLE_4    Oversample = 0x03
	BME280_OVERSAMPLE_8    Oversample = 0x04
	BME280_OVERSAMPLE_16   Oversample = 0x05
	BME280_OVERSAMPLE_MAX  Oversample = 0x07
)

BME280 Oversampling value

func (Oversample) String

func (o Oversample) String() string

type StandbyTime

type StandbyTime uint8
const (
	BME280_STANDBY_0P5MS  StandbyTime = 0x00
	BME280_STANDBY_62P5MS StandbyTime = 0x01
	BME280_STANDBY_125MS  StandbyTime = 0x02
	BME280_STANDBY_250MS  StandbyTime = 0x03
	BME280_STANDBY_500MS  StandbyTime = 0x04
	BME280_STANDBY_1000MS StandbyTime = 0x05
	BME280_STANDBY_10MS   StandbyTime = 0x06
	BME280_STANDBY_20MS   StandbyTime = 0x07
	BME280_STANDBY_MAX    StandbyTime = 0x07
)

BME280 Standby time

func (StandbyTime) String

func (t StandbyTime) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL