32-bitni mikrokontroleri i primena - MS1BMP

Slides:



Advertisements
Similar presentations
MC68HC11 System Overview. System block diagram (A8 version)
Advertisements

68HC11 Polling and Interrupts
Programming I/O for Embedded System. Page 2 Overview Basis: A DE2 Computer Architecture Parallel I/O 7-Segment Display Basic Manipulating 7-Segment Display.
Using PDG with e2studio: Example
Raul Cabrera Khaldon Batnij Isaac Zavala
Dr. Kimberly E. Newman Hybrid Embedded wk3 Fall 2009.
MSP432™ MCUs Training Part 9: Porting between MSP430 and MSP432
Introduction Purpose Objectives Content Learning Time
3-1 System peripherals & Bus Structure Memory map of the LPC2300 device is one contiguous 32-bit address range. However, the device itself is made up of.
Part 1 Using the ARM board And start working with C Tutorial 5 and 6
NET+OS 6.1 Training. BSP NET+OS 6.1 BSP Initialization Memory map New features Debugging Porting Issues.
Renesas Technology America Inc. 1 M16C/Tiny SKP Tutorial 2 Creating A New Project Using HEW4.
LPC2148 Programming Using BLUEBOARD
GPIO 碩一 李柏毅 陳政澤. overview Introduction example Structure of GPIO.
EE 446 Project Assignment Top Design Sensor Components Pin Assignment and Configuration Completed Physical Setup Project Tasks.
1 ARM University Program Copyright © ARM Ltd 2013 General Purpose I/O.
1 ARM University Program Copyright © ARM Ltd 2013 General Purpose I/O.
Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN.
ECS642U Embedded Systems Digital I/O William Marsh.
1 General Purpose and Alternate Function I/O (GPIO and AFIO)
1-3 GPIO_Output(LuminaryLibrary) 1.Alter the output current to 4mA 2.Let LED0 turn on but LED 1 turn off. Modify your program in E:\yourname\arm.
Prof: doc.dr. Samir Lemeš student: Samir Hrnjić. System restore je komponenta Microsoftovih operativnih sistema Windows Serveri ne podržavaju opciju System.
Implementation of Embedded OS Lab3 Porting μC/OS-II.
NAM S.B MDLAB. Electronic Engineering, Kangwon National University 1.
STM32F107VC Datablad Reference manual Schematics.pdf.
Interrupt 마이크로 프로세서 (Micro Processor) 2015년 2학기 충북대학교 전자공학과 박 찬식
1 The LPC1768 Architecture (with focus on Cortex-M3)
PRJ2: ESP2-UC workshop 1 Introductie 1.
Introduction to the ARM mbed Platform– A Hands-on Course
Outline Introduction to NuMaker TRIO Programming environment setup
Lab 1: Using NIOS II processor for code execution on FPGA
Code review: GPIO, timer, and ISR
Microcontrollers & GPIO
68HC11 Interrupts & Resets.
Computer System Laboratory
Implementation of Embedded OS
Chapter 6 General Purpose Input/Output
PRJ2UC: Microcontrollers
GPIO General Purpose Input/output Tiva C TM4C123GH6PM
Refer to Chapter 10 in the reference book
NS Training Hardware.
Programming Microcontroller ADC – Analog Digital Converter
CS4101 嵌入式系統概論 General Purpose IO
Embedded Systems Software Training Center
My First Nios II for Altera DE2-115 Board
Blinking an LED Using MSP430ware to Control GPIO
32-bitni mikrokontroleri i primena - MS1BMP 2. deo
Programming Microcontroller GPIO – General Purpose Input/Output
32-bitni mikrokontroleri i primena - MS1BMP 2. deo
32-bitni mikrokontroleri i primena - MS1BMP
RX111 Promotion Board (RPB) hands on
Introduction to Microprocessors and Microcontrollers
STM Arm I/O Programming
32-bitni mikrokontroleri i primena - MS1BMP 6. deo
OPIS KONAČNIH AUTOMATA POMOĆU VHDL-a
CheckBox RadioButton RadioGroup
32-bitni mikrokontroleri i primena - MS1BMP 4. deo
SPREGA SA U/I UREDJAJIMA
KREIRANJE OBJEKATA.
LABORATORIJSKA VEŽBA VEŽBA 4
32-bitni mikrokontroleri i primena - MS1BMP
32-bitni mikrokontroleri i primena
M-datoteke.
Baremetal C Programming for Embedded Systems
32-bitni mikrokontroleri i primena - MS1BMP
Do While ... Loop struktura
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
EECE.3170 Microprocessor Systems Design I
Software Setup & Validation
Presentation transcript:

32-bitni mikrokontroleri i primena - MS1BMP 2017/2018 Nenad Jovičić Marija Janković

STM32L476RG – kopamo dublje STM32L476xx – MCU Datasheet Provera karakteristika pri izboru mikrokontrolera Alternate pin function Additional pin function STM32 Nucleo-64 board – User Manual Solder bridges STM32L4x5 and STM32L4x6 advanced ARM®-based 32-bit MCUs - Reference Manual Sve što ste hteli da znate ali vas mrzi da čitate Ako hoćemo da znamo čime zapravo raspolažemo i šta sve nudi naš mikrokontroler treba da pogledamo par stvari, Datasheet čipa, User Manual ploče koji nam ukratko ukazuje na mogućnosti i pomoću koga možemo da vidimo da li nam neki mikrokontroler odgovara ili ne. I na kraju Reference manual koji detaljno opisuje anatomiju i fiziologiju mikrokontrolera. http://www.st.com/content/ccc/resource/technical/document/reference_manual/02/35/09/0c/4f/f7/40/03/DM00083560.pdf/files/DM00083560.pdf/jcr:content/translations/en.DM00083560.pdf Otvoriti reference manual i pokazati sekciju o GPIO.

STM Cortex-M - GPIO - Portovi 5V tolerantni ulazi Kapacitet po pinu 25mA 18 MHz učestanost toglovanja Konfigurabilna izlazna brzina do 50 MHz Do 16 analognih ulaza Alternativne funkcije (USARTx, TIMx, I2Cx, SPIx,…) Svaki pin može da generiše spoljašnji prekid Jedan pin može da se koristi za buđenje iz STANDBY moda (PA.00) Jedan pin može da bude Tamper Pin (za watchdog) (PC.13) Pinovi grupisani u 5 16-bitnih portova (GPIOA..GPIOE) Mehanizam zaključavanja konfiguracije

Analog Input/Output (Reset state) GPIO Konfiguracije Analog Input Configuration Mode CNF1 CNF0 MOD1 MOD0 To On-chip Peripherals ON/OFF Pull - UP Pull - Down VDD VSS Analog Input/Output (Reset state) 00 Alternate Function Input Input Floating 1 01 ON OFF Input Pull-Up(2) 1 Read Input Data Register VDD or VDD_FT(1) Input Pull-Down(2) TTL Schmitt Trigger Output Push-Pull 10 Input Driver I/O pin Output Open-Drain 1 VDD VSS Output Driver AF Push-Pull 1 11 Write Bit Set/Reset Registers OUTPUT CONTROL Output Data Register VSS AF Open-Drain 1 Push-Pull or Open Drain Read / Write or disabled From On-chip Peripherals Alternate Function Output

Ulazna konfiguracija Izlazni bafer je isključen Schmitt trigger kolo je aktivno Pull-up i pull-down otpornici su aktivni u zavisnosti od sadržaja GPIOx_PUPDR registra Vrednosti na ulazima pinova se očitavaju i upisuju u ulazni registar na svaki takt AHB magistrale Čitanjem ulaznog registra (Input data register) dobijaju se digitalna stanja ulaza

Izlazna konfiguracija Open-Drain mod: “0” u Output Data registru aktivira N-MOS tranzistor, dok “1” u Output Data registru ostavlja pin u stanju visoke impedanse (P-MOS transistor se nikada ne aktivira). Push-pull mod: “0” u Output Data registru aktivira N-MOS, dok “1” u Output Data registru aktivira P-MOStor. Schmitt Trigger kolo je uključeno Interni pull-up i pull-down otpornici su isključeni Stanje koje je na pinu se sempluje i upisuje u Input Data registar na svaki APB2 klok Čitanjem Input Data registra očitava se stanje pina kada je konfigurisan u Open-Drain ili Push-pull modu ako je pomenut debounsing treba objasniti i sta je schmitt trigger, tj. kako nam je on obezbedio da lepo detektujemo pritisak ili puštanje tastera.

Konfiguracija alternativne funkcije Izlazni dajver je u Open Drain ili Push-Pull konfiguraciji Schmitt Trigger ulaz je aktiviran Pull-up i pull-down otpornici su deaktivirani Podatak na pinu se sempluje u ulazni registar na svaku ivicu APB2 takta Ako je izlaz u open drain modu očitavanje ulaznog registra daje stanje na pinu

Konfiguracija analognog ulaza Izlazni bafer je isključen (otkačen) Schmitt Trigger kolo je isključeno zbog smanjenja potrošnje. Pull-up i pull-down otpornici su isključeni Očitavanje ulaznog registra uvek daje “0”

GPIO registri Četiri 32-bitna konfiguraciona registra (GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR, GPIOx_PUPDR) Dva 32-bitna data registra (GPIOx_IDR, GPIOx_ODR) Jedan 32-bitni set/reset registar (GPIOx_BSRR) Jedan 16-bitni reset registar (GPIOx_BRR) Jedan 32-bitni locking registar (GPIOx_LCKR) Dva 32-bitna alternate function selekciona registra (GPIOx_AFRH, GPIOx_AFRL)

Port mode register (GPIOx_MODER) (x=A..I)

Port output type register (GPIOx_OTYPER) (x=A..I) Port pull-up/pull-down register (GPIOx_PUPDR) (x=A..I)

Port speed register (GPIOx_OSPEEDR) (x=A..I)

Port input data register (GPIOx_IDR) (x=A..I) Port output data register (GPIOx_ODR) (x=A..I)

Port bit set/reset register (GPIOx_BSRR) (x=A..G) The purpose of the GPIOx_BSRR and GPIOx_BRR registers is to allow atomic read/modify accesses to any of the GPIOx_ODR registers. In this way, there is no risk of an IRQ occurring between the read and the modify access. Each I/O port bit is freely programmable, however the I/O port registers have to be accessed as 32-bit words, half-words or bytes.

Port bit reset register (GPIOx_BRR) (x=A..G) https://github.com/ARMmbed/mbed-os/blob/b7dce715105e62a993ec33ede0024efaf0f01f66/targets/TARGET_STM/gpio_object.h mbed-os/dirvers/DigitalOut.h [gpio_write] -> mbed-os/targets/TARGET_STM/gpio_object.h [static function gpio_write] -> obj->reg_set ili obj->reg_reset

Port configuration lock register (GPIOx_LCKR) (x=A..G)

STM32L4x5 and STM32L4x6 advanced ARM®-based 32-bit MCUs

STM32CubeL4 komponente Sa adrese tnt.etf.rs/~ms1bmp/stm32cubel4.zip (za F103RB tnt.etf.rs/~ms1bmp/stm32cubef1.zip) skinuti .zip fajl i raspakovati ga u folder E:/MS1BMP

STM32CubeL4 komponente STM32Cube includes STM32CubeMX, a graphical software configuration tool that allows the generation of C initialization code using graphical wizards. STM32Cube embedded software libraries, including: The HAL hardware abstraction layer, enabling portability between different STM32 devices via standardized API calls The Low-Layer (LL) APIs, a light-weight, optimized, expert oriented set of APIs designed for both performance and runtime efficiency A collection of Middleware components, like RTOS, USB library, file system, TCP/IP stack, Touch sensing library or Graphic Library (depending on the MCU series)

STM32CubeL4 arhitektura

Struktura foldera

Primeri – GPIO IOToggle

Projekat GPIO_IOToggle Efikasnije pretraživanje i orjentacija se mogu postići dodavanjem shortcut-ova za pojedine naredbe: Edit->Configuration->Shortcut Keys-> Go to Definition Navigate Backwards Navigate Forwards Comment Uncomment ovo je super pitanje, traziti im da se snadju i pogledaju. Tu treba i reći da im za prolazak kroz fajlove i definicije znacajno olaksavaju zivot shortcut-ovi. Edit-Configuration-Shortcut Keys Onda oni mogu sami da postave za Edit:Advanced:Go to Definition of the current word, za Edit: Navigate Backwards, Edit: Navigate Forwards, za Comment, Uncomment i tako dalje. Neko vreme da se igraju i da gledaju kako radi, onda da builduju i da fleshuju plocicu i da mozda udju u debug, da gledaju vrednosti registara. Autos,Watch1 i tako dalje. Gde se nalazi definicija funkcije HAL_GPIO_TogglePin ()? Kojim registrima se pristupa? HAL_Delay() funkcija imlementira čekanje. Na koji način?

STM CUBE CMSIS Struktura projekta Osnovni konfiguracioni heder fajl za odabranu familiju mikrokontrolera. U zavisnosti od USE_HAL_DRIVER obezbeđuje korišćenje HAL API-ja, ili zahteva direktan pristup registrima periferija u kodu. Startup fajl – definiše ga proizvođač kompajlera SystemInit() startup_stm32l476xx.s main.c BSP – board support package stm32l4xx.h stm32l4xx_nucleo.h main.h USE_HAL_DRIVER stm32l4xx_nucleo.c stm32l476xx.h Cortex-M4 prekidi i izuzeci stm32l4xx_hal.h stm32l4xx_it.c system_stm32l4xx.h system_stm32l4xx.c stm32l4xx_it.h core_cm4.h core_cm4.c Peripheral header file Ovaj fajl prilagodjava korisnik stm32l4xx_hal_conf.h startup_stm32l476xx.s: - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). main.c has #include main.h main.h has #include stm32l4xx_hal.h and #include stm32l4xx_nucleo.h stm32l4xx_hal.h - This file contains all the functions prototypes for the HAL module driver. HAL_Init() function is called at the beginning of program after reset and before * the clock configuration. The common HAL driver contains a set of generic and common APIs that can be used by the PPP peripheral drivers and the user to start using the HAL. [..] The HAL contains two APIs' categories: (+) Common HAL APIs (+) Services HAL APIs stm32l4xx_hal.h includes stm32l4_hal_conf.h which is the HAL configuration file. stm32l4xx_hal_conf.h This is the list of modules to be used in the HAL driver, ones defined include adequate stm32l4xx_hal_PPP.h and .c files. One of PPP files is cortex which sets up NVIC, SysTick and MPU stm32l4xx_nucleo.h defines specific nucleo peripherals: This file contains definitions for: * - LEDs and push-button available on STM32L4XX-Nucleo Kit * from STMicroelectronics * - LCD, joystick and microSD available on Adafruit 1.8" TFT LCD * shield (reference ID 802) stm32l4_xx.h - The file is the unique include file that the application programmer * is using in the C source code, usually in main.c. This file contains: * - Configuration section that allows to select: * - The STM32L4xx device used in the target application * - To use or not the peripheral’s drivers in application code(i.e. * code will be based on direct access to peripheral’s registers * rather than drivers API), this option is controlled by * "#define USE_HAL_DRIVER" stm32l476xx.h * This file contains: * - Data structures and the address mapping for all peripherals * - Peripheral's registers declarations and bits definition * - Macros to access peripheral’s registers hardware system_stm32l4xx.c This file provides two functions and one global variable to be called from * user application: * - SystemInit(): This function is called at startup just after reset and * before branch to main program. This call is made inside * the "startup_stm32l4xx.s" file. * * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used * by the user application to setup the SysTick * timer or configure other parameters. * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must * be called whenever the core clock is changed * during program execution. * After each device reset the MSI (4 MHz) is used as system clock source. * Then SystemInit() function is called, in "startup_stm32l4xx.s" file, to * configure the system clock before to branch to main program. stm32l4xx_hal_cortex.h stm32l4xx_hal_PPP.h stm32l4xx_hal_PPP.c Low-level & API funkcije koje čine biblioteku periferijskih drajvera. PPP = {pwr, gpio, rcc, tim, uart, spi, …} stm32l4xx_hal_cortex.c stm32l4xx_hal_gpio.c NVIC, SysTick and MPU drivers

Fajlovi koje menja korisnik Osnovni konfiguracioni heder fajl za odabranu familiju mikrokontrolera. U zavisnosti od USE_HAL_DRIVER obezbeđuje korišćenje HAL API-ja, ili zahteva direktan pristup registrima periferija u kodu. Startup fajl – definiše ga proizvođač kompajlera SystemInit() main.c startup_stm32l476xx.s main.c BSP – board support package stm32l4xx.h stm32l4xx_nucleo.h main.h stm32l4xx_it.c stm32l4xx_nucleo.c stm32l476xx.h Cortex-M4 prekidi i izuzeci stm32l4xx_hal.h stm32l4xx_it.c system_stm32l4xx.h system_stm32l4xx.c stm32l4xx_it.h stm32l4xx_it.h stm32l4xx_hal_conf.h core_cm4.h core_cm4.c Peripheral header file Ovaj fajl prilagodjava korisnik stm32l4xx_hal_conf.h startup_stm32l476xx.s: - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). main.c has #include main.h main.h has #include stm32l4xx_hal.h and #include stm32l4xx_nucleo.h stm32l4xx_hal.h - This file contains all the functions prototypes for the HAL module driver. HAL_Init() function is called at the beginning of program after reset and before * the clock configuration. The common HAL driver contains a set of generic and common APIs that can be used by the PPP peripheral drivers and the user to start using the HAL. [..] The HAL contains two APIs' categories: (+) Common HAL APIs (+) Services HAL APIs stm32l4xx_hal.h includes stm32l4_hal_conf.h which is the HAL configuration file. stm32l4xx_hal_conf.h This is the list of modules to be used in the HAL driver, ones defined include adequate stm32l4xx_hal_PPP.h and .c files. One of PPP files is cortex which sets up NVIC, SysTick and MPU stm32l4xx_nucleo.h defines specific nucleo peripherals: This file contains definitions for: * - LEDs and push-button available on STM32L4XX-Nucleo Kit * from STMicroelectronics * - LCD, joystick and microSD available on Adafruit 1.8" TFT LCD * shield (reference ID 802) stm32l4_xx.h - The file is the unique include file that the application programmer * is using in the C source code, usually in main.c. This file contains: * - Configuration section that allows to select: * - The STM32L4xx device used in the target application * - To use or not the peripheral’s drivers in application code(i.e. * code will be based on direct access to peripheral’s registers * rather than drivers API), this option is controlled by * "#define USE_HAL_DRIVER" stm32l476xx.h * This file contains: * - Data structures and the address mapping for all peripherals * - Peripheral's registers declarations and bits definition * - Macros to access peripheral’s registers hardware system_stm32l4xx.c This file provides two functions and one global variable to be called from * user application: * - SystemInit(): This function is called at startup just after reset and * before branch to main program. This call is made inside * the "startup_stm32l4xx.s" file. * * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used * by the user application to setup the SysTick * timer or configure other parameters. * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must * be called whenever the core clock is changed * during program execution. * After each device reset the MSI (4 MHz) is used as system clock source. * Then SystemInit() function is called, in "startup_stm32l4xx.s" file, to * configure the system clock before to branch to main program. stm32l4xx_hal_cortex.h stm32l4xx_hal_PPP.h stm32l4xx_hal_PPP.c Low-level & API funkcije koje čine biblioteku periferijskih drajvera. PPP = {pwr, gpio, rcc, tim, uart, spi, …} stm32l4xx_hal_cortex.c stm32l4xx_hal_gpio.c NVIC, SysTick and MPU drivers

CMSIS - fajlovi Fajlovi koje definiše isključivo ARM: core_cm4.c - Core Peripheral Access Layer Source File Ovaj fajl sadži implementaciju CMSIS intrinsic funkcija koje su za razliku od intrinsic funkcija u oviru C kompajlera nezavisne od vrste kompajlera. stm32l4xx_hal_cortex sadrži dummy f-je koji pozivaju one definisane u core_cm4.c fajlu – NVIC, MPU, SysTick core_cm4.h - Core Peripheral Access Layer Header File Ovaj fajl sadrži definicije registara periferija jezgra i funkcije za pristup tim registrima, kao i deklaraciju intrinsic funkcija   CMSIS layer Device Peripheral Access Layer čine sledeći fajlovi: system_stm32l4xx.c - Device Peripheral Access Layer Source File Ovaj fajl sadži definiciju funkcije SystemInit koja vrši inicijalizaciju dela mikrokontrolera zaduženog za generisanje klok signala i koja se poziva u okviru startup koda  system_stm32l4xx.h - Device Peripheral Access Layer Header File Ovaj fajl sadži deklaraciju funkcije SystemInit  stm32l4xx.h - Device Peripheral Access Layer Header File  Ovaj fajl sadrži definiciju registara periferija mikrokontrolera kao i definiciju bitova u okviru svakog definisanog registra, bazne adrese registara i numeraciju vektora prekida primer SysTick_Config funkcija postoji i u core_cm4.c i u stm32l4xx_hal_cortex.c fajlu, iz hal_cortex je dummy koja samo poziva postojecu funkciju iz core_cmx fajla

HAL - fajlovi stm32l4xx_hal_conf.h - Device Peripheral Access Layer Configuration Header File Ovaj fajl kontroliše korišćenje periferijskih biblioteka koje definiše isključivo proizvođač mikrokontrolera. stm32l4xx_hal_cortex.c stm32l4xx_hal_cortex.h Ovi fajlovi definišu specifičnosti kontrole prekida, sistemskog takta i reset-a. Formu propisuje ARM, ali ga neznatno redefiniše svaki proizvođač. stm32l4xx_hal_PPP.x Ovi fajlovi predstavljaju drajvere za odgovarajuće periferije i razlikuju se od proizvođača do proizvođača. Specifičnosti različitih razvojnih okruženja se definišu sledećim fajlom: startup_stm32l476xx.s - STM32L476xx Devices vector table for MDK-ARM toolchain. Ovaj fajl sadrži vektor tabelu i Reset_Handler ISR u kojoj se vrši setovanje SP, inicijalizacija dela mikrokontrolera zaduženog za generisanje klok signala i pozicioniranje PC na labelu __iar_program_start gde se nalazi kod za inicijalizaciju promenljivih, nakon čega se poziva main funkcija  Napomena: Ovaj fajl se po pravilu razlikuje od okruženja do okruženja!

Fajlovi koje menja korisnik stm32l4xx_hal_conf.h main_X.c stm32l4xx_It.c stm32l4xx_It.h

Opcije projekta Konretan mikrokontroler se definiše preko globalnog simbola što utiče na deklaracije u glavnom heder fajlu

Opcije projekta Korišćenje periferijskih biblioteka se kontroliše globalnim simbolom koji povezuje konfiguracione heder fajlove.

Periferijske biblioteke U konfiguracionom fajlu se uključuju biblioteke vendor-specific periferija koje obezbeđuje proizvođač mikrokontrolera. U tim hederima se nalaze deklaracije registara, ali i prototipovi specifičnih funkcija za pristup konkretnoj periferiji. stm32Cubexxxxxxxx/Drivers/STM32L4xx_HAL_Driver/Src – c fajlovi koji treba da se inkluduju u projekat Korišćenje funkcija zahteva uključivanje i odgovarajućih source fajlova u projekat!

Tipičan main() Ovo je praktično inicijalizacija Cortex Periferija

Tipičan main() Definiše korisnik

Inicijalizacija periferija I Pre konfigurisanja bilo koje periferije potrebno je dovesti joj takt korišćenjem odgovarajuće funkcije iz RCC drajvera: __HAL_RCC_PPP_CLK_ENABLE()

Inicijalizacija periferija II Inicijalizacija periferija se uvek izvodi korišćenjem struktura karakterističnih za te periferije: PPP_InitStucture.memberX = valX; PPP_InitStructure.memberY = valY; HAL_PPP_Init(PPPx, &PPP_InitStructure);

Kako se togluje LED2 Podatak će biti 0x0020 Na dresu 0x48000000 dodaje offset za ODR koji iznosi 0x14 i dobija se adresa 0x48000014

LED Toggle - BSRR Napisati funkciju GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) koja vrši izmenu stanja izlaza pina upisujući u BSR registar GPIO porta BSR i BR registar GPIO porta Testirati