mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-13 11:23:40 +00:00
examples: set pin mappings for sx126x external board
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
@@ -24,6 +24,8 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
time.Sleep(3 * time.Second)
|
||||||
|
|
||||||
println("\n# TinyGo Lora RX/TX test")
|
println("\n# TinyGo Lora RX/TX test")
|
||||||
println("# ----------------------")
|
println("# ----------------------")
|
||||||
machine.LED.Configure(machine.PinConfig{Mode: machine.PinOutput})
|
machine.LED.Configure(machine.PinConfig{Mode: machine.PinOutput})
|
||||||
|
|||||||
@@ -9,11 +9,21 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
spi = machine.SPI0
|
spi = machine.SPI1
|
||||||
nssPin, busyPin, dio1Pin = machine.GP17, machine.GP10, machine.GP11
|
nssPin, busyPin, dio1Pin = machine.GP13, machine.GP6, machine.GP7
|
||||||
rxPin, txLowPin, txHighPin = machine.GP13, machine.GP12, machine.GP12
|
rxPin, txLowPin, txHighPin = machine.GP9, machine.GP8, machine.GP8
|
||||||
)
|
)
|
||||||
|
|
||||||
func newRadioControl() sx126x.RadioController {
|
func newRadioControl() sx126x.RadioController {
|
||||||
return sx126x.NewRadioControl(nssPin, busyPin, dio1Pin, rxPin, txLowPin, txHighPin)
|
return sx126x.NewRadioControl(nssPin, busyPin, dio1Pin, rxPin, txLowPin, txHighPin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
spi.Configure(machine.SPIConfig{
|
||||||
|
Mode: 0,
|
||||||
|
Frequency: 8 * 1e6,
|
||||||
|
SDO: machine.SPI1_SDO_PIN,
|
||||||
|
SDI: machine.SPI1_SDI_PIN,
|
||||||
|
SCK: machine.SPI1_SCK_PIN,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user