Zigbee代码解析笔记

来源:互联网 发布:左华健 软件 编辑:程序博客网 时间:2024/06/04 08:40

首先自己去新建一个工程,并把相应的代码拷贝至工程文件夹,同时将文件添加到工程中,这样有一个比较直观的关于代码架构的认识。然后开始读代码。


int main( void ){    // Turn off interrupts    //关闭中断    osal_int_disable( INTS_ALL );    // Initialization for board related stuff such as LEDs    //初始化与板子相关的设备如LED等,设置端口方向    HAL_BOARD_INIT();    // Make sure supply voltage is high enough to run    //确保电压足够支撑系统运行,如果未上电,指示灯会闪烁    zmain_vdd_check();    // Initialize board I/O//关闭中断,关闭所有LED灯    InitBoard( OB_COLD );    // Initialze HAL drivers    //初始化定时器,LCD,按键,AD等外围设备    HalDriverInit();    // Initialize NV System//初始化非易失性存储器    osal_nv_init( NULL );    // Initialize the MAC    //初始化MAC层,都是库函数,看不到实现    ZMacInit();    // Determine the extended address    zmain_ext_addr();    // Initialize basic NV items    zgInit();#ifndef NONWK    // Since the AF isn't a task, call it's initialization routine    afInit();#endif    // Initialize the operating system    //初始化操作系统,包括任务的结构体,开启定时器等    osal_init_system();    // Allow interrupts    //打开中断    osal_int_enable( INTS_ALL );    // Final board initialization    //设置按键回调函数    InitBoard( OB_READY );    // Display information about this device    //在LCD上显示本节点信息,没有LCD可以用串口代替    zmain_dev_info();    /* Display the device info on the LCD */#ifdef LCD_SUPPORTED    zmain_lcd_init();#endif#ifdef WDT_IN_PM1    /* If WDT is used, this is a good place to enable it. */    WatchDogEnable( WDTIMX );#endif//LED1_SBIT = 1;//开始系统的轮询    osal_start_system(); // No Return from here#if 0#endif//PCT    return 0;  // Shouldn't get here.} // main()


原创粉丝点击