FRDM-KL46Z board sLCD demo code
Fork of FRDM-KL46Z LCD rtc Demo by
TSI/TSISensor.cpp@12:cae0afb130b1, 2014-10-02 (annotated)
- Committer:
- salemtang
- Date:
- Thu Oct 02 14:14:28 2014 +0000
- Revision:
- 12:cae0afb130b1
- Parent:
- 8:18e86eb228ca
20141002_2315 modified
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
salemtang | 8:18e86eb228ca | 1 | /* Freescale Semiconductor Inc. |
salemtang | 8:18e86eb228ca | 2 | * (c) Copyright 2004-2005 Freescale Semiconductor, Inc. |
salemtang | 8:18e86eb228ca | 3 | * (c) Copyright 2001-2004 Motorola, Inc. |
salemtang | 8:18e86eb228ca | 4 | * |
salemtang | 8:18e86eb228ca | 5 | * mbed Microcontroller Library |
salemtang | 8:18e86eb228ca | 6 | * (c) Copyright 2009-2012 ARM Limited. |
salemtang | 8:18e86eb228ca | 7 | * |
salemtang | 8:18e86eb228ca | 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
salemtang | 8:18e86eb228ca | 9 | * and associated documentation files (the "Software"), to deal in the Software without |
salemtang | 8:18e86eb228ca | 10 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
salemtang | 8:18e86eb228ca | 11 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
salemtang | 8:18e86eb228ca | 12 | * Software is furnished to do so, subject to the following conditions: |
salemtang | 8:18e86eb228ca | 13 | * |
salemtang | 8:18e86eb228ca | 14 | * The above copyright notice and this permission notice shall be included in all copies or |
salemtang | 8:18e86eb228ca | 15 | * substantial portions of the Software. |
salemtang | 8:18e86eb228ca | 16 | * |
salemtang | 8:18e86eb228ca | 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
salemtang | 8:18e86eb228ca | 18 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
salemtang | 8:18e86eb228ca | 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
salemtang | 8:18e86eb228ca | 20 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
salemtang | 8:18e86eb228ca | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
salemtang | 8:18e86eb228ca | 22 | */ |
salemtang | 8:18e86eb228ca | 23 | |
salemtang | 8:18e86eb228ca | 24 | #include "mbed.h" |
salemtang | 8:18e86eb228ca | 25 | #include "TSISensor.h" |
salemtang | 8:18e86eb228ca | 26 | |
salemtang | 8:18e86eb228ca | 27 | #define NO_TOUCH 0 |
salemtang | 8:18e86eb228ca | 28 | #define SLIDER_LENGTH 40 //LENGTH in mm |
salemtang | 8:18e86eb228ca | 29 | #define TOTAL_ELECTRODE 3 |
salemtang | 8:18e86eb228ca | 30 | |
salemtang | 8:18e86eb228ca | 31 | #define TSI0a 0 |
salemtang | 8:18e86eb228ca | 32 | #define TSI1 1 |
salemtang | 8:18e86eb228ca | 33 | #define TSI2 2 |
salemtang | 8:18e86eb228ca | 34 | #define TSI3 3 |
salemtang | 8:18e86eb228ca | 35 | #define TSI4 4 |
salemtang | 8:18e86eb228ca | 36 | #define TSI5 5 |
salemtang | 8:18e86eb228ca | 37 | #define TSI6 6 |
salemtang | 8:18e86eb228ca | 38 | #define TSI7 7 |
salemtang | 8:18e86eb228ca | 39 | #define TSI8 8 |
salemtang | 8:18e86eb228ca | 40 | #define TSI9 9 |
salemtang | 8:18e86eb228ca | 41 | #define TSI10 10 |
salemtang | 8:18e86eb228ca | 42 | #define TSI11 11 |
salemtang | 8:18e86eb228ca | 43 | #define TSI12 12 |
salemtang | 8:18e86eb228ca | 44 | #define TSI13 13 |
salemtang | 8:18e86eb228ca | 45 | #define TSI14 14 |
salemtang | 8:18e86eb228ca | 46 | #define TSI15 15 |
salemtang | 8:18e86eb228ca | 47 | |
salemtang | 8:18e86eb228ca | 48 | /*Chose the correct TSI channel for the electrode number*/ |
salemtang | 8:18e86eb228ca | 49 | #define ELECTRODE0 TSI9 |
salemtang | 8:18e86eb228ca | 50 | #define ELECTRODE1 TSI10 |
salemtang | 8:18e86eb228ca | 51 | #define ELECTRODE2 TSI0a |
salemtang | 8:18e86eb228ca | 52 | #define ELECTRODE3 TSI1 |
salemtang | 8:18e86eb228ca | 53 | #define ELECTRODE4 TSI2 |
salemtang | 8:18e86eb228ca | 54 | #define ELECTRODE5 TSI3 |
salemtang | 8:18e86eb228ca | 55 | #define ELECTRODE6 TSI4 |
salemtang | 8:18e86eb228ca | 56 | #define ELECTRODE7 TSI5 |
salemtang | 8:18e86eb228ca | 57 | #define ELECTRODE8 TSI6 |
salemtang | 8:18e86eb228ca | 58 | #define ELECTRODE9 TSI7 |
salemtang | 8:18e86eb228ca | 59 | #define ELECTRODE10 TSI8 |
salemtang | 8:18e86eb228ca | 60 | #define ELECTRODE11 TSI11 |
salemtang | 8:18e86eb228ca | 61 | #define ELECTRODE12 TSI12 |
salemtang | 8:18e86eb228ca | 62 | #define ELECTRODE13 TSI13 |
salemtang | 8:18e86eb228ca | 63 | #define ELECTRODE14 TSI14 |
salemtang | 8:18e86eb228ca | 64 | #define ELECTRODE15 TSI15 |
salemtang | 8:18e86eb228ca | 65 | |
salemtang | 8:18e86eb228ca | 66 | #define THRESHOLD0 100 |
salemtang | 8:18e86eb228ca | 67 | #define THRESHOLD1 100 |
salemtang | 8:18e86eb228ca | 68 | #define THRESHOLD2 100 |
salemtang | 8:18e86eb228ca | 69 | #define THRESHOLD3 100 |
salemtang | 8:18e86eb228ca | 70 | #define THRESHOLD4 100 |
salemtang | 8:18e86eb228ca | 71 | #define THRESHOLD5 100 |
salemtang | 8:18e86eb228ca | 72 | #define THRESHOLD6 100 |
salemtang | 8:18e86eb228ca | 73 | #define THRESHOLD7 100 |
salemtang | 8:18e86eb228ca | 74 | #define THRESHOLD8 100 |
salemtang | 8:18e86eb228ca | 75 | #define THRESHOLD9 100 |
salemtang | 8:18e86eb228ca | 76 | #define THRESHOLD10 100 |
salemtang | 8:18e86eb228ca | 77 | #define THRESHOLD11 100 |
salemtang | 8:18e86eb228ca | 78 | #define THRESHOLD12 100 |
salemtang | 8:18e86eb228ca | 79 | #define THRESHOLD13 100 |
salemtang | 8:18e86eb228ca | 80 | #define THRESHOLD14 100 |
salemtang | 8:18e86eb228ca | 81 | #define THRESHOLD15 100 |
salemtang | 8:18e86eb228ca | 82 | |
salemtang | 8:18e86eb228ca | 83 | static uint8_t total_electrode = TOTAL_ELECTRODE; |
salemtang | 8:18e86eb228ca | 84 | static uint8_t elec_array[16]={ELECTRODE0,ELECTRODE1,ELECTRODE2,ELECTRODE3,ELECTRODE4,ELECTRODE5, |
salemtang | 8:18e86eb228ca | 85 | ELECTRODE6,ELECTRODE7,ELECTRODE8,ELECTRODE9,ELECTRODE10,ELECTRODE11, |
salemtang | 8:18e86eb228ca | 86 | ELECTRODE12,ELECTRODE13,ELECTRODE14,ELECTRODE15}; |
salemtang | 8:18e86eb228ca | 87 | static uint16_t gu16TSICount[16]; |
salemtang | 8:18e86eb228ca | 88 | static uint16_t gu16Baseline[16]; |
salemtang | 8:18e86eb228ca | 89 | static uint16_t gu16Threshold[16]={THRESHOLD0,THRESHOLD1,THRESHOLD2,THRESHOLD3,THRESHOLD4,THRESHOLD5, |
salemtang | 8:18e86eb228ca | 90 | THRESHOLD6,THRESHOLD7,THRESHOLD8,THRESHOLD9,THRESHOLD10,THRESHOLD11, |
salemtang | 8:18e86eb228ca | 91 | THRESHOLD12,THRESHOLD13,THRESHOLD14,THRESHOLD15}; |
salemtang | 8:18e86eb228ca | 92 | static uint16_t gu16Delta[16]; |
salemtang | 8:18e86eb228ca | 93 | static uint8_t ongoing_elec; |
salemtang | 8:18e86eb228ca | 94 | static uint8_t end_flag = 1; |
salemtang | 8:18e86eb228ca | 95 | |
salemtang | 8:18e86eb228ca | 96 | static uint8_t SliderPercentegePosition[2] = {NO_TOUCH,NO_TOUCH}; |
salemtang | 8:18e86eb228ca | 97 | static uint8_t SliderDistancePosition[2] = {NO_TOUCH,NO_TOUCH}; |
salemtang | 8:18e86eb228ca | 98 | static uint32_t AbsolutePercentegePosition = NO_TOUCH; |
salemtang | 8:18e86eb228ca | 99 | static uint32_t AbsoluteDistancePosition = NO_TOUCH; |
salemtang | 8:18e86eb228ca | 100 | |
salemtang | 8:18e86eb228ca | 101 | static void tsi_irq(); |
salemtang | 8:18e86eb228ca | 102 | |
salemtang | 8:18e86eb228ca | 103 | TSISensor::TSISensor() { |
salemtang | 8:18e86eb228ca | 104 | SIM->SCGC5 |= SIM_SCGC5_PORTB_MASK; |
salemtang | 8:18e86eb228ca | 105 | SIM->SCGC5 |= SIM_SCGC5_TSI_MASK; |
salemtang | 8:18e86eb228ca | 106 | |
salemtang | 8:18e86eb228ca | 107 | TSI0->GENCS |= (TSI_GENCS_ESOR_MASK |
salemtang | 8:18e86eb228ca | 108 | | TSI_GENCS_MODE(0) |
salemtang | 8:18e86eb228ca | 109 | | TSI_GENCS_REFCHRG(4) |
salemtang | 8:18e86eb228ca | 110 | | TSI_GENCS_DVOLT(0) |
salemtang | 8:18e86eb228ca | 111 | | TSI_GENCS_EXTCHRG(7) |
salemtang | 8:18e86eb228ca | 112 | | TSI_GENCS_PS(4) |
salemtang | 8:18e86eb228ca | 113 | | TSI_GENCS_NSCN(11) |
salemtang | 8:18e86eb228ca | 114 | | TSI_GENCS_TSIIEN_MASK |
salemtang | 8:18e86eb228ca | 115 | | TSI_GENCS_STPE_MASK |
salemtang | 8:18e86eb228ca | 116 | ); |
salemtang | 8:18e86eb228ca | 117 | |
salemtang | 8:18e86eb228ca | 118 | TSI0->GENCS |= TSI_GENCS_TSIEN_MASK; |
salemtang | 8:18e86eb228ca | 119 | |
salemtang | 8:18e86eb228ca | 120 | NVIC_SetVector(TSI0_IRQn, (uint32_t)&tsi_irq); |
salemtang | 8:18e86eb228ca | 121 | NVIC_EnableIRQ(TSI0_IRQn); |
salemtang | 8:18e86eb228ca | 122 | |
salemtang | 8:18e86eb228ca | 123 | selfCalibration(); |
salemtang | 8:18e86eb228ca | 124 | } |
salemtang | 8:18e86eb228ca | 125 | |
salemtang | 8:18e86eb228ca | 126 | void TSISensor::TSISensor_reset(void) { |
salemtang | 8:18e86eb228ca | 127 | SIM->SCGC5 |= SIM_SCGC5_PORTB_MASK; |
salemtang | 8:18e86eb228ca | 128 | SIM->SCGC5 |= SIM_SCGC5_TSI_MASK; |
salemtang | 8:18e86eb228ca | 129 | |
salemtang | 8:18e86eb228ca | 130 | TSI0->GENCS |= (TSI_GENCS_ESOR_MASK |
salemtang | 8:18e86eb228ca | 131 | | TSI_GENCS_MODE(0) |
salemtang | 8:18e86eb228ca | 132 | | TSI_GENCS_REFCHRG(4) |
salemtang | 8:18e86eb228ca | 133 | | TSI_GENCS_DVOLT(0) |
salemtang | 8:18e86eb228ca | 134 | | TSI_GENCS_EXTCHRG(7) |
salemtang | 8:18e86eb228ca | 135 | | TSI_GENCS_PS(4) |
salemtang | 8:18e86eb228ca | 136 | | TSI_GENCS_NSCN(11) |
salemtang | 8:18e86eb228ca | 137 | | TSI_GENCS_TSIIEN_MASK |
salemtang | 8:18e86eb228ca | 138 | | TSI_GENCS_STPE_MASK |
salemtang | 8:18e86eb228ca | 139 | ); |
salemtang | 8:18e86eb228ca | 140 | |
salemtang | 8:18e86eb228ca | 141 | TSI0->GENCS |= TSI_GENCS_TSIEN_MASK; |
salemtang | 8:18e86eb228ca | 142 | |
salemtang | 8:18e86eb228ca | 143 | //NVIC_SetVector(TSI0_IRQn, (uint32_t)&tsi_irq); |
salemtang | 8:18e86eb228ca | 144 | //NVIC_EnableIRQ(TSI0_IRQn); |
salemtang | 8:18e86eb228ca | 145 | |
salemtang | 8:18e86eb228ca | 146 | selfCalibration(); |
salemtang | 8:18e86eb228ca | 147 | } |
salemtang | 8:18e86eb228ca | 148 | |
salemtang | 8:18e86eb228ca | 149 | void TSISensor::selfCalibration(void) |
salemtang | 8:18e86eb228ca | 150 | { |
salemtang | 8:18e86eb228ca | 151 | unsigned char cnt; |
salemtang | 8:18e86eb228ca | 152 | unsigned char trigger_backup; |
salemtang | 8:18e86eb228ca | 153 | |
salemtang | 8:18e86eb228ca | 154 | TSI0->GENCS |= TSI_GENCS_EOSF_MASK; // Clear End of Scan Flag |
salemtang | 8:18e86eb228ca | 155 | TSI0->GENCS &= ~TSI_GENCS_TSIEN_MASK; // Disable TSI module |
salemtang | 8:18e86eb228ca | 156 | |
salemtang | 8:18e86eb228ca | 157 | if(TSI0->GENCS & TSI_GENCS_STM_MASK) // Back-up TSI Trigger mode from Application |
salemtang | 8:18e86eb228ca | 158 | trigger_backup = 1; |
salemtang | 8:18e86eb228ca | 159 | else |
salemtang | 8:18e86eb228ca | 160 | trigger_backup = 0; |
salemtang | 8:18e86eb228ca | 161 | |
salemtang | 8:18e86eb228ca | 162 | TSI0->GENCS &= ~TSI_GENCS_STM_MASK; // Use SW trigger |
salemtang | 8:18e86eb228ca | 163 | TSI0->GENCS &= ~TSI_GENCS_TSIIEN_MASK; // Enable TSI interrupts |
salemtang | 8:18e86eb228ca | 164 | |
salemtang | 8:18e86eb228ca | 165 | TSI0->GENCS |= TSI_GENCS_TSIEN_MASK; // Enable TSI module |
salemtang | 8:18e86eb228ca | 166 | |
salemtang | 8:18e86eb228ca | 167 | for(cnt=0; cnt < total_electrode; cnt++) // Get Counts when Electrode not pressed |
salemtang | 8:18e86eb228ca | 168 | { |
salemtang | 8:18e86eb228ca | 169 | TSI0->DATA = ((elec_array[cnt] << TSI_DATA_TSICH_SHIFT) ); |
salemtang | 8:18e86eb228ca | 170 | TSI0->DATA |= TSI_DATA_SWTS_MASK; |
salemtang | 8:18e86eb228ca | 171 | while(!(TSI0->GENCS & TSI_GENCS_EOSF_MASK)); |
salemtang | 8:18e86eb228ca | 172 | TSI0->GENCS |= TSI_GENCS_EOSF_MASK; |
salemtang | 8:18e86eb228ca | 173 | gu16Baseline[cnt] = (TSI0->DATA & TSI_DATA_TSICNT_MASK); |
salemtang | 8:18e86eb228ca | 174 | } |
salemtang | 8:18e86eb228ca | 175 | |
salemtang | 8:18e86eb228ca | 176 | TSI0->GENCS &= ~TSI_GENCS_TSIEN_MASK; // Disable TSI module |
salemtang | 8:18e86eb228ca | 177 | TSI0->GENCS |= TSI_GENCS_TSIIEN_MASK; // Enale TSI interrupt |
salemtang | 8:18e86eb228ca | 178 | if(trigger_backup) // Restore trigger mode |
salemtang | 8:18e86eb228ca | 179 | TSI0->GENCS |= TSI_GENCS_STM_MASK; |
salemtang | 8:18e86eb228ca | 180 | else |
salemtang | 8:18e86eb228ca | 181 | TSI0->GENCS &= ~TSI_GENCS_STM_MASK; |
salemtang | 8:18e86eb228ca | 182 | |
salemtang | 8:18e86eb228ca | 183 | TSI0->GENCS |= TSI_GENCS_TSIEN_MASK; // Enable TSI module |
salemtang | 8:18e86eb228ca | 184 | |
salemtang | 8:18e86eb228ca | 185 | TSI0->DATA = ((elec_array[0]<<TSI_DATA_TSICH_SHIFT) ); |
salemtang | 8:18e86eb228ca | 186 | TSI0->DATA |= TSI_DATA_SWTS_MASK; |
salemtang | 8:18e86eb228ca | 187 | } |
salemtang | 8:18e86eb228ca | 188 | |
salemtang | 8:18e86eb228ca | 189 | void TSISensor::sliderRead(void ) { |
salemtang | 8:18e86eb228ca | 190 | if(end_flag) { |
salemtang | 8:18e86eb228ca | 191 | end_flag = 0; |
salemtang | 8:18e86eb228ca | 192 | if((gu16Delta[0] > gu16Threshold[0])||(gu16Delta[1] > gu16Threshold[1])) { |
salemtang | 8:18e86eb228ca | 193 | SliderPercentegePosition[0] = (gu16Delta[0]*100)/(gu16Delta[0]+gu16Delta[1]); |
salemtang | 8:18e86eb228ca | 194 | SliderPercentegePosition[1] = (gu16Delta[1]*100)/(gu16Delta[0]+gu16Delta[1]); |
salemtang | 8:18e86eb228ca | 195 | SliderDistancePosition[0] = (SliderPercentegePosition[0]* SLIDER_LENGTH)/100; |
salemtang | 8:18e86eb228ca | 196 | SliderDistancePosition[1] = (SliderPercentegePosition[1]* SLIDER_LENGTH)/100; |
salemtang | 8:18e86eb228ca | 197 | AbsolutePercentegePosition = ((100 - SliderPercentegePosition[0]) + SliderPercentegePosition[1])/2; |
salemtang | 8:18e86eb228ca | 198 | AbsoluteDistancePosition = ((SLIDER_LENGTH - SliderDistancePosition[0]) + SliderDistancePosition[1])/2; |
salemtang | 8:18e86eb228ca | 199 | } else { |
salemtang | 8:18e86eb228ca | 200 | SliderPercentegePosition[0] = NO_TOUCH; |
salemtang | 8:18e86eb228ca | 201 | SliderPercentegePosition[1] = NO_TOUCH; |
salemtang | 8:18e86eb228ca | 202 | SliderDistancePosition[0] = NO_TOUCH; |
salemtang | 8:18e86eb228ca | 203 | SliderDistancePosition[1] = NO_TOUCH; |
salemtang | 8:18e86eb228ca | 204 | AbsolutePercentegePosition = NO_TOUCH; |
salemtang | 8:18e86eb228ca | 205 | AbsoluteDistancePosition = NO_TOUCH; |
salemtang | 8:18e86eb228ca | 206 | } |
salemtang | 8:18e86eb228ca | 207 | } |
salemtang | 8:18e86eb228ca | 208 | } |
salemtang | 8:18e86eb228ca | 209 | |
salemtang | 8:18e86eb228ca | 210 | float TSISensor::readPercentage() { |
salemtang | 8:18e86eb228ca | 211 | sliderRead(); |
salemtang | 8:18e86eb228ca | 212 | return (float)AbsolutePercentegePosition/100.0; |
salemtang | 8:18e86eb228ca | 213 | } |
salemtang | 8:18e86eb228ca | 214 | |
salemtang | 8:18e86eb228ca | 215 | uint8_t TSISensor::readDistance() { |
salemtang | 8:18e86eb228ca | 216 | sliderRead(); |
salemtang | 8:18e86eb228ca | 217 | return AbsoluteDistancePosition; |
salemtang | 8:18e86eb228ca | 218 | } |
salemtang | 8:18e86eb228ca | 219 | |
salemtang | 8:18e86eb228ca | 220 | uint16_t TSISensor::readValue(uint8_t index) |
salemtang | 8:18e86eb228ca | 221 | { |
salemtang | 8:18e86eb228ca | 222 | return gu16TSICount[index]; |
salemtang | 8:18e86eb228ca | 223 | } |
salemtang | 8:18e86eb228ca | 224 | |
salemtang | 8:18e86eb228ca | 225 | static void changeElectrode(void) |
salemtang | 8:18e86eb228ca | 226 | { |
salemtang | 8:18e86eb228ca | 227 | int16_t u16temp_delta; |
salemtang | 8:18e86eb228ca | 228 | |
salemtang | 8:18e86eb228ca | 229 | gu16TSICount[ongoing_elec] = (TSI0->DATA & TSI_DATA_TSICNT_MASK); // Save Counts for current electrode |
salemtang | 8:18e86eb228ca | 230 | u16temp_delta = gu16TSICount[ongoing_elec] - gu16Baseline[ongoing_elec]; // Obtains Counts Delta from callibration reference |
salemtang | 8:18e86eb228ca | 231 | if(u16temp_delta < 0) |
salemtang | 8:18e86eb228ca | 232 | gu16Delta[ongoing_elec] = 0; |
salemtang | 8:18e86eb228ca | 233 | else |
salemtang | 8:18e86eb228ca | 234 | gu16Delta[ongoing_elec] = u16temp_delta; |
salemtang | 8:18e86eb228ca | 235 | |
salemtang | 8:18e86eb228ca | 236 | //Change Electrode to Scan |
salemtang | 8:18e86eb228ca | 237 | if(total_electrode > 1) |
salemtang | 8:18e86eb228ca | 238 | { |
salemtang | 8:18e86eb228ca | 239 | if((total_electrode-1) > ongoing_elec) |
salemtang | 8:18e86eb228ca | 240 | ongoing_elec++; |
salemtang | 8:18e86eb228ca | 241 | else |
salemtang | 8:18e86eb228ca | 242 | ongoing_elec = 0; |
salemtang | 8:18e86eb228ca | 243 | |
salemtang | 8:18e86eb228ca | 244 | TSI0->DATA = ((elec_array[ongoing_elec]<<TSI_DATA_TSICH_SHIFT) ); |
salemtang | 8:18e86eb228ca | 245 | TSI0->DATA |= TSI_DATA_SWTS_MASK; |
salemtang | 8:18e86eb228ca | 246 | } |
salemtang | 8:18e86eb228ca | 247 | } |
salemtang | 8:18e86eb228ca | 248 | |
salemtang | 8:18e86eb228ca | 249 | void tsi_irq(void) |
salemtang | 8:18e86eb228ca | 250 | { |
salemtang | 8:18e86eb228ca | 251 | end_flag = 1; |
salemtang | 8:18e86eb228ca | 252 | TSI0->GENCS |= TSI_GENCS_EOSF_MASK; // Clear End of Scan Flag |
salemtang | 8:18e86eb228ca | 253 | changeElectrode(); |
salemtang | 8:18e86eb228ca | 254 | } |