Skip to content

Instantly share code, notes, and snippets.

void update_gyro(void) {
static float past_dps_x_raw = 0;
static float dps_x_list[GYRO_SMOOZINGLENGTH] = { 0 };
float dps_x_raw = 0;
dps_x_raw = (float) (SPI_Gyro_Xaxis_get() - mouse.gyro.x.offset_raw);
//角速度に対する返り値の傾斜補正
if (dps_x_raw >= 0) {
dps_x_raw *= X_GYRO_GAIN_FORWARD;
} else {
dps_x_raw *= X_GYRO_GAIN_BACKWARD;
@zilmina
zilmina / 2017年時点のGYRO取得関数
Last active September 16, 2018 18:06
update_gyroの変化
//割り込み周期:1kHz
void update_gyro(void) {
static double past_dps_raw = 0;
short dps_raw = 0;
dps_raw = SPI_Gyro_Zaxis_get() - mouse.gyro.offset_raw;
//角速度に対する返り値の傾斜補正
if (dps_raw >= 0) {
dps_raw *= Z_GYRO_GAIN_FORWARD;
} else {