Created
June 20, 2019 12:11
-
-
Save goog/e81f68b3392fe7fc6730239c48305cbc to your computer and use it in GitHub Desktop.
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 keys_init() | |
{ | |
// config gpio | |
stm32f4_gpio_set_config(&io_key1); // PA12 | |
stm32f4_gpio_set_config(&io_key2); | |
stm32f4_gpio_set_config(&io_key3); | |
stm32f4_gpio_set_config(&io_key4); | |
// SYSCFGEN and exit map | |
(*(uint32_t*)0x40023844) |= 1<<14; | |
SYSCFG_EXTICR3 = 0; | |
SYSCFG_EXTICR4 = 0; | |
// EXIT INIT | |
EXTI_IMR |= (1<<12); | |
EXTI_RTSR |= (1<<12); | |
EXTI_IMR |= (1<<11); | |
EXTI_RTSR |= (1<<11); | |
EXTI_IMR |= (1<<10); | |
EXTI_RTSR |= (1<<10); | |
EXTI_IMR |= (1<<9); | |
EXTI_RTSR |= (1<<9); | |
//NVIC_Init | |
//NVIC it group2 | |
SCB_AIRCR = 0x05FA0000 | 0x500; | |
// ip Interrupt priority register x | |
//(*(volatile uint8_t*)0xE000E417) = 0xe0; //23 | |
//(*(volatile uint8_t*)0xE000E428) = 0xe0; // 40 | |
(*(volatile uint8_t*)0xE000E417) = 0x50; //23 | |
(*(volatile uint8_t*)0xE000E428) = 0x50; // 40 | |
printf("nip 5 %08x\n", (*(volatile uint32_t*)0xE000E414)); | |
// 23 40 Interrupt set-enable register x (NVIC_ISERx) | |
// nvic enable interrupter number | |
// 0xE000E100 | |
(*(volatile uint32_t*)0xE000E100) |= (1<<23); | |
(*(volatile uint32_t *)0xE000E104) |= (1<< (40%32)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment