From d664b474657eff9988c14b40e5d050dc5571f778 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 17 Jun 2014 15:29:50 +0200 Subject: ui: Added Seems to work mostly now. --- main.c | 42 ++---------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 015abc3..37592a7 100644 --- a/main.c +++ b/main.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -15,6 +14,7 @@ #include "accel.h" #include "speaker.h" #include "pwm.h" +#include "ui.h" static void cpuInit () { /* enter change prescaler mode */ @@ -49,46 +49,8 @@ int main () { accelStart (); pwmStart (); -#if 0 - speakerStart (); - _delay_ms (200); - speakerStop (); -#endif - - timerStart (); - bool checkGyro = false; - while (1) { - while (!timerHit ()) { - for (uint8_t i = 0; i < 6; i++) { - pwmSetBrightness (i, abs (gyroGetZTicks ())); - } + uiLoop (); - /* round-robin to prevent starvation */ - if (checkGyro) { - gyroProcess (); - accelProcess(); - } else { - accelProcess (); - gyroProcess (); - } - checkGyro = !checkGyro; - sleep_enable (); - sleep_cpu (); - sleep_disable (); - } - - printf ("t=%i, h=%i, s=%i\n", gyroGetZTicks (), accelGetHorizon (), - accelGetShakeCount ()); -#if 0 - volatile const int32_t *gyroval = gyroGetAccum (); - volatile const int16_t *gyroraw = gyroGetRaw (); - volatile const int8_t *accelval = accelGet (); - printf ("%li/%li/%li - %i/%i/%i - %i/%i/%i\n", - gyroval[0], gyroval[1], gyroval[2], - gyroraw[0], gyroraw[1], gyroraw[2], - accelval[1], accelval[3], accelval[5]); -#endif - } timerStop (); pwmStop (); -- cgit v1.2.3