summaryrefslogtreecommitdiff
path: root/src/ao_sample.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-08-02 19:07:56 -0700
committerKeith Packard <keithp@keithp.com>2011-08-02 19:07:56 -0700
commit6492218fc316f8cf6214a577807a8dd0a80a9b6a (patch)
tree27c0c590dd237c481dbf576b709010c141ecab3b /src/ao_sample.c
parent11a2bb8e28df7ed87542f2ee726f877971f5d52a (diff)
altos/altosui: Add pad orientation configure option
Allow TeleMetrum to be operated with the antenna pointing downwards on the pad. This provides some additional flexibility when designing an ebay. The accelerometer calibration levels are flipped around to match, so no re-calibration should be required. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_sample.c')
-rw-r--r--src/ao_sample.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ao_sample.c b/src/ao_sample.c
index ac156646..88ba58c5 100644
--- a/src/ao_sample.c
+++ b/src/ao_sample.c
@@ -179,6 +179,8 @@ ao_sample(void)
* just dropped a bit of noise off the low end.
*/
ao_sample_accel = (uint16_t) ((((uint32_t) ao_sample_accel << 16) / (ao_accel_ref[ao_sample_adc] << 1))) >> 1;
+ if (ao_config.pad_orientation != AO_PAD_ORIENTATION_ANTENNA_UP)
+ ao_sample_accel = 0x7fff - ao_sample_accel;
ao_adc->accel = ao_sample_accel;
#endif
#endif