This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

zstack中断处理函数

#pragma vector = P1INT_VECTOR

HAL_ISR_FUNCTION ()

用这两种方式是不是都能实现中断处理,有区别吗?

HAL_ISR_FUNCTION ()在哪调用?

  • 如 HAL_ISR_FUNCTION( halUart0RxIsr, URX0_VECTOR )      //uart0  接收 

    hal_mcu.h 文件: 

    #define HAL_ISR_FUNC_PROTOTYPE(f,v)    _PRAGMA(vector=v) __near_func __interrupt void f(void) 

    #define HAL_ISR_FUNCTION(f,v)           HAL_ISR_FUNC_PROTOTYPE(f,v); 

    从这两个#define 的定义可以了解到: 

    HAL_ISR_FUNCTION( halUart0RxIsr, URX0_VECTOR )按照定义展开来就是: 

    _PRAGMA(URX0_VECTOR) __near_func __interrupt void halUart0RxIsr(void); 

    其中_PRAGMA 是编译器预定义的声明中断服务程序的一个方法,URX0_VECTOR 是中断编号(在

    ioCC2530.h文件中定义)。halUart1TxIsr就是f所指的函数,也就是我们的中断服务函数。