Open Gadgetoid opened 5 years ago
@Gadgetoid Thanks for the report! PR are always welcome.
Looking at the existing tests: https://github.com/androidthings/contrib-drivers/blob/master/cap12xx/src/test/java/com/google/android/things/contrib/driver/cap12xx/Cap12xxTest.java https://github.com/androidthings/contrib-drivers/blob/master/cap12xx/src/androidTest/java/com/google/android/things/contrib/driver/cap12xx/Cap12xxTestActivity.java It doesn't seems that we have any coverage for the public constructors, so I'm not sure it would be required to add new ones, but @jdkoren is the authority there :)
I think for now don't worry about adding tests just for the constructors.
While sitting down with @proppy yesterday and getting something of a crash course in building drivers for Things, we ran into an omission in the cap1xxx library.
The cap1xxx range support at least 5 different i2c address that I'm aware of, via the use of a pull-down address select resistor:
The hard-coded address needs substituting with an optional constructor for supplying one of the above resistor-selected values:
https://github.com/androidthings/contrib-drivers/blob/69d9317e6222f334afbfc62420dd87e399bb2988/cap12xx/src/main/java/com/google/android/things/contrib/driver/cap12xx/Cap12xx.java#L231
I have local code working with alternate i2c addresses (Pimoroni Drum HAT uses
0x2c
) which looks like this:I'm happy to raise a PR, but since this is my first Java rodeo my code may be a little rough around the edges and I'm currently missing tests for this feature.