STC15W408AS library 0.15.0
Loading...
Searching...
No Matches
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
38typedef enum
39#if __SDCC_VERSION_MAJOR == 4 && __SDCC_VERSION_MINOR >= 5
40 : uint32_t
41#endif
42{
43 baudrate_172800 = 172800U,
44 baudrate_345600 = 345600U
46
51
65#define uart1_mode2_init(pins, baudRate) \
66do { \
67 enable_mcu_interrupts(); \
68 disable_uart1_interrupt(); \
69 \
70 /* PCON.7 always set to 1. Is it error? */ \
71 baudRate == baudrate_345600 ? bit_set(PCON, SBIT7) : bit_clr(PCON, SBIT7); \
72 \
73 /* SM1 = 1, SM0 = 0 to select UART1 mode2 */ \
74 SCON = 0x90; \
75 \
76 /* Set AUXR1 bits 6, 7 to select RxD/TxD pins */ \
77 AUXR1 &= 0x3F; \
78 AUXR1 |= pins; \
79} while (0)
80
82#endif
uart1_mode2_baudrate_t
UART1 baud rate enumeration.
Definition uart1_mode2.h:42