소스 검색

Add attachInterruptVector()

teensy4-core
PaulStoffregen 10 년 전
부모
커밋
3b5dc896f7
3개의 변경된 파일14개의 추가작업 그리고 12개의 파일을 삭제
  1. +5
    -0
      teensy3/core_pins.h
  2. +4
    -12
      teensy3/kinetis.h
  3. +5
    -0
      teensy3/pins_teensy.c

+ 5
- 0
teensy3/core_pins.h 파일 보기

@@ -693,6 +693,11 @@ void analogWriteRes(uint32_t bits);
static inline void analogWriteResolution(uint32_t bits) { analogWriteRes(bits); }
void analogWriteFrequency(uint8_t pin, uint32_t frequency);
void analogWriteDAC0(int val);
#ifdef __cplusplus
void attachInterruptVector(IRQ_NUMBER_t irq, void (*function)(void));
#else
void attachInterruptVector(enum IRQ_NUMBER_t irq, void (*function)(void));
#endif
void attachInterrupt(uint8_t pin, void (*function)(void), int mode);
void detachInterrupt(uint8_t pin);
void _init_Teensyduino_internal_(void);

+ 4
- 12
teensy3/kinetis.h 파일 보기

@@ -33,17 +33,9 @@

#include <stdint.h>

#ifdef __cplusplus
#define BEGIN_ENUM(NAME) enum name {
#define END_ENUM(NAME) };
#else
#define BEGIN_ENUM(NAME) typedef enum {
#define END_ENUM(NAME) } name;
#endif

// Teensy 3.0
#if defined(__MK20DX128__)
BEGIN_ENUM(IRQ_NUMBER_t)
enum IRQ_NUMBER_t {
IRQ_DMA_CH0 = 0,
IRQ_DMA_CH1 = 1,
IRQ_DMA_CH2 = 2,
@@ -89,7 +81,7 @@ BEGIN_ENUM(IRQ_NUMBER_t)
IRQ_PORTD = 43,
IRQ_PORTE = 44,
IRQ_SOFTWARE = 45
END_ENUM(IRQ_NUMBER_t)
};
#define NVIC_NUM_INTERRUPTS 46
#define DMA_NUM_CHANNELS 4
#define KINETISK_UART0
@@ -99,7 +91,7 @@ END_ENUM(IRQ_NUMBER_t)

// Teensy 3.1
#elif defined(__MK20DX256__)
BEGIN_ENUM(IRQ_NUMBER_t)
enum IRQ_NUMBER_t {
IRQ_DMA_CH0 = 0,
IRQ_DMA_CH1 = 1,
IRQ_DMA_CH2 = 2,
@@ -169,7 +161,7 @@ BEGIN_ENUM(IRQ_NUMBER_t)
IRQ_PORTD = 90,
IRQ_PORTE = 91,
IRQ_SOFTWARE = 94
END_ENUM(IRQ_NUMBER_t)
};
#define NVIC_NUM_INTERRUPTS 95
#define DMA_NUM_CHANNELS 16
#define KINETISK_UART0

+ 5
- 0
teensy3/pins_teensy.c 파일 보기

@@ -116,6 +116,11 @@ void init_pin_interrupts(void)
// fast interrupts will still be serviced quickly?
}

void attachInterruptVector(enum IRQ_NUMBER_t irq, void (*function)(void))
{
_VectorsRam[irq + 16] = function;
}

void attachInterrupt(uint8_t pin, void (*function)(void), int mode)
{
volatile uint32_t *config;

Loading…
취소
저장