Go to the documentation of this file.
36 #ifndef UM6_REGISTERS_H
37 #define UM6_REGISTERS_H
40 #include <machine/endian.h>
54 #define TO_RADIANS (M_PI / 180.0)
55 #define TO_DEGREES (180.0 / M_PI)
59 #define NUM_REGISTERS (DATA_REG_START_ADDRESS + DATA_ARRAY_SIZE)
67 #if __BYTE_ORDER == __LITTLE_ENDIAN
68 uint8_t*
d =
reinterpret_cast<uint8_t*
>(dest);
69 uint8_t*
s =
reinterpret_cast<uint8_t*
>(src);
70 for (uint8_t i = 0; i < count; i++)
72 d[i] =
s[count - (i+1)];
76 #warning Big-endian implementation is untested.
77 memcpy(dest, src, count);
97 uint8_t register_width, uint8_t array_length)
98 :
index(register_index),
width(register_width),
122 template<
typename RegT>
126 Accessor(
Registers* registers, uint8_t register_index, uint8_t array_length = 0,
double scale_factor = 1.0)
127 :
Accessor_(registers, register_index, sizeof(RegT), array_length),
scale_(scale_factor)
130 RegT
get(uint8_t field)
const
132 RegT* raw_ptr =
reinterpret_cast<RegT*
>(
raw());
143 void set(uint8_t field, RegT value)
const
145 RegT* raw_ptr =
reinterpret_cast<RegT*
>(
raw());
202 void write_raw(uint8_t register_index, std::string data)
204 if ((register_index - 1) + (data.length()/4 - 1) >=
NUM_REGISTERS)
206 throw std::range_error(
"Index and length write beyond boundaries of register array.");
208 memcpy(&
raw_[register_index], data.c_str(), data.length());
218 #endif // UM6_REGISTERS_H
const Accessor< uint32_t > cmd_set_mag_ref
double get_scaled(uint16_t field) const
const Accessor< int16_t > accel_raw
const Accessor< int16_t > gyro_bias
void memcpy_network(void *dest, void *src, size_t count)
const Accessor< uint32_t > status
const Accessor< int16_t > mag_raw
const Accessor< uint32_t > cmd_reset_ekf
const Accessor< float > temperature
const Accessor< int16_t > euler
const Accessor< uint32_t > communication
#define UM6_ACCEL_BIAS_XY
#define UM6_ACCEL_PROC_XY
const Accessor< uint32_t > misc_config
uint32_t raw_[NUM_REGISTERS]
const Accessor< uint32_t > cmd_set_accel_ref
#define UM6_SET_ACCEL_REF
const Accessor< int16_t > accel_bias
const Accessor< uint32_t > cmd_zero_gyros
const Accessor< int16_t > gyro
void write_raw(uint8_t register_index, std::string data)
const Accessor< float > accel_ref
void set(uint8_t field, RegT value) const
RegT get(uint8_t field) const
const Accessor< float > covariance
Copied directly from the UM6_config.h file, available online here: http://sourceforge....
const Accessor< int16_t > quat
const Accessor< int16_t > mag
Accessor_(Registers *registers, uint8_t register_index, uint8_t register_width, uint8_t array_length)
const Accessor< float > mag_ref
void set_scaled(uint16_t field, double value) const
const Accessor< int16_t > accel
const Accessor< int16_t > gyro_raw
Accessor(Registers *registers, uint8_t register_index, uint8_t array_length=0, double scale_factor=1.0)
const Accessor< int16_t > mag_bias
#define UM6_COMMUNICATION
#define UM6_EULER_PHI_THETA
um6
Author(s): Mike Purvis
autogenerated on Wed Apr 20 2022 02:39:13