/********************************************************************
 Function			:   void mTouchCap_Init(void)
 
 PreCondition		:   None 
 
 Input         		:   None
  
 Output				:   None
 
 Side Effects		:   None

 Overview			: 	This function initializes the PORT, CTMU, TIMER and ADC modules.


 *******************************************************************/
void mTouchCap_Init(void)
{
	WORD Index=0;

	/* Initialize Physical layer */
	mTouchCapPhy_InitCTMU();				


	/***************************************************************************
	--------------- Demo of API "mTouchCapAPI_SetUpCTMU_Default" -----------------------		
	Initialize the CTMU module to defaults using the API "mTouchCapAPI_SetUpCTMU_Default".
	***************************************************************************/
	trimbitsReady = 0;
	for (Index=0; Index < ScanChannelIndex; Index++) 		  
	{
		mTouchCapAPI_SetUpCTMU_Default(ScanChannels[Index]);  // Set up defult channel index
	}

	trimbitsReady = 1;
	
	#ifdef USE_STATIC_TRIP_VALUE
	mTouchCap_UpdateStaticTripValue();			// Update the STATIC TRIP values defined in config.h
	#endif
	// Timer4 is not used as the interrupt source for creating the 1 msec interrupt
	#ifndef TIMER4_NOT_USED_FOR_CAP_SENSOR_PROCESSING
		mTouchCapPhy_TickInit();					// Initialize Timer for system tick
	#endif

    mTouchCapPhy_StablizeChannelData();  // Stabilize channel data
}	
Ejemplo n.º 2
0
/******************************************************************************
 * Function:       void mTouchCapAPI_Init(void)
 *
 * PreCondition:    None
 *
 * Input:           None
 *
 * Output:          None
 *
 * Side Effects:    None
 *
 * Overview:        This function is used to initialize the default
 *                  settings of ADC and other related modules.
 *
 * Note:            None
 *****************************************************************************/
void mTouchCapAPI_Init(void)
{
    WORD Index=0;

    // init main ports, ADC ...
    mTouchCapPhy_Initialize();

    //initialize the Timer4
    mTouchCapPhy_TickInit();

    /***************************************************************************
    --------------- Demo of API "mTouchCapAPI_SetUp_Defaul" -----------------------
    Initialize the ADC module to defaults using the API "mTouchCapAPI_SetUp_Defaul".
    ***************************************************************************/
    for (Index=0; Index < NumberScanChannels; Index++)
    {
        mTouchCapAPI_SetUp_Default(Index);
    }

    mTouchCapPhy_StablizeChannelData();

}