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.h
- Revision:
- 0:b39f4f954a9b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TSIHW.h Wed Sep 24 18:48:10 2014 +0000 @@ -0,0 +1,50 @@ +#ifndef TSIHW_H +#define TSIHW_H + +#include "mbed.h" +/** +* KL25 TSI low-level library with very basic functions +* +* @code +* #include "mbed.h" +* #include "TSIHW.h" +* +* TSI touch(0,0,0,2,2); +* Serial pc(USBTX, USBRX); +* +* int main() { +* uint16_t s; +* +* pc.printf("BEGIN\r\n"); +* touch.ActivateChannel(5); // Electrode connected to PTA4 +* pc.printf("ACTIVATE\r\n"); +* while(1) { +* s = 0; +* touch.Start(5); +* pc.printf("START\r\n"); +* while(!s) { +* s = touch.Read(); +* } +* pc.printf("TOUCH: %d\r\n", s); +* wait(1); +* } +* } +* @endcode +*/ + + +class TSI +{ +public: + TSI(char rchg, char echg, char dvolt, char ps, char nscn); + + ~TSI(); + + void ActivateChannel(char ch); + + void Start(char ch); + + uint16_t Read(void); + +}; +#endif