Пример #1
0
void led_rgb(uint32 color)
{
	// clear all pins
	gpio_data(port_f) &= ~pins;
	// set desired pins
	gpio_data(port_f) |= color;
}
Пример #2
0
void main(void) {
	volatile packet_t *p;
	volatile uint8_t t=20;
	uint8_t chan;
	char c;

	gpio_data(0);
	
	gpio_pad_dir_set( 1ULL << LED );
        /* read from the data register instead of the pad */
	/* this is needed because the led clamps the voltage low */
	gpio_data_sel( 1ULL << LED);

	/* trim the reference osc. to 24MHz */
	trim_xtal();

	uart_init(UART1, 115200);

	vreg_init();

	maca_init();

        /* sets up tx_on, should be a board specific item */
        *GPIO_FUNC_SEL2 = (0x01 << ((44-16*2)*2));
	gpio_pad_dir_set( 1ULL << 44 );

	set_power(0x0f); /* 0dbm */
	chan = 0;
	set_channel(chan); /* channel 11 */

	*MACA_MACPANID = 0xaaaa;
	*MACA_MAC16ADDR = 0x1111;
	*MACA_TXACKDELAY = 68; /* 68 puts the tx ack at about the correct spot */
	set_prm_mode(AUTOACK);

	print_welcome("rftest-rx");
	while(1) {		

		/* call check_maca() periodically --- this works around */
		/* a few lockup conditions */
		check_maca();

		if((p = rx_packet())) {
			/* print and free the packet */
			printf("autoack-rx --- ");
			print_packet(p);
			maca_free_packet(p);
		}

		if(uart1_can_get()) {
			c = uart1_getc();
			if(c == 'z') t++;
			if(c == 'x') t--;
			*MACA_TXACKDELAY = t;
			printf("tx ack delay: %d\n\r", t);
		}

	}
}
Пример #3
0
void main(void) {	
	volatile uint32_t i;
	
	gpio_pad_dir(LED);

	while(1) {

		gpio_data(LED);
		
		for(i=0; i<DELAY; i++) { continue; }

		gpio_data(0);
		
		for(i=0; i<DELAY; i++) { continue; }

	};

}
Пример #4
0
void led_init(void)
{	
	// activate port f
	sysctrl(rcgc2, port_f);
	// output mode
	gpio_dir(port_f) |= pins;
	// regular gpio port
	gpio_afsel(port_f) &= ~pins;
	// 2ma current
	gpio_dr2r(port_f) |= pins;
	// digital mode
	gpio_den(port_f) |= pins;
	// clear all pins
	gpio_data(port_f) &= ~pins;
}
Пример #5
0
/***************************************************************************//**
 * @brief gpio_set_value
*******************************************************************************/
void gpio_set_value(unsigned gpio, int value)
{
	gpio_data(gpio, value);
}