瀏覽代碼

Allow attachInterrupt without pinMode (for AVR compatibility)

main
PaulStoffregen 8 年之前
父節點
當前提交
e76a593adc
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. +5
    -1
      teensy3/pins_teensy.c

+ 5
- 1
teensy3/pins_teensy.c 查看文件

@@ -209,7 +209,11 @@ void attachInterrupt(uint8_t pin, void (*function)(void), int mode)
}
mask = (mask << 16) | 0x01000000;
config = portConfigRegister(pin);

if ((*config & 0x00000700) == 0) {
// for compatibility with programs which depend
// on AVR hardware default to input mode.
pinMode(pin, INPUT);
}
#if defined(KINETISK)
attachInterruptVector(IRQ_PORTA, port_A_isr);
attachInterruptVector(IRQ_PORTB, port_B_isr);

Loading…
取消
儲存