comparison cons-reg.h @ 10:f0b4314b91ec

Fix for dual UART devices.
author Daniel O'Connor <darius@dons.net.au>
date Sat, 01 Jan 2011 19:43:34 +1030
parents 095216e8453d
children
comparison
equal deleted inserted replaced
9:5f21a1c8ca06 10:f0b4314b91ec
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29 /* Decide what registers and ISRs to use */ 29 /* Decide what registers and ISRs to use */
30 30 #ifdef UBRR0L
31 #ifdef UBRR0
32 /* Dual UART devices (eg ATMega324p) */ 31 /* Dual UART devices (eg ATMega324p) */
33 #define _SETBAUD(x) do { \ 32 #define _SETBAUD(x) do { \
34 UBRR0 = UART_BAUD_SELECT(x, F_CPU); \ 33 UBRR0L = (UART_BAUD_SELECT(x, F_CPU) & 0xff); \
34 UBRR0H = (UART_BAUD_SELECT(x, F_CPU) << 8) & 0xff; \
35 } while(0) 35 } while(0)
36
36 #define _INITREG() do { \ 37 #define _INITREG() do { \
37 UCSR0A = 0; \ 38 UCSR0A = 0; \
38 UCSR0B = _BV(RXEN0) | _BV(TXEN0) | _BV(RXCIE0); \ 39 UCSR0B = _BV(RXEN0) | _BV(TXEN0) | _BV(RXCIE0); \
39 UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); \ 40 UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); \
40 } while(0) 41 } while(0)