Mercurial > pihelp
comparison main.c @ 31:5d6a841eef82
/128 prescaler for adc
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 27 Jun 2013 00:12:32 +0800 |
parents | ce5097eacf2f |
children | cce426bb6d3e |
comparison
equal
deleted
inserted
replaced
30:320c8cc7df5a | 31:5d6a841eef82 |
---|---|
760 static void | 760 static void |
761 adc_generic(uint8_t admux, uint8_t *ret_num, uint16_t *ret_sum) | 761 adc_generic(uint8_t admux, uint8_t *ret_num, uint16_t *ret_sum) |
762 { | 762 { |
763 PRR &= ~_BV(PRADC); | 763 PRR &= ~_BV(PRADC); |
764 | 764 |
765 // /64 prescaler, interrupt | 765 // /128 prescaler (86kHz), interrupt |
766 ADCSRA = _BV(ADEN) | _BV(ADPS2) | _BV(ADPS1) | _BV(ADIE); | 766 ADCSRA = _BV(ADEN) |
767 | _BV(ADPS2) | _BV(ADPS1) | _BV(ADPS0) | |
768 | _BV(ADIE); | |
767 | 769 |
768 // set to measure 1.1 reference | 770 // set to measure 1.1 reference |
769 ADMUX = admux; | 771 ADMUX = admux; |
770 | 772 |
771 // delay after setting reference etc, allow settling | 773 // delay after setting reference etc, allow settling |