mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-27 13:48:56 +08:00
i2c: correct godocs to match new constructor signatures with optional params
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
21bdf5aa26
commit
03eba3853e
@ -129,6 +129,13 @@ func (a *AdafruitMotorHatDriver) Connection() gobot.Connection { return a.connec
|
|||||||
|
|
||||||
// NewAdafruitMotorHatDriver initializes the internal DCMotor and StepperMotor types.
|
// NewAdafruitMotorHatDriver initializes the internal DCMotor and StepperMotor types.
|
||||||
// Again the Adafruit Motor Hat supports up to four DC motors and up to two stepper motors.
|
// Again the Adafruit Motor Hat supports up to four DC motors and up to two stepper motors.
|
||||||
|
// Params:
|
||||||
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
|
//
|
||||||
|
// Optional params:
|
||||||
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewAdafruitMotorHatDriver(conn I2cConnector, options ...func(I2cConfig)) *AdafruitMotorHatDriver {
|
func NewAdafruitMotorHatDriver(conn I2cConnector, options ...func(I2cConfig)) *AdafruitMotorHatDriver {
|
||||||
var dc []adaFruitDCMotor
|
var dc []adaFruitDCMotor
|
||||||
var st []adaFruitStepperMotor
|
var st []adaFruitStepperMotor
|
||||||
|
@ -19,11 +19,13 @@ type BlinkMDriver struct {
|
|||||||
|
|
||||||
// NewBlinkMDriver creates a new BlinkMDriver.
|
// NewBlinkMDriver creates a new BlinkMDriver.
|
||||||
//
|
//
|
||||||
// Adds the following API commands:
|
// Params:
|
||||||
// Rgb - sets RGB color
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
// Fade - fades the RGB color
|
//
|
||||||
// FirmwareVersion - returns the version of the current Frimware
|
// Optional params:
|
||||||
// Color - returns the color of the LED.
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewBlinkMDriver(a I2cConnector, options ...func(I2cConfig)) *BlinkMDriver {
|
func NewBlinkMDriver(a I2cConnector, options ...func(I2cConfig)) *BlinkMDriver {
|
||||||
b := &BlinkMDriver{
|
b := &BlinkMDriver{
|
||||||
name: gobot.DefaultName("BlinkM"),
|
name: gobot.DefaultName("BlinkM"),
|
||||||
|
@ -57,6 +57,13 @@ type calibrationCoefficients struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewBMP180Driver creates a new driver with the i2c interface for the BMP180 device.
|
// NewBMP180Driver creates a new driver with the i2c interface for the BMP180 device.
|
||||||
|
// Params:
|
||||||
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
|
//
|
||||||
|
// Optional params:
|
||||||
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewBMP180Driver(c I2cConnector, options ...func(I2cConfig)) *BMP180Driver {
|
func NewBMP180Driver(c I2cConnector, options ...func(I2cConfig)) *BMP180Driver {
|
||||||
b := &BMP180Driver{
|
b := &BMP180Driver{
|
||||||
name: gobot.DefaultName("BMP180"),
|
name: gobot.DefaultName("BMP180"),
|
||||||
|
@ -9,6 +9,13 @@ type GroveLcdDriver struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewGroveLcdDriver creates a new driver with specified i2c interface.
|
// NewGroveLcdDriver creates a new driver with specified i2c interface.
|
||||||
|
// Params:
|
||||||
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
|
//
|
||||||
|
// Optional params:
|
||||||
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewGroveLcdDriver(a I2cConnector, options ...func(I2cConfig)) *GroveLcdDriver {
|
func NewGroveLcdDriver(a I2cConnector, options ...func(I2cConfig)) *GroveLcdDriver {
|
||||||
lcd := &GroveLcdDriver{
|
lcd := &GroveLcdDriver{
|
||||||
JHD1313M1Driver: NewJHD1313M1Driver(a),
|
JHD1313M1Driver: NewJHD1313M1Driver(a),
|
||||||
|
@ -13,6 +13,13 @@ type HMC6352Driver struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewHMC6352Driver creates a new driver with specified i2c interface
|
// NewHMC6352Driver creates a new driver with specified i2c interface
|
||||||
|
// Params:
|
||||||
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
|
//
|
||||||
|
// Optional params:
|
||||||
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewHMC6352Driver(a I2cConnector, options ...func(I2cConfig)) *HMC6352Driver {
|
func NewHMC6352Driver(a I2cConnector, options ...func(I2cConfig)) *HMC6352Driver {
|
||||||
hmc := &HMC6352Driver{
|
hmc := &HMC6352Driver{
|
||||||
name: gobot.DefaultName("HMC6352"),
|
name: gobot.DefaultName("HMC6352"),
|
||||||
|
@ -14,10 +14,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Error = "error"
|
Error = "error"
|
||||||
Joystick = "joystick"
|
|
||||||
C = "c"
|
|
||||||
Z = "z"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -81,6 +81,12 @@ type JHD1313M1Driver struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewJHD1313M1Driver creates a new driver with specified i2c interface.
|
// NewJHD1313M1Driver creates a new driver with specified i2c interface.
|
||||||
|
// Params:
|
||||||
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
|
//
|
||||||
|
// Optional params:
|
||||||
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
//
|
||||||
func NewJHD1313M1Driver(a I2cConnector, options ...func(I2cConfig)) *JHD1313M1Driver {
|
func NewJHD1313M1Driver(a I2cConnector, options ...func(I2cConfig)) *JHD1313M1Driver {
|
||||||
j := &JHD1313M1Driver{
|
j := &JHD1313M1Driver{
|
||||||
name: gobot.DefaultName("JHD1313M1"),
|
name: gobot.DefaultName("JHD1313M1"),
|
||||||
|
@ -44,6 +44,13 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// NewL3GD20HDriver creates a new driver with the i2c interface for the L3GD20H device.
|
// NewL3GD20HDriver creates a new driver with the i2c interface for the L3GD20H device.
|
||||||
|
// Params:
|
||||||
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
|
//
|
||||||
|
// Optional params:
|
||||||
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewL3GD20HDriver(c I2cConnector, options ...func(I2cConfig)) *L3GD20HDriver {
|
func NewL3GD20HDriver(c I2cConnector, options ...func(I2cConfig)) *L3GD20HDriver {
|
||||||
l := &L3GD20HDriver{
|
l := &L3GD20HDriver{
|
||||||
name: gobot.DefaultName("L3GD20H"),
|
name: gobot.DefaultName("L3GD20H"),
|
||||||
|
@ -16,6 +16,13 @@ type LIDARLiteDriver struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewLIDARLiteDriver creates a new driver with specified i2c interface
|
// NewLIDARLiteDriver creates a new driver with specified i2c interface
|
||||||
|
// Params:
|
||||||
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
|
//
|
||||||
|
// Optional params:
|
||||||
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewLIDARLiteDriver(a I2cConnector, options ...func(I2cConfig)) *LIDARLiteDriver {
|
func NewLIDARLiteDriver(a I2cConnector, options ...func(I2cConfig)) *LIDARLiteDriver {
|
||||||
l := &LIDARLiteDriver{
|
l := &LIDARLiteDriver{
|
||||||
name: gobot.DefaultName("LIDARLite"),
|
name: gobot.DefaultName("LIDARLite"),
|
||||||
|
@ -86,6 +86,13 @@ type MCP23017Driver struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewMCP23017Driver creates a new driver with specified i2c interface.
|
// NewMCP23017Driver creates a new driver with specified i2c interface.
|
||||||
|
// Params:
|
||||||
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
|
//
|
||||||
|
// Optional params:
|
||||||
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewMCP23017Driver(a I2cConnector, conf MCP23017Config, deviceAddress int, options ...func(I2cConfig)) *MCP23017Driver {
|
func NewMCP23017Driver(a I2cConnector, conf MCP23017Config, deviceAddress int, options ...func(I2cConfig)) *MCP23017Driver {
|
||||||
m := &MCP23017Driver{
|
m := &MCP23017Driver{
|
||||||
name: gobot.DefaultName("MCP23017"),
|
name: gobot.DefaultName("MCP23017"),
|
||||||
|
@ -36,6 +36,13 @@ type MMA7660Driver struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewMMA7660Driver creates a new driver with specified i2c interface
|
// NewMMA7660Driver creates a new driver with specified i2c interface
|
||||||
|
// Params:
|
||||||
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
|
//
|
||||||
|
// Optional params:
|
||||||
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewMMA7660Driver(a I2cConnector, options ...func(I2cConfig)) *MMA7660Driver {
|
func NewMMA7660Driver(a I2cConnector, options ...func(I2cConfig)) *MMA7660Driver {
|
||||||
m := &MMA7660Driver{
|
m := &MMA7660Driver{
|
||||||
name: gobot.DefaultName("MMA7660"),
|
name: gobot.DefaultName("MMA7660"),
|
||||||
|
@ -40,6 +40,13 @@ type MPL115A2Driver struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewMPL115A2Driver creates a new driver with specified i2c interface
|
// NewMPL115A2Driver creates a new driver with specified i2c interface
|
||||||
|
// Params:
|
||||||
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
|
//
|
||||||
|
// Optional params:
|
||||||
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewMPL115A2Driver(a I2cConnector, options ...func(I2cConfig)) *MPL115A2Driver {
|
func NewMPL115A2Driver(a I2cConnector, options ...func(I2cConfig)) *MPL115A2Driver {
|
||||||
m := &MPL115A2Driver{
|
m := &MPL115A2Driver{
|
||||||
name: gobot.DefaultName("MPL115A2"),
|
name: gobot.DefaultName("MPL115A2"),
|
||||||
|
@ -45,6 +45,13 @@ type MPU6050Driver struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewMPU6050Driver creates a new driver with specified i2c interface
|
// NewMPU6050Driver creates a new driver with specified i2c interface
|
||||||
|
// Params:
|
||||||
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
|
//
|
||||||
|
// Optional params:
|
||||||
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewMPU6050Driver(a I2cConnector, options ...func(I2cConfig)) *MPU6050Driver {
|
func NewMPU6050Driver(a I2cConnector, options ...func(I2cConfig)) *MPU6050Driver {
|
||||||
m := &MPU6050Driver{
|
m := &MPU6050Driver{
|
||||||
name: gobot.DefaultName("MPU6050"),
|
name: gobot.DefaultName("MPU6050"),
|
||||||
|
@ -66,6 +66,13 @@ type SHT3xDriver struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSHT3xDriver creates a new driver with specified i2c interface
|
// NewSHT3xDriver creates a new driver with specified i2c interface
|
||||||
|
// Params:
|
||||||
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
|
//
|
||||||
|
// Optional params:
|
||||||
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewSHT3xDriver(a I2cConnector, options ...func(I2cConfig)) *SHT3xDriver {
|
func NewSHT3xDriver(a I2cConnector, options ...func(I2cConfig)) *SHT3xDriver {
|
||||||
s := &SHT3xDriver{
|
s := &SHT3xDriver{
|
||||||
Units: "C",
|
Units: "C",
|
||||||
|
@ -6,6 +6,17 @@ import (
|
|||||||
"gobot.io/x/gobot"
|
"gobot.io/x/gobot"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Joystick event when the Wiichuck joystick is moved
|
||||||
|
Joystick = "joystick"
|
||||||
|
|
||||||
|
// C event when the Wiichuck "C" button is pressed
|
||||||
|
C = "c"
|
||||||
|
|
||||||
|
// Z event when the Wiichuck "C" button is pressed
|
||||||
|
Z = "z"
|
||||||
|
)
|
||||||
|
|
||||||
const wiichuckAddress = 0x52
|
const wiichuckAddress = 0x52
|
||||||
|
|
||||||
type WiichuckDriver struct {
|
type WiichuckDriver struct {
|
||||||
@ -22,11 +33,13 @@ type WiichuckDriver struct {
|
|||||||
|
|
||||||
// NewWiichuckDriver creates a WiichuckDriver with specified i2c interface.
|
// NewWiichuckDriver creates a WiichuckDriver with specified i2c interface.
|
||||||
//
|
//
|
||||||
// It adds the following events:
|
// Params:
|
||||||
// "z"- Gets triggered every interval amount of time if the z button is pressed
|
// conn I2cConnector - the Adaptor to use with this Driver
|
||||||
// "c" - Gets triggered every interval amount of time if the c button is pressed
|
//
|
||||||
// "joystick" - Gets triggered every "interval" amount of time if a joystick event occurred, you can access values x, y
|
// Optional params:
|
||||||
// "error" - Gets triggered whenever the WiichuckDriver encounters an error
|
// i2c.Bus(int): bus to use with this driver
|
||||||
|
// i2c.Address(int): address to use with this driver
|
||||||
|
//
|
||||||
func NewWiichuckDriver(a I2cConnector, options ...func(I2cConfig)) *WiichuckDriver {
|
func NewWiichuckDriver(a I2cConnector, options ...func(I2cConfig)) *WiichuckDriver {
|
||||||
w := &WiichuckDriver{
|
w := &WiichuckDriver{
|
||||||
name: gobot.DefaultName("Wiichuck"),
|
name: gobot.DefaultName("Wiichuck"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user