ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Вторник
21 января
1487805 Топик полностью
vesago (31.12.2024 10:28, просмотров: 123) ответил vesago на Хз. Может лучше exint_flag_clear делать по конкретной EXINT_LINE_X?
У меня во как обработчик 

//::::::::::::::::::::::::::::::::::::::::::::::::::::::

// Обработчик прерывания

//::::::::::::::::::::::::::::::::::::::::::::::::::::::

void EXINT9_5_IRQHandler(void)

{

#ifndef DISPLAY_ALLOW

//******************************************************************************

// W1_1

//******************************************************************************

if(exint_flag_get(W11_EXTI_LINE) != RESET)

{

if(Pin_W1_1_Check() == 0)

{

if(Reception_Timeout_Flag_Check(0) == 0) Reception_Timeout_Set(0);

wiegand[0].card |= (1<<WIEGAND_CARD_LSB);

wiegand[0].card <<= 1;

wiegand[0].counter++;

}

exint_flag_clear(W11_EXTI_LINE);

}

//******************************************************************************

// W1_0

//******************************************************************************

if(exint_flag_get(W10_EXTI_LINE) != RESET)

{

if(Pin_W1_0_Check() == 0)

{

if(Reception_Timeout_Flag_Check(0) == 0) Reception_Timeout_Set(0);

wiegand[0].card &= ~(1<<WIEGAND_CARD_LSB);

wiegand[0].card <<= 1;

wiegand[0].counter++;

}

exint_flag_clear(W10_EXTI_LINE);

}

#endif

//******************************************************************************

// W2_1

//******************************************************************************

if(exint_flag_get(W21_EXTI_LINE) != RESET)

{

if(Pin_W2_1_Check() == 0)

{

if(Reception_Timeout_Flag_Check(1) == 0) Reception_Timeout_Set(1);

wiegand[1].card |= (1<<WIEGAND_CARD_LSB);

wiegand[1].card <<= 1;

wiegand[1].counter++;

}

exint_flag_clear(W21_EXTI_LINE);

}

//******************************************************************************

// W2_0

//******************************************************************************

if(exint_flag_get(W20_EXTI_LINE) != RESET)

{

if(Pin_W2_0_Check() == 0)

{

if(Reception_Timeout_Flag_Check(1) == 0) Reception_Timeout_Set(1);

wiegand[1].card &= ~(1<<WIEGAND_CARD_LSB);

wiegand[1].card <<= 1;

wiegand[1].counter++;

}

exint_flag_clear(W20_EXTI_LINE);

}

}



Инит

//::::::::::::::::::::::::::::::::::::::::::::::::::::::

// Инициализация

//::::::::::::::::::::::::::::::::::::::::::::::::::::::

void Wiegand_Init(void)

{

#ifndef DISPLAY_ALLOW

exint_init_type exint_init_struct;

#else

#ifndef TANTOS_ALLOW

exint_init_type exint_init_struct;

#endif

#endif

//-----------------------------------------------------------------------

//-----------------------------------------------------------------------

#ifndef DISPLAY_ALLOW

HC595_Out_ON(HC595_OUT_D8_5);

//W11

scfg_exint_line_config(W11_EXTI_PORT_SOURCE, W11_EXTI_PIN_SOURCE);

exint_default_para_init(&exint_init_struct);

exint_init_struct.line_enable = TRUE;

exint_init_struct.line_mode = EXINT_LINE_INTERRUPUT;

exint_init_struct.line_select = W11_EXTI_LINE;

exint_init_struct.line_polarity = EXINT_TRIGGER_FALLING_EDGE;

exint_init(&exint_init_struct);

nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);

nvic_irq_enable(W11_EXTI_IRQn, 1, 0);

//W10

scfg_exint_line_config(W10_EXTI_PORT_SOURCE, W10_EXTI_PIN_SOURCE);

exint_default_para_init(&exint_init_struct);

exint_init_struct.line_enable = TRUE;

exint_init_struct.line_mode = EXINT_LINE_INTERRUPUT;

exint_init_struct.line_select = W10_EXTI_LINE;

exint_init_struct.line_polarity = EXINT_TRIGGER_FALLING_EDGE;

exint_init(&exint_init_struct);

nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);

nvic_irq_enable(W10_EXTI_IRQn, 1, 0);

#endif