#include "myADC.h" #include "pansi.h" #include // #include "stm32h743xx.h" // #include /** * Temperature Sensor Characteristics * uint16_t perché la grandezza è di 2 byte da datasheet | Table 93. Temperature sensor calibration values | | Symbol | Parameter | Memory address ===================================================================== |TS_CAL1 | Temperature sensor raw data | 0x1FF1E820 - 0x1FF1E821 acquired value at 30 °C, VDDA =3.3 V --------------------------------------------------------------------- /TS_CAL2 / Temperature sensor raw data | 0x1FF1E840 - 0x1FF1E841 acquired value at 110 °C, VDDA = 3.3 V ===================================================================== */ #define TS_CAL1 *(uint16_t *)0x1FF1E820 #define TS_CAL2 *(uint16_t *)0x1FF1E840 #define TCAL_30C *(uint16_t *)0x1FF1E820 #define TCAL_110C *(uint16_t *)0x1FF1E840 static volatile uint16_t *tsc_cal1 = (uint16_t *)0x1FF1E820; static volatile uint16_t *tsc_cal2 = (uint16_t *)0x1FF1E840; #define VREFINT_C *(uint16_t *)(0x1FF1E860) // Internal Referance Voltage 30 static volatile uint16_t *VRefInCal = (uint16_t *)0x1FF1E860; /** * @brief Funzione per la calibrazione dell'ADC * 3 step. (1). controllo se ad è spenta e in caso spengo io * (2). Avvio la calibrazione degli offset e quela lineare * (3). Aspetto la fine della calibrazione */ void myADC3_calibration(void) { // (1) check if the ADC is disable after start calibration if (ADC3->CR & ADC_CR_ADEN) { ADC3->CR |= ADC_CR_ADDIS; // disable while (ADC3->CR & ADC_CR_ADEN) { // aspettando che si spenga la periferica // blink RED led TODO } } // (2) // configure for a linear calibration. ADC3->CR |= ADC_CR_ADCALLIN; // start calibration. reset by hardware when the calibration complete ADC3->CR |= ADC_CR_ADCAL; // (3) while (ADC3->CR & ADC_CR_ADCAL) { // blink GREEN led } }