constCRC8Polynomial =uint8(0b00110001)// p(x) = x^8 + x^5 + x^4 + 1. x^8 is omitted due to byte size
constcrc8Polynomial =uint8(0b00110001)// p(x) = x^8 + x^5 + x^4 + 1. x^8 is omitted due to byte size
typeDevstruct{
typeDevstruct{
optsOpts
optsOpts
@ -44,7 +44,7 @@ type Dev struct {
// Opts holds the configuration options for the device.
// Opts holds the configuration options for the device.
typeOptsstruct{
typeOptsstruct{
// MeasurementReadTimeout is the timeout for reading a single measurement. The timeout only applies after the measurement triggering which itself takes 80ms. Default is 150ms. Leave 0 to use default.
// MeasurementReadTimeout is the timeout for reading a single measurement. The timeout only applies after the measurement triggering which itself takes 80ms. Default is 150ms. 0 means no timeout.
MeasurementReadTimeouttime.Duration
MeasurementReadTimeouttime.Duration
// MeasurementWaitInterval is the interval between subsequent sensor value reads. This applies only if the measurement is not finished after the initial 80ms wait. Do not confuse this interval with SenseContinuous. Default is 10ms. Leave 0 to use default.
// MeasurementWaitInterval is the interval between subsequent sensor value reads. This applies only if the measurement is not finished after the initial 80ms wait. Do not confuse this interval with SenseContinuous. Default is 10ms. Leave 0 to use default.
MeasurementWaitIntervaltime.Duration
MeasurementWaitIntervaltime.Duration
@ -59,20 +59,17 @@ var DefaultOpts = Opts{
ValidateData:true,
ValidateData:true,
}
}
// NewI2C returns an object that communicates over I²C to AHT20
// NewI2C returns an object that communicates over I²C to AHT20 environmental sensor. The sensor
// environmental sensor. The sensor will be calibrated if it is not already. The Opts can be nil.
// will be calibrated and initialized if it is not already. The Opts can be nil.