altos/ms5607: Allow applications to not use the normal data ring and thread
authorKeith Packard <keithp@keithp.com>
Fri, 28 Apr 2017 06:51:21 +0000 (23:51 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 28 Apr 2017 06:51:21 +0000 (23:51 -0700)
MicroPeak V2 has tasks, but doesn't want to use another thread just
for the MS5607.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_ms5607.c

index 261df67f7cacfdce5dd0b09fbfb6311f03da8939..0afdf01276b3a5d40337308a5058d1a99f297741 100644 (file)
@@ -191,9 +191,13 @@ ao_ms5607_sample(__xdata struct ao_ms5607_sample *sample)
 #include "ao_ms5607_convert.c"
 #endif
 
 #include "ao_ms5607_convert.c"
 #endif
 
-#if HAS_TASK
+#ifndef HAS_MS5607_TASK
+#define HAS_MS5607_TASK HAS_TASK
+#endif
+
 __xdata struct ao_ms5607_sample        ao_ms5607_current;
 
 __xdata struct ao_ms5607_sample        ao_ms5607_current;
 
+#if HAS_MS5607_TASK
 static void
 ao_ms5607(void)
 {
 static void
 ao_ms5607(void)
 {
@@ -209,7 +213,9 @@ ao_ms5607(void)
 }
 
 __xdata struct ao_task ao_ms5607_task;
 }
 
 __xdata struct ao_task ao_ms5607_task;
+#endif
 
 
+#if HAS_TASK
 void
 ao_ms5607_info(void)
 {
 void
 ao_ms5607_info(void)
 {
@@ -248,6 +254,8 @@ ao_ms5607_init(void)
 
 #if HAS_TASK
        ao_cmd_register(&ao_ms5607_cmds[0]);
 
 #if HAS_TASK
        ao_cmd_register(&ao_ms5607_cmds[0]);
+#endif
+#if HAS_MS5607_TASK
        ao_add_task(&ao_ms5607_task, ao_ms5607, "ms5607");
 #endif
 
        ao_add_task(&ao_ms5607_task, ao_ms5607, "ms5607");
 #endif