Skip to content

Commit

Permalink
ninafw: use NINA settings from board file in main TinyGo repo
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Jan 5, 2024
1 parent 190c4be commit 62e318c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions adapter_ninafw.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type Adapter struct {
isDefault bool
scanning bool

reset func()
connectHandler func(device Address, connected bool)

connectedDevices []*Device
Expand All @@ -31,7 +30,6 @@ type Adapter struct {
// Make sure to call Enable() before using it to initialize the adapter.
var DefaultAdapter = &Adapter{
isDefault: true,
reset: resetNINAInverted,
connectHandler: func(device Address, connected bool) {
return
},
Expand All @@ -45,14 +43,19 @@ func (a *Adapter) Enable() error {
machine.NINA_CS.Configure(machine.PinConfig{Mode: machine.PinOutput})
machine.NINA_RESETN.Configure(machine.PinConfig{Mode: machine.PinOutput})
machine.NINA_CS.Low()
a.reset()

if machine.NINA_RESET_INVERTED {
resetNINAInverted()
} else {
resetNINA()
}

// serial port for nina chip
uart := machine.UART1
uart.Configure(machine.UARTConfig{
TX: machine.NINA_TX,
RX: machine.NINA_RX,
BaudRate: 115200,
BaudRate: machine.NINA_BAUDRATE,
CTS: machine.NINA_CTS,
RTS: machine.NINA_RTS,
})
Expand Down

0 comments on commit 62e318c

Please sign in to comment.