1
0
mirror of https://github.com/kidoman/embd synced 2024-06-06 11:07:48 +02:00

On some platform spidev devices has a name whos minor is > 255. Use an int instead of byte to set ID

This commit is contained in:
Claes Jakobsson 2015-07-10 18:58:07 +02:00
parent 5065e49386
commit 7cffa7f1e5
4 changed files with 7 additions and 7 deletions

View File

@ -95,7 +95,7 @@ var ledMap = embd.LEDMap{
"beaglebone:green:usr3": []string{"3", "USR3", "usr3"}, "beaglebone:green:usr3": []string{"3", "USR3", "usr3"},
} }
var spiDeviceMinor byte = 1 var spiDeviceMinor int = 1
func ensureFeatureEnabled(id string) error { func ensureFeatureEnabled(id string) error {
glog.V(3).Infof("bbb: enabling feature %v", id) glog.V(3).Infof("bbb: enabling feature %v", id)

View File

@ -41,7 +41,7 @@ type spiIOCTransfer struct {
type spiBus struct { type spiBus struct {
file *os.File file *os.File
spiDevMinor byte spiDevMinor int
channel byte channel byte
mode byte mode byte
@ -61,7 +61,7 @@ func spiIOCMessageN(n uint32) uint32 {
return (spiIOCMessage0 + (n * spiIOCIncrementor)) return (spiIOCMessage0 + (n * spiIOCIncrementor))
} }
func NewSPIBus(spiDevMinor, mode, channel byte, speed, bpw, delay int, i func() error) embd.SPIBus { func NewSPIBus(spiDevMinor int, mode, channel byte, speed, bpw, delay int, i func() error) embd.SPIBus {
return &spiBus{ return &spiBus{
spiDevMinor: spiDevMinor, spiDevMinor: spiDevMinor,
mode: mode, mode: mode,

View File

@ -13,7 +13,7 @@ import (
"github.com/kidoman/embd/host/generic" "github.com/kidoman/embd/host/generic"
) )
var spiDeviceMinor = byte(0) var spiDeviceMinor int = 0
var rev1Pins = embd.PinMap{ var rev1Pins = embd.PinMap{
&embd.PinDesc{ID: "P1_3", Aliases: []string{"0", "GPIO_0", "SDA", "I2C0_SDA"}, Caps: embd.CapDigital | embd.CapI2C, DigitalLogical: 0}, &embd.PinDesc{ID: "P1_3", Aliases: []string{"0", "GPIO_0", "SDA", "I2C0_SDA"}, Caps: embd.CapDigital | embd.CapI2C, DigitalLogical: 0},

View File

@ -2,10 +2,10 @@ package embd
import "sync" import "sync"
type spiBusFactory func(byte, byte, byte, int, int, int, func() error) SPIBus type spiBusFactory func(int, byte, byte, int, int, int, func() error) SPIBus
type spiDriver struct { type spiDriver struct {
spiDevMinor byte spiDevMinor int
initializer func() error initializer func() error
busMap map[byte]SPIBus busMap map[byte]SPIBus
@ -16,7 +16,7 @@ type spiDriver struct {
// NewSPIDriver returns a SPIDriver interface which allows control // NewSPIDriver returns a SPIDriver interface which allows control
// over the SPI bus. // over the SPI bus.
func NewSPIDriver(spiDevMinor byte, sbf spiBusFactory, i func() error) SPIDriver { func NewSPIDriver(spiDevMinor int, sbf spiBusFactory, i func() error) SPIDriver {
return &spiDriver{ return &spiDriver{
spiDevMinor: spiDevMinor, spiDevMinor: spiDevMinor,
sbf: sbf, sbf: sbf,