aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/main.c b/main.c
index fa3b3c1..f017109 100644
--- a/main.c
+++ b/main.c
@@ -59,13 +59,21 @@ int main () {
sleepwhile (!gyroscopeRead ());
sleepwhile (twr.status == TWST_WAIT);
-
- volatile const int16_t *val = gyroscopeGet ();
- printf ("%i/%i/%i\n", val[0], val[1], val[2]);
-
- _delay_ms (50);
+ switch (twr.status) {
+ case TWST_OK: {
+ volatile const int16_t *val = gyroscopeGet ();
+ printf ("%i/%i/%i\n", val[0], val[1], val[2]);
+ break;
+ }
+
+ case TWST_ERR:
+ goto fail;
+ break;
+ }
}
//timerStop ();
+fail:
+ printf ("fail\n");
/* global interrupt disable */
cli ();