1 | #ifndef __USART_H
|
---|
2 | #define __USART_H
|
---|
3 | //-----------------------------------------------------------------------------
|
---|
4 |
|
---|
5 | #include "typedefs.h"
|
---|
6 | #include "application.h"
|
---|
7 | #include "num_conversion.h"
|
---|
8 | //-----------------------------------------------------------------------------
|
---|
9 |
|
---|
10 | #define USART_CHAR_BS 8
|
---|
11 | #define USART_CHAR_LF 10
|
---|
12 | #define USART_CHAR_CR 13
|
---|
13 | #define USART_CHAR_ESC 27
|
---|
14 | #define USART_CHAR_SPC 32
|
---|
15 | //-----------------------------------------------------------------------------
|
---|
16 |
|
---|
17 | #define USART_SET_BAUDRATE(br) (UBRRH = (U08)((((U32)F_CPU) /\
|
---|
18 | ((U32)br * 16) - 1) >> 8),\
|
---|
19 | UBRRL = (U08)(((U32)F_CPU) /\
|
---|
20 | ((U32)br * 16) - 1))
|
---|
21 | //-----------------------------------------------------------------------------
|
---|
22 | /*
|
---|
23 | extern U08 usart_rx_buffer[];
|
---|
24 | extern volatile BOOL usart_rx_ready;
|
---|
25 | extern volatile BOOL ISR_toggle_out;
|
---|
26 | extern U08 usart_received_chars;
|
---|
27 | */
|
---|
28 | extern bool usart_tx_buffer_overflow;
|
---|
29 | extern U08 usart_tx_buffer_index;
|
---|
30 | extern U08 usart_tx_buffer[USART_TX_BUFFER_SIZE];
|
---|
31 | extern U08 usart_received_chars;
|
---|
32 | //-----------------------------------------------------------------------------
|
---|
33 |
|
---|
34 | void usart_init(void);
|
---|
35 | void usart_write_char(U08 data);
|
---|
36 | void usart_write_crlf(void);
|
---|
37 | void usart_write_str(pU08 str);
|
---|
38 | void usart_writeln_str(pU08 str);
|
---|
39 | void usart_write_flash_str(fpU08 str);
|
---|
40 | void usart_writeln_flash_str(fpU08 str);
|
---|
41 | void usart_write_U08(U08 value,U08 digits);
|
---|
42 | void usart_write_S08(S08 value,U08 digits);
|
---|
43 | void usart_write_U08_hex(U08 value);
|
---|
44 | void usart_write_U08_bin(U08 value);
|
---|
45 | void usart_write_U16(U16 value,U08 digits);
|
---|
46 | void usart_write_S16(S16 value,U08 digits);
|
---|
47 | void usart_write_U16_hex(U16 value);
|
---|
48 | void usart_write_U32(U32 value,U08 digits);
|
---|
49 | void usart_write_S32(S32 value,U08 digits);
|
---|
50 | void usart_write_U32_hex(U32 value);
|
---|
51 | void usart_write_float(float value,U08 decimals,U08 digits);
|
---|
52 | //-----------------------------------------------------------------------------
|
---|
53 |
|
---|
54 | #endif
|
---|