串口打印 重連也不好用 估計(jì)toms被打破了
Conn 1 - Int 28
Connected..
Update 1 - Int 6
Update 1 - Int a
RSSI -34 dB CoRun at EXTI
n? 1
RSSI -34 dB Conn? 1
RSSI -34 dB Conn? 1
Disconnected.. Reason:8
Advertising..
/***********************************
peripheral.c?? 啟動(dòng)或停止電機(jī)
static void performPeriodicTask(void)
{
??? GPIO_WriteBit(GPIOB, GPIO_Pin_6, Bit_RESET);
??? GPIO_WriteBit(GPIOC, GPIO_Pin_6, (i == 0) ? (i = Bit_SET) : (i = Bit_RESET));
}
/********************************************
peripheral_main.c
void EXTI4_INT_INIT(void)
{
內(nèi)嵌運(yùn)放的輸出為高電平就啟動(dòng)中斷
??? EXTI_InitTypeDef EXTI_InitStructure = {0};
??? NVIC_InitTypeDef NVIC_InitStructure = {0};
??? RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO , ENABLE);
??? /* GPIOA ----> EXTI_Line0 */
??? GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource4);
??? EXTI_InitStructure.EXTI_Line = EXTI_Line4;
??? EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
??? EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
??? EXTI_InitStructure.EXTI_LineCmd = ENABLE;
??? EXTI_Init(&EXTI_InitStructure);
??? NVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQn;
??? NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
??? NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
??? NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
??? NVIC_Init(&NVIC_InitStructure);
}
int main(void)
{
??? NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
??? Delay_Init();
#ifdef DEBUG
??? USART_Printf_Init( 115200 );
#endif
??? PRINT("%s\n", VER_LIB);
??? //NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
??? GPIO_INIT();
??? OPA2_Init();
??? EXTI4_INT_INIT();
??? WCHBLE_Init();
??? HAL_Init();
??? GAPRole_PeripheralInit();
??? Peripheral_Init();
??? Main_Circulation();
}
中斷
void EXTI4_IRQHandler(void)
{
? if(EXTI_GetITStatus(EXTI_Line4)!=RESET)
? {
??? printf("Run at EXTI\r\n");
??? EXTI_ClearITPendingBit(EXTI_Line4);???? /* Clear Flag */
? }
}