Skip to content

Commit 8106e6b

Browse files
committed
DM: fix interrupts, pcc pins
1 parent 6c57ca9 commit 8106e6b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

cores/arduino/WInterrupts.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,24 +159,27 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
159159
// Assign pin to EIC
160160
pinPeripheral(pin, PIO_EXTINT);
161161

162+
// Assign callback to interrupt
163+
callbacksInt[in] = callback;
164+
162165
// Look for right CONFIG register to be addressed
163166
if (in > EXTERNAL_INT_7) {
164167
config = 1;
165168
} else {
166169
config = 0;
167170
}
168171

169-
// Configure the interrupt mode
170-
pos = (in - (8 * config)) << 2;
171-
172+
// Configure the interrupt mode
173+
pos = (in - (8 * config)) << 2;
174+
172175
#if defined (__SAMD51__)
173176
EIC->CTRLA.bit.ENABLE = 0;
174177
while (EIC->SYNCBUSY.bit.ENABLE == 1) { }
175178
#endif
176-
177-
switch (mode)
178-
{
179-
case LOW:
179+
180+
switch (mode)
181+
{
182+
case LOW:
180183
EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_LOW_Val << pos;
181184
break;
182185

@@ -204,9 +207,6 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
204207
EIC->CTRLA.bit.ENABLE = 1;
205208
while (EIC->SYNCBUSY.bit.ENABLE == 1) { }
206209
#endif
207-
208-
// Assign callback to interrupt
209-
callbacksInt[in] = callback;
210210
}
211211
}
212212

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)