ds18b20

package
v0.0.0-...-0087ba1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package ds18b20 provides a driver for the DS18B20 digital thermometer

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

Index

Constants

View Source
const (
	CONVERT_TEMPERATURE uint8 = 0x44
	READ_SCRATCHPAD     uint8 = 0xBE
	WRITE_SCRATCHPAD    uint8 = 0x4E
)

Device ROM commands

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

Device wraps a connection to an 1-Wire devices.

func New

func New(owd OneWireDevice) Device

func (Device) Configure

func (d Device) Configure()

Configure. Initializes the device, left for compatibility reasons.

func (Device) ReadTemperature

func (d Device) ReadTemperature(romid []uint8) (int32, error)

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

func (Device) ReadTemperatureRaw

func (d Device) ReadTemperatureRaw(romid []uint8) ([]uint8, error)

ReadTemperatureRaw returns the raw temperature. ScratchPad memory map: byte 0: Temperature LSB byte 1: Temperature MSB

func (Device) RequestTemperature

func (d Device) RequestTemperature(romid []uint8)

RequestTemperature sends request to device

func (Device) ThermometerResolution

func (d Device) ThermometerResolution(romid []uint8, resolution uint8)

ThermometerResolution sets thermometer resolution from 9 to 12 bits

type OneWireDevice

type OneWireDevice interface {
	Write(uint8)
	Read() uint8
	Select([]uint8) error
	Сrc8([]uint8, int) uint8
}

Jump to

Keyboard shortcuts

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