Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C:
- #include "main_base.h"
- unsigned short int dioda();
- int main(void) {
- // to jest jednorazowa konfiguracja
- RCC->AHB1ENR |= RCC_AHB1Periph_GPIOG;
- GPIOG->MODER |= GPIO_Mode_OUT << (14*2);// 1 - output
- GPIOG->OTYPER|= GPIO_OType_PP << 14;//0 - push-pull (def.)
- GPIOG->PUPDR |= GPIO_PuPd_NOPULL << (14*2);//0 - (default)
- RCC->AHB1ENR |= RCC_AHB1Periph_GPIOG;
- GPIOG->MODER |= GPIO_Mode_OUT << (13*2);// 1 - output
- GPIOG->OTYPER|= GPIO_OType_PP << 13;//0 - push-pull (def.)
- GPIOG->PUPDR |= GPIO_PuPd_NOPULL << (13*2);//0 - (default)
- RCC->AHB1ENR |= RCC_AHB1Periph_GPIOA;
- GPIOA->MODER |= GPIO_Mode_IN; // 0 - input (default)
- GPIOA->PUPDR |= GPIO_PuPd_NOPULL ; // 0 - (default)
- while (1) {
- GPIOG->BSRR = 0x80004000; // dodany początek 0x8000 gaszący diodę PG14
- if(GPIOA->IDR&1)
- dioda();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement