Beispiel #1
0
/**
 * @brief Main function of the Terminal Target application
 */
int main(void)
{
    irq_initialize_vectors();
	sysclk_init();

    /* Initialize the board.
     * The board-specific conf_board.h file contains the configuration of
     * the board initialization.
     */
    board_init();

    sw_timer_init();

    if (nwk_init()!= NWK_SUCCESS) {
        app_alert();
    }

    zrc_ind.vendor_data_ind_cb = vendor_data_ind;

#ifdef ZRC_CMD_DISCOVERY
	zrc_ind.zrc_cmd_disc_indication_cb =  zrc_cmd_disc_indication;
#endif
	zrc_ind.zrc_cmd_indication_cb = zrc_cmd_indication;

	register_zrc_indication_callback(&zrc_ind);

	nwk_ind.nwk_ch_agility_indication_cb = nwk_ch_agility_indication;
	nwk_ind.nlme_unpair_indication_cb = nlme_unpair_indication;
	register_nwk_indication_callback(&nwk_ind);

	/* Initialize LEDs. */
	LED_On(LED_START);     /* indicating application is started */
	LED_Off(LED_NWK_SETUP); /* indicating network is started */
	LED_Off(LED_DATA);     /* indicating data reception */

	/*
	 * The stack is initialized above, hence the global interrupts are
	 *enabled
	 * here.
	 */
	cpu_irq_enable();

#ifdef SIO_HUB
	/* Initialize the serial interface used for communication with terminal
	 *program. */

	sio2host_init();
#endif

	sw_timer_get_id(&led_timer);

	/* Endless while loop */
	while (1) {
		app_task(); /* Application task */
		nwk_task(); /* RF4CE network layer task */
	}
}
/**
 * Main function, initialization and main message loop
 *
 */
int main(void)
{
    irq_initialize_vectors();

    /* Initialize the board.*/	
    board_init();    

	/* Initialize the Software timer */
    sw_timer_init();       
    
	/* Init the RF4CE Network layer */
    if (nwk_init()!= NWK_SUCCESS)
    {
        app_alert();
    }

#ifdef RF4CE_CALLBACK_PARAM
	/* Register the ZID Callback indication */
    zid_ind.zid_report_data_indication_cb = zid_report_data_indication;
    zid_ind.zid_get_report_indication_cb = zid_get_report_indication;
    register_zid_indication_callback(&zid_ind);
#endif
    /*
     * The stack is initialized above,
     * hence the global interrupts are enabled here.
     */
     cpu_irq_enable();
	 sw_timer_get_id(&APP_TIMER_ACC_READ);
    if (get_zid_keyrc_button(button_scan()) == ZID_COLD_START)
    {        
        /* Cold start */
        LED_On(ZID_APP_LED);
        node_status = COLD_START;
        nlme_reset_request(true
#ifdef RF4CE_CALLBACK_PARAM
                          ,(FUNC_PTR)nlme_reset_confirm
#endif
                           );
    }
    else
    {
        /* Warm start */
        node_status = WARM_START;
        nlme_reset_request(false
#ifdef RF4CE_CALLBACK_PARAM
                          ,(FUNC_PTR)nlme_reset_confirm
#endif
                           );
    }

    /* Endless while loop */
    while (1)
    {
        app_task(); /* Application task */
        nwk_task(); /* RF4CE network layer task */
    }
}
Beispiel #3
0
/**
 * @brief Main function of the Terminal Target application
 * @ingroup App_API
 */
int main(void)
{
    /* Initialize all layers */
    if (nwk_init() != NWK_SUCCESS)
    {
        /* something went wrong during initialization */
        pal_alert();
    }
    /* disable pull-ups */
    MCUCR |= (1u << PUD);
    
#ifdef FLASH_NVRAM
    pal_ps_set(EE_IEEE_ADDR,IEEE_ADDRESS_BYTES, &tal_pib_IeeeAddress);
#endif
    
    /* Initialize LEDs. */
    pal_led_init();
    pal_led(LED_START, LED_ON);         /* indicating application is started */
    pal_led(LED_NWK_SETUP, LED_OFF);    /* indicating network is started */
    pal_led(LED_DATA, LED_OFF);         /* indicating data reception */

    /*
     * The stack is initialized above, hence the global interrupts are enabled
     * here.
     */
    
    pal_global_irq_enable();
 
    /**
    * @brief TWI and QT600 interface initialization
    */
    int i;
    twi_master_init();
    RESET_QT600_PIN_INIT();
    RESET_QT600_ON();
    for (i = 0; i < 100 ; i++)
        asm("nop");
    
    /* Endless while loop */
    while (1)
    {
        app_task(); /* Application task */
        if(rf4ce_new_msg == 1)
        {
          twi_send_message();
          TX_index = 0;
          rf4ce_new_msg = 0;
        }
 
        nwk_task(); /* RF4CE network layer task */
    }
}
static void run_nlme_reset_test(const struct test_case *test)
{
	nlme_reset_request(true
#ifdef RF4CE_CALLBACK_PARAM
			, (FUNC_PTR)nlme_reset_confirm
#endif
			);
	while (!nlme_reset_conf_rcvd) {
		nwk_task();
	}
	test_assert_true(test, nlme_reset_conf_status == NWK_SUCCESS,
			"NWK Reset request failed");
}
/**
 * \brief Run Wireless Module unit tests
 *
 * Initializes the clock system, board and USB.
 * Then runs the wireless task continuously.
 */
int main(void)
{
	irq_initialize_vectors();
	board_init();
	sysclk_init();

	sw_timer_init();
	nwk_init();
	/* Enable interrupts */
	cpu_irq_enable();

	stdio_usb_init();

	while (1) {
		nwk_task();
	}
}
Beispiel #6
0
/**
 * Main function, initialization and main message loop
 *
 * @return error code
 */
int main(void)
{
	irq_initialize_vectors();
	#if SAMD21 || SAMD20 || SAMR21
	system_init();
	delay_init();
#else
	sysclk_init();

	/* Initialize the board.
	 * The board-specific conf_board.h file contains the configuration of
	 * the board initialization.
	 */
	board_init();
#endif	

	sw_timer_init();

	if (nwk_init() != NWK_SUCCESS) {
		app_alert();
	}

	stack_indication_callback_init();

#ifdef FLASH_NVRAM
	pal_ps_set(EE_IEEE_ADDR, 8, &tal_pib.IeeeAddress);
#endif
	/* Initialize LEDs */
	/* pal_led_init(); */
	cpu_irq_enable();

	/*
	 * The global interrupt has to be enabled here as TAL uses the timer
	 * delay which in turn requires interrupt to be enabled
	 */
	/* pal_global_irq_enable(); */

	serial_interface_init();

	/* Loop forever, the interrupts are doing the rest */
	while (1) {
		nwk_task();
		serial_data_handler();
	}
	/* No return statement here, because this code is unreachable */
}
Beispiel #7
0
static void run_zid_rec_connect_test(const struct test_case *test)
{
	dev_type_t RecDevTypeList[DEVICE_TYPE_LIST_SIZE];
	profile_id_t RecProfileIdList[PROFILE_ID_LIST_SIZE];

	RecDevTypeList[0] = (dev_type_t)SUPPORTED_DEV_TYPE_0;
	RecProfileIdList[0] = SUPPORTED_PROFILE_ID_0;

	zid_rec_connect_request(APP_CAPABILITIES, RecDevTypeList, RecProfileIdList
  #ifdef RF4CE_CALLBACK_PARAM
			, (FUNC_PTR)zid_connect_confirm
  #endif
			);
	while (!zid_connect_conf_rcvd) {
		nwk_task();
	}
	test_assert_true(test,
			zid_connect_conf_status  == NWK_DISCOVERY_TIMEOUT,
			"Push button pairing test failed");
}
Beispiel #8
0
/**
 * Main function, initialization and main message loop
 *
 */
int main (void)
{
    irq_initialize_vectors();

    /* Initialize the board.ss
     * The board-specific conf_board.h file contains the configuration of
     * the board initialization.
     */
    sysclk_init();
    board_init();

    sw_timer_init();

    if (nwk_init()!= NWK_SUCCESS)
    {
        app_alert();
    }

    zid_indication_callback_init();
    /*
     * The stack is initialized above, hence the global interrupts are enabled
     * here.
     */
    cpu_irq_enable();
    /* Initializing udc stack as HID composite device*/
    udc_start();

    sw_timer_get_id(&APP_TIMER);

    /* Endless while loop */
    //udi_hid_gpd_up(16);
    while (1)
    {


        app_task(); /* Application task */
        nwk_task(); /* RF4CE network layer task */


    }
}
static void run_nlme_auto_discovery_test(const struct test_case *test)
{
	dev_type_t RecDevTypeList[DEVICE_TYPE_LIST_SIZE];
	profile_id_t RecProfileIdList[PROFILE_ID_LIST_SIZE];

	RecDevTypeList[0] = (dev_type_t)SUPPORTED_DEV_TYPE_0;
	RecProfileIdList[0] = SUPPORTED_PROFILE_ID_0;
	nlme_auto_discovery_request( 0x13,
			RecDevTypeList,
			RecProfileIdList,
			0x08,
#ifdef RF4CE_CALLBACK_PARAM
			(FUNC_PTR)nlme_auto_discovery_confirm
#endif
			);
	while (!nlme_auto_discovery_conf_rcvd) {
		nwk_task();
	}
	test_assert_true(test, (nlme_auto_discovery_conf_status == NWK_SUCCESS) ||
			(nlme_auto_discovery_conf_status ==
			NWK_DISCOVERY_TIMEOUT),
			"NWK DISCOVERY test failed");
}
Beispiel #10
0
/**
 * Main function, initialization and main message loop
 *
 * @return error code
 */
int main (void)
{
    irq_initialize_vectors();

	/* Initialize the board.
	 * The board-specific conf_board.h file contains the configuration of
	 * the board initialization.
	 */
	board_init();
	sysclk_init();

	sw_timer_init();
        
    if (nwk_init() != NWK_SUCCESS)
    {
        app_alert();
    }

    zid_indication_callback_init();

    cpu_irq_enable();

    /*
     * The global interrupt has to be enabled here as TAL uses the timer
     * delay which in turn requires interrupt to be enabled
     */
   
    serial_interface_init();

    /* Loop forever, the interrupts are doing the rest */
    while (1)
    {
        nwk_task();
        serial_data_handler();
    }
    /* No return statement here, because this code is unreachable */
}