From 6708da2661d693f855b6f56d69af1e2fb8502463 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 23 Sep 2014 17:24:57 +0200 Subject: Add wakeup source mechanism Should reduce amount of cpu wakeups with expensive computations. --- ui.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'ui.c') 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 (), -- cgit v1.2.3