Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stm32f10x.h"
- #include "stm32f10x_exti.h"
- #include "stm32f10x_gpio.h"
- #include "stm32f10x_rcc.h"
- #include "misc.h"
- #define przesuniete 1<<5;
- GPIO_InitTypeDef GPIO_InitStruct;
- int przerwanie = 0;
- void SysTick_Handler() {
- przerwanie++;
- //gdy wystąpi 1000 z kolei przerwanie SysTick (minie 1 sekunda)
- if (przerwanie == 1000) {
- //resetuję stan licznika przerwań
- przerwanie = 0;
- GPIOA->ODR ^= przesuniete;
- }
- }
- void konfiguracjaDiody(void) {
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
- GPIO_StructInit(&GPIO_InitStruct);
- GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
- //konfiguracja prędkości (takowania) portu na szybkie
- GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_InitStruct.GPIO_Pin = GPIO_Pin_5;
- GPIO_Init(GPIOA, &GPIO_InitStruct);
- }
- int main(void) {
- //konfiguracja SysTick - przerwanie, co 1ms, gdzie 72000000 to taktowanie proc.
- SysTick_Config(72000000 / 1000);
- konfiguracjaDiody();
- while (1) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement