Beispiel #1
0
/**
 * @brief Initialization of PAL
 *
 * This function initializes the PAL.
 *
 * @return MAC_SUCCESS  if PAL initialization is successful, FAILURE otherwise
 */
retval_t pal_init(void)
{

#ifdef WATCHDOG
    /* Watchdog Initialization. Enables the watchdog and sets the timeout period */
    pal_wdt_init();
#else
    /* Disabling watch dog*/
    pal_wdt_disable();
#endif

    /* Initialising PIO pins */
    gpio_init();

    /* Initialising PIO interrupts with Zero prority*/
    pal_pio_initialize_interrupts(0);

    /* Initialising tranceiver interface */
    trx_interface_init();

    /* Initialising timer for PAL */
    timer_init();

    return MAC_SUCCESS;
}
Beispiel #2
0
/**
 * @brief Initialization of PAL
 *
 * This function initializes the PAL.
 * This includes selecting the proper system clock source, initializing the
 * GPIOs, the interface to the transceiver, and the timers.
 *
 * @return MAC_SUCCESS if PAL initialization is successful, FAILURE otherwise
 */
retval_t pal_init(void)
{
    mcu_clock_init();
    gpio_init();
    trx_interface_init();
#ifdef CW_SUPPORTED
    TST_INIT();
#endif
    timer_init();
	
	 __watchdog_reset();
	/* Clear WDRF in MCUSR */
		MCUSR &= ~(1<<WDRF);
		/* Write logical one to WDCE and WDE */
		/* Keep old prescaler setting to prevent unintentional time-out
		*/
		WDTCSR |= (1<<WDCE) | (1<<WDE);
		/* Turn off WDT */
		WDTCSR = 0x00;
	

    return MAC_SUCCESS;
}