From 03eba3853e5ad636daa08b81eaf8b74384fe1669 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Thu, 9 Feb 2017 16:47:11 +0100 Subject: [PATCH] i2c: correct godocs to match new constructor signatures with optional params Signed-off-by: deadprogram --- drivers/i2c/adafruit_driver.go | 7 +++++++ drivers/i2c/blinkm_driver.go | 12 +++++++----- drivers/i2c/bmp180_driver.go | 7 +++++++ drivers/i2c/grove_drivers.go | 7 +++++++ drivers/i2c/hmc6352_driver.go | 7 +++++++ drivers/i2c/i2c.go | 5 +---- drivers/i2c/jhd1313m1_driver.go | 6 ++++++ drivers/i2c/l3gd20h_driver.go | 7 +++++++ drivers/i2c/lidarlite_driver.go | 7 +++++++ drivers/i2c/mcp23017_driver.go | 7 +++++++ drivers/i2c/mma7660_driver.go | 7 +++++++ drivers/i2c/mpl115a2_driver.go | 7 +++++++ drivers/i2c/mpu6050_driver.go | 7 +++++++ drivers/i2c/sht3x_driver.go | 7 +++++++ drivers/i2c/wiichuck_driver.go | 23 ++++++++++++++++++----- 15 files changed, 109 insertions(+), 14 deletions(-) diff --git a/drivers/i2c/adafruit_driver.go b/drivers/i2c/adafruit_driver.go index 1aa7065d..d67ad622 100644 --- a/drivers/i2c/adafruit_driver.go +++ b/drivers/i2c/adafruit_driver.go @@ -129,6 +129,13 @@ func (a *AdafruitMotorHatDriver) Connection() gobot.Connection { return a.connec // 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. +// 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 { var dc []adaFruitDCMotor var st []adaFruitStepperMotor diff --git a/drivers/i2c/blinkm_driver.go b/drivers/i2c/blinkm_driver.go index 5fe5a4dd..cd4c926d 100644 --- a/drivers/i2c/blinkm_driver.go +++ b/drivers/i2c/blinkm_driver.go @@ -19,11 +19,13 @@ type BlinkMDriver struct { // NewBlinkMDriver creates a new BlinkMDriver. // -// 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. +// 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 NewBlinkMDriver(a I2cConnector, options ...func(I2cConfig)) *BlinkMDriver { b := &BlinkMDriver{ name: gobot.DefaultName("BlinkM"), diff --git a/drivers/i2c/bmp180_driver.go b/drivers/i2c/bmp180_driver.go index 19eb2260..0e63402c 100644 --- a/drivers/i2c/bmp180_driver.go +++ b/drivers/i2c/bmp180_driver.go @@ -57,6 +57,13 @@ type calibrationCoefficients struct { } // 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 { b := &BMP180Driver{ name: gobot.DefaultName("BMP180"), diff --git a/drivers/i2c/grove_drivers.go b/drivers/i2c/grove_drivers.go index c5baf70b..9d094ddd 100644 --- a/drivers/i2c/grove_drivers.go +++ b/drivers/i2c/grove_drivers.go @@ -9,6 +9,13 @@ type GroveLcdDriver struct { } // 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 { lcd := &GroveLcdDriver{ JHD1313M1Driver: NewJHD1313M1Driver(a), diff --git a/drivers/i2c/hmc6352_driver.go b/drivers/i2c/hmc6352_driver.go index 457e841b..a5217ba2 100644 --- a/drivers/i2c/hmc6352_driver.go +++ b/drivers/i2c/hmc6352_driver.go @@ -13,6 +13,13 @@ type HMC6352Driver struct { } // 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 { hmc := &HMC6352Driver{ name: gobot.DefaultName("HMC6352"), diff --git a/drivers/i2c/i2c.go b/drivers/i2c/i2c.go index fc9c5220..949ae736 100644 --- a/drivers/i2c/i2c.go +++ b/drivers/i2c/i2c.go @@ -14,10 +14,7 @@ var ( ) const ( - Error = "error" - Joystick = "joystick" - C = "c" - Z = "z" + Error = "error" ) const ( diff --git a/drivers/i2c/jhd1313m1_driver.go b/drivers/i2c/jhd1313m1_driver.go index 0ee6057a..36fcaf61 100644 --- a/drivers/i2c/jhd1313m1_driver.go +++ b/drivers/i2c/jhd1313m1_driver.go @@ -81,6 +81,12 @@ type JHD1313M1Driver struct { } // 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 { j := &JHD1313M1Driver{ name: gobot.DefaultName("JHD1313M1"), diff --git a/drivers/i2c/l3gd20h_driver.go b/drivers/i2c/l3gd20h_driver.go index e4d8a32c..86773279 100644 --- a/drivers/i2c/l3gd20h_driver.go +++ b/drivers/i2c/l3gd20h_driver.go @@ -44,6 +44,13 @@ const ( ) // 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 { l := &L3GD20HDriver{ name: gobot.DefaultName("L3GD20H"), diff --git a/drivers/i2c/lidarlite_driver.go b/drivers/i2c/lidarlite_driver.go index bcb9cfce..bd88ac5b 100644 --- a/drivers/i2c/lidarlite_driver.go +++ b/drivers/i2c/lidarlite_driver.go @@ -16,6 +16,13 @@ type LIDARLiteDriver struct { } // 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 { l := &LIDARLiteDriver{ name: gobot.DefaultName("LIDARLite"), diff --git a/drivers/i2c/mcp23017_driver.go b/drivers/i2c/mcp23017_driver.go index 55bc3ef1..ccd74d42 100644 --- a/drivers/i2c/mcp23017_driver.go +++ b/drivers/i2c/mcp23017_driver.go @@ -86,6 +86,13 @@ type MCP23017Driver struct { } // 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 { m := &MCP23017Driver{ name: gobot.DefaultName("MCP23017"), diff --git a/drivers/i2c/mma7660_driver.go b/drivers/i2c/mma7660_driver.go index 5002360c..4e3574d7 100644 --- a/drivers/i2c/mma7660_driver.go +++ b/drivers/i2c/mma7660_driver.go @@ -36,6 +36,13 @@ type MMA7660Driver struct { } // 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 { m := &MMA7660Driver{ name: gobot.DefaultName("MMA7660"), diff --git a/drivers/i2c/mpl115a2_driver.go b/drivers/i2c/mpl115a2_driver.go index 2ffda2c0..6ae7b5a8 100644 --- a/drivers/i2c/mpl115a2_driver.go +++ b/drivers/i2c/mpl115a2_driver.go @@ -40,6 +40,13 @@ type MPL115A2Driver struct { } // 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 { m := &MPL115A2Driver{ name: gobot.DefaultName("MPL115A2"), diff --git a/drivers/i2c/mpu6050_driver.go b/drivers/i2c/mpu6050_driver.go index 74ae4a25..4ecde457 100644 --- a/drivers/i2c/mpu6050_driver.go +++ b/drivers/i2c/mpu6050_driver.go @@ -45,6 +45,13 @@ type MPU6050Driver struct { } // 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 { m := &MPU6050Driver{ name: gobot.DefaultName("MPU6050"), diff --git a/drivers/i2c/sht3x_driver.go b/drivers/i2c/sht3x_driver.go index 3b4cead5..32aacdf8 100644 --- a/drivers/i2c/sht3x_driver.go +++ b/drivers/i2c/sht3x_driver.go @@ -66,6 +66,13 @@ type SHT3xDriver struct { } // 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 { s := &SHT3xDriver{ Units: "C", diff --git a/drivers/i2c/wiichuck_driver.go b/drivers/i2c/wiichuck_driver.go index 24d0f1d6..1b84b0c4 100644 --- a/drivers/i2c/wiichuck_driver.go +++ b/drivers/i2c/wiichuck_driver.go @@ -6,6 +6,17 @@ import ( "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 type WiichuckDriver struct { @@ -22,11 +33,13 @@ type WiichuckDriver struct { // NewWiichuckDriver creates a WiichuckDriver with specified i2c interface. // -// It adds the following events: -// "z"- Gets triggered every interval amount of time if the z button is pressed -// "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 -// "error" - Gets triggered whenever the WiichuckDriver encounters an error +// 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 NewWiichuckDriver(a I2cConnector, options ...func(I2cConfig)) *WiichuckDriver { w := &WiichuckDriver{ name: gobot.DefaultName("Wiichuck"),