[riot-notifications] [RIOT-OS/RIOT] cpu/atmega_common: add adc driver (#7227)

Sebastian Meiling notifications at github.com
Thu Sep 28 15:03:12 CEST 2017


smlng commented on this pull request.



> +        }
+    #elif defined (CPU_ATMEGA1281)
+        DDRF &= ~(1 << line);
+        PORTF &= ~(1 << line);
+    #endif
+
+    /* set clock prescaler to get the maximal possible ADC clock value */
+    for (clk_div = 1; clk_div < 8; clk_div++) {
+        if ((CLOCK_CORECLOCK / (1 << clk_div)) <= ADC_MAX_CLK) {
+            break;
+        }
+    }
+    ADCSRA |= clk_div;
+
+    /* Ref Voltage is Vcc(5V) */
+    ADMUX |= (1 << REFS0);

but maybe we should get general ADC support first and fix this later on. A first step could also be to make the ref voltage configurable via define macro (though it applies to all pins then).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/7227#discussion_r141610296
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20170928/f4ca6acb/attachment.html>


More information about the notifications mailing list