Documentation ¶
Overview ¶
Package i2c provides Gobot drivers for i2c devices.
Installing:
go get github.com/hybridgroup/gobot/platforms/i2c
For further information refer to i2c README: https://github.com/hybridgroup/gobot/blob/master/platforms/i2c/README.md
Index ¶
- Constants
- type BlinkMDriver
- func (b *BlinkMDriver) Color() []byte
- func (b *BlinkMDriver) Fade(red byte, green byte, blue byte)
- func (b *BlinkMDriver) FirmwareVersion() string
- func (b *BlinkMDriver) Halt() bool
- func (b *BlinkMDriver) Init() bool
- func (b *BlinkMDriver) Rgb(red byte, green byte, blue byte)
- func (b *BlinkMDriver) Start() bool
- type HMC6352Driver
- type I2cInterface
- type MPL115A2Driver
- type MPU6050Driver
- type ThreeDData
- type WiichuckDriver
Constants ¶
const MPL115A2_REGISTER_A0_COEFF_LSB = 0x05
const MPL115A2_REGISTER_A0_COEFF_MSB = 0x04
const MPL115A2_REGISTER_B1_COEFF_LSB = 0x07
const MPL115A2_REGISTER_B1_COEFF_MSB = 0x06
const MPL115A2_REGISTER_B2_COEFF_LSB = 0x09
const MPL115A2_REGISTER_B2_COEFF_MSB = 0x08
const MPL115A2_REGISTER_C12_COEFF_LSB = 0x0B
const MPL115A2_REGISTER_C12_COEFF_MSB = 0x0A
const MPL115A2_REGISTER_PRESSURE_LSB = 0x01
const MPL115A2_REGISTER_PRESSURE_MSB = 0x00
const MPL115A2_REGISTER_STARTCONVERSION = 0x12
const MPL115A2_REGISTER_TEMP_LSB = 0x03
const MPL115A2_REGISTER_TEMP_MSB = 0x02
const MPU6050_ACCEL_FS_2 = 0x00
const MPU6050_ACONFIG_AFS_SEL_BIT = 4
const MPU6050_ACONFIG_AFS_SEL_LENGTH = 2
const MPU6050_CLOCK_PLL_XGYRO = 0x01
const MPU6050_GCONFIG_FS_SEL_BIT = 4
const MPU6050_GCONFIG_FS_SEL_LENGTH = 2
const MPU6050_GYRO_FS_250 = 0x00
const MPU6050_PWR1_CLKSEL_BIT = 2
const MPU6050_PWR1_CLKSEL_LENGTH = 3
const MPU6050_PWR1_SLEEP_BIT = 6
const MPU6050_RA_ACCEL_CONFIG = 0x1C
const MPU6050_RA_ACCEL_XOUT_H = 0x3B
const MPU6050_RA_GYRO_CONFIG = 0x1B
const MPU6050_RA_PWR_MGMT_1 = 0x6B
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlinkMDriver ¶
func NewBlinkMDriver ¶
func NewBlinkMDriver(a I2cInterface, name string) *BlinkMDriver
NewBlinkMDriver creates a new BlinkMDriver with specified name.
Adds the following API commands:
Rgb - sets RGB color Fade - fades the RGB color FirmwareVersion - returns the version of the current Frimware Color - returns the color of the LED.
func (*BlinkMDriver) Color ¶
func (b *BlinkMDriver) Color() []byte
Color returns an array with current rgb color
func (*BlinkMDriver) Fade ¶
func (b *BlinkMDriver) Fade(red byte, green byte, blue byte)
Fade removes color using r,g,b params
func (*BlinkMDriver) FirmwareVersion ¶
func (b *BlinkMDriver) FirmwareVersion() string
FirmwareVersion returns version with MAYOR.minor format
func (*BlinkMDriver) Halt ¶
func (b *BlinkMDriver) Halt() bool
Halt returns true if device is halted successfully
func (*BlinkMDriver) Init ¶
func (b *BlinkMDriver) Init() bool
Init returns true if device is initialized correctly
func (*BlinkMDriver) Rgb ¶
func (b *BlinkMDriver) Rgb(red byte, green byte, blue byte)
Rgb sets color using r,g,b params
func (*BlinkMDriver) Start ¶
func (b *BlinkMDriver) Start() bool
Start writes start bytes and resets color
type HMC6352Driver ¶
func NewHMC6352Driver ¶
func NewHMC6352Driver(a I2cInterface, name string) *HMC6352Driver
NewHMC6352Driver creates a new driver with specified name and i2c interface
func (*HMC6352Driver) Halt ¶
func (h *HMC6352Driver) Halt() bool
Halt returns true if devices is halted successfully
func (*HMC6352Driver) Init ¶
func (h *HMC6352Driver) Init() bool
Init returns true if device is initialized correctly
func (*HMC6352Driver) Start ¶
func (h *HMC6352Driver) Start() bool
Start writes initialization bytes and reads from adaptor using specified interval to update Heading
type I2cInterface ¶
type MPL115A2Driver ¶
type MPL115A2Driver struct { gobot.Driver A0 float32 B1 float32 B2 float32 C12 float32 Pressure float32 Temperature float32 }
func NewMPL115A2Driver ¶
func NewMPL115A2Driver(a I2cInterface, name string) *MPL115A2Driver
NewMPL115A2Driver creates a new driver with specified name and i2c interface
func (*MPL115A2Driver) Halt ¶
func (h *MPL115A2Driver) Halt() bool
Halt returns true if devices is halted successfully
func (*MPL115A2Driver) Init ¶
func (h *MPL115A2Driver) Init() bool
Init returns true if device is initialized correctly
func (*MPL115A2Driver) Start ¶
func (h *MPL115A2Driver) Start() bool
Start writes initialization bytes and reads from adaptor using specified interval to accelerometer andtemperature data
type MPU6050Driver ¶
type MPU6050Driver struct { gobot.Driver Accelerometer ThreeDData Gyroscope ThreeDData Temperature int16 }
func NewMPU6050Driver ¶
func NewMPU6050Driver(a I2cInterface, name string) *MPU6050Driver
NewMPU6050Driver creates a new driver with specified name and i2c interface
func (*MPU6050Driver) Halt ¶
func (h *MPU6050Driver) Halt() bool
Halt returns true if devices is halted successfully
func (*MPU6050Driver) Init ¶
func (h *MPU6050Driver) Init() bool
Init returns true if device is initialized correctly
func (*MPU6050Driver) Start ¶
func (h *MPU6050Driver) Start() bool
Start writes initialization bytes and reads from adaptor using specified interval to accelerometer andtemperature data
type ThreeDData ¶
type WiichuckDriver ¶
func NewWiichuckDriver ¶
func NewWiichuckDriver(a I2cInterface, name string) *WiichuckDriver
NewWiichuckDriver creates a WiichuckDriver with specified i2c interface and name.
It adds the following events:
"z"- Get's triggered every interval amount of time if the z button is pressed "c" - Get's triggered every interval amount of time if the c button is pressed "joystick" - Get's triggered every "interval" amount of time if a joystick event occured, you can access values x, y
func (*WiichuckDriver) Halt ¶
func (w *WiichuckDriver) Halt() bool
Halt returns true if driver is halted successfully
func (*WiichuckDriver) Init ¶
func (w *WiichuckDriver) Init() bool
Init returns true if driver is initialized correctly
func (*WiichuckDriver) Start ¶
func (w *WiichuckDriver) Start() bool
Start initilizes i2c and reads from adaptor using specified interval to update with new value