Untitled
Never
/* ****************************************************************************** File: main.c Info: Generated by Atollic TrueSTUDIO(R) 9.2.0 2022-06-08 The MIT License (MIT) Copyright (c) 2018 STMicroelectronics Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************** */ /* Includes */ #include "stm32f4xx.h" #include "stm32f4xx_rcc.h" #include "stm32f4xx_gpio.h" /* Private macro */ /* Private variables */ /* Private function prototypes */ /* Private functions */ /** **=========================================================================== ** ** Abstract: main program ** **=========================================================================== */ volatile uint8_t delayNum=1; GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitTypeDef GPIO_InitStructure2; volatile static int systickCounter = 0; int main(void) { int i = 0; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure2.GPIO_Pin = GPIO_Pin_14; GPIO_InitStructure2.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure2.GPIO_OType = GPIO_OType_PP; GPIO_Init(GPIOD, &GPIO_InitStructure); GPIO_SetBits(GPIOD,GPIO_Pin_15); GPIO_Init(GPIOD, &GPIO_InitStructure2); GPIO_ResetBits(GPIOD,GPIO_Pin_14); GPIO_InitTypeDef GPIO_InitButn; EXTI_InitTypeDef EXTI_InitStruct; NVIC_InitTypeDef NVIC_InitStruct; GPIO_InitButn.GPIO_Mode = GPIO_Mode_IN; GPIO_InitButn.GPIO_Pin = GPIO_Pin_0; GPIO_InitButn.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitButn.GPIO_Speed = GPIO_Speed_100MHz; GPIO_Init(GPIOA, &GPIO_InitButn); RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource0); EXTI_InitStruct.EXTI_Line = EXTI_Line0; EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStruct.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStruct); NVIC_SetPriorityGrouping(0u); SysTick_Config(168000); NVIC_SetPriority(EXTI0_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),1,0)); NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0,0)); NVIC_EnableIRQ(EXTI0_IRQn); /** * IMPORTANT NOTE! * The symbol VECT_TAB_SRAM needs to be defined when building the project * if code has been located to RAM and interrupts are used. * Otherwise the interrupt table located in flash will be used. * See also the <system_*.c> file and how the SystemInit() function updates * SCB->VTOR register. * E.g. SCB->VTOR = 0x20000000; */ /* TODO - Add your application code here */ /* Infinite loop */ while (1) { } } void EXTI0_IRQHandler(void){ GPIO_SetBits(GPIOD,GPIO_Pin_14); int i=0; while(i<100000000){ i++; } GPIO_ResetBits(GPIOD,GPIO_Pin_14); EXTI_ClearITPendingBit(EXTI_Line0); } void SysTick_Handler(void){ systickCounter++; if(systickCounter >= 1000*delayNum){ systickCounter = 0; GPIO_ToggleBits(GPIOD,GPIO_Pin_15); } }
Raw Text
-
dsfds fds fdsf ds fdsf dsf ds fds
3 min ago
-
Untitled
4 min ago
-
fsdfgsdfsdf
5 min ago
-
sfggj jjjhjkjjlk
6 min ago
-
https://www.daretodoubt.org/profile/titans-vs-ravens-nfl-game-live-free-coverage-on-11-aug-2022-tv-2
6 min ago
-
Untitled
8 min ago
-
Untitled
14 min ago
-
dsfds dsf dfs dfsdsf sfdsf dsffdss
17 min ago
-
Untitled
19 min ago
-
dsghghfgh
19 min ago