X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=common%2Fadc.h;fp=common%2Fadc.h;h=d9cff6b1b961a88c1c0c498533814d5d8f058a0a;hb=3c070b8fc92fe0506e29d0c0491038be241f7107;hp=0000000000000000000000000000000000000000;hpb=912c9026215483f1755c2291370208f43e1a7b2c;p=model-railway-devices.git diff --git a/common/adc.h b/common/adc.h new file mode 100644 index 0000000..d9cff6b --- /dev/null +++ b/common/adc.h @@ -0,0 +1,17 @@ +#ifndef ADC_H_ +#define ADC_H_ + +#include + +#define ADC_SET_CALLBACK(f) \ + ISR(ADC_vect) \ + { \ + uint16_t v = ADCL; \ + v |= ADCH<<8; \ + f(v); \ + } + +void adc_init(); +void adc_read_async(uint8_t); + +#endif