summaryrefslogtreecommitdiff
path: root/src/drivers/ao_hmc5883.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/ao_hmc5883.c')
-rw-r--r--src/drivers/ao_hmc5883.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/drivers/ao_hmc5883.c b/src/drivers/ao_hmc5883.c
index f668fb66..9f1131d6 100644
--- a/src/drivers/ao_hmc5883.c
+++ b/src/drivers/ao_hmc5883.c
@@ -126,13 +126,15 @@ struct ao_hmc5883_sample ao_hmc5883_current;
static void
ao_hmc5883(void)
{
+ struct ao_hmc5883_sample sample;
ao_hmc5883_setup();
for (;;) {
- ao_hmc5883_sample(&ao_hmc5883_current);
- ao_arch_critical(
- AO_DATA_PRESENT(AO_DATA_HMC5883);
- AO_DATA_WAIT();
- );
+ ao_hmc5883_sample(&sample);
+ ao_arch_block_interrupts();
+ ao_hmc5883_current = sample;
+ AO_DATA_PRESENT(AO_DATA_HMC5883);
+ AO_DATA_WAIT();
+ ao_arch_release_interrupts();
}
}