Go to the documentation of this file.
42 #ifndef __RS232_ATMEGA1281__
43 #define __RS232_ATMEGA1281__
52 #define RS232_PORT_0 0
53 #define RS232_PORT_1 1
58 #if (F_CPU == 16000000UL)
60 #define USART_BAUD_2400 416
61 #define USART_BAUD_4800 207
62 #define USART_BAUD_9600 103
63 #define USART_BAUD_14400 68
64 #define USART_BAUD_19200 51
65 #define USART_BAUD_28800 34
66 #define USART_BAUD_38400 25
67 #define USART_BAUD_57600 16
68 #define USART_BAUD_76800 12
69 #define USART_BAUD_115200 8
70 #define USART_BAUD_230400 3
71 #define USART_BAUD_250000 3
72 #define USART_BAUD_500000 1
73 #define USART_BAUD_1000000 0
74 #elif (F_CPU == 8000000UL)
76 #define USART_BAUD_2400 207
77 #define USART_BAUD_4800 103
78 #define USART_BAUD_9600 51
79 #define USART_BAUD_14400 34
80 #define USART_BAUD_19200 25
81 #define USART_BAUD_28800 16
82 #define USART_BAUD_38400 12
83 #define USART_BAUD_57600 8
84 #define USART_BAUD_76800 6
85 #define USART_BAUD_115200 3
86 #define USART_BAUD_230400 1
87 #define USART_BAUD_250000 1
88 #define USART_BAUD_500000 0
89 #elif (F_CPU == 4000000UL)
91 #define USART_BAUD_2400 103
92 #define USART_BAUD_4800 51
93 #define USART_BAUD_9600 25
94 #define USART_BAUD_14400 16
95 #define USART_BAUD_19200 12
96 #define USART_BAUD_28800 8
97 #define USART_BAUD_38400 6
98 #define USART_BAUD_57600 3
99 #define USART_BAUD_76800 2
100 #define USART_BAUD_115200 1
101 #define USART_BAUD_230400 0
102 #define USART_BAUD_250000 0
103 #define USART_BAUD_500000 0
105 #error "Please define the baud rates for your CPU clock: ATmega128 handbook p. \
106 195-198 or set the rate in contiki-conf.h"
113 #define USART_INTERRUPT_RX_COMPLETE _BV (RXCIE0)
114 #define USART_INTERRUPT_TX_COMPLETE _BV (TXCIE0)
115 #define USART_INTERRUPT_DATA_REG_EMPTY _BV (UDRIE0)
120 #define USART_RECEIVER_ENABLE _BV (RXEN0)
121 #define USART_TRANSMITTER_ENABLE _BV (TXEN0)
126 #define USART_MODE_ASYNC 0x00
127 #define USART_MODE_SYNC _BV (UMSEL00)
132 #define USART_PARITY_NONE 0x00
133 #define USART_PARITY_EVEN _BV (UPM01)
134 #define USART_PARITY_ODD _BV (UPM01) | _BV (UPM00)
139 #define USART_STOP_BITS_1 0x00
140 #define USART_STOP_BITS_2 _BV (USBS)
145 #define USART_DATA_BITS_5 0x00
146 #define USART_DATA_BITS_6 _BV (UCSZ00)
147 #define USART_DATA_BITS_7 _BV (UCSZ01)
148 #define USART_DATA_BITS_8 _BV (UCSZ01) | _BV (UCSZ00)
154 #define USART_RISING_XCKN_EDGE 0x00
155 #define USART_FALLING_XCKN_EDGE _BV (UCPOL0)