remove macros for threading compatability

This commit is contained in:
Jorj Bauer 2020-08-03 05:11:23 -04:00
parent f9d060b593
commit 16fbb37f90
1 changed files with 75 additions and 80 deletions

View File

@ -16,12 +16,14 @@
//#define DEBUG_TIMING
#define THREADED if (1)
#if F_CPU < 240000000
#pragma AiiE warning: performance will improve if you overclock the Teensy to 240MHz (F_CPU=240MHz) or 256MHz (F_CPU=256MHz)
#endif
#if F_CPU == 600000000
#pragma AiiE suggestion: if you underclock to 528MHz (F_CPU=528MHz) then it will use significantly less power, and still perform perfectly
#endif
#define RESETPIN 38
#define DEBUGPIN 23
@ -226,7 +228,6 @@ void runMaintenance(uint32_t now)
{
static uint32_t nextRuntime = 0;
THREADED {
if (now >= nextRuntime) {
nextRuntime = now + 100000; // FIXME: what's a good time here? 1/10 sec?
@ -239,7 +240,6 @@ void runMaintenance(uint32_t now)
usb.maintain();
}
}
}
#define TARGET_FPS 30
void runDisplay(uint32_t now)
@ -254,7 +254,6 @@ void runDisplay(uint32_t now)
static uint32_t lastFps = 0;
static uint32_t displayFrameCount = 0;
THREADED {
// If it's time to draw the next frame, then do so
if (now >= microsForNext) {
refreshCount++;
@ -298,22 +297,20 @@ void runDisplay(uint32_t now)
microsForNext = microsAtStart + (1000000.0*((float)refreshCount/(float)TARGET_FPS));
}
}
}
// The debouncer is used in the bios, which blocks the main loop
// execution; so this thread updates the debouncer instead.
// execution; so this function updates the debouncer instead. It used
// to be a thread of its own, but now that this is single-threaded
// again, it's a standalone method.
void runDebouncer()
{
static uint32_t nextRuntime = 0;
// while (1) {
if (millis() >= nextRuntime) {
nextRuntime = millis() + 10;
resetButtonDebouncer.update();
} else {
yield();
// threads.yield();
}
// }
}
void runCPU(uint32_t now)
@ -323,7 +320,6 @@ void runCPU(uint32_t now)
static uint32_t microsAtStart = micros();
static uint32_t microsForNext = microsAtStart + (countSinceLast * SPEEDCTL);
THREADED {
if (now >= microsForNext) {
countSinceLast += g_cpu->Run(24); // The CPU runs in bursts of cycles. This '24' is the max burst we perform.
((AppleVM *)g_vm)->cpuMaintenance(g_cpu->cycles);
@ -343,7 +339,6 @@ void runCPU(uint32_t now)
microsForNext = microsAtStart + (countSinceLast * SPEEDCTL);
}
}
}
void loop()
{