Skip to content

Instantly share code, notes, and snippets.

@dekuNukem
Last active December 25, 2016 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dekuNukem/4761c0c9d2d3fd5dde1b78ac607b0b3a to your computer and use it in GitHub Desktop.
Save dekuNukem/4761c0c9d2d3fd5dde1b78ac607b0b3a to your computer and use it in GitHub Desktop.
FAP I/O board STM32 interrupt snippet
void interrupt_activate(uint8_t vector)
{
// put the interrupt vector on STM32-CPLD bus
CPLD_DATA_PORT->ODR &= 0xff00;
CPLD_DATA_PORT->ODR |= vector;
// load the interrupt vector latch inside CPLD
data_output();
vect_load_activate();
vect_load_deactivate();
data_input();
// start the Z80 interrupt
HAL_GPIO_WritePin(Z80_INT_GPIO_Port, Z80_INT_Pin, GPIO_PIN_RESET);
}
// ...meanwhile in STM32 pin change ISR
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
// INTACK interrupt
if(GPIO_Pin == INTACK_Pin)
HAL_GPIO_WritePin(Z80_INT_GPIO_Port, Z80_INT_Pin, GPIO_PIN_SET); // turn off Z80 interrupt
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment