STC15W408AS library
0.12.0
Loading...
Searching...
No Matches
include
uart1_mode2.h
Go to the documentation of this file.
1
#ifndef STC15_UART1MODE2H
2
#define STC15_UART1MODE2H
3
4
#include <stdint.h>
5
6
#include <
sys.h
>
7
#include <bits.h>
8
#include <
interrupt.h
>
9
#include <
uart1_shared.h
>
10
#include <
uart1_9bit_shared.h
>
11
38
typedef
enum
{
39
baudrate_172800 = 172800U,
40
baudrate_345600 = 345600U
41
}
uart1_mode2_baudrate_t
;
42
47
60
#define uart1_mode2_init(pins, baudRate) \
61
do { \
62
enable_mcu_interrupts(); \
63
enable_uart1_interrupt(); \
64
\
65
/* PCON.7 always set to 1. Is it error? */
\
66
baudRate == baudrate_345600 ? bit_set(PCON, SBIT7) : bit_clr(PCON, SBIT7); \
67
\
68
/* SM1 = 1, SM0 = 0 to select UART1 mode2 */
\
69
SCON = 0x90; \
70
\
71
/* Set AUXR1 bits 6, 7 to select RxD/TxD pins */
\
72
AUXR1 &= 0x3F; \
73
AUXR1 |= pins; \
74
} while (0)
75
77
#endif
uart1_mode2_baudrate_t
uart1_mode2_baudrate_t
UART1 baud rate enumeration.
Definition
uart1_mode2.h:38
interrupt.h
sys.h
uart1_9bit_shared.h
uart1_shared.h
Generated by
1.9.8