A library for Freescale MCU which contain TSI peripheral, just for Kinetis L version. Because they use "lighter" version of TSI peripheral.

Dependents:   kl25z-tinyshell-demo tsi_slider_light_senso_LED frdm_tsi_slider_led_blend demo_slider ... more

This library is "fork" of the TSI library created by the mbed team.

Files at this revision

API Documentation at this revision

Comitter:
Kojto
Date:
Sun Feb 23 18:31:58 2014 +0000
Parent:
2:b7074bcc2376
Child:
4:f64097679f27
Commit message:
Analog slider contain own instances of electrodes.

Changed in this revision

tsi_sensor.cpp Show annotated file Show diff for this revision Revisions of this file
tsi_sensor.h Show annotated file Show diff for this revision Revisions of this file
--- a/tsi_sensor.cpp	Sat Feb 22 15:42:11 2014 +0000
+++ b/tsi_sensor.cpp	Sun Feb 23 18:31:58 2014 +0000
@@ -24,11 +24,11 @@
 void tsi_irq(void);
 TSIAnalogSlider *TSIAnalogSlider::_instance;
 
-TSIAnalogSlider::TSIAnalogSlider(TSIElectrode& elec0, TSIElectrode& elec1,
+TSIAnalogSlider::TSIAnalogSlider(uint32_t elec0, uint32_t elec1,
                                  uint32_t range)
 : _elec0(elec0), _elec1(elec1), _range(range) {
     _instance = this;
-    _current_elec = &elec0;
+    _current_elec = &_elec0;
     SIM->SCGC5 |= SIM_SCGC5_TSI_MASK;
 
     TSI0->GENCS |= (TSI_GENCS_ESOR_MASK | TSI_GENCS_MODE(0) | TSI_GENCS_REFCHRG(4)
--- a/tsi_sensor.h	Sat Feb 22 15:42:11 2014 +0000
+++ b/tsi_sensor.h	Sun Feb 23 18:31:58 2014 +0000
@@ -114,7 +114,7 @@
     /**
      *   Initialize the TSI Touch Sensor
      */
-    TSIAnalogSlider(TSIElectrode& elec0, TSIElectrode& elec1, uint32_t range);
+    TSIAnalogSlider(uint32_t elec0, uint32_t elec1, uint32_t range);
     /**
      * Read Touch Sensor percentage value
      *
@@ -182,8 +182,8 @@
         _absolute_distance_pos = distance;
     }
 private:
-    TSIElectrode& _elec0;
-    TSIElectrode& _elec1;
+    TSIElectrode  _elec0;
+    TSIElectrode  _elec1;
     uint8_t       _scan_in_progress;
     TSIElectrode* _current_elec;
     uint8_t       _percentage_position[2];