1 /* Auto-generated config file hpl_usart_config.h */ 2 #ifndef HPL_USART_CONFIG_H 3 #define HPL_USART_CONFIG_H 4 5 // <<< Use Configuration Wizard in Context Menu >>> 6 7 #include <peripheral_clk_config.h> 8 9 #ifndef CONF_USART_1_ENABLE 10 #define CONF_USART_1_ENABLE 1 11 #endif 12 13 // <h> Basic Configuration 14 15 // <o> Frame parity 16 // <0x0=>Even parity 17 // <0x1=>Odd parity 18 // <0x2=>Parity forced to 0 19 // <0x3=>Parity forced to 1 20 // <0x4=>No parity 21 // <i> Parity bit mode for USART frame 22 // <id> usart_parity 23 #ifndef CONF_USART_1_PARITY 24 #define CONF_USART_1_PARITY 0x4 25 #endif 26 27 // <o> Character Size 28 // <0x0=>5 bits 29 // <0x1=>6 bits 30 // <0x2=>7 bits 31 // <0x3=>8 bits 32 // <i> Data character size in USART frame 33 // <id> usart_character_size 34 #ifndef CONF_USART_1_CHSIZE 35 #define CONF_USART_1_CHSIZE 0x3 36 #endif 37 38 // <o> Stop Bit 39 // <0=>1 stop bit 40 // <1=>1.5 stop bits 41 // <2=>2 stop bits 42 // <i> Number of stop bits in USART frame 43 // <id> usart_stop_bit 44 #ifndef CONF_USART_1_SBMODE 45 #define CONF_USART_1_SBMODE 0 46 #endif 47 48 // <o> Clock Output Select 49 // <0=>The USART does not drive the SCK pin 50 // <1=>The USART drives the SCK pin if USCLKS does not select the external clock SCK 51 // <i> Clock Output Select in USART sck, if in usrt master mode, please drive SCK. 52 // <id> usart_clock_output_select 53 #ifndef CONF_USART_1_CLKO 54 #define CONF_USART_1_CLKO 0 55 #endif 56 57 // <o> Baud rate <1-3000000> 58 // <i> USART baud rate setting 59 // <id> usart_baud_rate 60 #ifndef CONF_USART_1_BAUD 61 #define CONF_USART_1_BAUD 115200 62 #endif 63 64 // </h> 65 66 // <e> Advanced configuration 67 // <id> usart_advanced 68 #ifndef CONF_USART_1_ADVANCED_CONFIG 69 #define CONF_USART_1_ADVANCED_CONFIG 1 70 #endif 71 72 // <o> Channel Mode 73 // <0=>Normal Mode 74 // <1=>Automatic Echo 75 // <2=>Local Loopback 76 // <3=>Remote Loopback 77 // <i> Channel mode in USART frame 78 // <id> usart_channel_mode 79 #ifndef CONF_USART_1_CHMODE 80 #define CONF_USART_1_CHMODE 0 81 #endif 82 83 // <q> 9 bits character enable 84 // <i> Enable 9 bits character, this has high priority than 5/6/7/8 bits. 85 // <id> usart_9bits_enable 86 #ifndef CONF_USART_1_MODE9 87 #define CONF_USART_1_MODE9 0 88 #endif 89 90 // <o> Variable Sync 91 // <0=>User defined configuration 92 // <1=>sync field is updated when a character is written into US_THR 93 // <i> Variable Synchronization of Command/Data Sync Start Frarm Delimiter 94 // <id> variable_sync 95 #ifndef CONF_USART_1_VAR_SYNC 96 #define CONF_USART_1_VAR_SYNC 0 97 #endif 98 99 // <o> Oversampling Mode 100 // <0=>16 Oversampling 101 // <1=>8 Oversampling 102 // <i> Oversampling Mode in UART mode 103 // <id> usart__oversampling_mode 104 #ifndef CONF_USART_1_OVER 105 #define CONF_USART_1_OVER 0 106 #endif 107 108 // <o> Inhibit Non Ack 109 // <0=>The NACK is generated 110 // <1=>The NACK is not generated 111 // <i> Inhibit Non Acknowledge 112 // <id> usart__inack 113 #ifndef CONF_USART_1_INACK 114 #define CONF_USART_1_INACK 1 115 #endif 116 117 // <o> Disable Successive NACK 118 // <0=>NACK is sent on the ISO line as soon as a parity error occurs 119 // <1=>Many parity errors generate a NACK on the ISO line 120 // <i> Disable Successive NACK 121 // <id> usart_dsnack 122 #ifndef CONF_USART_1_DSNACK 123 #define CONF_USART_1_DSNACK 0 124 #endif 125 126 // <o> Inverted Data 127 // <0=>Data isn't inverted, nomal mode 128 // <1=>Data is inverted 129 // <i> Inverted Data 130 // <id> usart_invdata 131 #ifndef CONF_USART_1_INVDATA 132 #define CONF_USART_1_INVDATA 0 133 #endif 134 135 // <o> Maximum Number of Automatic Iteration <0-7> 136 // <i> Defines the maximum number of iterations in mode ISO7816, protocol T = 0. 137 // <id> usart_max_iteration 138 #ifndef CONF_USART_1_MAX_ITERATION 139 #define CONF_USART_1_MAX_ITERATION 0 140 #endif 141 142 // <q> Receive Line Filter enable 143 // <i> whether the USART filters the receive line using a three-sample filter 144 // <id> usart_receive_filter_enable 145 #ifndef CONF_USART_1_FILTER 146 #define CONF_USART_1_FILTER 0 147 #endif 148 149 // <q> Manchester Encoder/Decoder Enable 150 // <i> whether the USART Manchester Encoder/Decoder 151 // <id> usart_manchester_filter_enable 152 #ifndef CONF_USART_1_MAN 153 #define CONF_USART_1_MAN 0 154 #endif 155 156 // <o> Manchester Synchronization Mode 157 // <0=>The Manchester start bit is a 0 to 1 transition 158 // <1=>The Manchester start bit is a 1 to 0 transition 159 // <i> Manchester Synchronization Mode 160 // <id> usart_manchester_synchronization_mode 161 #ifndef CONF_USART_1_MODSYNC 162 #define CONF_USART_1_MODSYNC 0 163 #endif 164 165 // <o> Start Frame Delimiter Selector 166 // <0=>Start frame delimiter is COMMAND or DATA SYNC 167 // <1=>Start frame delimiter is one bit 168 // <i> Start Frame Delimiter Selector 169 // <id> usart_start_frame_delimiter 170 #ifndef CONF_USART_1_ONEBIT 171 #define CONF_USART_1_ONEBIT 0 172 #endif 173 174 // <o> Fractional Part <0-7> 175 // <i> Fractional part of the baud rate if baud rate generator is in fractional mode 176 // <id> usart_arch_fractional 177 #ifndef CONF_USART_1_FRACTIONAL 178 #define CONF_USART_1_FRACTIONAL 0x0 179 #endif 180 181 // <o> Data Order 182 // <0=>LSB is transmitted first 183 // <1=>MSB is transmitted first 184 // <i> Data order of the data bits in the frame 185 // <id> usart_arch_msbf 186 #ifndef CONF_USART_1_MSBF 187 #define CONF_USART_1_MSBF 0 188 #endif 189 190 // </e> 191 192 #define CONF_USART_1_MODE 0x0 193 194 // Calculate BAUD register value in UART mode 195 #if CONF_USART1_CK_SRC < 3 196 #ifndef CONF_USART_1_BAUD_CD 197 #define CONF_USART_1_BAUD_CD ((CONF_USART1_FREQUENCY) / CONF_USART_1_BAUD / 8 / (2 - CONF_USART_1_OVER)) 198 #endif 199 #ifndef CONF_USART_1_BAUD_FP 200 #define CONF_USART_1_BAUD_FP \ 201 ((CONF_USART1_FREQUENCY) / CONF_USART_1_BAUD / (2 - CONF_USART_1_OVER) - 8 * CONF_USART_1_BAUD_CD) 202 #endif 203 #elif CONF_USART1_CK_SRC == 3 204 // No division is active. The value written in US_BRGR has no effect. 205 #ifndef CONF_USART_1_BAUD_CD 206 #define CONF_USART_1_BAUD_CD 1 207 #endif 208 #ifndef CONF_USART_1_BAUD_FP 209 #define CONF_USART_1_BAUD_FP 1 210 #endif 211 #endif 212 213 // <<< end of configuration section >>> 214 215 #endif // HPL_USART_CONFIG_H 216