Use runtime/volatile.T.ReplaceBits

This commit is contained in:
Ethan Reesor
2020-07-12 18:40:37 -05:00
committed by Ron Evans
parent 01f5c51b77
commit ca1a282495
3 changed files with 50 additions and 50 deletions
+1 -1
View File
@@ -240,7 +240,7 @@ func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error {
addr = &sam.EIC.CONFIG1
}
pos := (extint % 8) * 4 // bit position in register
addr.Set((addr.Get() &^ (0xf << pos)) | uint32(change)<<pos)
addr.ReplaceBits(uint32(change), 0xf, pos)
// Enable external interrupt for this pin.
sam.EIC.INTENSET.Set(1 << extint)