Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: UITDSP_ADDA_Example2
Diff: InternalADC.cpp
- Revision:
- 1:e997f4e94491
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/InternalADC.cpp Mon Mar 16 23:59:49 2015 +0000
@@ -0,0 +1,33 @@
+//------------------------------------------------------
+// Class for Internal ADC using Ticker for trigger
+// To get bit definition for registers in
+// peripheral, see "stm32f401xe.h"
+//
+// 2015/01/27, Copyright (c) 2015 MIKAMI, Naoki
+//------------------------------------------------------
+
+#include "InternalADC.hpp"
+
+namespace Mikami
+{
+ InternalADC::InternalADC(PinName pin1,
+ PinName pin2, PinName pin3)
+ : adc_(pin1), myAdc_(ADC1)
+ {
+ myAdc_->CR2 = ADC_CR2_ADON; // Enable ADC
+
+ ch1_ = GetChannelNumber(pin1);
+ if (pin2 != NC)
+ {
+ adc2_ = new AnalogIn(pin2);
+ ch2_ = GetChannelNumber(pin2);
+ }
+ if (pin3 != NC)
+ {
+ adc3_ = new AnalogIn(pin3);
+ ch3_ = GetChannelNumber(pin3);
+ }
+ Select1stChannel();
+ }
+}
+