Files
OpenCellular/core/cortex-m/include/math.h
Gwendal Grignou 828b55a735 common: Add magnetometer online calibration.
Code for hard iron calibration: Every seconds (or faster if enough
samples), find a sphere that fit the compass data.

Based on Android code.

BRANCH=smaug
BUG=chrome-os-partner:39900
TEST=Check hard-iron bias is removed. Works better outside.

Change-Id: Iab479d5113b6560b4f01b0fd87373d2eecdb9b54
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299583
Reviewed-by: Anton Staaf <robotboy@chromium.org>
2015-10-13 05:28:54 -07:00

36 lines
605 B
C

/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Math utility functions for ARMv7 */
#ifndef __CROS_EC_MATH_H
#define __CROS_EC_MATH_H
#ifdef CONFIG_FPU
static inline float sqrtf(float v)
{
float root;
asm volatile(
"fsqrts %0, %1"
: "=w" (root)
: "w" (v)
);
return root;
}
static inline float fabsf(float v)
{
float root;
asm volatile(
"fabss %0, %1"
: "=w" (root)
: "w" (v)
);
return root;
}
#endif /* CONFIG_FPU */
#endif /* __CROS_EC_MATH_H */