Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/machine/machine_nrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,17 @@ func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error {

// Set and enable the GPIOTE interrupt. It's not a problem if this happens
// more than once.
interrupt.New(nrf.IRQ_GPIOTE, func(interrupt.Interrupt) {
intr := interrupt.New(nrf.IRQ_GPIOTE, func(interrupt.Interrupt) {
for i := range nrf.GPIOTE.EVENTS_IN {
if nrf.GPIOTE.EVENTS_IN[i].Get() != 0 {
nrf.GPIOTE.EVENTS_IN[i].Set(0)
pin := Pin((nrf.GPIOTE.CONFIG[i].Get() & nrf.GPIOTE_CONFIG_PSEL_Msk) >> nrf.GPIOTE_CONFIG_PSEL_Pos)
pinCallbacks[i](pin)
}
}
}).Enable()
})
intr.SetPriority(0x40) // interrupt priority 2 (highest priority not reserved by the SoftDevice)
intr.Enable()

// Everything was configured correctly.
return nil
Expand Down
Loading