mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-15 12:23:41 +00:00
apply @gen2thomas suggestions
This commit is contained in:
committed by
deadprogram
parent
5d1bc2fc36
commit
c815f2560e
+7
-7
@@ -12,10 +12,10 @@ import (
|
||||
|
||||
// Device wraps FT6336 I2C Self-Capacitive touch
|
||||
type Device struct {
|
||||
bus drivers.I2C
|
||||
buf []byte
|
||||
Address uint8
|
||||
config func()
|
||||
bus drivers.I2C
|
||||
buf []byte
|
||||
Address uint8
|
||||
configurePins func()
|
||||
}
|
||||
|
||||
// New returns FT6336 device for the provided I2C bus using default address.
|
||||
@@ -24,7 +24,7 @@ func New(i2c drivers.I2C, intPin legacy.PinInput) *Device {
|
||||
bus: i2c,
|
||||
buf: make([]byte, 11),
|
||||
Address: Address,
|
||||
config: func() {
|
||||
configurePins: func() {
|
||||
legacy.ConfigurePinInputPulldown(intPin)
|
||||
},
|
||||
}
|
||||
@@ -36,11 +36,11 @@ type Config struct {
|
||||
|
||||
// Configure the FT6336 device.
|
||||
func (d *Device) Configure(config Config) error {
|
||||
if d.config == nil {
|
||||
if d.configurePins == nil {
|
||||
return legacy.ErrConfigBeforeInstantiated
|
||||
}
|
||||
d.write1Byte(0xA4, 0x00)
|
||||
d.config()
|
||||
d.configurePins()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user