base program for tilt measurement
Dependencies: COG4050_ADT7420 ADXL362
Fork of COG4050_adxl355_adxl357-ver2 by
Diff: ADXL35x/ADXL355.h
- Revision:
- 7:5aaa09c40283
- Parent:
- 6:45d2393ef468
- Child:
- 8:9e6ead2ee8d7
diff -r 45d2393ef468 -r 5aaa09c40283 ADXL35x/ADXL355.h --- a/ADXL35x/ADXL355.h Tue Aug 14 06:49:07 2018 +0000 +++ b/ADXL35x/ADXL355.h Tue Aug 14 11:33:30 2018 +0000 @@ -5,11 +5,32 @@ class ADXL355 { public: + // -------------------------- // + // CONST AND VARIABLES // + // -------------------------- // + typedef struct { + // sensitivity + float Sxx; + float Sxy; + float Sxz; + float Syx; + float Syy; + float Syz; + float Szx; + float Szy; + float Szz; + float St; + // 0g offset + float Bx; + float By; + float Bz; + float Bt; + } ADXL355_calib_t; const static float t_sens = -9.05; const static float t_bias = 1852; float axis355_sens; float axis357_sens; - + ADXL355_calib_t calib_data; // -------------------------- // // REGISTERS // // -------------------------- // @@ -115,7 +136,6 @@ ST2 = 0x02, ST1 = 0x01 } ADXL355_int_ctl_t; - // -------------------------- // // FUNCTIONS // // -------------------------- // @@ -161,8 +181,12 @@ void fifo_setup(uint8_t nr_of_entries); uint32_t fifo_read_u32(); uint64_t fifo_scan(); - // ADXL tilt methods and calibration - // TBD + // ADXL calibration + float convert(uint32_t data); + ADXL355_calib_t convert_2p(); + ADXL355_calib_t convert_3to8p(); + ADXL355_calib_t convert_12p(); + private: // SPI adxl355; ///< SPI instance of the ADXL SPI adxl355; DigitalOut cs;