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

Sebastian Meiling notifications at github.com
Thu Sep 28 14:46:38 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);

In general a good idea, specifically to have the reference voltage configurable. What I don't like is the duplication in `pin` and `ch` because they have a direct dependency and ADC_PORT is fixed for all anyway.

-- 
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_r141606632
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20170928/a51adb60/attachment.html>


More information about the notifications mailing list