first pass at ti hdc1080. Temperature works, humidity doesn't
Some checks failed
Build / build (macos-12) (push) Waiting to run
Build / build (macos-14) (push) Waiting to run
Build / build (windows-2022) (push) Waiting to run
Build / build (ubuntu-22.04) (push) Failing after 18s
Documentation / build (push) Successful in 5s

This commit is contained in:
2024-04-28 04:18:39 -06:00
parent 9fc352115f
commit e82df2fec4
8 changed files with 276 additions and 26 deletions

View File

@ -116,12 +116,12 @@ int main(void)
}
LOG_INF("Initialized %s\n", lis->name);
// hdc = DEVICE_DT_GET(DT_NODELABEL(hdc1080));
// if (!device_is_ready(dev))
// {
// printf("Device %s not ready\n", hdc->name);
// return 0;
// }
hdc = DEVICE_DT_GET(DT_NODELABEL(hdc1080));
if (!device_is_ready(hdc))
{
printf("Device %s not ready\n", hdc->name);
return 0;
}
while (1)
{
@ -219,18 +219,24 @@ int main(void)
return 0;
}
// ret = sensor_sample_fetch(hdc);
// if (ret < 0)
// {
// LOG_ERR("Could not fetch sample (%d)", ret);
// return 0;
// }
// ret = sensor_channel_get(ina, SENSOR_CHAN_HUMIDITY, &humidity);
// if (ret < 0)
// {
// LOG_ERR("Could not get sample (%d)", ret);
// return 0;
// }
ret = sensor_sample_fetch(hdc);
if (ret < 0)
{
LOG_ERR("Could not fetch sample (%d)", ret);
return 0;
}
ret = sensor_channel_get(hdc, SENSOR_CHAN_AMBIENT_TEMP, &temperature);
if (ret < 0)
{
LOG_ERR("Could not get sample (%d)", ret);
return 0;
}
ret = sensor_channel_get(hdc, SENSOR_CHAN_HUMIDITY, &humidity);
if (ret < 0)
{
LOG_ERR("Could not get sample (%d)", ret);
return 0;
}
sprintf(str_v, "V :%7.5f", voltage.val1 + voltage.val2 * 1e-6);
sprintf(str_i, "I :%7.5f", current.val1 + current.val2 * 1e-6);
@ -245,21 +251,21 @@ int main(void)
// printf("%s\t%s\t%s\t%s\n", str_v, str_i, str_p, str_t);
cfb_framebuffer_clear(dev, false);
if (cfb_print(dev, str_ax, 0, 0))
if (cfb_print(dev, str_t, 0, 0))
{
printf("Failed to print a string\n");
continue;
}
if (cfb_print(dev, str_ay, 0, 16))
{
printf("Failed to print a string\n");
continue;
}
if (cfb_print(dev, str_az, 0, 16 * 2))
if (cfb_print(dev, str_h, 0, 16))
{
printf("Failed to print a string\n");
continue;
}
// if (cfb_print(dev, str_az, 0, 16 * 2))
// {
// printf("Failed to print a string\n");
// continue;
// }
// if (cfb_print(dev, str_az_ref, 0, 16 * 3))
// {
// printf("Failed to print a string\n");