firmware/Temperature/src/ADC.c
///////////////////////////////////////////////////////////////////////////////
/// \brief Normalize the value returned from an ADC_Read
///
/// \param ADC reading
/// \param destination pointer to return the normalized value
///
/// \return True on success else no valid destination
///////////////////////////////////////////////////////////////////////////////
\brief Normalize the value returned from an ADC_Read
\param ADC reading
\param destination pointer to return the normalized value

\return True on success else no valid destination
\ brief Normalize the value returned from an ADC_Read \ param ADC reading \ param destination pointer to return the normalized value \ return True on success else no valid destination
uint_fast8_t ADC_Normalize(uint_fast16_t adcReading, float *destination) {
	if (!destination) {
		return FALSE;
	}
	uint32_t adcResolution;
	if (adcReading != 0) {
		adcResolution =  (uint32_t)12 - (((uint32_t)(ADC1->CFGR1 & ADC_CFGR1_RES ) >> 3) * 2);
		adcResolution = ((uint32_t)(1 << adcResolution)); 
		float temp = (float)adcReading / (float)(adcResolution-1);
		*destination = temp;
		return TRUE;
	} else {
		*destination = 0;
		return TRUE;
	}
}
uint_fast8_t ADC_Normalize ( uint_fast16_t adcReading , float * destination ) { if ( ! destination ) { return FALSE ; } uint32_t adcResolution ; if ( adcReading != 0 ) { adcResolution = ( uint32_t ) 12 - ( ( ( uint32_t ) ( ADC1 -> CFGR1 & ADC_CFGR1_RES ) >> 3 ) * 2 ) ; adcResolution = ( ( uint32_t ) ( 1 << adcResolution ) ) ; float temp = ( float ) adcReading / ( float ) ( adcResolution - 1 ) ; * destination = temp ; return TRUE ; } else { * destination = 0 ; return TRUE ; } }
\brief Normalize the value returned from an ADC_Read
\param ADC reading
\param destination pointer to return the normalized value
\ brief Normalize the value returned from an ADC_Read \ param ADC reading \ param destination pointer to return the normalized value
// this gives us 2^adcResolution