Last active
December 25, 2016 17:40
-
-
Save dekuNukem/4761c0c9d2d3fd5dde1b78ac607b0b3a to your computer and use it in GitHub Desktop.
FAP I/O board STM32 interrupt snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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