Alpha release.
[speedometer] / util.c
diff --git a/util.c b/util.c
index 0b246f5..b53b8aa 100644 (file)
--- a/util.c
+++ b/util.c
@@ -22,6 +22,7 @@
 #include "util.h"
 #include "appdata.h"
 #include "callbacks.h"
+#include "ui.h"
 
 static LocationGPSDevice *device = NULL;
 static LocationGPSDControl *control = NULL;
@@ -50,3 +51,21 @@ void stop_gps(AppData* appdata) {
 #endif // __arm__
 }
 
+void interpret_speed_from_gps(AppData* appdata, gdouble speed) {
+
+       // first let's convert the number to characters
+       gchar* c_digits = calloc(30, 1);
+
+       g_sprintf(c_digits, "%f", speed);
+
+       g_print("interpret_speed_from_gps: %s", c_digits);
+
+       int i = 0;
+       while(i < 3) {
+               guint value = g_ascii_digit_value(c_digits[i]);
+               set_nth_digit(appdata, i, value);
+               i++;
+       }
+       g_free(c_digits);
+}
+