Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 701 → Rev 702

/branches/V0.68d Code Redesign killagreg/uart1.c
36,19 → 36,16
// disable TX-Interrupt
UCSR1B &= ~(1 << TXCIE1);
// disable DRE-Interrupt
UCSR1B |= (1 << UDRIE1);
UCSR1B &= ~(1 << UDRIE1);
 
// disable receiver and transmitter (will flush the buffers)
UCSR1B &= ~((1 << TXEN1) | (1 << RXEN1));
 
// set direction of RXD1 and TXD1 pins
// set RXD1 (PD2) as an input pin
PORTD |= (1 << PORTD2);
DDRD &= ~(1 << DDD2);
PORTD |= (1 << PORTD2);
 
// set TXD1 (PD3) as an output pin
PORTD |= (1 << PORTD3);
DDRD |= (1 << DDD3);
PORTD |= (1 << PORTD3);
 
// USART0 Baud Rate Register
// set clock divider
79,7 → 76,7
// enable RX-Interrupt
UCSR1B |= (1 << RXCIE1);
// enable TX-Interrupt
//UCSR1B |= (1 << TXCIE1);
UCSR1B |= (1 << TXCIE1);
// enable DRE interrupt
//UCSR1B |= (1 << UDRIE1);
 
89,10 → 86,10
 
// inint FIFO buffer
//fifo_init (&infifo, inbuf, BUFSIZE_IN);
fifo_init (&outfifo, outbuf, BUFSIZE_OUT);
//fifo_init (&outfifo, outbuf, BUFSIZE_OUT);
}
 
int16_t USART1_putc (const uint8_t c)
/*int16_t USART1_putc (const uint8_t c)
{
int16_t ret = fifo_put (&outfifo, c);
// create an data register empty interrupt
100,7 → 97,7
 
return ret;
}
 
*/
/*int16_t USART1_getc_nowait ()
{
return fifo_get_nowait (&infifo);
116,7 → 113,7
/****************************************************************/
/* USART1 data register empty ISR */
/****************************************************************/
ISR(USART1_UDRE_vect)
/*ISR(USART1_UDRE_vect)
{
// Move a character from the output buffer to the data register.
// When the character was processed the next interrupt is generated.
126,15 → 123,16
else
UCSR1B &= ~(1 << UDRIE1);
}
*/
 
/****************************************************************/
/* USART1 transmitter ISR */
/****************************************************************/
ISR(USART1_TX_vect)
/*ISR(USART1_TX_vect)
{
 
}
 
*/
/****************************************************************/
/* USART1 receiver ISR */
/****************************************************************/
141,6 → 139,6
ISR(USART1_RX_vect)
{
uint8_t c;
c = UDR0; // get data byte
c = UDR1; // get data byte
ubx_parser(c); // and put it into the ubx protocol parser
}