mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-16 04:43:25 +00:00
sx126x: there is no dio0 just dio1
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
@@ -20,13 +20,13 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
spi = machine.SPI0
|
spi = machine.SPI0
|
||||||
nssPin, busyPin, dio0Pin, dio1Pin = machine.GP17, machine.GP20, machine.GP11, machine.GP10
|
nssPin, busyPin, dio1Pin = machine.GP17, machine.GP10, machine.GP11
|
||||||
rxPin, txLowPin, txHighPin = machine.GP13, machine.GP12, machine.GP12
|
rxPin, txLowPin, txHighPin = machine.GP13, machine.GP12, machine.GP12
|
||||||
)
|
)
|
||||||
|
|
||||||
func newRadioControl() sx126x.RadioController {
|
func newRadioControl() sx126x.RadioController {
|
||||||
return sx126x.NewRadioControl(nssPin, busyPin, dio0Pin, dio1Pin, rxPin, txLowPin, txHighPin)
|
return sx126x.NewRadioControl(nssPin, busyPin, dio1Pin, rxPin, txLowPin, txHighPin)
|
||||||
}
|
}
|
||||||
|
|
||||||
// do sx126x setup here
|
// do sx126x setup here
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
spi = machine.SPI0
|
spi = machine.SPI0
|
||||||
nssPin, busyPin, dio0Pin, dio1Pin = machine.GP17, machine.GP20, machine.GP11, machine.GP10
|
nssPin, busyPin, dio1Pin = machine.GP17, machine.GP10, machine.GP11
|
||||||
rxPin, txLowPin, txHighPin = machine.GP13, machine.GP12, machine.GP12
|
rxPin, txLowPin, txHighPin = machine.GP13, machine.GP12, machine.GP12
|
||||||
)
|
)
|
||||||
|
|
||||||
func newRadioControl() sx126x.RadioController {
|
func newRadioControl() sx126x.RadioController {
|
||||||
return sx126x.NewRadioControl(nssPin, busyPin, dio0Pin, dio1Pin, rxPin, txLowPin, txHighPin)
|
return sx126x.NewRadioControl(nssPin, busyPin, dio1Pin, rxPin, txLowPin, txHighPin)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
spi = machine.SPI0
|
spi = machine.SPI0
|
||||||
nssPin, busyPin, dio0Pin, dio1Pin = machine.GP17, machine.GP20, machine.GP11, machine.GP10
|
nssPin, busyPin, dio1Pin = machine.GP17, machine.GP10, machine.GP11
|
||||||
rxPin, txLowPin, txHighPin = machine.GP13, machine.GP12, machine.GP12
|
rxPin, txLowPin, txHighPin = machine.GP13, machine.GP12, machine.GP12
|
||||||
)
|
)
|
||||||
|
|
||||||
func newRadioControl() sx126x.RadioController {
|
func newRadioControl() sx126x.RadioController {
|
||||||
return sx126x.NewRadioControl(nssPin, busyPin, dio0Pin, dio1Pin, rxPin, txLowPin, txHighPin)
|
return sx126x.NewRadioControl(nssPin, busyPin, dio1Pin, rxPin, txLowPin, txHighPin)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// RadioControl for boards that are connected using normal pins.
|
||||||
type RadioControl struct {
|
type RadioControl struct {
|
||||||
nssPin, busyPin, dio0Pin, dio1Pin machine.Pin
|
nssPin, busyPin, dio1Pin machine.Pin
|
||||||
rxPin, txLowPin, txHighPin machine.Pin
|
rxPin, txLowPin, txHighPin machine.Pin
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRadioControl(nssPin, busyPin, dio0Pin, dio1Pin,
|
func NewRadioControl(nssPin, busyPin, dio1Pin,
|
||||||
rxPin, txLowPin, txHighPin machine.Pin) *RadioControl {
|
rxPin, txLowPin, txHighPin machine.Pin) *RadioControl {
|
||||||
return &RadioControl{
|
return &RadioControl{
|
||||||
nssPin: nssPin,
|
nssPin: nssPin,
|
||||||
busyPin: busyPin,
|
busyPin: busyPin,
|
||||||
dio0Pin: dio0Pin,
|
|
||||||
dio1Pin: dio1Pin,
|
dio1Pin: dio1Pin,
|
||||||
rxPin: rxPin,
|
rxPin: rxPin,
|
||||||
txLowPin: txLowPin,
|
txLowPin: txLowPin,
|
||||||
@@ -56,11 +56,6 @@ func (rc *RadioControl) Init() error {
|
|||||||
func (rc *RadioControl) SetupInterrupts(handler func()) error {
|
func (rc *RadioControl) SetupInterrupts(handler func()) error {
|
||||||
irqHandler = handler
|
irqHandler = handler
|
||||||
|
|
||||||
rc.dio0Pin.Configure(machine.PinConfig{Mode: machine.PinInputPulldown})
|
|
||||||
if err := rc.dio0Pin.SetInterrupt(machine.PinRising, handleInterrupt); err != nil {
|
|
||||||
return errRadioNotFound
|
|
||||||
}
|
|
||||||
|
|
||||||
rc.dio1Pin.Configure(machine.PinConfig{Mode: machine.PinInputPulldown})
|
rc.dio1Pin.Configure(machine.PinConfig{Mode: machine.PinInputPulldown})
|
||||||
if err := rc.dio1Pin.SetInterrupt(machine.PinRising, handleInterrupt); err != nil {
|
if err := rc.dio1Pin.SetInterrupt(machine.PinRising, handleInterrupt); err != nil {
|
||||||
return errRadioNotFound
|
return errRadioNotFound
|
||||||
|
|||||||
Reference in New Issue
Block a user