Subversion Repositories Projects

Rev

Rev 426 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 426 Rev 434
Line 1... Line 1...
1
#include <avr/io.h>
1
#include <avr/io.h>
2
#include <avr/interrupt.h>
2
#include <avr/interrupt.h>
3
 
3
 
4
#include "main.h"
4
#include "main.h"
5
#include "uart1.h"
5
#include "uart1.h"
-
 
6
#include "printf_P.h"
6
#include "ubx.h"
7
#include "ubx.h"
7
 
8
 
8
 
9
 
9
/****************************************************************/
10
/****************************************************************/
10
/*              Initialization of the USART1                    */
11
/*              Initialization of the USART1                    */
11
/****************************************************************/
12
/****************************************************************/
12
void USART1_Init (void)
13
void USART1_Init (void)
13
{
14
{
-
 
15
        printf("\r\n UART1 init...");
14
        // USART1 Control and Status Register A, B, C and baud rate register
16
        // USART1 Control and Status Register A, B, C and baud rate register
15
        uint8_t sreg = SREG;
17
        uint8_t sreg = SREG;
16
        uint16_t ubrr = (uint16_t) ((uint32_t) SYSCLK/(8 * USART1_BAUD) - 1);
18
        uint16_t ubrr = (uint16_t) ((uint32_t) SYSCLK/(8 * USART1_BAUD) - 1);
17
 
19
 
18
        // disable all interrupts before reconfiguration
20
        // disable all interrupts before reconfiguration
Line 68... Line 70...
68
        //UCSR1B |= (1 << UDRIE1);
70
        //UCSR1B |= (1 << UDRIE1);
69
 
71
 
70
 
72
 
71
        // restore global interrupt flags
73
        // restore global interrupt flags
72
    SREG = sreg;
74
    SREG = sreg;
73
 
75
        sei();
-
 
76
        printf("ok");
74
}
77
}
75
 
78
 
76
/****************************************************************/
79
/****************************************************************/
77
/*               USART1 transmitter ISR                         */
80
/*               USART1 transmitter ISR                         */
78
/****************************************************************/
81
/****************************************************************/