@@ -1535,7 +1535,11 @@ uint32_t micros(void); | |||
static inline void delayMicroseconds(uint32_t) __attribute__((always_inline, unused)); | |||
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; | |||
#elif F_CPU == 144000000 | |||
uint32_t n = usec * 48; |
@@ -716,6 +716,9 @@ void ResetHandler(void) | |||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__) | |||
SCB_CPACR = 0x00F00000; | |||
#endif | |||
#if defined(__MK66FX1M0__) | |||
LMEM_PCCCR = 0x85000003; | |||
#endif | |||
#if 0 | |||
// testing only, enable ser_print | |||
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV4(1); |
@@ -1111,7 +1111,11 @@ void delay(uint32_t ms) | |||
} | |||
// 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 | |||
#elif F_CPU == 144000000 | |||
#define PULSEIN_LOOPS_PER_USEC 21 |
@@ -78,6 +78,9 @@ static const uint8_t pin2tsi[] = { | |||
int touchRead(uint8_t pin) | |||
{ | |||
#if defined(__MK64FX512__) | |||
return 0; // no Touch sensing :( | |||
#else | |||
uint32_t ch; | |||
if (pin >= NUM_DIGITAL_PINS) return 0; | |||
@@ -104,6 +107,7 @@ int touchRead(uint8_t pin) | |||
delayMicroseconds(1); | |||
return TSI0_DATA & 0xFFFF; | |||
#endif | |||
#endif | |||
} | |||
@@ -48,7 +48,11 @@ static uint8_t transmit_previous_timeout=0; | |||
// When the PC isn't listening, how long do we wait before discarding data? | |||
#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) | |||
#elif F_CPU == 144000000 | |||
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932) |
@@ -449,7 +449,11 @@ static uint8_t transmit_previous_timeout=0; | |||
// When the PC isn't listening, how long do we wait before discarding data? | |||
#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) | |||
#elif F_CPU == 144000000 | |||
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932) |
@@ -64,7 +64,11 @@ static uint8_t tx_noautoflush=0; | |||
// When the PC isn't listening, how long do we wait before discarding data? | |||
#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) | |||
#elif F_CPU == 144000000 | |||
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932) |
@@ -115,7 +115,11 @@ static uint8_t transmit_previous_timeout=0; | |||
// When the PC isn't listening, how long do we wait before discarding data? | |||
#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) | |||
#elif F_CPU == 144000000 | |||
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932) |
@@ -139,7 +139,11 @@ void usb_seremu_flush_input(void) | |||
// software. If it's too long, we stall the user's program when no software is running. | |||
#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) | |||
#elif F_CPU == 144000000 | |||
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932) |
@@ -149,7 +149,11 @@ void usb_serial_flush_input(void) | |||
// software. If it's too long, we stall the user's program when no software is running. | |||
#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) | |||
#elif F_CPU == 144000000 | |||
#define TX_TIMEOUT (TX_TIMEOUT_MSEC * 932) |