Author: sebastien.lelong
Date: Mon Jun 29 05:14:11 2009
New Revision: 1063

Modified:
    trunk/include/peripheral/adc/adc_channels.jal
    trunk/tools/adc/adc_channels.jal.tmpl

Log:
issue-76: handle ANSEL_ANSELx bits

Modified: trunk/include/peripheral/adc/adc_channels.jal
==============================================================================
--- trunk/include/peripheral/adc/adc_channels.jal       (original)
+++ trunk/include/peripheral/adc/adc_channels.jal       Mon Jun 29 05:14:11 2009
@@ -1380,7 +1380,22 @@
     if defined(ANSEL_ANS7) == true then
        var volatile bit JALLIB_ANS7      is ANSEL_ANS7
     end if
-
+   -- PICs: 18f13k22, 18f14k22, 18lf13k22, 18lf14k22
+   if defined(ANSEL_ANSEL0) == true then
+         -- ANSEL0 always comes with ANSEL1 and ANSEL2
+      var volatile bit JALLIB_ANS0      is ANSEL_ANSEL0
+      var volatile bit JALLIB_ANS1      is ANSEL_ANSEL1
+      var volatile bit JALLIB_ANS2      is ANSEL_ANSEL2
+   end if
+   -- PICs: 18f13k22, 18f13k50, 18f14k22, 18f14k50, 18lf13k22, 18lf13k50,  
18lf14k22, 18lf14k50
+   if defined(ANSEL_ANSEL3) == true then
+         -- ANSEL3 always comes with ANSEL4, ANSEL5, ANSEL6 and ANSEL7
+      var volatile bit JALLIB_ANS3      is ANSEL_ANSEL3
+      var volatile bit JALLIB_ANS4      is ANSEL_ANSEL4
+      var volatile bit JALLIB_ANS5      is ANSEL_ANSEL5
+      var volatile bit JALLIB_ANS6      is ANSEL_ANSEL6
+      var volatile bit JALLIB_ANS7      is ANSEL_ANSEL7
+   end if

     -- Now, it's normalized...
     -- Provide helper func to configure pins either in digital or analog  
mode
@@ -1397,139 +1412,139 @@
        if defined(JALLIB_ANS0) == true then
           if an_pin_num == 0 then
              JALLIB_ANS0 = true
-                       adc_pin_AN0_direction = input
+            adc_pin_AN0_direction = input
           end if
        end if
        if defined(JALLIB_ANS1) == true then
           if an_pin_num == 1 then
              JALLIB_ANS1 = true
-                       adc_pin_AN1_direction = input
+            adc_pin_AN1_direction = input
           end if
        end if
        if defined(JALLIB_ANS2) == true then
           if an_pin_num == 2 then
              JALLIB_ANS2 = true
-                       adc_pin_AN2_direction = input
+            adc_pin_AN2_direction = input
           end if
        end if
        if defined(JALLIB_ANS3) == true then
           if an_pin_num == 3 then
              JALLIB_ANS3 = true
-                       adc_pin_AN3_direction = input
+            adc_pin_AN3_direction = input
           end if
        end if
        if defined(JALLIB_ANS4) == true then
           if an_pin_num == 4 then
              JALLIB_ANS4 = true
-                       adc_pin_AN4_direction = input
+            adc_pin_AN4_direction = input
           end if
        end if
        if defined(JALLIB_ANS5) == true then
           if an_pin_num == 5 then
              JALLIB_ANS5 = true
-                       adc_pin_AN5_direction = input
+            adc_pin_AN5_direction = input
           end if
        end if
        if defined(JALLIB_ANS6) == true then
           if an_pin_num == 6 then
              JALLIB_ANS6 = true
-                       adc_pin_AN6_direction = input
+            adc_pin_AN6_direction = input
           end if
        end if
        if defined(JALLIB_ANS7) == true then
           if an_pin_num == 7 then
              JALLIB_ANS7 = true
-                       adc_pin_AN7_direction = input
+            adc_pin_AN7_direction = input
           end if
        end if
        if defined(JALLIB_ANS8) == true then
           if an_pin_num == 8 then
              JALLIB_ANS8 = true
-                       adc_pin_AN8_direction = input
+            adc_pin_AN8_direction = input
           end if
        end if
        if defined(JALLIB_ANS9) == true then
           if an_pin_num == 9 then
              JALLIB_ANS9 = true
-                       adc_pin_AN9_direction = input
+            adc_pin_AN9_direction = input
           end if
        end if
        if defined(JALLIB_ANS10) == true then
           if an_pin_num == 10 then
              JALLIB_ANS10 = true
-                       adc_pin_AN10_direction = input
+            adc_pin_AN10_direction = input
           end if
        end if
        if defined(JALLIB_ANS11) == true then
           if an_pin_num == 11 then
              JALLIB_ANS11 = true
-                       adc_pin_AN11_direction = input
+            adc_pin_AN11_direction = input
           end if
        end if
        if defined(JALLIB_ANS12) == true then
           if an_pin_num == 12 then
              JALLIB_ANS12 = true
-                       adc_pin_AN12_direction = input
+            adc_pin_AN12_direction = input
           end if
        end if
        if defined(JALLIB_ANS13) == true then
           if an_pin_num == 13 then
              JALLIB_ANS13 = true
-                       adc_pin_AN13_direction = input
+            adc_pin_AN13_direction = input
           end if
        end if
        if defined(JALLIB_ANS14) == true then
           if an_pin_num == 14 then
              JALLIB_ANS14 = true
-                       adc_pin_AN14_direction = input
+            adc_pin_AN14_direction = input
           end if
        end if
        if defined(JALLIB_ANS15) == true then
           if an_pin_num == 15 then
              JALLIB_ANS15 = true
-                       adc_pin_AN15_direction = input
+            adc_pin_AN15_direction = input
           end if
        end if
        if defined(JALLIB_ANS16) == true then
           if an_pin_num == 16 then
              JALLIB_ANS16 = true
-                       adc_pin_AN16_direction = input
+            adc_pin_AN16_direction = input
           end if
        end if
        if defined(JALLIB_ANS17) == true then
           if an_pin_num == 17 then
              JALLIB_ANS17 = true
-                       adc_pin_AN17_direction = input
+            adc_pin_AN17_direction = input
           end if
        end if
        if defined(JALLIB_ANS18) == true then
           if an_pin_num == 18 then
              JALLIB_ANS18 = true
-                       adc_pin_AN18_direction = input
+            adc_pin_AN18_direction = input
           end if
        end if
        if defined(JALLIB_ANS19) == true then
           if an_pin_num == 19 then
              JALLIB_ANS19 = true
-                       adc_pin_AN19_direction = input
+            adc_pin_AN19_direction = input
           end if
        end if
        if defined(JALLIB_ANS20) == true then
           if an_pin_num == 20 then
              JALLIB_ANS20 = true
-                       adc_pin_AN20_direction = input
+            adc_pin_AN20_direction = input
           end if
        end if
        if defined(JALLIB_ANS21) == true then
           if an_pin_num == 21 then
              JALLIB_ANS21 = true
-                       adc_pin_AN21_direction = input
+            adc_pin_AN21_direction = input
           end if
        end if
        if defined(JALLIB_ANS22) == true then
           if an_pin_num == 22 then
              JALLIB_ANS22 = true
-                       adc_pin_AN22_direction = input
+            adc_pin_AN22_direction = input
           end if
        end if
     end procedure

Modified: trunk/tools/adc/adc_channels.jal.tmpl
==============================================================================
--- trunk/tools/adc/adc_channels.jal.tmpl       (original)
+++ trunk/tools/adc/adc_channels.jal.tmpl       Mon Jun 29 05:14:11 2009
@@ -519,7 +519,22 @@
     if defined(ANSEL_ANS7) == true then
        var volatile bit JALLIB_ANS7      is ANSEL_ANS7
     end if
-
+   -- PICs: 18f13k22, 18f14k22, 18lf13k22, 18lf14k22
+   if defined(ANSEL_ANSEL0) == true then
+         -- ANSEL0 always comes with ANSEL1 and ANSEL2
+      var volatile bit JALLIB_ANS0      is ANSEL_ANSEL0
+      var volatile bit JALLIB_ANS1      is ANSEL_ANSEL1
+      var volatile bit JALLIB_ANS2      is ANSEL_ANSEL2
+   end if
+   -- PICs: 18f13k22, 18f13k50, 18f14k22, 18f14k50, 18lf13k22, 18lf13k50,  
18lf14k22, 18lf14k50
+   if defined(ANSEL_ANSEL3) == true then
+         -- ANSEL3 always comes with ANSEL4, ANSEL5, ANSEL6 and ANSEL7
+      var volatile bit JALLIB_ANS3      is ANSEL_ANSEL3
+      var volatile bit JALLIB_ANS4      is ANSEL_ANSEL4
+      var volatile bit JALLIB_ANS5      is ANSEL_ANSEL5
+      var volatile bit JALLIB_ANS6      is ANSEL_ANSEL6
+      var volatile bit JALLIB_ANS7      is ANSEL_ANSEL7
+   end if

     -- Now, it's normalized...
     -- Provide helper func to configure pins either in digital or analog  
mode
@@ -537,7 +552,7 @@
        if defined(JALLIB_ANS$i) == true then
           if an_pin_num == $i then
              JALLIB_ANS$i = true
-                       adc_pin_AN${i}_direction = input
+            adc_pin_AN${i}_direction = input
           end if
        end if
        #end for

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to