ソースを参照

Add attachInterruptVector()

main
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;

読み込み中…
キャンセル
保存