.\" $NetBSD: am2315temp.4,v 1.2 2017/12/29 14:47:09 wiz Exp $ .\" .\" Copyright (c) 2017 Brad Spencer .\" .\" 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 December 28, 2017 .Dt AM2315TEMP 4 .Os .Sh NAME .Nm am2315temp .Nd Driver for Aosong AM2315 sensor chip via I2C bus .Sh SYNOPSIS .Cd "am2315temp* at iic? addr 0x5c" .Sh DESCRIPTION The .Nm driver provides measurements from the AM2315 humidity/temperature sensors via the .Xr envsys 4 framework. The .Nm .Ar addr argument selects the address at the .Xr iic 4 bus. The AM2315 has limits on how often the measurements can be read. Adjustments to the number of times to take reading before considering it valid, and the number of ticks to wait between readings can be changed through .Xr sysctl 8 nodes. .Pp There are other oddities about the AM2315 that should be mentioned. The datasheet says that the device should read no more often then every 2 seconds, further, it also implies that a measurement is not performed until the device is 1) awake 2) has been asked for a measurement. From observation, it has been noted that it is possible to ask for measurements more often than every 2 seconds, and actually get something that looks to be valid. It may, in fact, be valid, but it has also been noted that the measurements do not appear to change. This implies that a measurement was done, and then returned time and time again. It has also been noticed that if measurements are taken very close to every 2 seconds, that sometimes the device will return a I2C error on a read. If this happens a lot, increase hw.am2315temp0.readticks a bit. .Sh SYSCTL VARIABLES The following .Xr sysctl 3 variables are provided: .Bl -tag -width indent .It hw.am2315temp0.readcount The number of times to take a reading before considering it valid. This defaults to 2. .It hw.am2315temp0.readticks The number of ticks to wait in between readings. The default is 100. .It hw.am2315temp0.debug If the driver is compiled with .Dv AM2315_DEBUG , this node will appear and can be used to set the debugging level. .El .Sh SEE ALSO .Xr envsys 4 , .Xr iic 4 , .Xr envstat 8 , .Xr sysctl 8 .Sh HISTORY The .Nm driver first appeared in .Nx 8.0 . .Sh AUTHORS .An -nosplit The .Nm driver was written by .An Brad Spencer Aq Mt brad@anduin.eldar.org . .Sh BUGS The device does not appear to work with the .Xr gpioiic 4 bitbang controller. When tried, reads would not error, but no data was returned.