- void TSI_Init (void)
- {
- SIM_SCGC5 |= SIM_SCGC5_TSI_MASK; // Enable clock gating for TSI
- /* Enable proper GPIO as TSI channels */
- PORTB_PCR16 = PORT_PCR_MUX(0); // PTB16 as TSI channel 9
- PORTB_PCR17 = PORT_PCR_MUX(0); // PTB17 as TSI channel 10
- PORTC_PCR0 = PORT_PCR_MUX(0); // PTB17 as TSI channel 13
- NVIC_DisableIRQ((IRQn_Type)TSI0_IRQn);
- TSI0_GENCS |= (TSI_GENCS_ESOR_MASK
- | TSI_GENCS_MODE(0)
- | TSI_GENCS_REFCHRG(4)
- | TSI_GENCS_DVOLT(0)
- | TSI_GENCS_EXTCHRG(7)
- | TSI_GENCS_PS(4)
- | TSI_GENCS_NSCN(11)
- | TSI_GENCS_TSIIEN_MASK
- | TSI_GENCS_STPE_MASK
- //| TSI_GENCS_STM_MASK //Trigger for the module 0=Sofware
- );
- TSI0_GENCS |= TSI_GENCS_TSIEN_MASK;
- TSI_SelfCalibration();
- }
|