LM3S1968: Add first example project.
[bertos.git] / boards / ek-lm3s1968 / examples / gps / compass.h
diff --git a/boards/ek-lm3s1968/examples/gps/compass.h b/boards/ek-lm3s1968/examples/gps/compass.h
new file mode 100644 (file)
index 0000000..f1f4c5f
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef COMPASS_H
+#define COMPASS_H
+
+#define PI 3.14159265358979323846
+
+INLINE float deg2rad(float deg)
+{
+       return deg * PI / 180;
+}
+
+INLINE float rad2deg(float rad)
+{
+       return rad * 180 / PI;
+}
+
+float distance(float lat1, float lon1, float lat2, float lon2);
+int bearing(float lat1, float lon1, float lat2, float lon2);
+const char *compass_heading(int bearing);
+
+#endif /* COMPASS_H */