Sergii Kaplia
/
Internal_Temperature_F103RB1
test
Diff: main.cpp
- Revision:
- 5:27071c2166bb
- Parent:
- 4:f5c604b5eceb
- Child:
- 7:fabc8bd0dbcd
--- a/main.cpp Tue Mar 29 16:51:33 2016 +0000 +++ b/main.cpp Tue Feb 05 13:28:38 2019 +0000 @@ -10,19 +10,20 @@ * Table 50. TS characteristics, Page 80 */ const float AVG_SLOPE = 4.3E-03; // slope (gradient) of temperature line function [V/°C] -const float V25 = 1.43; // sensor's voltage at 25°C [V] +const float V25 = 1.43; // sensor's output voltage at 25°C [V] const float ADC_TO_VOLT = 3.3 / 4096; // conversion coefficient of digital value to voltage [V] // when using 3.3V ref. voltage at 12-bit resolution (2^12 = 4096) Serial pc(USBTX, USBRX); -DigitalOut led(LED1); +DigitalOut led(PC_13); ADC_HandleTypeDef hadc1; // ADC handle uint16_t adcValue; // digital value of sensor float vSense; // sensor's output voltage [V] float temp; // sensor's temperature [°C] /* ADC1 init function */ -void MX_ADC1_Init(void) { +void MX_ADC1_Init(void) +{ ADC_ChannelConfTypeDef sConfig; /**Common config @@ -44,7 +45,8 @@ HAL_ADC_ConfigChannel(&hadc1, &sConfig); } -int main() { +int main() +{ MX_ADC1_Init(); // initialize AD convertor while(HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK); // calibrate AD convertor