1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-08 19:29:16 +08:00

i2c: add some additional comments for godocs awesomeeness

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2017-02-11 12:34:51 +01:00
parent 313d6664d1
commit 11a7587f09
5 changed files with 22 additions and 17 deletions

View File

@ -29,16 +29,6 @@ const (
BMP180UltraHighResolution
)
// BMP180Driver is the gobot driver for the Bosch pressure sensor BMP180.
// Device datasheet: https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf
type BMP180Driver struct {
name string
connector Connector
connection Connection
Config
calibrationCoefficients *calibrationCoefficients
}
// BMP180OversamplingMode is the oversampling ratio of the pressure measurement.
type BMP180OversamplingMode uint
@ -56,6 +46,16 @@ type calibrationCoefficients struct {
md int16
}
// BMP180Driver is the gobot driver for the Bosch pressure sensor BMP180.
// Device datasheet: https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf
type BMP180Driver struct {
name string
connector Connector
connection Connection
Config
calibrationCoefficients *calibrationCoefficients
}
// NewBMP180Driver creates a new driver with the i2c interface for the BMP180 device.
// Params:
// conn Connector - the Adaptor to use with this Driver

View File

@ -30,6 +30,9 @@ const (
L3GD20HScale2000dps L3GD20HScale = 0x30
)
// L3GD20HScale is the scale sensitivity of degrees-per-second.
type L3GD20HScale byte
// L3GD20HDriver is the gobot driver for the Adafruit Triple-Axis Gyroscope L3GD20H.
// Device datasheet: http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/DM00036465.pdf
type L3GD20HDriver struct {
@ -40,10 +43,9 @@ type L3GD20HDriver struct {
scale L3GD20HScale
}
// L3GD20HScale is the scale sensitivity of degrees-per-second.
type L3GD20HScale byte
// NewL3GD20HDriver creates a new driver with the i2c interface for the L3GD20H device.
// NewL3GD20HDriver creates a new Gobot driver for the
// L3GD20H I2C Triple-Axis Gyroscope.
//
// Params:
// conn Connector - the Adaptor to use with this Driver
//

View File

@ -8,6 +8,7 @@ import (
const lidarliteAddress = 0x62
// LIDARLiteDriver is the Gobot driver for the LIDARLite I2C LIDAR device.
type LIDARLiteDriver struct {
name string
connector Connector
@ -15,7 +16,8 @@ type LIDARLiteDriver struct {
Config
}
// NewLIDARLiteDriver creates a new driver with specified i2c interface
// NewLIDARLiteDriver creates a new driver for the LIDARLite I2C LIDAR device.
//
// Params:
// conn Connector - the Adaptor to use with this Driver
//

View File

@ -95,12 +95,12 @@ func (h *MMA7660Driver) Start() (err error) {
// Halt returns true if devices is halted successfully
func (h *MMA7660Driver) Halt() (err error) { return }
// Acceleration returns the acceleration of the provided x, y, z
// Acceleration returns the acceleration of the provided x, y, z
func (h *MMA7660Driver) Acceleration(x, y, z float64) (ax, ay, az float64) {
return x / 21.0, y / 21.0, z / 21.0
}
// XYZ returns the raw x,y and z axis from the mma7660
// XYZ returns the raw x,y and z axis from the mma7660
func (h *MMA7660Driver) XYZ() (x float64, y float64, z float64, err error) {
buf := []byte{0, 0, 0}
bytesRead, err := h.connection.Read(buf)

View File

@ -32,6 +32,7 @@ type ThreeDData struct {
Z int16
}
// MPU6050Driver is a new Gobot Driver for an MPU6050 I2C Accelerometer/Gyroscope.
type MPU6050Driver struct {
name string
connector Connector