47R can pull PC13 high to trigger interrupt. too low impedance for input port
static void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, RST_Pin|CS_Pin|GPIO_PIN_11|GPIO_PIN_12, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, RD_Pin|WR_Pin|DC_Pin|LD2_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, D0_Pin|D1_Pin|D2_Pin|D10_Pin
|D11_Pin|D12_Pin|D13_Pin|D14_Pin
|D15_Pin|D5_Pin|D6_Pin|D7_Pin
|D8_Pin|D9_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : BTN_Pin */
GPIO_InitStruct.Pin = BTN_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(BTN_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : RST_Pin CS_Pin PC11 PC12 */
GPIO_InitStruct.Pin = RST_Pin|CS_Pin|GPIO_PIN_11|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pins : RD_Pin WR_Pin DC_Pin LD2_Pin */
GPIO_InitStruct.Pin = RD_Pin|WR_Pin|DC_Pin|LD2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pins : D0_Pin D1_Pin D2_Pin D10_Pin
D11_Pin D12_Pin D13_Pin D14_Pin
D15_Pin D5_Pin D6_Pin D7_Pin
D8_Pin D9_Pin */
GPIO_InitStruct.Pin = D0_Pin|D1_Pin|D2_Pin|D10_Pin
|D11_Pin|D12_Pin|D13_Pin|D14_Pin
|D15_Pin|D5_Pin|D6_Pin|D7_Pin
|D8_Pin|D9_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI15_10_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
}
/* USER CODE BEGIN 4 */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
if (GPIO_Pin == GPIO_PIN_13) {
menu++;
if (menu == 12) {
menu = 0;
}
} else {
__NOP();
}
)