split out magnetometer

This commit is contained in:
2024-07-04 23:30:11 -06:00
parent 9a2419223a
commit d8ac413a9a
7 changed files with 226 additions and 112 deletions

View File

@ -203,14 +203,13 @@ int main(void)
}
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));
// if (!device_is_ready(mag))
// {
// LOG_ERR("Device %s not ready", mag->name);
// return 0;
// }
// LOG_INF("Initialized %s", mag->name);
mag = DEVICE_DT_GET(DT_NODELABEL(bmx055_mag));
if (!device_is_ready(mag))
{
LOG_ERR("Device %s not ready", mag->name);
return 0;
}
LOG_INF("Initialized %s", mag->name);
lis = DEVICE_DT_GET(DT_NODELABEL(lis2dh));
if (!device_is_ready(lis))
@ -289,10 +288,10 @@ int main(void)
LOG_ERR("Could not get gyro");
}
// if (sensor_sample_fetch(mag) < 0)
// {
// LOG_ERR("Could not fetch sample from mag");
// }
if (sensor_sample_fetch(mag) < 0)
{
LOG_ERR("Could not fetch sample from mag");
}
if (sensor_channel_get(mag, SENSOR_CHAN_MAGN_X, &mag_x) < 0)
{
LOG_ERR("Could not get mag");