Beispiel #1
0
void Enable_LLWU(void)
{
	// Enables LLWU interrupt
	xIntEnable(INT_LLWU);

	/* Initialization of the LLWU module */
	LLWU_PE1 = 0;
	LLWU_PE2 = 0;
	LLWU_PE3 = 0;
	LLWU_PE4 =  0x20;

	/* LLWU_ME: WUME7=0,WUME5=0,WUME4=0,WUME1=0,WUME0=1 */
	LLWU_ME = (uint8_t)((LLWU_ME & (uint8_t)~(uint8_t)(
			   LLWU_ME_WUME7_MASK |
			   LLWU_ME_WUME5_MASK |
			   LLWU_ME_WUME4_MASK |
			   LLWU_ME_WUME1_MASK
			  )) | (uint8_t)(
			   LLWU_ME_WUME0_MASK
			  ));

	/* LLWU_FILT1: FILTF=1,FILTE=0,??=0,FILTSEL=0 */
	LLWU_FILT1 = LLWU_FILT1_FILTF_MASK |
				 LLWU_FILT1_FILTE(0x00) |
				 LLWU_FILT1_FILTSEL(0x00);
	/* LLWU_FILT2: FILTF=1,FILTE=0,??=0,FILTSEL=0 */
	LLWU_FILT2 = LLWU_FILT2_FILTF_MASK |
				 LLWU_FILT2_FILTE(0x00) |
				 LLWU_FILT2_FILTSEL(0x00);
}
Beispiel #2
0
void llwu_configure_filter(unsigned int wu_pin_num, unsigned char filter_en, unsigned char rise_fall ) 
{
   //wu_pin_num is the pin number to be written to FILTSEL.  wu_pin_num is not the same as pin_en. 
    uint8 temp;

    LLWU_Info("\n\rEnabling Filter %x on WU Pin %x for WU sense %x \n",filter_en, wu_pin_num, rise_fall);
   
     temp = 0;
     //first clear filter values and clear flag by writing a 1
     LLWU_FILT1 = LLWU_FILT1_FILTF_MASK;
     LLWU_FILT2 = LLWU_FILT2_FILTF_MASK;
     
     if(filter_en == 1)
     {
    	 //clear the flag bit and set the others
         temp |= (LLWU_FILT1_FILTF_MASK) | (LLWU_FILT1_FILTE(rise_fall) | LLWU_FILT1_FILTSEL(wu_pin_num));         
         LLWU_FILT1 = temp;
         
     }else if (filter_en == 2)
     {
    	 //clear the flag bit and set the others
    	 temp |= (LLWU_FILT2_FILTF_MASK) | (LLWU_FILT2_FILTE(rise_fall) | LLWU_FILT2_FILTSEL(wu_pin_num));         
         LLWU_FILT2 = temp;
     }else
     {
    	 LLWU_Info("\n\rError - invalid filter number\n"); 
     }
}    
Beispiel #3
0
/*******************************************************************************
 *
 *       llwu_configure_filter -
 *
 *******************************************************************************/
void llwu_configure_filter(unsigned int wu_pin_num, unsigned char filter_en, unsigned char rise_fall ) {
    //wu_pin_num is the pin number to be written to FILTSEL.  wu_pin_num is not the same as pin_en.
    uint8_t temp;
    
    temp = 0;
    //first clear filter values and clear flag by writing a 1
    LLWU_FILT1 = LLWU_FILT1_FILTF_MASK;
    LLWU_FILT2 = LLWU_FILT2_FILTF_MASK;
    
    if(filter_en == 1) {
        //clear the flag bit and set the others
        temp |= (LLWU_FILT1_FILTF_MASK) | (LLWU_FILT1_FILTE(rise_fall) | LLWU_FILT1_FILTSEL(wu_pin_num));
        LLWU_FILT1 = temp;
    }else if (filter_en == 2) {
        //clear the flag bit and set the others
        temp |= (LLWU_FILT2_FILTF_MASK) | (LLWU_FILT2_FILTE(rise_fall) | LLWU_FILT2_FILTSEL(wu_pin_num));
        LLWU_FILT2 = temp;
    }else {
        
    }
}