Skip to content

Commit 3413fa1

Browse files
committed
fix pinchg inside rf12_control() - thx Stefan R
1 parent 455814f commit 3413fa1

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

RF12.cpp

+21-1
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,29 @@ static void rf12_xfer (uint16_t cmd) {
254254
/// @param cmd RF12 command, topmost bits determines which register is affected.
255255
uint16_t rf12_control(uint16_t cmd) {
256256
#ifdef EIMSK
257+
#if PINCHG_IRQ
258+
#if RFM_IRQ < 8
259+
bitClear(PCICR, PCIE2);
260+
#elif RFM_IRQ < 14
261+
bitClear(PCICR, PCIE0);
262+
#else
263+
bitClear(PCICR, PCIE1);
264+
#endif
265+
#else
257266
bitClear(EIMSK, INT0);
258-
uint16_t r = rf12_xferSlow(cmd);
267+
#endif
268+
uint16_t r = rf12_xferSlow(cmd);
269+
#if PINCHG_IRQ
270+
#if RFM_IRQ < 8
271+
bitSet(PCICR, PCIE2);
272+
#elif RFM_IRQ < 14
273+
bitSet(PCICR, PCIE0);
274+
#else
275+
bitSet(PCICR, PCIE1);
276+
#endif
277+
#else
259278
bitSet(EIMSK, INT0);
279+
#endif
260280
#else
261281
// ATtiny
262282
bitClear(GIMSK, INT0);

0 commit comments

Comments
 (0)