Fork of tsi_sensor library that allows object construction with pin names instead of TSI channels
Fork of tsi_sensor by
Diff: tsi_sensor.cpp
- Revision:
- 4:f64097679f27
- Parent:
- 3:20ffa9b18488
--- a/tsi_sensor.cpp Sun Feb 23 18:31:58 2014 +0000 +++ b/tsi_sensor.cpp Mon Aug 04 07:43:15 2014 +0000 @@ -24,9 +24,16 @@ void tsi_irq(void); TSIAnalogSlider *TSIAnalogSlider::_instance; +TSIAnalogSlider::TSIAnalogSlider(PinName pin0, PinName pin1, uint32_t range): _elec0(pin0), _elec1(pin1), _range(range) { + initObject(); +} TSIAnalogSlider::TSIAnalogSlider(uint32_t elec0, uint32_t elec1, uint32_t range) : _elec0(elec0), _elec1(elec1), _range(range) { + initObject(); +} + +void TSIAnalogSlider::initObject(void) { _instance = this; _current_elec = &_elec0; SIM->SCGC5 |= SIM_SCGC5_TSI_MASK;