This is a VERY low-level library for controlling the TSI hardware module in a KL25 microcontroller. The programmer creates the TSI object passing basic parameters, and selects the active channels. Then, a scan on a given channel can be started, and the raw result can be read.
Diff: TSIHW.cpp
- Revision:
- 1:532aa572220b
- Parent:
- 0:b39f4f954a9b
--- a/TSIHW.cpp Wed Sep 24 18:48:10 2014 +0000 +++ b/TSIHW.cpp Fri Sep 26 17:25:06 2014 +0000 @@ -7,7 +7,7 @@ */ TSI::TSI(char rchg, char echg, char dvolt, char ps, char nscn) { // The first version is preconfigured for non-noise detection, no interrupts, not running on stop modes, software trigger - SIM->SCGC5 |= 0x00000020; // clock gate for TSI + SIM->SCGC5 |= 0x00000E20; // clock gate for TSI and PORTS A, B, and C TSI0->GENCS = 0xC0000080 | ((rchg & 0x07) << 21) | ((echg & 0x07) << 16) | ((dvolt & 0x03) << 19) | ((ps & 0x07) << 13) | ((nscn & 0x1F) << 8); }