Fork of tsi_sensor library that allows object construction with pin names instead of TSI channels

Fork of tsi_sensor by Martin Kojtal

Files at this revision

API Documentation at this revision

Comitter:
bjo3rn
Date:
Wed Aug 06 08:33:46 2014 +0000
Parent:
4:f64097679f27
Commit message:
Added KL46Z pin->channel mapping; converted compile time error for other platforms to runtime error (so error only occurs if code is actually called, not for programs that don't use the pin map)

Changed in this revision

tsi_sensor.h Show annotated file Show diff for this revision Revisions of this file
--- a/tsi_sensor.h	Mon Aug 04 07:43:15 2014 +0000
+++ b/tsi_sensor.h	Wed Aug 06 08:33:46 2014 +0000
@@ -112,7 +112,7 @@
      * @throws compile-time error if target is not supported, or runtime error if pin does not match any channel.
      */
     static uint8_t getTSIChannel(PinName pin) {
-#if   defined (TARGET_KL25Z)        
+#if   defined (TARGET_KL25Z) || defined (TARGET_KL46Z)        
         switch(pin) {
             //these are 
             case PTA0: return 1;
@@ -133,7 +133,7 @@
             default: error("PinName provided to TSIElectrode::getTSIChannel() does not correspond to any known TSI channel.");
         }
 # else
-    #error "Unknown target for TSIElectrode::getTSIChannel() - only supports KL25Z so far."
+        error("Unknown target for TSIElectrode::getTSIChannel() - only supports KL25Z and KL46Z so far.");
 # endif   
         return 0xFF; //should never get here
     }