bmp180

package
Version: v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: BSD-3-Clause Imports: 2 Imported by: 9

Documentation

Overview

Package bmp180 provides a driver for the BMP180 digital pressure sensor by Bosch.

Datasheet: https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf

Index

Constants

View Source
const (
	AC1_MSB          = 0xAA // Calibration coefficients start at 0xAA ends at 0xBF
	CMD_TEMP         = 0x2E
	CMD_PRESSURE     = 0x34
	REG_CTRL         = 0xF4
	REG_TEMP_MSB     = 0xF6
	REG_PRESSURE_MSB = 0xF6

	WHO_AM_I = 0xD0
	CHIP_ID  = 0x55
)

Registers. Names, addresses and comments copied from the datasheet.

View Source
const Address = 0x77

The I2C address which this device listens to.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

Device wraps an I2C connection to a BMP180 device.

func New

func New(bus drivers.I2C) Device

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

This function only creates the Device object, it does not initialize the device. You must call Configure() first in order to use the device itself.

func (*Device) Configure

func (d *Device) Configure()

Configure sets up the device for communication and read the calibration coefficients.

func (*Device) Connected

func (d *Device) Connected() bool

Connected returns whether a BMP180 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).

type OversamplingMode

type OversamplingMode uint

OversamplingMode is the oversampling ratio of the pressure measurement.

const (
	// ULTRALOWPOWER is the lowest oversampling mode of the pressure measurement.
	ULTRALOWPOWER OversamplingMode = iota
	// BSTANDARD is the standard oversampling mode of the pressure measurement.
	STANDARD
	// HIGHRESOLUTION is a high oversampling mode of the pressure measurement.
	HIGHRESOLUTION
	// ULTRAHIGHRESOLUTION is the highest oversampling mode of the pressure measurement.
	ULTRAHIGHRESOLUTION
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL