tmp102

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: 1 Imported by: 9

Documentation

Index

Constants

View Source
const (
	// Default I2C address
	Address = 0x48

	// Temperature register address
	RegTemperature = 0x00

	// Configuration register address
	RegConfiguration = 0x01

	// Low limit register address
	RegLimitLow = 0x02

	// High limit register address
	RegLimitHigh = 0x03
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address uint8
}

Config is the configuration for the TMP102.

type Device

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

Device holds the already configured I2C bus and the address of the sensor.

func New

func New(bus drivers.I2C) Device

New creates a new TMP102 connection. The I2C bus must already be configured.

func (*Device) Configure

func (d *Device) Configure(cfg Config)

Configure initializes the sensor with the given parameters.

func (*Device) Connected added in v0.13.0

func (d *Device) Connected() bool

Connected checks if the config register can be read and that the configuration is correct.

func (*Device) ReadTemperature

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

Reads the temperature from the sensor and returns it in celsius milli degrees (°C/1000).

Jump to

Keyboard shortcuts

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