Skip to content

Commit 040bda6

Browse files
committed
DM: fix interrupts, pcc pins
1 parent 1c1cb3e commit 040bda6

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

cores/arduino/WInterrupts.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
8787
__initialize();
8888
enabled = 1;
8989
}
90-
#if defined (__SAMD51__)
91-
EIC->CTRLA.bit.ENABLE = 0;
92-
while (EIC->SYNCBUSY.bit.ENABLE == 1) { }
93-
#endif
9490

9591
if (in == EXTERNAL_INT_NMI) {
9692
EIC->NMIFLAG.bit.NMI = 1; // Clear flag
@@ -130,6 +126,9 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
130126
// Assign pin to EIC
131127
pinPeripheral(pin, PIO_EXTINT);
132128

129+
// Assign callback to interrupt
130+
callbacksInt[in] = callback;
131+
133132
// Look for right CONFIG register to be addressed
134133
if (in > EXTERNAL_INT_7) {
135134
config = 1;
@@ -139,6 +138,12 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
139138

140139
// Configure the interrupt mode
141140
pos = (in - (8 * config)) << 2;
141+
142+
#if defined (__SAMD51__)
143+
EIC->CTRLA.bit.ENABLE = 0;
144+
while (EIC->SYNCBUSY.bit.ENABLE == 1) { }
145+
#endif
146+
142147
switch (mode)
143148
{
144149
case LOW:

variants/metro_m4/variant.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static const uint8_t SCL = PIN_WIRE_SCL;
204204
#define PIN_QSPI_IO3 (45u)
205205

206206
//PCC Pins
207-
#define PIN_PCC_DEN1 (13u)
207+
#define PIN_PCC_DEN1 (PIN_SPI_MOSI)
208208
#define PIN_PCC_DEN2 (PIN_SPI_SCK)
209209
#define PIN_PCC_CLK (PIN_SPI_MISO)
210210
#define PIN_PCC_D0 (13u)

0 commit comments

Comments
 (0)