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

     1  // Package bmp388 provides a driver for Bosch's BMP388 digital temperature & pressure sensor.
     2  // The datasheet can be found here: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp388-ds001.pdf
     3  package bmp388
     4  
     5  const Address byte = 0x77 // default I2C address
     6  
     7  const (
     8  	RegChipId  byte = 0x00 // useful for checking the connection
     9  	RegCali    byte = 0x31 // pressure & temperature compensation calibration coefficients
    10  	RegPress   byte = 0x04 // start of pressure data registers
    11  	RegTemp    byte = 0x07 // start of temperature data registers
    12  	RegPwrCtrl byte = 0x1B // measurement mode & pressure/temperature sensor power register
    13  	RegOSR     byte = 0x1C // oversampling settings register
    14  	RegODR     byte = 0x1D //
    15  	RegCmd     byte = 0x7E // miscellaneous command register
    16  	RegStat    byte = 0x03 // sensor status register
    17  	RegErr     byte = 0x02 // error status register
    18  	RegIIR     byte = 0x1F
    19  )
    20  
    21  const (
    22  	ChipId    byte = 0x50 // correct response if reading from chip id register
    23  	PwrPress  byte = 0x01 // power on pressure sensor
    24  	PwrTemp   byte = 0x02 // power on temperature sensor
    25  	SoftReset byte = 0xB6 // command to reset all user configuration
    26  	DRDYPress byte = 0x20 // for checking if pressure data is ready
    27  	DRDYTemp  byte = 0x40 // for checking if pressure data is ready
    28  )
    29  
    30  // The difference between forced and normal mode is the bmp388 goes to sleep after taking a measurement in forced mode.
    31  // Set it to forced if you intend to take measurements sporadically and want to save power. The driver will handle
    32  // waking the sensor up when the sensor is in forced mode.
    33  const (
    34  	Normal Mode = 0x30
    35  	Forced Mode = 0x16
    36  	Sleep  Mode = 0x00
    37  )
    38  
    39  // Increasing sampling rate increases precision but also the wait time for measurements. The datasheet has a table of
    40  // suggested values for oversampling, output data rates, and iir filter coefficients by use case.
    41  const (
    42  	Sampling1X Oversampling = iota
    43  	Sampling2X
    44  	Sampling4X
    45  	Sampling8X
    46  	Sampling16X
    47  	Sampling32X
    48  )
    49  
    50  // Output data rates in Hz. If increasing the sampling rates you need to decrease the output data rates, else the bmp388
    51  // will freeze and Configure() will return a configuration error message. In that case keep decreasing the data rate
    52  // until the bmp is happy
    53  const (
    54  	Odr200 OutputDataRate = iota
    55  	Odr100
    56  	Odr50
    57  	Odr25
    58  	Odr12p5
    59  	Odr6p25
    60  	Odr3p1
    61  	Odr1p5
    62  	Odr0p78
    63  	Odr0p39
    64  	Odr0p2
    65  	Odr0p1
    66  	Odr0p05
    67  	Odr0p02
    68  	Odr0p01
    69  	Odr0p006
    70  	Odr0p003
    71  	Odr0p0015
    72  )
    73  
    74  // IIR filter coefficients, higher values means steadier measurements but slower reaction times
    75  const (
    76  	Coeff0 FilterCoefficient = iota
    77  	Coeff1
    78  	Coeff3
    79  	Coeff7
    80  	Coeff15
    81  	Coeff31
    82  	Coeff63
    83  	Coeff127
    84  )