test_thermal.c 550 B

12345678910111213141516171819202122232425262728293031
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <hal_cmd.h>
  4. #include <sunxi_hal_thermal.h>
  5. #include <hal_timer.h>
  6. int cmd_ths_gt(int argc, char **argv)
  7. {
  8. int ret, temp, i;
  9. static int init = 0;
  10. if (!init) {
  11. hal_ths_init();
  12. init = 1;
  13. hal_msleep(1000);
  14. }
  15. printf("ths get temp\n");
  16. ret = hal_ths_get_temp(0, &temp);
  17. if (ret < 0)
  18. printf("Fail to get temp.\n");
  19. else
  20. printf("\ntemp:%d\n", temp);
  21. return 0;
  22. }
  23. FINSH_FUNCTION_EXPORT_CMD(cmd_ths_gt, ths_gt, thermal get temp)