Open Sint  3.4-2
Macros | Functions
adc.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ADC_RATIO   1.65
 

Functions

void adc_init (void)
 
int adc_wind_position (void)
 Convert between 0-255 to 0-360 degrees.
 

Macro Definition Documentation

◆ ADC_RATIO

#define ADC_RATIO   1.65

Ratio to convert 0-255 to 0-360 degrees (mostly) From the Davis sensor we have a range 0 ~ 4V, then we read 0 - (4/5)*255 value from the adc. This means 0 - 204 rappresent 0-360 degrees. Things changes slightly anytime. 1.65 seems a good approximation

Function Documentation

◆ adc_init()

void adc_init ( void  )

Enable ADC.

select ADC clock = F_CPU / 128, manual sample.

Set internal VREF, left adjusted result, adc0