1.\" $NetBSD: am2315temp.4,v 1.2 2017/12/29 14:47:09 wiz Exp $ 2.\" 3.\" Copyright (c) 2017 Brad Spencer <brad@anduin.eldar.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd December 28, 2017 18.Dt AM2315TEMP 4 19.Os 20.Sh NAME 21.Nm am2315temp 22.Nd Driver for Aosong AM2315 sensor chip via I2C bus 23.Sh SYNOPSIS 24.Cd "am2315temp* at iic? addr 0x5c" 25.Sh DESCRIPTION 26The 27.Nm 28driver provides measurements from the AM2315 humidity/temperature 29sensors via the 30.Xr envsys 4 31framework. 32The 33.Nm 34.Ar addr 35argument selects the address at the 36.Xr iic 4 37bus. 38The AM2315 has limits on how often the measurements can be read. 39Adjustments to the number of times to take reading before considering 40it valid, and the number of ticks to wait between readings can be 41changed through 42.Xr sysctl 8 43nodes. 44.Pp 45There are other oddities about the AM2315 that should be mentioned. 46The datasheet says that the device should read no more often then 47every 2 seconds, further, it also implies that a measurement is not 48performed until the device is 1) awake 2) has been asked for a 49measurement. 50From observation, it has been noted that it is possible 51to ask for measurements more often than every 2 seconds, and actually 52get something that looks to be valid. 53It may, in fact, be valid, but 54it has also been noted that the measurements do not appear to change. 55This implies that a measurement was done, and then returned time and 56time again. 57It has also been noticed that if measurements are taken 58very close to every 2 seconds, that sometimes the device will return a 59I2C error on a read. 60If this happens a lot, increase hw.am2315temp0.readticks a bit. 61.Sh SYSCTL VARIABLES 62The following 63.Xr sysctl 3 64variables are provided: 65.Bl -tag -width indent 66.It hw.am2315temp0.readcount 67The number of times to take a reading before considering it valid. 68This defaults to 2. 69.It hw.am2315temp0.readticks 70The number of ticks to wait in between readings. 71The default is 100. 72.It hw.am2315temp0.debug 73If the driver is compiled with 74.Dv AM2315_DEBUG , 75this node will appear and can be used to set the debugging level. 76.El 77.Sh SEE ALSO 78.Xr envsys 4 , 79.Xr iic 4 , 80.Xr envstat 8 , 81.Xr sysctl 8 82.Sh HISTORY 83The 84.Nm 85driver first appeared in 86.Nx 8.0 . 87.Sh AUTHORS 88.An -nosplit 89The 90.Nm 91driver was written by 92.An Brad Spencer Aq Mt brad@anduin.eldar.org . 93.Sh BUGS 94The device does not appear to work with the 95.Xr gpioiic 4 96bitbang controller. 97When tried, reads would not error, but no data was returned. 98