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: Registers.txt
- Revision:
- 0:b39f4f954a9b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Registers.txt Wed Sep 24 18:48:10 2014 +0000 @@ -0,0 +1,51 @@ +/* +TSI REGISTERS +------------------------------------------ + +TSI0_GENCS: +Bit 31: OUTRGF; Out-of-range flag; set if result register is out of the range given by TSI_THRESHOLD; write 1 to clear +Bit 28: ESOR; Selector for End-of-scan (set) or out-of-range (clear) interrupt source +Bits 27-24: MODE; defines analog mode; keep bits 25-24 to 00 + 0000: capacitive sensing (non-noise detection) + 0100: Single threshold noise detection mode; frequency limitation disabled + 1000: Single threshold noise detection mode; frequency limitation enabled + 1100: Automatic noise detection mode +Bits 23-21: REFCHRG; current value for charging the reference oscillator + 000: 500nA + 001: 1uA + 010: 2uA + 011: 4uA + 100: 8uA + 101: 16uA + 110: 32uA + 111: 64uA +Bits 20-19: DVOLT; oscillator's voltage rails + 00: DV = 1.03V; Vp = 1.33V; Vm = 0.30V + 01: DV = 0.73V; Vp = 1.18V; Vm = 0.45V + 10: DV = 0.43V; Vp = 1.03V; Vm = 0.60V + 11: DV = 0.29V; Vp = 0.95V; Vm = 0.67V +Bits 18-16: EXTCHRG; current value for charging the electrode oscillator + Same values as for REFCHRG +Bits 15-13: PS; electrode oscillator prescaler + Value is 2 to the power of the number given by the three bits (0-7) +Bits 12-8: NSCN; Number of scans for each electrode + Value is the number given by the five bits (0-31) plus 1. +Bit 7: TSIEN; TSI enable; set to enable +Bit 6: TSIIEN; TSI interrupt enable; set to enable +Bit 5: STPE; STOP enable; set to allow TSI to run in low-power modes +Bit 4: STM; Scan Trigger Mode; clear to software and set to hardware +Bit 3: SCNIP; Scan In Progress status; set if there is a scan in progress +Bit 2: EOSF; End of Scan Flag; set if scan complete +Bit 1: CURSW; Current sources swapped; set if swapped + +TSI0_DATA: +Bits 31-28: TSICH; current channel to be measured (4 bits, values 0 to 15) +Bit 23: DMAEN; DMA enabled; set for DMA transfer instead of interrupt +Bit 22: SWTS; Software Trigger Start; write 1 to start scan if software trigger was selected +Bit 15-0: TSICNT; TSI Conversion Counter; record the accumulated scan counter value ticked by the reference oscillator + +TSI0_TSHD: +Threshold value +---------------------------------------------------- + +*/ \ No newline at end of file