update for latest sx128x driver changes
This commit is contained in:
@@ -66,12 +66,13 @@ func main() {
|
|||||||
timeout.Store(true)
|
timeout.Store(true)
|
||||||
|
|
||||||
dio1Pin.SetInterrupt(machine.PinRising, func(machine.Pin) {
|
dio1Pin.SetInterrupt(machine.PinRising, func(machine.Pin) {
|
||||||
irqStatus := radio.GetIrqStatus()
|
irqStatus, _ := radio.GetIrqStatus()
|
||||||
|
|
||||||
if irqStatus&sx128x.IRQ_TX_DONE_MASK != 0 {
|
if irqStatus&sx128x.IRQ_TX_DONE_MASK != 0 {
|
||||||
txDone.Store(true)
|
txDone.Store(true)
|
||||||
timeout.Store(false)
|
timeout.Store(false)
|
||||||
led.Set(false)
|
led.Set(false)
|
||||||
|
println("tx done")
|
||||||
}
|
}
|
||||||
if irqStatus&sx128x.IRQ_RX_DONE_MASK != 0 {
|
if irqStatus&sx128x.IRQ_RX_DONE_MASK != 0 {
|
||||||
rxDone.Store(true)
|
rxDone.Store(true)
|
||||||
@@ -103,13 +104,8 @@ func main() {
|
|||||||
SetupLora(radio, loraConfig)
|
SetupLora(radio, loraConfig)
|
||||||
|
|
||||||
oscMessage := osc.OSCMessage{
|
oscMessage := osc.OSCMessage{
|
||||||
Address: "/lora/button",
|
Address: "/cue/1/go",
|
||||||
Args: []osc.OSCArg{
|
Args: []osc.OSCArg{},
|
||||||
{
|
|
||||||
Type: "i",
|
|
||||||
Value: 0,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@@ -120,7 +116,6 @@ func main() {
|
|||||||
radio.SetStandby(sx128x.STANDBY_RC)
|
radio.SetStandby(sx128x.STANDBY_RC)
|
||||||
led.Set(true)
|
led.Set(true)
|
||||||
|
|
||||||
oscMessage.Args[0].Value = int32(time.Now().UnixMilli() / 1000)
|
|
||||||
bytes, err := oscMessage.ToBytes()
|
bytes, err := oscMessage.ToBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
println("failed to serialize OSC message:", err)
|
println("failed to serialize OSC message:", err)
|
||||||
@@ -163,7 +158,7 @@ func main() {
|
|||||||
func SetupLora(radio *sx128x.Device, config lora.Config) {
|
func SetupLora(radio *sx128x.Device, config lora.Config) {
|
||||||
// Switch to standby prior to configuration changes
|
// Switch to standby prior to configuration changes
|
||||||
|
|
||||||
circuitMode, _ := radio.GetStatus()
|
circuitMode, _, _ := radio.GetStatus()
|
||||||
if circuitMode != sx128x.CIRCUIT_MODE_STDBY_RC {
|
if circuitMode != sx128x.CIRCUIT_MODE_STDBY_RC {
|
||||||
radio.SetStandby(sx128x.STANDBY_RC)
|
radio.SetStandby(sx128x.STANDBY_RC)
|
||||||
}
|
}
|
||||||
@@ -184,7 +179,7 @@ func SetupLora(radio *sx128x.Device, config lora.Config) {
|
|||||||
data[0] = 0x32
|
data[0] = 0x32
|
||||||
}
|
}
|
||||||
radio.WriteRegister(0x925, data[:])
|
radio.WriteRegister(0x925, data[:])
|
||||||
existing := radio.ReadRegister(0x93C)
|
existing, _ := radio.ReadRegister(0x93C)
|
||||||
data[0] = existing | 0x01
|
data[0] = existing | 0x01
|
||||||
radio.WriteRegister(0x93C, data[:])
|
radio.WriteRegister(0x93C, data[:])
|
||||||
|
|
||||||
@@ -199,7 +194,7 @@ func SetupLora(radio *sx128x.Device, config lora.Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkStatus(radio *sx128x.Device, operation string) {
|
func checkStatus(radio *sx128x.Device, operation string) {
|
||||||
circuitMode, commandStatus := radio.GetStatus()
|
circuitMode, commandStatus, _ := radio.GetStatus()
|
||||||
if commandStatus != sx128x.COMMAND_STATUS_SUCCESS {
|
if commandStatus != sx128x.COMMAND_STATUS_SUCCESS {
|
||||||
println(operation, "-> failed with status:", commandStatus)
|
println(operation, "-> failed with status:", commandStatus)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user