|
3 | 3 | /** |
4 | 4 | * @file fc_config.h |
5 | 5 | * @author fool_cat (2696652257@qq.com) |
6 | | - * @brief fc_embed配置头文件 - 所有可配置项的集中管理 |
| 6 | + * @brief fc_embed配置头文件 - 把一些关键宏配置放这里,具体的可以去相关的.h/.c文件中查看说明 |
7 | 7 | * @version 1.0 |
8 | 8 | * @date 2025-09-02 |
9 | 9 | * |
|
16 | 16 | #ifndef _FC_CONFIG_TEMPLATE_H_ |
17 | 17 | #define _FC_CONFIG_TEMPLATE_H_ |
18 | 18 |
|
19 | | - /** |
20 | | - * ===================================================================== |
21 | | - * Custom Header Files Section |
22 | | - * ===================================================================== |
23 | | - * Add your custom #include statements here if needed. |
24 | | - * |
25 | | - * Examples: |
26 | | - * #include "stm32f4xx_hal.h" |
27 | | - * #include "FreeRTOS.h" |
28 | | - * #include "cmsis_os.h" |
29 | | - * |
30 | | - * Note: Configuration Wizard does not support dynamic header inclusion. |
31 | | - * Please manually edit this section to add your headers. |
32 | | - * ===================================================================== |
33 | | - */ |
| 19 | +//+********************************* 配置项说明 **********************************/ |
| 20 | +/** |
| 21 | + * Configuration Wizard 使用说明: |
| 22 | + * |
| 23 | + * 1. 本文件作为模版文件,移植时需定义一份fc_config.h文件,并保证文件的可包含性(#include 能找到) |
| 24 | + * 2. 可以旋转将本文件完整复制到fc_config.h中进行修改,也可以在fc_config.h中#include此文件 |
| 25 | + * 3. 在 Keil MDK 中,点击 fc_config.h 文件底部的 "Configuration Wizard" 标签 |
| 26 | + * 4. 点击编辑器底部的 "Configuration Wizard" 标签 |
| 27 | + * 5. 通过图形界面配置所有选项 (复选框、下拉框、数值输入框) |
| 28 | + * 6. 保存文件后配置重新编译 |
| 29 | + */ |
| 30 | + |
| 31 | +/** |
| 32 | + * ===================================================================== |
| 33 | + * Custom Header Files Section |
| 34 | + * ===================================================================== |
| 35 | + * Add your custom #include statements here if needed. |
| 36 | + * |
| 37 | + * Examples: |
| 38 | + * #include "stm32f4xx_hal.h" |
| 39 | + * #include "FreeRTOS.h" |
| 40 | + * #include "cmsis_os.h" |
| 41 | + * |
| 42 | + * Note: Configuration Wizard does not support dynamic header inclusion. |
| 43 | + * Please manually edit this section to add your headers. |
| 44 | + * ===================================================================== |
| 45 | + */ |
| 46 | + |
| 47 | + //+********************************* auto_init **********************************/ |
34 | 48 |
|
35 | 49 | // Add your custom includes below: |
36 | 50 | // #include "your_header.h" |
|
43 | 57 | // <i> Default: 1 (Enabled) |
44 | 58 | #define USE_FC_AUTO_INIT 1 |
45 | 59 |
|
46 | | - // </h> |
47 | | - |
48 | | - // <h> Logger Configuration |
49 | | - // <i> Logger component configuration |
50 | | - |
51 | | - // <q> FC_LOG_ENABLE - Enable Logger |
52 | | - // <i> Enable logging functionality |
53 | | - // <i> Default: 1 (Enabled) |
54 | | - #define FC_LOG_ENABLE 1 |
55 | | - |
56 | | - // <o> FC_LOG_LINE_SIZE - Log Line Buffer Size <32-512:8> |
57 | | - // <i> Log line buffer size in bytes |
58 | | - // <i> Default: 128 |
59 | | - #define FC_LOG_LINE_SIZE 128 |
60 | | - |
61 | | - // <o> FC_LOG_STACK_LINE_SIZE - Log Stack Line Size <32-512:8> |
62 | | - // <i> Log buffer size on stack in bytes |
63 | | - // <i> Default: FC_LOG_LINE_SIZE |
64 | | - #define FC_LOG_STACK_LINE_SIZE (FC_LOG_LINE_SIZE) |
65 | | - |
66 | | - // <q> FC_LOG_USING_COLOR - Enable Color Output |
67 | | - // <i> Enable ANSI color codes for colored output |
68 | | - // <i> Default: 1 (Enabled) |
69 | | - #define FC_LOG_USING_COLOR 1 |
70 | | - |
71 | | - // <q> FC_LOG_NOPREFIX_API - Enable No-Prefix API |
72 | | - // <i> Provide simplified log macros without fc_ prefix (log_debug, log_info, etc.) |
73 | | - // <i> Default: 1 (Enabled) |
74 | | - #define FC_LOG_NOPREFIX_API 1 |
75 | | - |
76 | | - // <o> FC_LOG_POOL_TOTAL_SIZE - Log Memory Pool Size <1024-16384:256> |
77 | | - // <i> Total memory pool size for logger in bytes |
78 | | - // <i> Default: 4096 (4KB) |
79 | | - #define FC_LOG_POOL_TOTAL_SIZE (4 * 1024) |
80 | | - |
81 | | - // <o> FC_LOG_ALLOC_BLOCK_SIZE - Log Allocation Block Size <64-512:64> |
82 | | - // <i> Memory pool block size in bytes |
83 | | - // <i> Default: 128 |
84 | | - #define FC_LOG_ALLOC_BLOCK_SIZE 128 |
85 | | - |
86 | | -// Note: The following string options are defined below but not configurable via Configuration Wizard |
87 | | -// You can modify them directly in code if needed: |
88 | | -// - FC_LOG_PREFIX_FMT: Log prefix format (default: "(%d)%s:") |
89 | | -// - FC_LOG_END: Log end string (default: "" or "\r\n") |
90 | | -// - FC_LOG_ERROR_HEAD/WARNING_HEAD/INFO_HEAD/DEBUG_HEAD/VERBOSE_HEAD: Log level prefixes |
91 | | - |
92 | | - #define FC_LOG_PREFIX_FMT "(%d)%s:" |
93 | | - #define FC_LOG_END "" |
94 | | - #define FC_LOG_ERROR_HEAD "E" |
95 | | - #define FC_LOG_WARNING_HEAD "W" |
96 | | - #define FC_LOG_INFO_HEAD "I" |
97 | | - #define FC_LOG_DEBUG_HEAD "D" |
98 | | - #define FC_LOG_VERBOSE_HEAD "V" |
99 | | - |
100 | | - // </h> |
| 60 | +// </h> |
101 | 61 |
|
102 | | - // <h> Memory Pool Configuration |
103 | | - // <i> Memory pool configuration |
| 62 | +//+********************************* port **********************************/ |
104 | 63 |
|
105 | | - // <q> FC_FOOL_ENABLE_DYNAMIC_POOL_ALLOC - Enable Dynamic Allocation |
106 | | - // <i> Allow memory pool to use dynamic memory (malloc/free) when static memory is exhausted |
107 | | - // <i> Default: 0 (Disabled) |
108 | | - #define FC_FOOL_ENABLE_DYNAMIC_POOL_ALLOC 0 |
109 | | - |
110 | | - // </h> |
| 64 | +// fc_port的锁函数宏 |
| 65 | +// #define FC_PORT_LOCK(port, rb_index, dir) ((void)0) |
| 66 | +// #define FC_PORT_UNLOCK(port, rb_index, dir) ((void)0) |
111 | 67 |
|
112 | 68 | // <h> Port Configuration |
113 | 69 | // <i> Port and ring buffer configuration |
|
147 | 103 | // <i> Default: 0 (Disabled) |
148 | 104 | #define PHY_SERIAL_RX_ENABLE 0 |
149 | 105 |
|
| 106 | +// </h> |
| 107 | + |
| 108 | +//+********************************* log **********************************/ |
| 109 | + |
| 110 | +// <h> Logger Configuration |
| 111 | +// <i> Logger component configuration |
| 112 | + |
| 113 | +// <q> FC_LOG_ENABLE - Enable Logger |
| 114 | +// <i> Enable logging functionality |
| 115 | +// <i> Default: 1 (Enabled) |
| 116 | + #define FC_LOG_ENABLE 1 |
| 117 | + |
| 118 | + // <o> FC_LOG_LINE_SIZE - Log Line Buffer Size <32-512:8> |
| 119 | + // <i> Log line buffer size in bytes |
| 120 | + // <i> Default: 128 |
| 121 | + #define FC_LOG_LINE_SIZE 128 |
| 122 | + |
| 123 | + // <q> FC_LOG_USING_COLOR - Enable Color Output |
| 124 | + // <i> Enable ANSI color codes for colored output |
| 125 | + // <i> Default: 1 (Enabled) |
| 126 | + #define FC_LOG_USING_COLOR 1 |
| 127 | + |
| 128 | + // <o> FC_LOG_POOL_TOTAL_SIZE - Log Memory Pool Size <1024-16384:256> |
| 129 | + // <i> Total memory pool size for logger in bytes |
| 130 | + // <i> Default: 4096 (4KB) |
| 131 | + #define FC_LOG_POOL_TOTAL_SIZE (4 * 1024) |
| 132 | + |
| 133 | +// Note: The following string options are defined below but not configurable via Configuration Wizard |
| 134 | +// You can modify them directly in code if needed: |
| 135 | +// - FC_LOG_PREFIX_FMT: Log prefix format (default: "(%d)%s:") |
| 136 | +// - FC_LOG_END: Log end string (default: "" or "\r\n") |
| 137 | +// - FC_LOG_ERROR_HEAD/WARNING_HEAD/INFO_HEAD/DEBUG_HEAD/VERBOSE_HEAD: Log level prefixes |
| 138 | + |
| 139 | + #define FC_LOG_PREFIX_FMT ":%s->%d:\t" |
| 140 | + #define FC_LOG_PREFIX_CONTENT __FC_LOG_MACRO_EXPANDING(__FUNCTION__, (uint32_t)__LINE__) |
| 141 | + |
| 142 | + // #define FC_LOG_END "" |
| 143 | + // #define FC_LOG_ERROR_HEAD "E" |
| 144 | + // #define FC_LOG_WARNING_HEAD "W" |
| 145 | + // #define FC_LOG_INFO_HEAD "I" |
| 146 | + // #define FC_LOG_DEBUG_HEAD "D" |
| 147 | + // #define FC_LOG_VERBOSE_HEAD "V" |
| 148 | + |
150 | 149 | // </h> |
151 | 150 |
|
| 151 | + //+********************************* pool **********************************/ |
| 152 | + |
| 153 | + // <h> Memory Pool Configuration |
| 154 | + // <i> Memory pool configuration |
| 155 | + |
| 156 | + // <q> FC_FOOL_ENABLE_DYNAMIC_POOL_ALLOC - Enable Dynamic Allocation |
| 157 | + // <i> Allow memory pool to use dynamic memory (malloc/free) when static memory is exhausted |
| 158 | + // <i> Default: 0 (Disabled) |
| 159 | + #define FC_FOOL_ENABLE_DYNAMIC_POOL_ALLOC 0 |
| 160 | + |
| 161 | + // </h> |
| 162 | + |
| 163 | + //+********************************* 基于日志的传输层 **********************************/ |
| 164 | + |
152 | 165 | // <h> Transport Configuration |
153 | 166 | // <i> Transport component configuration |
154 | 167 |
|
|
164 | 177 |
|
165 | 178 | // </h> |
166 | 179 |
|
| 180 | + //+********************************* stdio **********************************/ |
| 181 | + |
167 | 182 | // <h> StdIO Configuration |
168 | 183 | // <i> Standard I/O configuration |
169 | 184 |
|
|
177 | 192 | // <i> Default: 1 (Enabled) |
178 | 193 | #define XF_USE_FP 1 |
179 | 194 |
|
180 | | - // <o> SZB_OUTPUT - Output Buffer Size <16-128:8> |
181 | | - // <i> Internal buffer size for printf/sprintf functions |
182 | | - // <i> Default: 32 |
183 | | - #define SZB_OUTPUT 32 |
184 | | - |
185 | | - // <q> FC_FIFO_VPRINTF_LINEAR_WRITE - Enable Linear Write Mode |
186 | | - // <i> Use linear write mode for better performance |
187 | | - // <i> Default: 1 (Enabled) |
188 | | - #define FC_FIFO_VPRINTF_LINEAR_WRITE 1 |
189 | | - |
190 | | - // Note: XF_DPC (Decimal Point Character) is defined below |
191 | | - // Modify directly in code if you need a different decimal separator |
192 | | - #define XF_DPC '.' |
193 | | - |
194 | | - // </h> |
195 | | - |
196 | | - // <h> FIFO Configuration |
197 | | - // <i> FIFO (ring buffer) configuration |
198 | | - |
199 | | - // <q> FC_USE_STD_MEMCPY - Use Standard memcpy |
200 | | - // <i> Use standard library memcpy (0 = use byte-by-byte copy) |
201 | | - // <i> Default: 1 (Enabled) |
202 | | - #define FC_USE_STD_MEMCPY 1 |
203 | | - |
204 | 195 | // </h> |
205 | 196 |
|
206 | | -//+********************************* 高级配置 (通常不需要修改) **********************************/ |
207 | | -/** |
208 | | - * Advanced Configuration - Normally no need to modify |
209 | | - * |
210 | | - * The following macros can be overridden in your project if needed: |
211 | | - * |
212 | | - * - fc_assert(x) - Runtime assertion |
213 | | - * - FC_WAIT_MOMENT() - Wait/delay function |
214 | | - * - FC_PORT_LOCK(port, rb, dir) - Port lock function |
215 | | - * - FC_PORT_UNLOCK(port, rb, dir) - Port unlock function |
216 | | - * - FC_PORT_LOSE_HOOK(...) - Data loss hook |
217 | | - * - FC_LOG_OBJ - Log output object |
218 | | - * - FC_LOG_LOSE_HOOK(...) - Log data loss hook |
219 | | - * - FC_LOG_PREFIX_CONTENT - Log prefix content macro |
220 | | - * - FC_STDOUT_OBJ - Standard output object |
221 | | - * - FC_STDOUT_RB_INDEX - Standard output ring buffer index |
222 | | - * - FC_STDIN_OBJ - Standard input object |
223 | | - * - FC_STDIN_RB_INDEX - Standard input ring buffer index |
224 | | - * - FC_POOL_ATOMIC_ENTER(obj) - Pool atomic section enter |
225 | | - * - FC_POOL_ATOMIC_EXIT(obj) - Pool atomic section exit |
226 | | - * - FC_POOL_MALLOC(size) - Pool malloc function |
227 | | - * - FC_POOL_FREE(ptr) - Pool free function |
228 | | - * - fc_fifo_assert(x) - FIFO assertion |
229 | | - * - fc_fifo_memcpy(dst, src, size) - FIFO memory copy function |
230 | | - * |
231 | | - * Define these macros in your project before including fc_embed headers if you need |
232 | | - * custom implementations. |
233 | | - */ |
234 | | - |
235 | | -//+********************************* 配置项说明 **********************************/ |
236 | | -/** |
237 | | - * Configuration Wizard 使用说明: |
238 | | - * |
239 | | - * 1. 在 Keil MDK 中打开本文件 |
240 | | - * 2. 点击编辑器底部的 "Configuration Wizard" 标签 |
241 | | - * 3. 通过图形界面配置所有选项 (复选框、下拉框、数值输入框) |
242 | | - * 4. 保存文件后配置立即生效 |
243 | | - * |
244 | | - * 配置优先级: |
245 | | - * 1. 工程中自定义的 fc_config.h (最高优先级) |
246 | | - * 2. 本模板文件中的配置 |
247 | | - * 3. 源代码中的默认值 (最低优先级) |
248 | | - * |
249 | | - * 使用方法: |
250 | | - * 1. 复制本文件并重命名为 fc_config.h |
251 | | - * 2. 使用 Configuration Wizard 修改配置 |
252 | | - * 3. 将 fc_config.h 添加到工程的包含路径 |
253 | | - */ |
254 | | - |
255 | 197 | #endif //\ _FC_CONFIG_TEMPLATE_H_ |
256 | 198 |
|
257 | 199 | // <<< end of configuration section >>> |
0 commit comments