We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
There is no api for extern interrupts. So how to set exit while using cmsis-driver?
//Ð²Ñ€ÐµÐ¼ÐµÐ½Ð½Ð°Ñ Ð¸Ð½Ð¸Ñ†Ð¸Ð°Ð»Ð¸Ð·Ð°Ñ†Ð¸Ñ ÐºÐ½Ð¾Ð¿ÐºÐ¸ Ñ Ñ„Ð¸ÐºÑацией проверка Ð²ÐºÐ»ÑŽÑ‡ÐµÐ½Ð¸Ñ Ð² прерываниÑÑ… GPIO_StructInit(&port); port.GPIO_Mode = GPIO_Mode_IPD; //GPIO_Mode_AF_PP; port.GPIO_Pin = GPIO_Pin_0; //поÑмотреть временно удобный пин. port.GPIO_Speed = GPIO_Speed_2MHz; GPIO_Init(GPIOB, &port); //выÑтавить временно удобный порт. //наÑтройка ÑиÑтемы прерываний GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource0); /* PB0 is connected to EXTI_Line0, which has EXTI0_IRQn vector */ NVIC_InitStruct.NVIC_IRQChannel = EXTI0_IRQn; /* Set priority */ NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 0x00; /* Set sub priority */ NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0x00; /* Enable interrupt */ NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE; /* Add to NVIC */ NVIC_Init(&NVIC_InitStruct); EXTI_InitStruct.EXTI_Line = EXTI_Line0; /* Enable interrupt */ EXTI_InitStruct.EXTI_LineCmd = ENABLE; /* Interrupt mode */ EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt; /* Triggers on rising and falling edge */ EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising_Falling; /* Add to EXTI */ EXTI_Init(&EXTI_InitStruct); NVIC_EnableIRQ(EXTI0_IRQn); // выÑтавить на нужное ИРКУ
void EXTI0_IRQHandler(void) { if (EXTI_GetITStatus(EXTI_Line0) != RESET) { if (GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_0) != 0) { // Rising } if (GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_0) == 0) { // Falling } /* Clear interrupt flag */ EXTI_ClearITPendingBit(EXTI_Line0); } }
something like this