A N 3 7 0
34
Rev. 1.0
/* Disable the Matrix and Roff modes */
PORT_CTRL &= ~(M_PORT_MATRIX | M_PORT_ROFF | M_PORT_STROBE);
PORT_CTRL |= M_PORT_STROBE;
PORT_CTRL &= ~M_PORT_STROBE;
/* Clear the master time */
vSys_SetMasterTime( 0UL );
/* Prepare the BSR for debouncing .. interested to monitor buttons
* at GPIO1 and GPIO2 */
rBsrSetup.bButtonMask = (1 << B_GPIO1) | (1 << B_GPIO2);
rBsrSetup.pbPtsReserveHead = (BYTE *) arPtsArray;
rBsrSetup.bPtsSize = bPtsSize_c;
rBsrSetup.bPushQualThresh = 3; /* 3 same consecutive samples to qualify */
/* Setup the BSR */
vBsr_Setup( &rBsrSetup );
/* Setup the RTC to tick every 5ms and clear it. Keep it disabled. */
RTC_CTRL = (0x07 << B_RTC_DIV) | M_RTC_CLR;
/* Enable the RTC */
RTC_CTRL |= M_RTC_ENA;
/* Enable the RTC interrupt and global interrupt enable */
ERTC = 1;
EA = 1;
/* Waiting for a button change */
while ( 1 )
{
/* Wait for a button push */
while ( 0 == bBsr_GetPtsItemCnt() ) {}
/* Get the button data */