Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void GPIO_Config(void)
- {
- //konfigurowanie portow GPIO
- GPIO_InitTypeDef GPIO_InitStructure;
- // disable JTAG
- GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
- /*Tu nalezy umiescic kod zwiazany z konfiguracja poszczegolnych portow GPIO potrzebnych w programie*/
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //wyjscie push-pull
- GPIO_Init(GPIOB, &GPIO_InitStructure);
- }
- void NVIC_Config(void)
- {
- //Konfigurowanie kontrolera przerwan NVIC
- NVIC_InitTypeDef NVIC_InitStructure;
- NVIC_InitTypeDef NVIC_InitStructure2;
- #ifdef VECT_TAB_RAM
- // Jezeli tablica wektorow w RAM, to ustaw jej adres na 0x20000000
- NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
- #else // VECT_TAB_FLASH
- // W przeciwnym wypadku ustaw na 0x08000000
- NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
- #endif
- //Konfiguracja NVIC - ustawienia priorytetow przerwania EXTI0
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1); //Wybor modelu grupowania przerwan
- NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; //Wybor konfigurowanego IRQ
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; //Priorytet grupowy
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //Podpriorytet
- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //Wlaczenie obslugi IRQ
- NVIC_Init(&NVIC_InitStructure);
- NVIC_InitStructure2.NVIC_IRQChannel = EXTI1_IRQn; //Wybor konfigurowanego IRQ
- NVIC_InitStructure2.NVIC_IRQChannelPreemptionPriority = 1; //Priorytet grupowy
- NVIC_InitStructure2.NVIC_IRQChannelSubPriority = 0; //Podpriorytet
- NVIC_InitStructure2.NVIC_IRQChannelCmd = ENABLE; //Wlaczenie obslugi IRQ
- NVIC_Init(&NVIC_InitStructure2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement