Browse Source

Even more defs

teensy4-core
PaulStoffregen 9 years ago
parent
commit
c364608480
10 changed files with 47 additions and 8 deletions
  1. +5
    -1
      teensy3/core_pins.h
  2. +3
    -0
      teensy3/mk20dx128.c
  3. +5
    -1
      teensy3/pins_teensy.c
  4. +4
    -0
      teensy3/touch.c
  5. +5
    -1
      teensy3/usb_joystick.c
  6. +5
    -1
      teensy3/usb_keyboard.c
  7. +5
    -1
      teensy3/usb_midi.c
  8. +5
    -1
      teensy3/usb_mouse.c
  9. +5
    -1
      teensy3/usb_seremu.c
  10. +5
    -1
      teensy3/usb_serial.c

+ 5
- 1
teensy3/core_pins.h View File

static inline void delayMicroseconds(uint32_t) __attribute__((always_inline, unused)); static inline void delayMicroseconds(uint32_t) __attribute__((always_inline, unused));
static inline void delayMicroseconds(uint32_t usec) static inline void delayMicroseconds(uint32_t usec)
{ {
#if F_CPU == 168000000
#if F_CPU == 192000000
uint32_t n = usec * 64;
#elif F_CPU == 180000000
uint32_t n = usec * 60;
#elif F_CPU == 168000000
uint32_t n = usec * 56; uint32_t n = usec * 56;
#elif F_CPU == 144000000 #elif F_CPU == 144000000
uint32_t n = usec * 48; uint32_t n = usec * 48;

+ 3
- 0
teensy3/mk20dx128.c View File

#if defined(__MK64FX512__) || defined(__MK66FX1M0__) #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
SCB_CPACR = 0x00F00000; SCB_CPACR = 0x00F00000;
#endif #endif
#if defined(__MK66FX1M0__)
LMEM_PCCCR = 0x85000003;
#endif
#if 0 #if 0
// testing only, enable ser_print // testing only, enable ser_print
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV4(1); SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV4(1);

+ 5
- 1
teensy3/pins_teensy.c View File

} }


// TODO: verify these result in correct timeouts... // TODO: verify these result in correct timeouts...
#if F_CPU == 168000000
#if F_CPU == 192000000
#define PULSEIN_LOOPS_PER_USEC 29
#elif F_CPU == 180000000
#define PULSEIN_LOOPS_PER_USEC 27
#elif F_CPU == 168000000
#define PULSEIN_LOOPS_PER_USEC 25 #define PULSEIN_LOOPS_PER_USEC 25
#elif F_CPU == 144000000 #elif F_CPU == 144000000
#define PULSEIN_LOOPS_PER_USEC 21 #define PULSEIN_LOOPS_PER_USEC 21

+ 4
- 0
teensy3/touch.c View File



int touchRead(uint8_t pin) int touchRead(uint8_t pin)
{ {
#if defined(__MK64FX512__)
return 0; // no Touch sensing :(
#else
uint32_t ch; uint32_t ch;


if (pin >= NUM_DIGITAL_PINS) return 0; if (pin >= NUM_DIGITAL_PINS) return 0;
delayMicroseconds(1); delayMicroseconds(1);
return TSI0_DATA & 0xFFFF; return TSI0_DATA & 0xFFFF;
#endif #endif
#endif
} }





+ 5
- 1
teensy3/usb_joystick.c View File

// When the PC isn't listening, how long do we wait before discarding data? // When the PC isn't listening, how long do we wait before discarding data?
#define TX_TIMEOUT_MSEC 30 #define TX_TIMEOUT_MSEC 30


#if F_CPU == 168000000
#if F_CPU == 192000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1280)
#elif F_CPU == 180000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1200)
#elif F_CPU == 168000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1100) #define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1100)
#elif F_CPU == 144000000 #elif F_CPU == 144000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932) #define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932)

+ 5
- 1
teensy3/usb_keyboard.c View File

// When the PC isn't listening, how long do we wait before discarding data? // When the PC isn't listening, how long do we wait before discarding data?
#define TX_TIMEOUT_MSEC 50 #define TX_TIMEOUT_MSEC 50


#if F_CPU == 168000000
#if F_CPU == 192000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1280)
#elif F_CPU == 180000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1200)
#elif F_CPU == 168000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1100) #define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1100)
#elif F_CPU == 144000000 #elif F_CPU == 144000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932) #define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932)

+ 5
- 1
teensy3/usb_midi.c View File

// When the PC isn't listening, how long do we wait before discarding data? // When the PC isn't listening, how long do we wait before discarding data?
#define TX_TIMEOUT_MSEC 40 #define TX_TIMEOUT_MSEC 40


#if F_CPU == 168000000
#if F_CPU == 192000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1280)
#elif F_CPU == 180000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1200)
#elif F_CPU == 168000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1100) #define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1100)
#elif F_CPU == 144000000 #elif F_CPU == 144000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932) #define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932)

+ 5
- 1
teensy3/usb_mouse.c View File

// When the PC isn't listening, how long do we wait before discarding data? // When the PC isn't listening, how long do we wait before discarding data?
#define TX_TIMEOUT_MSEC 30 #define TX_TIMEOUT_MSEC 30


#if F_CPU == 168000000
#if F_CPU == 192000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1280)
#elif F_CPU == 180000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1200)
#elif F_CPU == 168000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1100) #define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1100)
#elif F_CPU == 144000000 #elif F_CPU == 144000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932) #define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932)

+ 5
- 1
teensy3/usb_seremu.c View File

// software. If it's too long, we stall the user's program when no software is running. // software. If it's too long, we stall the user's program when no software is running.
#define TX_TIMEOUT_MSEC 30 #define TX_TIMEOUT_MSEC 30


#if F_CPU == 168000000
#if F_CPU == 192000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1280)
#elif F_CPU == 180000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1200)
#elif F_CPU == 168000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1100) #define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1100)
#elif F_CPU == 144000000 #elif F_CPU == 144000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932) #define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932)

+ 5
- 1
teensy3/usb_serial.c View File

// software. If it's too long, we stall the user's program when no software is running. // software. If it's too long, we stall the user's program when no software is running.
#define TX_TIMEOUT_MSEC 70 #define TX_TIMEOUT_MSEC 70


#if F_CPU == 168000000
#if F_CPU == 192000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1280)
#elif F_CPU == 180000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1200)
#elif F_CPU == 168000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1100) #define TX_TIMEOUT (TX_TIMEOUT_MSEC * 1100)
#elif F_CPU == 144000000 #elif F_CPU == 144000000
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932) #define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932)

Loading…
Cancel
Save