Skip to content

Commit

Permalink
Add internal chip temperature for W600 (untested) and W800 (#1393)
Browse files Browse the repository at this point in the history
* Add internal chip temperature for W600 (untested) and W800

* Add comment to force rebuild
  • Loading branch information
MaxineMuster authored Nov 8, 2024
1 parent c505156 commit a8c76f2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hal/hal_adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@

void HAL_ADC_Init(int pinNumber);
int HAL_ADC_Read(int pinNumber);

#if defined(PLATFORM_W800) || defined(PLATFORM_W600)
float HAL_ADC_Temp(void);
#endif
10 changes: 10 additions & 0 deletions src/hal/w800/hal_adc_w800.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,15 @@ int HAL_ADC_Read(int pinNumber)
{
return adc_get_inputVolt(gpioToAdc(pinNumber));
}
// cpu internal temperature
float HAL_ADC_Temp(void)
{
wm_adc_config(0);
adc_get_offset();
// adc_temp returns
// chip temperature, unit: 1/1000 degree
// we want a float here
return (float)adc_temp()/1000;
}

#endif
2 changes: 2 additions & 0 deletions src/user_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ void Main_OnEverySecond()
get_tsen_adc(&g_wifi_temperature, 0);
#elif PLATFORM_LN882H
// this is set externally, I am just leaving comment here
#elif PLATFORM_W800 || PLATFORM_W600
g_wifi_temperature = HAL_ADC_Temp();
#endif
}
// run_adc_test();
Expand Down

0 comments on commit a8c76f2

Please sign in to comment.