From 4d628eebbcc6750a31e8ff9d0153e17b43de9752 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Fri, 2 Dec 2016 00:01:05 +0100 Subject: [PATCH] chip: correct ]base for new 4.4 GPIO Signed-off-by: deadprogram --- examples/chip_blink.go | 2 +- platforms/chip/chip_adaptor.go | 16 ++++++++-------- platforms/chip/chip_adaptor_test.go | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/chip_blink.go b/examples/chip_blink.go index 01de5f76..0a629178 100644 --- a/examples/chip_blink.go +++ b/examples/chip_blink.go @@ -10,7 +10,7 @@ import ( func main() { chipAdaptor := chip.NewAdaptor() - led := gpio.NewLedDriver(chipAdaptor, "XIO-P0") + led := gpio.NewLedDriver(chipAdaptor, "XIO-P6") work := func() { gobot.Every(1*time.Second, func() { diff --git a/platforms/chip/chip_adaptor.go b/platforms/chip/chip_adaptor.go index ad3ba800..b3c14aad 100644 --- a/platforms/chip/chip_adaptor.go +++ b/platforms/chip/chip_adaptor.go @@ -29,14 +29,14 @@ var pinsOriginal = map[string]int{ } var pins44 = map[string]int{ - "XIO-P0": 1016, - "XIO-P1": 1017, - "XIO-P2": 1018, - "XIO-P3": 1019, - "XIO-P4": 1020, - "XIO-P5": 1021, - "XIO-P6": 1022, - "XIO-P7": 1023, + "XIO-P0": 1013, + "XIO-P1": 1014, + "XIO-P2": 1015, + "XIO-P3": 1016, + "XIO-P4": 1017, + "XIO-P5": 1018, + "XIO-P6": 1019, + "XIO-P7": 1020, } // NewAdaptor creates a C.H.I.P. Adaptor diff --git a/platforms/chip/chip_adaptor_test.go b/platforms/chip/chip_adaptor_test.go index 749e4fbb..e2f3e9ed 100644 --- a/platforms/chip/chip_adaptor_test.go +++ b/platforms/chip/chip_adaptor_test.go @@ -55,18 +55,18 @@ func TestChipAdaptorDigitalIO(t *testing.T) { fs := sysfs.NewMockFilesystem([]string{ "/sys/class/gpio/export", "/sys/class/gpio/unexport", - "/sys/class/gpio/gpio1016/value", - "/sys/class/gpio/gpio1016/direction", - "/sys/class/gpio/gpio1023/value", - "/sys/class/gpio/gpio1023/direction", + "/sys/class/gpio/gpio1013/value", + "/sys/class/gpio/gpio1013/direction", + "/sys/class/gpio/gpio1020/value", + "/sys/class/gpio/gpio1020/direction", }) sysfs.SetFilesystem(fs) a.DigitalWrite("XIO-P0", 1) - gobottest.Assert(t, fs.Files["/sys/class/gpio/gpio1016/value"].Contents, "1") + gobottest.Assert(t, fs.Files["/sys/class/gpio/gpio1013/value"].Contents, "1") - fs.Files["/sys/class/gpio/gpio1023/value"].Contents = "1" + fs.Files["/sys/class/gpio/gpio1020/value"].Contents = "1" i, _ := a.DigitalRead("XIO-P7") gobottest.Assert(t, i, 1)