aboutsummaryrefslogtreecommitdiff
path: root/barometer_sim.c
diff options
context:
space:
mode:
Diffstat (limited to 'barometer_sim.c')
-rw-r--r--barometer_sim.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/barometer_sim.c b/barometer_sim.c
new file mode 100644
index 0000000..f2e9eac
--- /dev/null
+++ b/barometer_sim.c
@@ -0,0 +1,22 @@
+/* Dummy pressures to return in sequence, each call to barometer_read */
+static const float pressures[] = {
+ 1019.5,
+ 1019.45,
+ 1019.41,
+ 1019.33,
+ 1019.2,
+ 1019.0,
+ 1018.99,
+ 1018.91,
+ 1018.88,
+ 1018.86,
+ 1018.83,
+ 1018.82,
+};
+
+float barometer_read(void)
+{
+ static int i = 0;
+ i %= sizeof(pressures)/sizeof(pressures[0]);
+ return pressures[i++];
+}