*
* ao_sample_accel 32767
* = ------------ * ------------
- * 32737 ao_accel_ref
+ * 32767 ao_accel_ref
*
* Multiply through by 32767:
*
* 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