예제 #1
0
int main (void)
{
	/* Insert system clock initialization code here (sysclk_init()). */
	board_init();
	sysclk_init();
	delay_init(sysclk_get_cpu_hz());
	
	//gpio_configure_pin(PORTA5,1);
	
	ioport_init();
		
	ioport_set_pin_dir(LED_GREEN,IOPORT_DIR_OUTPUT);
	ioport_set_pin_dir(LED_RED,IOPORT_DIR_OUTPUT);
	
	/* Insert application code here, after the board has been initialized. */
	
	ioport_set_pin_high(LED_RED);
	ioport_set_pin_low(LED_GREEN);
	
	
	
	
	//gpio_set_pin_high(PORTA5);
	
	while(true){
		ioport_toggle_pin(LED_GREEN);
		ioport_toggle_pin(LED_RED);
		delay_ms(500);
	}
	
}
예제 #2
0
/**
 * \brief Symbol Counter Compare 3 interrupt callback function
 *
 * This function is called when a compare match has occured on channel 3 of
 *  symbol counter  and toggles CMP3_INT_CHK_PIN.
 * CMP2_INT_CHK_PIN is set HIGH.
 *  Compare match occurs at the end of every beacon interval.
 */
static void example_cmp3_int_cb(void)
{
	ioport_toggle_pin(CMP3_INT_CHK_PIN);
	ioport_set_value(CMP2_INT_CHK_PIN, 1);        
        
        uint8_t tx_buf[] = "\n\rStarting beacon interval";	    
	for (uint8_t i = 0; i < sizeof(tx_buf); i++) {
		usart_putchar(USART_SERIAL_PORT, tx_buf[i]);
	}
        
	macsc_enable_manual_bts();
	macsc_enable_cmp_int(MACSC_CC1);
	macsc_use_cmp(COMPARE_MODE, ACTIVE_PERIOD, MACSC_CC1);
}