mirror of
https://github.com/eddyem/stm32samples.git
synced 2026-02-28 11:54:30 +03:00
some fixes of old bugs
This commit is contained in:
@@ -126,9 +126,11 @@ uint16_t getADCval(int nch){
|
||||
PIX_SORT(p[4], p[2]) ;
|
||||
#undef PIX_SORT
|
||||
#undef PIX_SWAP
|
||||
/*
|
||||
#ifdef EBUG
|
||||
DBG("val: "); printu(p[4]); newline();
|
||||
#endif
|
||||
*/
|
||||
return p[4];
|
||||
}
|
||||
|
||||
@@ -136,9 +138,11 @@ uint16_t getADCval(int nch){
|
||||
int32_t getADCvoltage(int nch){
|
||||
float v = getADCval(nch) * 3.3;
|
||||
v /= 4.096f; // 12bit ADC
|
||||
/*
|
||||
#ifdef EBUG
|
||||
DBG("v="); printf(v); newline();
|
||||
#endif
|
||||
*/
|
||||
return (uint32_t) v;
|
||||
}
|
||||
|
||||
@@ -150,9 +154,11 @@ int32_t getMCUtemp(){
|
||||
temperature *= (110.f - 30.f);
|
||||
temperature /= (float)(*TEMP30_CAL_ADDR - *TEMP110_CAL_ADDR);
|
||||
temperature += 30.f;
|
||||
/*
|
||||
#ifdef EBUG
|
||||
DBG("t="); printf(temperature); newline();
|
||||
#endif
|
||||
*/
|
||||
return (uint32_t) (temperature*1000.f);
|
||||
}
|
||||
|
||||
@@ -160,8 +166,10 @@ int32_t getMCUtemp(){
|
||||
int32_t getVdd(){
|
||||
float vdd = ((float) *VREFINT_CAL_ADDR) * 3.3f; // 3.3V
|
||||
vdd /= getADCval(ADC_VREF);
|
||||
/*
|
||||
#ifdef EBUG
|
||||
DBG("vdd="); printf(vdd); newline();
|
||||
#endif
|
||||
*/
|
||||
return (uint32_t) (vdd * 1000.f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user