mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-18 05:33:58 +00:00
bring #753 changes over to new pin HAL
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
//go:build tinygo
|
||||
|
||||
package sx127x
|
||||
|
||||
import (
|
||||
|
||||
+4
-4
@@ -6,10 +6,10 @@ package sx127x
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"machine"
|
||||
"time"
|
||||
|
||||
"tinygo.org/x/drivers"
|
||||
"tinygo.org/x/drivers/internal/pin"
|
||||
"tinygo.org/x/drivers/lora"
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ const (
|
||||
// Device wraps an SPI connection to a SX127x device.
|
||||
type Device struct {
|
||||
spi drivers.SPI // SPI bus for module communication
|
||||
rstPin machine.Pin // GPIO for reset
|
||||
rstPin pin.OutputFunc // GPIO for reset
|
||||
radioEventChan chan lora.RadioEvent // Channel for Receiving events
|
||||
loraConf lora.Config // Current Lora configuration
|
||||
controller RadioController // to manage interactions with the radio
|
||||
@@ -43,10 +43,10 @@ func (d *Device) GetRadioEventChan() chan lora.RadioEvent {
|
||||
}
|
||||
|
||||
// New creates a new SX127x connection. The SPI bus must already be configured.
|
||||
func New(spi drivers.SPI, rstPin machine.Pin) *Device {
|
||||
func New(spi drivers.SPI, rstPin pin.Output) *Device {
|
||||
k := Device{
|
||||
spi: spi,
|
||||
rstPin: rstPin,
|
||||
rstPin: rstPin.Set,
|
||||
radioEventChan: make(chan lora.RadioEvent, RADIOEVENTCHAN_SIZE),
|
||||
spiTxBuf: make([]byte, SPI_BUFFER_SIZE),
|
||||
spiRxBuf: make([]byte, SPI_BUFFER_SIZE),
|
||||
|
||||
Reference in New Issue
Block a user