adt7410

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2021 License: BSD-3-Clause Imports: 2 Imported by: 15

Documentation

Overview

Package adt7410 provides a driver for the adt7410 I2C Temperature Sensor.

Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADT7410.pdf

Index

Constants

View Source
const (
	// Address is default I2C address.
	Address = 0x48
	// Address1 is for first device, aka the default.
	Address1 = Address
	// Address2 is for second device.
	Address2 = 0x49
	// Address3 is for third device.
	Address3 = 0x4A
	// Address4 is for fourth device.
	Address4 = 0x4B

	// Temperature Value MSB Register
	RegTempValueMSB = 0x0

	// Temperature Value LSB Register
	RegTempValueLSB = 0x1

	// Status Register
	RegStatus = 0x2

	// Config Register
	RegConfig = 0x3

	// THIGH setpoint most significant byte 0x20 (64°C)
	RegTHIGHMsbReg = 0x4

	// THIGH setpoint least significant byte 0x00 (64°C)
	RegTHIGHLsbReg = 0x5

	// TLOW setpoint most significant byte 0x05 (10°C)
	RegTLOWMsbReg = 0x6

	// TLOW setpoint least significant byte 0x00 (10°C)
	RegTLOWLsbReg = 0x7

	// TCRIT setpoint most significant byte 0x49 (147°C)
	RegTCRITMsbReg = 0x8

	// TCRIT setpoint least significant byte 0x80 (147°C)
	RegTCRITLsbReg = 0x9

	// THYST setpoint 0x05 (5°C)
	RegTHYSTReg = 0xA

	// ID Register (0xCx)
	RegID = 0x0B

	// Software Reset Register
	RegReset = 0x2F
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Address uint8
	// contains filtered or unexported fields
}

func New

func New(i2c drivers.I2C) *Device

New returns ADT7410 device for the provided I2C bus using default address. of 0x48 (1001000). To use multiple ADT7410 devices, the last 2 bits of the address can be set using by connecting to the A1 and A0 pins to VDD or GND (for a total of up to 4 devices on a I2C bus). Also note that 10k pullups are recommended for the SDA and SCL lines.

func (*Device) Configure

func (d *Device) Configure() (err error)

Configure the ADT7410 device.

func (*Device) Connected added in v0.14.0

func (d *Device) Connected() bool

Connected returns whether sensor has been found.

func (*Device) ReadTempC

func (d *Device) ReadTempC() float32

ReadTempC returns the value in the temperature value register, in Celsius.

func (*Device) ReadTempF

func (d *Device) ReadTempF() float32

ReadTempF returns the value in the temperature value register, in Fahrenheit.

func (*Device) ReadTemperature

func (d *Device) ReadTemperature() (temperature int32, err error)

ReadTemperature returns the temperature in celsius milli degrees (°C/1000)

type Error

type Error uint8
const (
	ErrInvalidID Error = 0x1
)

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL