split out gyro code
Some checks failed
Build / build (ubuntu-22.04) (push) Failing after 1m43s
Documentation / build (push) Successful in 24s

This commit is contained in:
2024-07-04 23:21:16 -06:00
parent d0fd24548c
commit 9a2419223a
6 changed files with 224 additions and 116 deletions

View File

@ -195,14 +195,13 @@ int main(void)
}
LOG_INF("Initialized %s", accel->name);
gyro = accel; // FIXME: this is a hack while splitting apart BMX055
// gyro = DEVICE_DT_GET(DT_NODELABEL(bmx055_gyro));
// if (!device_is_ready(gyro))
// {
// LOG_ERR("Device %s not ready", gyro->name);
// return 0;
// }
// LOG_INF("Initialized %s", gyro->name);
gyro = DEVICE_DT_GET(DT_NODELABEL(bmx055_gyro));
if (!device_is_ready(gyro))
{
LOG_ERR("Device %s not ready", gyro->name);
return 0;
}
LOG_INF("Initialized %s", gyro->name);
mag = accel; // FIXME: this is a hack while splitting apart BMX055
// mag = DEVICE_DT_GET(DT_NODELABEL(bmx055_mag));
@ -273,10 +272,10 @@ int main(void)
LOG_ERR("Could not get acceleration");
}
// if (sensor_sample_fetch(gyro) < 0)
// {
// LOG_ERR("Could not fetch sample from gyro");
// }
if (sensor_sample_fetch(gyro) < 0)
{
LOG_ERR("Could not fetch sample from gyro");
}
if (sensor_channel_get(gyro, SENSOR_CHAN_GYRO_X, &gyro_x) < 0)
{
LOG_ERR("Could not get gyro");
@ -352,11 +351,11 @@ int main(void)
{
LOG_ERR("Failed to print a string");
}
if (cfb_print(display, str_my, 0, 16))
if (cfb_print(display, str_gy, 0, 16))
{
LOG_ERR("Failed to print a string");
}
if (cfb_print(display, str_mz, 0, 16 * 2))
if (cfb_print(display, str_gz, 0, 16 * 2))
{
LOG_ERR("Failed to print a string");
}