tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/bme280/registers.go (about)

     1  package bme280
     2  
     3  // Constants/addresses used for I2C.
     4  
     5  // The I2C address which this device listens to.
     6  const Address = 0x76
     7  
     8  // Registers. Names, addresses and comments copied from the datasheet.
     9  const (
    10  	CTRL_MEAS_ADDR        = 0xF4
    11  	CTRL_HUMIDITY_ADDR    = 0xF2
    12  	CTRL_CONFIG           = 0xF5
    13  	REG_PRESSURE          = 0xF7
    14  	REG_CALIBRATION       = 0x88
    15  	REG_CALIBRATION_H1    = 0xA1
    16  	REG_CALIBRATION_H2LSB = 0xE1
    17  	CMD_RESET             = 0xE0
    18  
    19  	WHO_AM_I = 0xD0
    20  	CHIP_ID  = 0x60
    21  )
    22  
    23  // Increasing sampling rate increases precision but also the wait time for measurements. The datasheet has a table of
    24  // suggested values for oversampling, output data rates, and iir filter coefficients by use case.
    25  const (
    26  	SamplingOff Oversampling = iota
    27  	Sampling1X
    28  	Sampling2X
    29  	Sampling4X
    30  	Sampling8X
    31  	Sampling16X
    32  )
    33  
    34  // In normal mode (the default) the sensor takes masurements periodically.  In forced
    35  // mode, the sensor takes a measurement only when requested.
    36  //
    37  // For use-cases with infrequent sampling, forced mode is more power efficient.
    38  const (
    39  	ModeNormal Mode = 0x03
    40  	ModeForced Mode = 0x01
    41  	ModeSleep  Mode = 0x00
    42  )
    43  
    44  // IIR filter coefficients, higher values means steadier measurements but slower reaction times
    45  const (
    46  	Coeff0 FilterCoefficient = iota
    47  	Coeff2
    48  	Coeff4
    49  	Coeff8
    50  	Coeff16
    51  )
    52  
    53  // Period of standby in normal mode which controls how often measurements are taken
    54  //
    55  // Note Period10ms and Period20ms are out of sequence, but are per the datasheet
    56  const (
    57  	Period0_5ms  Period = 0b000
    58  	Period62_5ms        = 0b001
    59  	Period125ms         = 0b010
    60  	Period250ms         = 0b011
    61  	Period500ms         = 0b100
    62  	Period1000ms        = 0b101
    63  	Period10ms          = 0b110
    64  	Period20ms          = 0b111
    65  )
    66  
    67  const (
    68  	SEALEVEL_PRESSURE float32 = 1013.25 // in hPa
    69  )