This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//割り込み周期: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 { |