lps22hb

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: BSD-3-Clause Imports: 1 Imported by: 2

Documentation

Overview

Package lps22hb implements a driver for LPS22HB, a MEMS nano pressure sensor.

Datasheet: https://www.st.com/resource/en/datasheet/dm00140895.pdf

Index

Constants

View Source
const (

	// I2C address
	LPS22HB_ADDRESS = 0x5C

	// control/status registers
	LPS22HB_WHO_AM_I_REG  = 0x0F
	LPS22HB_CTRL1_REG     = 0x10
	LPS22HB_CTRL2_REG     = 0x11
	LPS22HB_STATUS_REG    = 0x27
	LPS22HB_PRESS_OUT_REG = 0x28
	LPS22HB_TEMP_OUT_REG  = 0x2B
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

Device wraps an I2C connection to a HTS221 device.

func New

func New(bus drivers.I2C) Device

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

This function only creates the Device object, it does not touch the device.

func (*Device) Configure

func (d *Device) Configure()

Configure sets up the LPS22HB device for communication.

func (*Device) Connected

func (d *Device) Connected() bool

Connected returns whether LPS22HB has been found. It does a "who am I" request and checks the response.

func (*Device) ReadPressure

func (d *Device) ReadPressure() (pressure int32, err error)

ReadPressure returns the pressure in milli pascals (mPa).

func (*Device) ReadTemperature

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

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

Jump to

Keyboard shortcuts

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