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

added support for the Intel Edison #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const (
// HostGalileo represents the Intel Galileo board.
HostGalileo = "Intel Galileo"

// HostEdison represents teh Intel Edison board.
HostEdison = "Intel Edison"

// HostCubieTruck represents the Cubie Truck.
HostCubieTruck = "CubieTruck"

Expand Down Expand Up @@ -126,6 +129,8 @@ func DetectHost() (host Host, rev int, err error) {
return HostBBB, rev, nil
case strings.Contains(hardware, "BCM2708") || strings.Contains(hardware, "BCM2709"):
return HostRPi, rev, nil
case strings.Contains(model, "Genuine Intel(R) CPU 4000 @ 500MHz"):
return HostEdison, rev, nil
case hardware == "Allwinner sun4i/sun5i Families":
if major < 4 || (major == 4 && minor < 4) {
return HostNull, 0, fmt.Errorf(
Expand Down
1 change: 1 addition & 0 deletions host/all/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ package all

import (
_ "github.com/kidoman/embd/host/bbb"
_ "github.com/kidoman/embd/host/edison"
_ "github.com/kidoman/embd/host/rpi"
)
51 changes: 51 additions & 0 deletions host/edison/edison.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
Package edison provides Intel Edison support.
*/
package edison

import (
"github.com/kidoman/embd"
"github.com/kidoman/embd/host/generic"
)

var pins = embd.PinMap{
&embd.PinDesc{ID: "P1_12", Aliases: []string{"12", "GPIO_12"}, Caps: embd.CapDigital, DigitalLogical: 12}, // PWM?
&embd.PinDesc{ID: "P1_13", Aliases: []string{"13", "GPIO_13"}, Caps: embd.CapDigital, DigitalLogical: 13}, // PWM?
&embd.PinDesc{ID: "P1_14", Aliases: []string{"14", "GPIO_14"}, Caps: embd.CapDigital, DigitalLogical: 14},
&embd.PinDesc{ID: "P1_15", Aliases: []string{"15", "GPIO_15"}, Caps: embd.CapDigital, DigitalLogical: 15},
&embd.PinDesc{ID: "P1_44", Aliases: []string{"44", "GPIO_44"}, Caps: embd.CapDigital, DigitalLogical: 44},
&embd.PinDesc{ID: "P1_45", Aliases: []string{"45", "GPIO_45"}, Caps: embd.CapDigital, DigitalLogical: 45},
&embd.PinDesc{ID: "P1_46", Aliases: []string{"46", "GPIO_46"}, Caps: embd.CapDigital, DigitalLogical: 46},
&embd.PinDesc{ID: "P1_47", Aliases: []string{"47", "GPIO_47"}, Caps: embd.CapDigital, DigitalLogical: 47},
&embd.PinDesc{ID: "P1_48", Aliases: []string{"48", "GPIO_48"}, Caps: embd.CapDigital, DigitalLogical: 48},
&embd.PinDesc{ID: "P1_49", Aliases: []string{"49", "GPIO_49"}, Caps: embd.CapDigital, DigitalLogical: 49},
&embd.PinDesc{ID: "P1_128", Aliases: []string{"128", "GPIO_128"}, Caps: embd.CapDigital, DigitalLogical: 128}, //CTS?
&embd.PinDesc{ID: "P1_129", Aliases: []string{"129", "GPIO_129"}, Caps: embd.CapDigital, DigitalLogical: 129}, //RTS?
&embd.PinDesc{ID: "P1_130", Aliases: []string{"130", "GPIO_130", "RXD", "UART0_RXD"}, Caps: embd.CapDigital | embd.CapUART, DigitalLogical: 130},
&embd.PinDesc{ID: "P1_131", Aliases: []string{"131", "GPIO_131", "TXD", "UART0_TXD"}, Caps: embd.CapDigital | embd.CapUART, DigitalLogical: 131},
&embd.PinDesc{ID: "P1_182", Aliases: []string{"182", "GPIO_182"}, Caps: embd.CapDigital, DigitalLogical: 182}, // PWM?
&embd.PinDesc{ID: "P1_183", Aliases: []string{"183", "GPIO_183"}, Caps: embd.CapDigital, DigitalLogical: 183}, // PWM?
}

var ledMap = embd.LEDMap{}

var spiDeviceMinor = 0 // Check??

func init() {
embd.Register(embd.HostEdison, func(rev int) *embd.Descriptor {
return &embd.Descriptor{
GPIODriver: func() embd.GPIODriver {
return embd.NewGPIODriver(pins, generic.NewDigitalPin, nil, nil)
},
I2CDriver: func() embd.I2CDriver {
return embd.NewI2CDriver(generic.NewI2CBus)
},
LEDDriver: func() embd.LEDDriver {
return embd.NewLEDDriver(ledMap, generic.NewLED)
},
SPIDriver: func() embd.SPIDriver {
return embd.NewSPIDriver(spiDeviceMinor, generic.NewSPIBus, nil)
},
}
})
}