projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Go back to recording sensor data in globals
[fw/altos]
/
src
/
drivers
/
ao_mpu6000.c
diff --git
a/src/drivers/ao_mpu6000.c
b/src/drivers/ao_mpu6000.c
index a1c32d4d836db80808389009a8b38d0e6d2565ee..495967057336ef8930263467cb3cbdfc15850e4f 100644
(file)
--- a/
src/drivers/ao_mpu6000.c
+++ b/
src/drivers/ao_mpu6000.c
@@
-225,7
+225,7
@@
ao_mpu6000_setup(void)
errors += ao_mpu6000_gyro_check(normal_mode.gyro_z, test_mode.gyro_z, "z");
if (errors)
errors += ao_mpu6000_gyro_check(normal_mode.gyro_z, test_mode.gyro_z, "z");
if (errors)
- ao_panic(AO_PANIC_SELF_TEST);
+ ao_panic(AO_PANIC_SELF_TEST
_MPU6000
);
/* Filter to about 100Hz, which also sets the gyro rate to 1000Hz */
ao_mpu6000_reg_write(MPU6000_CONFIG,
/* Filter to about 100Hz, which also sets the gyro rate to 1000Hz */
ao_mpu6000_reg_write(MPU6000_CONFIG,
@@
-240,8
+240,7
@@
ao_mpu6000_setup(void)
ao_mpu6000_configured = 1;
}
ao_mpu6000_configured = 1;
}
-struct ao_mpu6000_sample ao_mpu6000_current;
-uint8_t ao_mpu6000_valid;
+struct ao_mpu6000_sample ao_mpu6000_current;
static void
ao_mpu6000(void)
static void
ao_mpu6000(void)
@@
-249,13
+248,11
@@
ao_mpu6000(void)
ao_mpu6000_setup();
for (;;)
{
ao_mpu6000_setup();
for (;;)
{
- struct ao_mpu6000_sample ao_mpu6000_next;
- ao_mpu6000_sample(&ao_mpu6000_next);
+ ao_mpu6000_sample(&ao_mpu6000_current);
ao_arch_critical(
ao_arch_critical(
-
ao_mpu6000_current = ao_mpu6000_next
;
-
ao_mpu6000_valid = 1
;
+
AO_DATA_PRESENT(AO_DATA_MPU6000)
;
+
AO_DATA_WAIT()
;
);
);
- ao_delay(0);
}
}
}
}
@@
-264,18
+261,16
@@
static struct ao_task ao_mpu6000_task;
static void
ao_mpu6000_show(void)
{
static void
ao_mpu6000_show(void)
{
- struct ao_
mpu6000_sample
sample;
+ struct ao_
data
sample;
- ao_arch_critical(
- sample = ao_mpu6000_current;
- );
+ ao_data_get(&sample);
printf ("Accel: %7d %7d %7d Gyro: %7d %7d %7d\n",
printf ("Accel: %7d %7d %7d Gyro: %7d %7d %7d\n",
- sample.accel_x,
- sample.accel_y,
- sample.accel_z,
- sample.gyro_x,
- sample.gyro_y,
- sample.gyro_z);
+ sample.
mpu6000.
accel_x,
+ sample.
mpu6000.
accel_y,
+ sample.
mpu6000.
accel_z,
+ sample.
mpu6000.
gyro_x,
+ sample.
mpu6000.
gyro_y,
+ sample.
mpu6000.
gyro_z);
}
static const struct ao_cmds ao_mpu6000_cmds[] = {
}
static const struct ao_cmds ao_mpu6000_cmds[] = {
@@
-287,7
+282,6
@@
void
ao_mpu6000_init(void)
{
ao_mpu6000_configured = 0;
ao_mpu6000_init(void)
{
ao_mpu6000_configured = 0;
- ao_mpu6000_valid = 0;
ao_add_task(&ao_mpu6000_task, ao_mpu6000, "mpu6000");
ao_cmd_register(&ao_mpu6000_cmds[0]);
ao_add_task(&ao_mpu6000_task, ao_mpu6000, "mpu6000");
ao_cmd_register(&ao_mpu6000_cmds[0]);