diff options
| author | Lars-Dominik Braun <lars@6xq.net> | 2014-09-23 17:24:57 +0200 |
|---|---|---|
| committer | Lars-Dominik Braun <lars@6xq.net> | 2014-09-30 15:15:01 +0200 |
| commit | 6708da2661d693f855b6f56d69af1e2fb8502463 (patch) | |
| tree | 5b8eac0f6f40932417519cbdcd229caeabd8eee8 /ui.c | |
| parent | 69cb10f51321a2443a3314c40fb2b8556aa804c0 (diff) | |
| download | hourglass-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.c | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -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 (), |
