mirror of
https://github.com/kidoman/embd
synced 2024-12-21 12:20:05 +01:00
Support SPI minor devices >255 (PR #33)
This commit is contained in:
parent
56cb934dbf
commit
6cfa481f30
@ -95,7 +95,7 @@ var ledMap = embd.LEDMap{
|
||||
"beaglebone:green:usr3": []string{"3", "USR3", "usr3"},
|
||||
}
|
||||
|
||||
var spiDeviceMinor byte = 1
|
||||
var spiDeviceMinor int = 1
|
||||
|
||||
func ensureFeatureEnabled(id string) error {
|
||||
glog.V(3).Infof("bbb: enabling feature %v", id)
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
"github.com/kidoman/embd/host/generic"
|
||||
)
|
||||
|
||||
var spiDeviceMinor = byte(0)
|
||||
var spiDeviceMinor = 32766
|
||||
|
||||
var chipPins = embd.PinMap{
|
||||
// official GPIO pins (U14 connector) using the pcf8574a
|
||||
|
@ -245,7 +245,7 @@ func (b *i2cBus) WriteToReg(addr, reg byte, value []byte) error {
|
||||
message.addr = uint16(addr)
|
||||
message.flags = 0
|
||||
message.len = uint16(len(outbuf))
|
||||
message.buf = uintptr(unsafe.Pointer(&hdrp.Data))
|
||||
message.buf = uintptr(unsafe.Pointer(hdrp.Data))
|
||||
|
||||
var packets i2c_rdwr_ioctl_data
|
||||
|
||||
|
@ -43,7 +43,7 @@ type spiIOCTransfer struct {
|
||||
type spiBus struct {
|
||||
file *os.File
|
||||
|
||||
spiDevMinor byte
|
||||
spiDevMinor int
|
||||
|
||||
channel byte
|
||||
mode byte
|
||||
@ -63,7 +63,7 @@ func spiIOCMessageN(n uint32) uint32 {
|
||||
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{
|
||||
spiDevMinor: spiDevMinor,
|
||||
mode: mode,
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
"github.com/kidoman/embd/host/generic"
|
||||
)
|
||||
|
||||
var spiDeviceMinor = byte(0)
|
||||
var spiDeviceMinor = 0
|
||||
|
||||
var rev1Pins = embd.PinMap{
|
||||
&embd.PinDesc{ID: "P1_3", Aliases: []string{"0", "GPIO_0", "SDA", "I2C0_SDA"}, Caps: embd.CapDigital | embd.CapI2C, DigitalLogical: 0},
|
||||
|
@ -2,10 +2,10 @@ package embd
|
||||
|
||||
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 {
|
||||
spiDevMinor byte
|
||||
spiDevMinor int
|
||||
initializer func() error
|
||||
|
||||
busMap map[byte]SPIBus
|
||||
@ -16,7 +16,7 @@ type spiDriver struct {
|
||||
|
||||
// NewSPIDriver returns a SPIDriver interface which allows control
|
||||
// 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{
|
||||
spiDevMinor: spiDevMinor,
|
||||
sbf: sbf,
|
||||
|
Loading…
x
Reference in New Issue
Block a user