Improved LIS3MDL driver and related demo: improved sensitivity handling.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9821 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
21c467fb5a
commit
4ca399b1af
|
@ -151,7 +151,7 @@ static msg_t read_cooked(void *ip, float axes[]) {
|
|||
|
||||
msg = read_raw(ip, raw);
|
||||
for(i = 0; i < LIS3MDL_NUMBER_OF_AXES ; i++){
|
||||
axes[i] = raw[i] / ((LIS3MDLDriver *)ip)->sensitivity[i];
|
||||
axes[i] = raw[i] * ((LIS3MDLDriver *)ip)->sensitivity[i];
|
||||
axes[i] -= ((LIS3MDLDriver *)ip)->bias[i];
|
||||
}
|
||||
return msg;
|
||||
|
|
|
@ -70,10 +70,10 @@
|
|||
#define LIS3MDL_12GA 12.0f
|
||||
#define LIS3MDL_16GA 16.0f
|
||||
|
||||
#define LIS3MDL_SENS_4GA 6842.0f
|
||||
#define LIS3MDL_SENS_8GA 3421.0f
|
||||
#define LIS3MDL_SENS_12GA 2281.0f
|
||||
#define LIS3MDL_SENS_16GA 1711.0f
|
||||
#define LIS3MDL_SENS_4GA 0.00014615f
|
||||
#define LIS3MDL_SENS_8GA 0.00029231f
|
||||
#define LIS3MDL_SENS_12GA 0.0004384f
|
||||
#define LIS3MDL_SENS_16GA 0.00058445f
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue