aboutsummaryrefslogtreecommitdiff
path: root/ui.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2014-09-23 17:24:57 +0200
committerLars-Dominik Braun <lars@6xq.net>2014-09-30 15:15:01 +0200
commit6708da2661d693f855b6f56d69af1e2fb8502463 (patch)
tree5b8eac0f6f40932417519cbdcd229caeabd8eee8 /ui.c
parent69cb10f51321a2443a3314c40fb2b8556aa804c0 (diff)
downloadhourglass-6708da2661d693f855b6f56d69af1e2fb8502463.tar.gz
hourglass-6708da2661d693f855b6f56d69af1e2fb8502463.tar.bz2
hourglass-6708da2661d693f855b6f56d69af1e2fb8502463.zip
Add wakeup source mechanism
Should reduce amount of cpu wakeups with expensive computations.
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/ui.c b/ui.c
index 7bd393d..9175133 100644
--- a/ui.c
+++ b/ui.c
@@ -266,14 +266,6 @@ static void doInit () {
}
}
-/* Sleep CPU
- */
-static void cpuSleep () {
- sleep_enable ();
- sleep_cpu ();
- sleep_disable ();
-}
-
/* Main loop
*/
void uiLoop () {
@@ -329,7 +321,7 @@ void uiLoop () {
while (1) {
processSensors ();
-
+
horizon newh = accelGetHorizon ();
if (newh != h) {
horizonChanged = true;
@@ -367,7 +359,8 @@ void uiLoop () {
assert (0 && "invalid ui mode");
break;
}
- cpuSleep ();
+
+ sleepwhile (wakeup == 0);
#if 0
printf ("t=%i, h=%i, s=%i\n", gyroGetZTicks (), accelGetHorizon (),