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 |
|
---|
29 | void usart_init(void);
|
---|
30 | void usart_write_char(U08 data);
|
---|
31 | void usart_write_crlf(void);
|
---|
32 | void usart_write_str(pU08 str);
|
---|
33 | void usart_writeln_str(pU08 str);
|
---|
34 | void usart_write_flash_str(fpU08 str);
|
---|
35 | void usart_writeln_flash_str(fpU08 str);
|
---|
36 | void usart_write_U08(U08 value,U08 digits);
|
---|
37 | void usart_write_S08(S08 value,U08 digits);
|
---|
38 | void usart_write_U08_hex(U08 value);
|
---|
39 | void usart_write_U08_bin(U08 value);
|
---|
40 | void usart_write_U16(U16 value,U08 digits);
|
---|
41 | void usart_write_S16(S16 value,U08 digits);
|
---|
42 | void usart_write_U16_hex(U16 value);
|
---|
43 | void usart_write_U32(U32 value,U08 digits);
|
---|
44 | void usart_write_S32(S32 value,U08 digits);
|
---|
45 | void usart_write_U32_hex(U32 value);
|
---|
46 | void usart_write_float(float value,U08 decimals,U08 digits);
|
---|
47 | //-----------------------------------------------------------------------------
|
---|
48 |
|
---|
49 | #endif
|
---|