-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIMU_accelerometer.h
More file actions
35 lines (27 loc) · 1.08 KB
/
Copy pathIMU_accelerometer.h
File metadata and controls
35 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include <string.h>
#include <stdint.h>
#pragma pack(push,1)
// @Parseclass
class IMU_accelerometer {
public:
IMU_accelerometer() = default;
IMU_accelerometer(const uint8_t buf[8]) { load(buf); }
inline void load(const uint8_t buf[8]) { memcpy(this, buf, sizeof(*this)); }
inline void write(uint8_t buf[]) const { memcpy(buf, this, sizeof(*this)); }
inline int16_t get_lat_accel() const { return lat_accel; }
inline int16_t get_long_accel() const { return long_accel; }
inline int16_t get_vert_accel() const { return vert_accel; }
// New Setters
inline void set_lat_accel(int16_t lat_accel) { this->lat_accel = lat_accel; }
inline void set_long_accel(int16_t long_accel) { this->long_accel = long_accel; }
inline void set_vert_accel(int16_t vert_accel) { this->vert_accel = vert_accel; }
private:
// @Parse @Unit(m/s/s) @Scale(102)
int16_t lat_accel;
// @Parse @Unit(m/s/s) @Scale(102)
int16_t long_accel;
// @Parse @Unit(m/s/s) @Scale(102)
int16_t vert_accel;
};
#pragma pack(pop)