#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <termios.h>
#include "hwmon.h"

int main(int argc, char **argv)
{
  int k = 0;
  hwmon_data data;

  if ((k = hwmon_init()) < 0)
  {
    fprintf(stderr, "%s: hwmon_init() failed\n", argv[0]);
    return 1;
  }
  printf("Detected board configuration %d\n", k);

  while (1)
  {
    hwmon_read(&data);
    printf("Poll %d, CPU temperature: %.0f\tCPU fan: %ld\tChassis fan: %ld\n", 
           ++k, data.cpu_temp, data.cpu_fan, data.chassis_fan);
    sleep(1);
  }

  return 0;
}
