bmp085

package module
v0.0.0-...-18d1e3a Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2014 License: Apache-2.0 Imports: 4 Imported by: 0

README

go-bmp085

A go library to interact with the BMP085 Temperature/Pressure Sensor.

NOTE: This has only been tested on a Raspberry Pi.

Usage

import ("github.com/mschoch/go-bmp085")

// choose which i2c bus to use
var i2cbus byte = 1

// create the device
d := new(bmp085.Device)

// initialize it
_ := d.Init(i2cbus)

// read the temperature
temp, _ := d.ReadTemp()

Examples

There is one example app showing how to read the temperature. (you may need to be root to read the i2c bus)

$ sudo ./read_temperature 
Temp is 20.900000C

Documentation

Index

Constants

View Source
const (
	ULTRALOWPOWER byte = iota
	STANDARD
	HIGHRES
	ULTRAHIGHRES
)
View Source
const CAL_AC1 byte = 0xAA
View Source
const CAL_AC2 byte = 0xAC
View Source
const CAL_AC3 byte = 0xAE
View Source
const CAL_AC4 byte = 0xB0
View Source
const CAL_AC5 byte = 0xB2
View Source
const CAL_AC6 byte = 0xB4
View Source
const CAL_B1 byte = 0xB6
View Source
const CAL_B2 byte = 0xB8
View Source
const CAL_MB byte = 0xBA
View Source
const CAL_MC byte = 0xBC
View Source
const CAL_MD byte = 0xBE
View Source
const CONTROL = 0xF4
View Source
const I2C_ADDR = 0x77
View Source
const PRESSURE_DATA = 0xF6
View Source
const READ_PRESSURE_CMD = 0x34
View Source
const READ_TEMP_CMD = 0x2E
View Source
const TEMP_DATA = 0xF6
View Source
const TO_INCHES_MERCURY = 3386.389

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

func (*Device) Init

func (d *Device) Init(busNum byte) (err error)

func (*Device) InitCustomAddr

func (d *Device) InitCustomAddr(addr, busNum byte) (err error)

func (*Device) ReadPressure

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

func (*Device) ReadTemp

func (d *Device) ReadTemp() (temp float32, err error)

func (*Device) SetMode

func (d *Device) SetMode(mode byte)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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