Private functions ---------------------------------------------------------*/ / * @brief * Get current temperature value in degree celsius * * @details * * @note * * @return * Temperature value (signed integer) in degree celsius times 100 * ******************************************************************************/
| 51 | * |
| 52 | ******************************************************************************/ |
| 53 | rt_int32_t rt_hw_get_temp(void) |
| 54 | { |
| 55 | ADC_InitSingle_TypeDef singleInit = ADC_INITSINGLE_DEFAULT; |
| 56 | struct efm32_adc_result_t result; |
| 57 | rt_uint32_t temp; |
| 58 | |
| 59 | /* Set input to temperature sensor. Acquisition time must be 256 cycles. |
| 60 | Reference must be 1.25V */ |
| 61 | singleInit.acqTime = adcAcqTime32; |
| 62 | singleInit.reference = adcRef1V25; |
| 63 | singleInit.input = adcSingleInpTemp; |
| 64 | |
| 65 | control.single.init = &singleInit; |
| 66 | adc0->control(adc0, RT_DEVICE_CTRL_ADC_MODE, &control); |
| 67 | result.mode = control.mode; |
| 68 | result.buffer = (void *)&temp; |
| 69 | adc0->control(adc0, RT_DEVICE_CTRL_RESUME, &result); |
| 70 | adc0->control(adc0, RT_DEVICE_CTRL_ADC_RESULT, &result); |
| 71 | |
| 72 | return efm32_misc_getCelsius(temp); |
| 73 | } |
| 74 | |
| 75 | /***************************************************************************//** |
| 76 | * @brief |
no test coverage detected