Frank Vannieuwkerke / ComparatorIn

Dependents:   ComparatorIn_demo TEMT6200_demo 05_comparator_demo 05_comparator_demo ... more

Files at this revision

API Documentation at this revision

Comitter:
frankvnk
Date:
Sun Aug 25 18:00:42 2013 +0000
Parent:
18:efa8d41b738f
Commit message:
_fptr names were too generic. Added comparatorin_ to each name.

Changed in this revision

ComparatorIn.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ComparatorIn.cpp	Sat Jul 20 18:56:26 2013 +0000
+++ b/ComparatorIn.cpp	Sun Aug 25 18:00:42 2013 +0000
@@ -9,9 +9,9 @@
 
 #include "ComparatorIn.h"
  
-void (*rise_fptr)(void);     // Pointer to user function - called after rising IRQ assertion.
-void (*fall_fptr)(void);     // Pointer to user function - called after falling IRQ assertion.
-AnalogOut *_dac12;           // Pointer to AnalogOut
+void (*comparatorin_rise_fptr)(void);     // Pointer to user function - called after rising IRQ assertion.
+void (*comparatorin_fall_fptr)(void);     // Pointer to user function - called after falling IRQ assertion.
+AnalogOut *_dac12;                        // Pointer to AnalogOut
 
 const PinMap ComparatorIn::PinMap_CMP[] = {
     {PTC6,  CMP0_IN0, 0},
@@ -26,8 +26,8 @@
 
 ComparatorIn::ComparatorIn(PinName pinP, PinName pinM)
 {
-    rise_fptr = NULL;
-    fall_fptr = NULL;
+    comparatorin_rise_fptr = NULL;
+    comparatorin_fall_fptr = NULL;
     CMPnumberP = (CMPName)pinmap_peripheral(pinP, PinMap_CMP);
     if (CMPnumberP == (uint32_t)NC)         // When NC, use DAC0
         CMPnumberP = 0x07;
@@ -218,12 +218,12 @@
     {
         CMP0->SCR &= ~CMP_SCR_IER_MASK;  // Disable rising int.
         CMP0->SCR |=  CMP_SCR_CFR_MASK;  // clear flag
-        if(fall_fptr == NULL)
+        if(comparatorin_fall_fptr == NULL)
             NVIC_DisableIRQ(CMP0_IRQn);
     }
     else
     {
-        rise_fptr = fptr;
+        comparatorin_rise_fptr = fptr;
         CMP0->SCR |= (CMP_SCR_IER_MASK | CMP_SCR_CFR_MASK);  // Enable rising int. and clear flag
         NVIC_EnableIRQ(CMP0_IRQn);  // enable CMP0 interrupt
     }
@@ -235,12 +235,12 @@
     {
         CMP0->SCR &= ~CMP_SCR_IEF_MASK;  // Disable falling int.
         CMP0->SCR |=  CMP_SCR_CFF_MASK;  // clear flag
-        if(rise_fptr == NULL)
+        if(comparatorin_rise_fptr == NULL)
             NVIC_DisableIRQ(CMP0_IRQn);
     }
     else
     {
-        fall_fptr = fptr;
+        comparatorin_fall_fptr = fptr;
         CMP0->SCR |= (CMP_SCR_IEF_MASK | CMP_SCR_CFF_MASK);  // Enable falling int. and clear flag
         NVIC_EnableIRQ(CMP0_IRQn);  // enable CMP0 interrupt
     }
@@ -252,15 +252,15 @@
     // Rising edge
     if (((CMP0->SCR & CMP_SCR_IER_MASK)==CMP_SCR_IER_MASK) && ((CMP0->SCR & CMP_SCR_CFR_MASK)==CMP_SCR_CFR_MASK))
     {
-        CMP0->SCR |= CMP_SCR_CFR_MASK;                              // Clear the flag
-        if (rise_fptr != NULL) rise_fptr();                         // call user function
+        CMP0->SCR |= CMP_SCR_CFR_MASK;                                // Clear the flag
+        if (comparatorin_rise_fptr != NULL) comparatorin_rise_fptr(); // call user function
     }
 
     // Falling edge
     if (((CMP0->SCR & CMP_SCR_IEF_MASK)==CMP_SCR_IEF_MASK) && ((CMP0->SCR & CMP_SCR_CFF_MASK)==CMP_SCR_CFF_MASK))
     {
-        CMP0->SCR |= CMP_SCR_CFF_MASK;                              // Clear the flag
-        if (fall_fptr != NULL) fall_fptr();                         // call user function
+        CMP0->SCR |= CMP_SCR_CFF_MASK;                                // Clear the flag
+        if (comparatorin_fall_fptr != NULL) comparatorin_fall_fptr(); // call user function
     } 
 }