summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/ao_hmc5883.c4
-rw-r--r--src/drivers/ao_hmc5883.h2
-rw-r--r--src/drivers/ao_mma655x.c7
-rw-r--r--src/drivers/ao_mma655x.h1
-rw-r--r--src/drivers/ao_mpu6000.c4
-rw-r--r--src/drivers/ao_mpu6000.h2
-rw-r--r--src/drivers/ao_ms5607.c13
-rw-r--r--src/drivers/ao_ms5607.h2
8 files changed, 23 insertions, 12 deletions
diff --git a/src/drivers/ao_hmc5883.c b/src/drivers/ao_hmc5883.c
index ade6c263..059fc2c8 100644
--- a/src/drivers/ao_hmc5883.c
+++ b/src/drivers/ao_hmc5883.c
@@ -123,12 +123,14 @@ ao_hmc5883_setup(void)
return 1;
}
+struct ao_hmc5883_sample ao_hmc5883_current;
+
static void
ao_hmc5883(void)
{
ao_hmc5883_setup();
for (;;) {
- ao_hmc5883_sample((struct ao_hmc5883_sample *) &ao_data_ring[ao_data_head].hmc5883);
+ ao_hmc5883_sample(&ao_hmc5883_current);
ao_arch_critical(
AO_DATA_PRESENT(AO_DATA_HMC5883);
AO_DATA_WAIT();
diff --git a/src/drivers/ao_hmc5883.h b/src/drivers/ao_hmc5883.h
index 55690978..ff2725eb 100644
--- a/src/drivers/ao_hmc5883.h
+++ b/src/drivers/ao_hmc5883.h
@@ -79,6 +79,8 @@ struct ao_hmc5883_sample {
int16_t x, y, z;
};
+extern struct ao_hmc5883_sample ao_hmc5883_current;
+
void
ao_hmc5883_init(void);
diff --git a/src/drivers/ao_mma655x.c b/src/drivers/ao_mma655x.c
index 005bc684..28fe1e08 100644
--- a/src/drivers/ao_mma655x.c
+++ b/src/drivers/ao_mma655x.c
@@ -238,11 +238,12 @@ ao_mma655x_setup(void)
}
+uint16_t ao_mma655x_current;
+
static void
ao_mma655x_dump(void)
{
- ao_mma655x_setup();
- printf ("MMA655X value %d\n", ao_mma655x_value());
+ printf ("MMA655X value %d\n", ao_mma655x_current);
}
__code struct ao_cmds ao_mma655x_cmds[] = {
@@ -255,7 +256,7 @@ ao_mma655x(void)
{
ao_mma655x_setup();
for (;;) {
- ao_data_ring[ao_data_head].mma655x = ao_mma655x_value();
+ ao_mma655x_current = ao_mma655x_value();
ao_arch_critical(
AO_DATA_PRESENT(AO_DATA_MMA655X);
AO_DATA_WAIT();
diff --git a/src/drivers/ao_mma655x.h b/src/drivers/ao_mma655x.h
index 9c0c59dc..2d951e07 100644
--- a/src/drivers/ao_mma655x.h
+++ b/src/drivers/ao_mma655x.h
@@ -78,6 +78,7 @@
#define AO_MMA655X_COUNT 0x15
#define AO_MMA655X_OFFCORR 0x16
+extern uint16_t ao_mma655x_current;
void
ao_mma655x_init(void);
diff --git a/src/drivers/ao_mpu6000.c b/src/drivers/ao_mpu6000.c
index b3e284e0..49596705 100644
--- a/src/drivers/ao_mpu6000.c
+++ b/src/drivers/ao_mpu6000.c
@@ -240,13 +240,15 @@ ao_mpu6000_setup(void)
ao_mpu6000_configured = 1;
}
+struct ao_mpu6000_sample ao_mpu6000_current;
+
static void
ao_mpu6000(void)
{
ao_mpu6000_setup();
for (;;)
{
- ao_mpu6000_sample((struct ao_mpu6000_sample *) &ao_data_ring[ao_data_head].mpu6000);
+ ao_mpu6000_sample(&ao_mpu6000_current);
ao_arch_critical(
AO_DATA_PRESENT(AO_DATA_MPU6000);
AO_DATA_WAIT();
diff --git a/src/drivers/ao_mpu6000.h b/src/drivers/ao_mpu6000.h
index 5c0cee1b..6aada9a9 100644
--- a/src/drivers/ao_mpu6000.h
+++ b/src/drivers/ao_mpu6000.h
@@ -158,6 +158,8 @@ struct ao_mpu6000_sample {
int16_t gyro_z;
};
+extern struct ao_mpu6000_sample ao_mpu6000_current;
+
void
ao_mpu6000_init(void);
diff --git a/src/drivers/ao_ms5607.c b/src/drivers/ao_ms5607.c
index fdd2c31e..077a40e6 100644
--- a/src/drivers/ao_ms5607.c
+++ b/src/drivers/ao_ms5607.c
@@ -170,13 +170,15 @@ ao_ms5607_sample(struct ao_ms5607_sample *sample)
#include "ao_ms5607_convert.c"
#if HAS_TASK
+struct ao_ms5607_sample ao_ms5607_current;
+
static void
ao_ms5607(void)
{
ao_ms5607_setup();
for (;;)
{
- ao_ms5607_sample((struct ao_ms5607_sample *) &ao_data_ring[ao_data_head].ms5607_raw);
+ ao_ms5607_sample(&ao_ms5607_current);
ao_arch_critical(
AO_DATA_PRESENT(AO_DATA_MS5607);
AO_DATA_WAIT();
@@ -202,14 +204,11 @@ ao_ms5607_info(void)
static void
ao_ms5607_dump(void)
{
- struct ao_ms5607_sample sample;
struct ao_ms5607_value value;
- ao_ms5607_setup();
- ao_ms5607_sample(&sample);
- ao_ms5607_convert(&sample, &value);
- printf ("Pressure: %8u %8d\n", sample.pres, value.pres);
- printf ("Temperature: %8u %8d\n", sample.temp, value.temp);
+ ao_ms5607_convert(&ao_ms5607_current, &value);
+ printf ("Pressure: %8u %8d\n", ao_ms5607_current.pres, value.pres);
+ printf ("Temperature: %8u %8d\n", ao_ms5607_current.temp, value.temp);
printf ("Altitude: %ld\n", ao_pa_to_altitude(value.pres));
}
diff --git a/src/drivers/ao_ms5607.h b/src/drivers/ao_ms5607.h
index 5c31fd8b..b2f98a59 100644
--- a/src/drivers/ao_ms5607.h
+++ b/src/drivers/ao_ms5607.h
@@ -56,6 +56,8 @@ struct ao_ms5607_value {
int32_t temp; /* in °C * 100 */
};
+extern struct ao_ms5607_sample ao_ms5607_current;
+
void
ao_ms5607_setup(void);