change to float and remove unused h

This commit is contained in:
William Clark 2023-12-23 10:33:28 +00:00
parent e9472ed1f0
commit 11e6e65c6f
2 changed files with 6 additions and 8 deletions

View File

@ -1,5 +1,3 @@
#include <stdio.h>
#include <math.h>
#include "lis3dh.h" #include "lis3dh.h"
#include "registers.h" #include "registers.h"
@ -241,9 +239,9 @@ int lis3dh_read(lis3dh_t *lis3dh) {
y = (((int16_t)((data[2] << 8) | data[3])) >> scale) * sens; y = (((int16_t)((data[2] << 8) | data[3])) >> scale) * sens;
z = (((int16_t)((data[4] << 8) | data[5])) >> scale) * sens; z = (((int16_t)((data[4] << 8) | data[5])) >> scale) * sens;
lis3dh->acc.x = (double)x / 1000.0; lis3dh->acc.x = ((float)x) / 1000.0;
lis3dh->acc.y = (double)y / 1000.0; lis3dh->acc.y = ((float)y) / 1000.0;
lis3dh->acc.z = (double)z / 1000.0; lis3dh->acc.z = ((float)z) / 1000.0;
return err; return err;
} }

View File

@ -87,9 +87,9 @@ struct lis3dh_config {
}; };
struct lis3dh_acceleration { struct lis3dh_acceleration {
double x; float x;
double y; float y;
double z; float z;
}; };
struct lis3dh { struct lis3dh {