ARM/Microchip/SAM4L/src/iopincfg_sam4l.c
void IOPinSetSense(int PortNo, int PinNo, IOPINSENSE Sense)
{
	if (PortNo < 0 || PinNo < 0 || PortNo > IOPIN_MAX_PORT || PinNo > 31)
	{
		return;
	}
	
	GpioPort *reg = (GpioPort *)((uint32_t)&SAM4L_GPIO->GPIO_PORT[PortNo]);
	uint32_t pinmask = 1 << PinNo;
	reg->GPIO_GFERS = pinmask;	// Enable glitch filter

	switch (Sense)
	{
		case IOPINSENSE_LOW_TRANSITION:
			reg->GPIO_IMR0C = pinmask;
			reg->GPIO_IMR1S = pinmask;
			break;
		case IOPINSENSE_HIGH_TRANSITION:
			reg->GPIO_IMR0S = pinmask;
			reg->GPIO_IMR1C = pinmask;
			break;
		case IOPINSENSE_TOGGLE:
			reg->GPIO_IMR0C = pinmask;
			reg->GPIO_IMR1C = pinmask;
			break;
	}
}
/**
 * @brief Set I/O pin sensing option
 *
 * Some hardware allow pin sensing to wake up or active other subsystem without
 * requiring enabling interrupts. This requires the I/O already configured
 *
 * @param	PortNo : Port number (up to 32 ports)
 * 			PinNo   : Pin number (up to 32 pins)
 * 			Sense   : Sense type of event on the I/O pin
 */
@brief Set I/O pin sensing option
Some hardware allow pin sensing to wake up or active other subsystem without
requiring enabling interrupts. This requires the I/O already configured

@param       PortNo : Port number (up to 32 ports)
PinNo   : Pin number (up to 32 pins)
Sense   : Sense type of event on the I/O pin
@brief Set I / O pin sensing option Some hardware allow pin sensing to wake up or active other subsystem without requiring enabling interrupts . This requires the I / O already configured @param PortNo : Port number ( up to 32 ports ) PinNo : Pin number ( up to 32 pins ) Sense : Sense type of event on the I / O pin
void IOPinSetSense(int PortNo, int PinNo, IOPINSENSE Sense)
{
	if (PortNo < 0 || PinNo < 0 || PortNo > IOPIN_MAX_PORT || PinNo > 31)
	{
		return;
	}
	GpioPort *reg = (GpioPort *)((uint32_t)&SAM4L_GPIO->GPIO_PORT[PortNo]);
	uint32_t pinmask = 1 << PinNo;
	reg->GPIO_GFERS = pinmask;	
	switch (Sense)
	{
		case IOPINSENSE_LOW_TRANSITION:
			reg->GPIO_IMR0C = pinmask;
			reg->GPIO_IMR1S = pinmask;
			break;
		case IOPINSENSE_HIGH_TRANSITION:
			reg->GPIO_IMR0S = pinmask;
			reg->GPIO_IMR1C = pinmask;
			break;
		case IOPINSENSE_TOGGLE:
			reg->GPIO_IMR0C = pinmask;
			reg->GPIO_IMR1C = pinmask;
			break;
	}
}
void IOPinSetSense ( int PortNo , int PinNo , IOPINSENSE Sense ) { if ( PortNo < 0 || PinNo < 0 || PortNo > IOPIN_MAX_PORT || PinNo > 31 ) { return ; } GpioPort * reg = ( GpioPort * ) ( ( uint32_t ) & SAM4L_GPIO -> GPIO_PORT [ PortNo ] ) ; uint32_t pinmask = 1 << PinNo ; reg -> GPIO_GFERS = pinmask ; switch ( Sense ) { case IOPINSENSE_LOW_TRANSITION : reg -> GPIO_IMR0C = pinmask ; reg -> GPIO_IMR1S = pinmask ; break ; case IOPINSENSE_HIGH_TRANSITION : reg -> GPIO_IMR0S = pinmask ; reg -> GPIO_IMR1C = pinmask ; break ; case IOPINSENSE_TOGGLE : reg -> GPIO_IMR0C = pinmask ; reg -> GPIO_IMR1C = pinmask ; break ; } }
@brief Set I/O pin sensing option
 Some hardware allow pin sensing to wake up or active other subsystem without
 requiring enabling interrupts.
@brief Set I / O pin sensing option Some hardware allow pin sensing to wake up or active other subsystem without requiring enabling interrupts .
// Enable glitch filter