Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cap1xxx - add support to specify alternate i2c address (#111) #114

Merged

Conversation

Gadgetoid
Copy link
Contributor

The cap1xxx range support multiple i2c addresses which are used across our various boards- GFX HAT, Display-o-tron HAT, Drum HAT, Piano HAT, etc- this patch adds support for specifying an i2c address

See #111 for details.

/**
* Create a new Cap1xxx controller.
*
* @param i2cName I2C port name where the controller is attached. Cannot be null.
* @param i2cAddress 7-bit I2C address for the attached controller. Cannot be null.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int values cannot be null, I'd remove that phrase from the end.

* framework.
*
* @param i2cName I2C port name where the controller is attached. Cannot be null.
* @param i2cAddress 7-bit I2C address for the attached controller. Cannot be null.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int values cannot be null, I'd remove that phrase from the end.

* @throws IOException
*/
public Cap1xxx(String i2cName, String alertName, Configuration chip, Handler handler) throws IOException {
this(i2cName, I2C_ADDRESS, alertName, chip, handler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good change, but if we expose the I2C address as a parameter let's rename the constant to DEFAULT_I2C_ADDRESS to match our other drivers (example)

@@ -192,7 +192,7 @@ public Cap1xxx(Context context, String i2cName, String alertName, Configuration
}

/**
* Create a new Cap1xxx controller.
* Create a new Cap12xx controller with the default I2C address.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to Cap1xxx

@Gadgetoid
Copy link
Contributor Author

I believe all requested changes are made @devunwired

@devunwired devunwired merged commit aa3209b into androidthings:master Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants