sx126x: move RadioController into separate file for clarity

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2023-01-15 09:07:25 +01:00
committed by Ron Evans
parent 462d2b3315
commit 73e9d5bfec
2 changed files with 14 additions and 13 deletions
+13
View File
@@ -0,0 +1,13 @@
package sx126x
// SX126X radio transceiver has several pins that control
// RF_IN, RF_OUT, NSS, and BUSY.
// This interface allows the creation of struct
// that can drive the RF Switch (Used in Lora RX and Lora Tx)
type RadioController interface {
Init() error
SetRfSwitchMode(mode int) error
SetNss(state bool) error
WaitWhileBusy() error
SetupInterrupts(handler func()) error
}
+1 -13
View File
@@ -19,18 +19,6 @@ var (
errRadioNotFound = errors.New("LoRa radio not found")
)
// SX126X radio transceiver has several pins that control
// RF_IN, RF_OUT, NSS, and BUSY.
// This interface allows the creation of struct
// that can drive the RF Switch (Used in Lora RX and Lora Tx)
type RadioController interface {
Init() error
SetRfSwitchMode(mode int) error
SetNss(state bool) error
WaitWhileBusy() error
SetupInterrupts(handler func()) error
}
const (
DEVICE_TYPE_SX1261 = iota
DEVICE_TYPE_SX1262 = iota
@@ -51,7 +39,7 @@ const (
// Device wraps an SPI connection to a SX126x device.
type Device struct {
spi drivers.SPI // SPI bus for module communication
rstPin machine.Pin // GPIOs for reset, chip select, and busy pin
rstPin machine.Pin // GPIO for reset pin
radioEventChan chan lora.RadioEvent // Channel for Receiving events
loraConf lora.Config // Current Lora configuration
controller RadioController // to manage interactions with the radio