mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-18 05:33:58 +00:00
legacy.PinOutput->pin.Output and add High+Low methods on drivers.PinOutput and use them in drivers
This commit is contained in:
+4
-4
@@ -9,7 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"tinygo.org/x/drivers"
|
||||
"tinygo.org/x/drivers/internal/legacy"
|
||||
"tinygo.org/x/drivers/internal/pin"
|
||||
"tinygo.org/x/drivers/lora"
|
||||
)
|
||||
|
||||
@@ -43,7 +43,7 @@ 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 legacy.PinOutput) *Device {
|
||||
func New(spi drivers.SPI, rstPin pin.Output) *Device {
|
||||
k := Device{
|
||||
spi: spi,
|
||||
rstPin: rstPin.Set,
|
||||
@@ -67,9 +67,9 @@ func (d *Device) SetRadioController(rc RadioController) error {
|
||||
|
||||
// Reset re-initialize the sx127x device
|
||||
func (d *Device) Reset() {
|
||||
d.rstPin(false)
|
||||
d.rstPin.Low()
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
d.rstPin(true)
|
||||
d.rstPin.High()
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user