Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPIO driver code jumbled up and unnecessarily invoking trigger #10

Open
NavadeepGaneshU opened this issue Jan 27, 2022 · 1 comment
Open

Comments

@NavadeepGaneshU
Copy link

The tutorial shows it correctly, but the committed code has issues. I was confused by this mismatch while comparing the code. This is as shown in the tutorial:

/*********************************************************
 * @fn		- GPIO_IRQHandling
 * @brief		- Interrupt handling
 *
 * @param[in]	-
 * @param[in]	-
 *
 * @return		- 
 *
 * @notes		-
 * /
void GPIO_IRQHandling(uint8_t PinNumber)
{
 //clear the EXTIPR register
	if(EXTI ->PR |= (1 << PinNumber))
	{
		//clear
		EXTI ->PR &= ~(1 << PinNumber);
	}
}
@panoskalf
Copy link

This register is actually a special case and it is cleared by writing 1. You can find this mentioned in the register details in the reference manual.

image

The tutorial shows it correctly, but the committed code has issues. I was confused by this mismatch while comparing the code. This is as shown in the tutorial:

/*********************************************************
 * @fn		- GPIO_IRQHandling
 * @brief		- Interrupt handling
 *
 * @param[in]	-
 * @param[in]	-
 *
 * @return		- 
 *
 * @notes		-
 * /
void GPIO_IRQHandling(uint8_t PinNumber)
{
 //clear the EXTIPR register
	if(EXTI ->PR |= (1 << PinNumber))
	{
		//clear
		EXTI ->PR &= ~(1 << PinNumber);
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants