aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/avr8/drivers/usart_common.asm
blob: e6238ecceafc87291e0b853188d7aca8e4c2ed62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

.set USART_C_VALUE = bm_ASYNC | bm_NO_PARITY | bm_1STOPBIT | bm_8BIT
.if WANT_INTERRUPTS == 0
  .if WANT_ISR_RX == 1
    .error "*** Config error. set WANT_ISR_RX to 0 too if you disable interrupts (WANT_INTERRUPTS is set to 0)"
  .endif
.endif

.if WANT_ISR_RX == 1
  .set USART_B_VALUE = bm_ENABLE_TX | bm_ENABLE_RX | bm_ENABLE_INT_RX
  .include "drivers/usart-rx-buffer.asm"
;  .include "drivers/timer-usart-isr.asm"
  .set XT_RX  = XT_RX_BUFFER
  .set XT_RXQ = XT_RXQ_BUFFER
  .set XT_USART_INIT_RX = XT_USART_INIT_RX_BUFFER
.else
  .set USART_B_VALUE = bm_ENABLE_TX | bm_ENABLE_RX
  .include "words/usart-rx-poll.asm"
  .set XT_RX  = XT_RX_POLL
  .set XT_RXQ = XT_RXQ_POLL
  .set XT_USART_INIT_RX = 0
.endif

.include "words/usart-tx-poll.asm"
.set XT_TX  = XT_TX_POLL
.set XT_TXQ = XT_TXQ_POLL
.set XT_USART_INIT_TX = 0

.include "words/ubrr.asm"
.include "words/usart.asm"