.\" $NetBSD: bmx280thp.4,v 1.5 2022/12/03 01:04:42 brad Exp $
.\"
.\" Copyright (c) 2022 Brad Spencer <brad@anduin.eldar.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd November 19, 2022
.Dt BMX280THP 4
.Os
.Sh NAME
.Nm bmx280thp
.Nd Driver for Bosch BMP280/BME280 sensor chip via I2C bus
.Sh SYNOPSIS
.Cd "bmx280thp* at iic? addr 0x76"
.Cd "bmx280thp* at iic? addr 0x77"
.Cd "bmx280thp* at spi? slave 0"
.Cd "bmx280thp* at spi? slave 1"
.Sh DESCRIPTION
The
.Nm
driver provides measurements from the BMP280 and BME280 temperature,
humidity and barometric pressure sensors via the
.Xr envsys 4
framework.
The
.Nm
.Ar addr
argument selects the address at the
.Xr iic 4
bus and the
.Nm
.Ar slave
argument selects which chip select will be used on the
.Xr spi 4
bus.
The precision of the measurement which is related to the over
sampling performed on the measurement can be changed through
.Xr sysctl 8
nodes.
.Sh SYSCTL VARIABLES
The following
.Xr sysctl 3
variables are provided:
.Bl -tag -width indent
.It Li hw.bmx280thp0.osrs_t
.It Li hw.bmx280thp0.osrs_p
.It Li hw.bmx280thp0.osrs_h
These control oversampling of temperature, pressure and humidity.
The valid values are 1, 2, 4, 8, and 16 times oversample.
Humidity is only available if the chip is a BME280.
.It Li hw.bmx280thp0.irr_samples
IRR is a filter that can be used to reduce the noise in the
measurement.
The value values are 1 (or off), 2, 5, 11 and 22 samples
to reach >= 75% of the step response.
.It Li hw.bmx280thp0.waitfactor.t
.It Li hw.bmx280thp0.waitfactor.p
.It Li hw.bmx280thp0.waitfactor.h
These control the wait multiplication factor for a measurement cycle.
This factor is different for temperature, pressure and humidity and
is based upon the values of osrs_t, osrs_p and osrs_h.
If the chip does not return the correct measurements for a given
over sampling then the wait factors can be adjusted to allow more
time for the measurement to complete successfully.
.It Li hw.bmx280thp0.debug
.It Li hw.bmx280thp0.dump_calibration
If the driver is compiled with
.Dv BMX280_DEBUG ,
these nodes will appear and 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.
.It Li 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.
.El
.Sh SEE ALSO
.Xr envsys 4 ,
.Xr iic 4 ,
.Xr spi 4 ,
.Xr envstat 8 ,
.Xr sysctl 8
.Sh HISTORY
The
.Nm
driver first appeared in
.Nx 10.0 .
.Sh AUTHORS
.An -nosplit
The
.Nm
driver was written by
.An Brad Spencer Aq Mt brad@anduin.eldar.org .
.Sh BUGS
The driver does not support the continuous read mode that the BMP280
and BME280 has.