BMX280THP(4)

πŸ“¦ version 11.0, in nixpkgs unstable

πŸ’œ BMX280THP(4) β€” the bmx280thp girlies' guide πŸ’œ

okay so this is a page from the Kernel Interfaces Manual, bestie β€” we're talking a kernel driver today, and honestly? she's kind of iconic. let's get into it 🫢


✨ NAME ✨

bmx280thp β€” the driver for the Bosch BMP280/BME280 sensor chip, and she talks over the I2C bus πŸ’…


🌸 SYNOPSIS 🌸

bmx280thp* at iic? addr 0x76
bmx280thp* at iic? addr 0x77

bmx280thp* at spi? slave 0
bmx280thp* at spi? slave 1

like, that's the whole vibe check right there. two addresses on iic, two slave selects on spi. pick your fighter πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so the bmx280thp driver is the one that gives you actual measurements β€” temperature, humidity and barometric pressure β€” from the BMP280 and BME280 sensors, and it feeds all of that through the envsys(4) framework. literally the whole point of her πŸ₯°

the bmx280thp addr argument is what picks the address on the iic(4) bus, and the bmx280thp slave argument is what picks which chip select gets used on the spi(4) bus. iykyk.

and here's the slay part β€” the precision of the measurement, which is tied to the over sampling done on that measurement, can be changed through sysctl(8) nodes. so you're not stuck, you can tune her ✨


πŸ‘‘ SYSCTL VARIABLES πŸ‘‘

the following sysctl(3) variables are provided, and yes you should be obsessed:

  • hw.bmx280thp0.osrs_t
  • hw.bmx280thp0.osrs_p
  • hw.bmx280thp0.osrs_h

these three control oversampling of temperature, pressure and humidity respectively. the valid values are 1, 2, 4, 8, and 16 times oversample. important note bestie: humidity is only available if the chip is a BME280 🫢

  • hw.bmx280thp0.irr_samples

IRR is a filter that can be used to reduce the noise in the measurement. the valid values are 1 (or off), 2, 5, 11 and 22 samples to reach >= 75% of the step response πŸ‘‘

  • hw.bmx280thp0.waitfactor.t
  • hw.bmx280thp0.waitfactor.p
  • hw.bmx280thp0.waitfactor.h

these control the wait multiplication factor for a measurement cycle. the factor is different for temperature, pressure and humidity, and it's based upon the values of osrs_t, osrs_p and osrs_h. so if the chip isn't returning the correct measurements for a given over sampling, you can adjust the wait factors to allow more time for the measurement to complete successfully. she just needs a lil minute πŸ’€

  • hw.bmx280thp0.debug
  • hw.bmx280thp0.dump_calibration

if the driver is compiled with BMX280_DEBUG, these nodes will appear πŸ’– and they can be used to set the debugging level and provide the calibration constants β€” upon refresh β€” that are stored in the chip. since the constants are fixed, this is a boolean node and will reset back to false once one dump has been performed. one and done, no cap ✨

  • hw.bmx280thp0.readattempts

a status register tells the driver if the chip is busy with a measurement. this status register must be polled, and readattempts is the number of times that this poll will be performed. the default is 25, which should be more than enough for most purposes πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯

envsys(4), iic(4), spi(4), envstat(8), sysctl(8)

go read them, she's worth it 🧚


🌈 HISTORY 🌈

the bmx280thp driver first appeared in NetBSD 10.0. a whole era, honestly πŸ’…


πŸŽ€ AUTHORS πŸŽ€

the bmx280thp driver was written by Brad Spencer <brad@anduin.eldar.org> β€” thank you king πŸ‘‘


πŸ’€ BUGS πŸ’€

the driver does not support the continuous read mode that the BMP280 and BME280 has. so like, that's a thing. not me being sad about it 😭


mwah, that's the whole page πŸ’œ this one came from the Debian crew, dated November 19, 2022, and it's filed under BMX280THP(4) β€” go measure something, bestie, and stay hydrated πŸ“βœ¨

πŸ“¦ where this page comes from