|
|
@ -27,11 +27,15 @@ class Gyro
|
|
|
|
|
|
|
|
|
|
|
|
Filter x_filter, y_filter, z_filter;
|
|
|
|
Filter x_filter, y_filter, z_filter;
|
|
|
|
|
|
|
|
|
|
|
|
int16_t x, y, z;
|
|
|
|
int32_t x, y, z;
|
|
|
|
uint8_t mapped_id;
|
|
|
|
uint8_t mapped_id;
|
|
|
|
|
|
|
|
|
|
|
|
int8_t invert_x, invert_y, invert_z;
|
|
|
|
int8_t invert_x, invert_y, invert_z;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float sensitivity;
|
|
|
|
|
|
|
|
int16_t deadzone;
|
|
|
|
|
|
|
|
int16_t min_delta;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
enum BindToX : uint8_t
|
|
|
|
enum BindToX : uint8_t
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -45,6 +49,8 @@ class Gyro
|
|
|
|
|
|
|
|
|
|
|
|
MPU6050 mpu;
|
|
|
|
MPU6050 mpu;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t time0;
|
|
|
|
|
|
|
|
uint32_t delay;
|
|
|
|
bool (*_Enabled)();
|
|
|
|
bool (*_Enabled)();
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
public:
|
|
|
@ -54,24 +60,30 @@ class Gyro
|
|
|
|
void init();
|
|
|
|
void init();
|
|
|
|
|
|
|
|
|
|
|
|
void setEnabledCallback(bool (*_Enabled)()) { this->_Enabled = _Enabled; }
|
|
|
|
void setEnabledCallback(bool (*_Enabled)()) { this->_Enabled = _Enabled; }
|
|
|
|
bool Enabled() { return _Enabled(); };
|
|
|
|
bool Enabled() { return _Enabled(); }
|
|
|
|
|
|
|
|
|
|
|
|
void setMappedId(uint8_t mapped_id) { this->mapped_id = mapped_id; };
|
|
|
|
void setMappedId(uint8_t mapped_id) { this->mapped_id = mapped_id; }
|
|
|
|
uint8_t getMappedId() { return mapped_id; }
|
|
|
|
uint8_t getMappedId() { return mapped_id; }
|
|
|
|
|
|
|
|
|
|
|
|
void setInvertX(bool invert_x = true) { this->invert_x = invert_x? -1 : 1; };
|
|
|
|
void setInvertX(bool invert_x = true) { this->invert_x = invert_x? -1 : 1; }
|
|
|
|
void setInvertY(bool invert_y = true) { this->invert_y = invert_y? -1 : 1; };
|
|
|
|
void setInvertY(bool invert_y = true) { this->invert_y = invert_y? -1 : 1; }
|
|
|
|
void setInvertZ(bool invert_z = true) { this->invert_z = invert_z? -1 : 1; };
|
|
|
|
void setInvertZ(bool invert_z = true) { this->invert_z = invert_z? -1 : 1; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setSensitivity(float sensitivity) { this->sensitivity = sensitivity; }
|
|
|
|
|
|
|
|
void setDeadzone(int16_t deadzone) { this->deadzone = deadzone; }
|
|
|
|
|
|
|
|
void setMinDelta(int16_t min_delta) { this->min_delta = min_delta; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setBindToX(BindToX bind_to_x) { this->bind_to_x = bind_to_x; }
|
|
|
|
|
|
|
|
|
|
|
|
void setBindToX(BindToX bind_to_x) { this->bind_to_x = bind_to_x; };
|
|
|
|
void setDelay(uint32_t delay) { this->delay = delay; }
|
|
|
|
|
|
|
|
|
|
|
|
void update();
|
|
|
|
void update(uint32_t time);
|
|
|
|
|
|
|
|
|
|
|
|
int16_t getX() { return x; }
|
|
|
|
int16_t getX() { return x; }
|
|
|
|
int16_t getY() { return y; }
|
|
|
|
int16_t getY() { return y; }
|
|
|
|
int16_t getZ() { return z; }
|
|
|
|
int16_t getZ() { return z; }
|
|
|
|
|
|
|
|
|
|
|
|
int32_t getDX();
|
|
|
|
int16_t getDX();
|
|
|
|
int16_t getDY();
|
|
|
|
int16_t getDY();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|