Ejemplo n.º 1
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 */
    }
}
Ejemplo n.º 2
0
/**
 * @brief Main function of the Wireless UART application
 */
int main(void)
{
    /* Initialize the TAL layer */
    if (tal_init() != MAC_SUCCESS)
    {
        // something went wrong during initialization
        pal_alert();
    }

    /* Calibrate MCU's RC oscillator */
    pal_calibrate_rc_osc();

    /* Initialize LEDs */
    pal_led_init();
    pal_led(LED_START, LED_ON);     // indicating application is started
    pal_led(LED_DATA_RX, LED_OFF);  // indicating data reception
    pal_led(LED_DATA_TX, LED_OFF);  // indicating successfull data transmission

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

    /* Initialize the serial interface used for communication with terminal program */
    if (pal_sio_init(SIO_CHANNEL) != MAC_SUCCESS)
    {
        // something went wrong during initialization
        pal_alert();
    }

    /* Configure TX frame and transceiver */
    configure_frame_sending();

    /* Switch receiver on */
    tal_rx_enable(PHY_RX_ON);

#if(SEND_BLOCKWISE==true)
    start_timer();
#endif

    /* Endless while loop */
    while (1)
    {
        pal_task(); /* Handle platform specific tasks, like serial interface */
        tal_task(); /* Handle transceiver specific tasks */
#if(!(SEND_BLOCKWISE==true))
        app_task(); /* Application task */
#endif
    }
}
Ejemplo n.º 3
0
/**
 * @brief Main function of the Sniffer application
 */
int main(void)
{

   /* Initialize the TAL layer */
    if (tal_init() != MAC_SUCCESS)
    {
        /* something went wrong during initialization*/
        pal_alert();
    }

    /* Calibrate MCU's RC oscillator */
    pal_calibrate_rc_osc();

    /* Initialize LEDs */
    pal_led_init();


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

    /* Initialize the serial interface used for communication with sniffer
       GUI */
    if (pal_sio_init(SIO_CHANNEL) != MAC_SUCCESS)
    {
        /* something went wrong during initialization */
        pal_alert();
    }

    //sio_getchar();

    Wireshark_Settings = INIT_STATE ;

    /* Endless while loop */
    while (1)
    {
        pal_task();
        tal_task();
        app_task();
    }
}