Пример #1
0
Файл: uart.c Проект: sndae/b3r1
// enable and initialize the uart
void uartInit(void)
{
	// initialize the buffers
	uartInitBuffers();
	// initialize user receive handler
	UartRxFunc = 0;

	// enable RxD/TxD and interrupts
	UCR = (1<<RXCIE)|(1<<TXCIE)|(1<<RXEN)|(1<<TXEN);

	//#ifdef UCSRA
	    // Make sure 2x speed is off -JR
	//	UCSRA &= ~(1<<U2X); 
	//#endif

	// set default baud rate
	uartSetBaudRate(UART_DEFAULT_BAUD_RATE);  
	// initialize states
	uartReadyTx = TRUE;
	uartBufferedTx = FALSE;
	// clear overflow count
	uartRxOverflow = 0;
	// enable interrupts
	sei();
}
Пример #2
0
// enable and initialize the uart
void uartInit(void)
{
	// initialize the buffers
	uartInitBuffers();
	// initialize user receive handler
	UartRxFunc = 0;

#if USE_2X
	sbi(UCSRA, U2X);
#else
	cbi(UCSRA, U2X);
#endif

	// enable RxD/TxD and interrupts
	//outb(UCSRB, BV(RXCIE)|BV(TXCIE)|BV(RXEN)|BV(TXEN));
	outb(UCSRB, BV(RXCIE)|BV(RXEN)|BV(TXEN));
	outb(UCSRC, BV(UCSZ1)|BV(UCSZ0)); /* 8 data bits, 1 stop bit */

	// set default baud rate
	uartSetBaudRate(UART_DEFAULT_BAUD_RATE);
	// initialize states
	//uartReadyTx = TRUE;
	//uartBufferedTx = FALSE;
	// clear overflow count
	uartRxOverflow = 0;
	// enable interrupts
	sei();
}
Пример #3
0
// enable and initialize the uart
void uartInit(void)
{
	// initialize the buffers
	uartInitBuffers();
	// initialize user receive handler
	UartRxFunc = 0;

	// enable RxD/TxD and interrupts
	outb(UCR, BV(RXCIE)|BV(TXCIE)|BV(RXEN)|BV(TXEN));

	// set default baud rate
	uartSetBaudRate(UART_DEFAULT_BAUD_RATE);  
	// initialize states
	uartReadyTx = TRUE;
	uartBufferedTx = FALSE;
	// clear overflow count
	uartRxOverflow = 0;
	// enable interrupts
	sei();
}