Support KL25z USB logger

Dependents:   kl25z_Usb_Logger

Fork of FastAnalogIn by Erik -

Files at this revision

API Documentation at this revision

Comitter:
humlet
Date:
Mon Apr 21 07:17:39 2014 +0000
Parent:
4:cd84739f7640
Child:
6:e2a98449ae58
Commit message:
* minor docu changes; * added definition of "channel_usage" also to KLXX-implementation

Changed in this revision

FastAnalogIn.h Show annotated file Show diff for this revision Revisions of this file
FastAnalogIn_KLXX.cpp Show annotated file Show diff for this revision Revisions of this file
FastAnalogIn_LPC408X.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/FastAnalogIn.h	Sun Apr 20 16:23:19 2014 +0000
+++ b/FastAnalogIn.h	Mon Apr 21 07:17:39 2014 +0000
@@ -11,14 +11,14 @@
     #error "Target not supported"
 #endif
 
- /** A class similar to AnalogIn, only faster, for LPC1768 and KLxx
+ /** A class similar to AnalogIn, only faster, for LPC1768, LPC408X and KLxx
  *
  * AnalogIn does a single conversion when you read a value (actually several conversions and it takes the median of that).
  * This library runns the ADC conversion automatically in the background.
  * When read is called, it immediatly returns the last sampled value.
  *
- * LPC1768
- * Using more ADC pins in continuous mode will decrease the conversion rate (LPC1768).
+ * LPC1768 / LPC4088
+ * Using more ADC pins in continuous mode will decrease the conversion rate (LPC1768:200kHz/LPC4088:400kHz).
  * If you need to sample one pin very fast and sometimes also need to do AD conversions on another pin,
  * you can disable the continuous conversion on that ADC channel and still read its value.
  *
--- a/FastAnalogIn_KLXX.cpp	Sun Apr 20 16:23:19 2014 +0000
+++ b/FastAnalogIn_KLXX.cpp	Mon Apr 21 07:17:39 2014 +0000
@@ -6,6 +6,8 @@
 #define MAX_FADC            6000000
 #define CHANNELS_A_SHIFT    5
 
+int FastAnalogIn::channel_usage[8] = {0,0,0,0,0,0,0,0};
+
 FastAnalogIn::FastAnalogIn(PinName pin, bool enabled)
 {
     ADCnumber = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
--- a/FastAnalogIn_LPC408X.cpp	Sun Apr 20 16:23:19 2014 +0000
+++ b/FastAnalogIn_LPC408X.cpp	Mon Apr 21 07:17:39 2014 +0000
@@ -26,10 +26,9 @@
     ADCnumber = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
     if (ADCnumber == (uint32_t)NC)
         error("ADC pin mapping failed");
-    //printf("ADC_ID=%u\n",ADCnumber);
     datareg = (uint32_t*) (&LPC_ADC->DR[ADCnumber]);
 
-    wait_us(1000); // we need either the debug printf above or a wait before we try to initialize the ADC
+    wait_us(1000); // wait for a short while before trying to initialize the ADC afer a reset (needed for those global instantiations just before main)
 
     // ensure power is turned on
     LPC_SC->PCONP |= (1 << 12);