You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 lines
629 B

  1. //#include <proc/p32mx440f256h.h>
  2. #include "TemperatureSensor.h"
  3. #include "BoardCfg.h"
  4. #include "TC77.h"
  5. #include "timer.h"
  6. void InitTempSensor()
  7. {
  8. ActualTemp = 0xBAADBEEF;
  9. TimerStart(TEMP_SENSOR_REFRESH_TIMER,1000);
  10. }
  11. int TempSensorCheckAndConfigure()
  12. {
  13. if(TC77Configure() == RET_OK)
  14. {
  15. ActualTemp = TC77GetActualTemp();
  16. return RET_OK;
  17. }
  18. return RET_ERROR;
  19. }
  20. float TempSensorGetTemp()
  21. {
  22. return ActualTemp;
  23. }
  24. void TickTempSensor()
  25. {
  26. if(IsTimerExpired(TEMP_SENSOR_REFRESH_TIMER))
  27. {
  28. ActualTemp = TC77GetActualTemp();
  29. TimerStart(TEMP_SENSOR_REFRESH_TIMER,1000);
  30. // printf("Temperature: %f\n",ActualTemp);
  31. }
  32. }