|
1 | | -/********************************** (C) COPYRIGHT ******************************* |
2 | | - * File Name : debug.h |
3 | | - * Author : WCH |
4 | | - * Version : V1.0.0 |
5 | | - * Date : 2024/01/01 |
6 | | - * Description : This file contains all the functions prototypes for UART |
7 | | - * Printf , Delay functions. |
8 | | - ********************************************************************************* |
9 | | - * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. |
10 | | - * Attention: This software (modified or not) and binary are used for |
11 | | - * microcontroller manufactured by Nanjing Qinheng Microelectronics. |
12 | | - *******************************************************************************/ |
13 | | -#ifndef __DEBUG_H |
14 | | -#define __DEBUG_H |
15 | | - |
16 | | -#ifdef __cplusplus |
17 | | - extern "C" { |
18 | | -#endif |
19 | | - |
20 | | -#include <ch32v00X.h> |
21 | | -#include <stdio.h> |
22 | | - |
23 | | -/* UART Printf Definition */ |
24 | | -#define DEBUG_UART1_NoRemap 1 //Tx-PD5 |
25 | | -#define DEBUG_UART1_Remap1 2 //Tx-PD6 |
26 | | -#define DEBUG_UART1_Remap2 3 //Tx-PD0 |
27 | | -#define DEBUG_UART1_Remap3 4 //Tx-PC0 |
28 | | -#define DEBUG_UART1_Remap4 5 //Tx-PD1 |
29 | | -#define DEBUG_UART1_Remap5 6 //Tx-PB3 |
30 | | -#define DEBUG_UART1_Remap6 7 //Tx-PC5 |
31 | | -#define DEBUG_UART1_Remap7 8 //Tx-PB5 |
32 | | -#define DEBUG_UART1_Remap8 9 //Tx-PA0 |
33 | | - |
34 | | -/* USART2 print function only for V005,V006,V007,M007 series*/ |
35 | | -#if defined(CH32V005) || defined(CH32V006) || defined(CH32V007_M007) |
36 | | -#define DEBUG_UART2_NoRemap 10 //Tx-PA7 |
37 | | -#define DEBUG_UART2_Remap1 11 //Tx-PA4 |
38 | | -#define DEBUG_UART2_Remap2 12 //Tx-PA2 |
39 | | -#define DEBUG_UART2_Remap3 13 //Tx-PD2 |
40 | | -#define DEBUG_UART2_Remap4 14 //Tx-PB0 |
41 | | -#define DEBUG_UART2_Remap5 15 //Tx-PC4 |
42 | | -#define DEBUG_UART2_Remap6 16 //Tx-PA6 |
43 | | -#endif |
44 | | -/* DEBUG UATR Definition */ |
45 | | -#ifndef DEBUG |
46 | | -#define DEBUG DEBUG_UART1_NoRemap |
47 | | -#endif |
48 | | - |
49 | | -/* SDI Printf Definition */ |
50 | | -#define SDI_PR_CLOSE 0 |
51 | | -#define SDI_PR_OPEN 1 |
52 | | - |
53 | | -#ifndef SDI_PRINT |
54 | | -#define SDI_PRINT SDI_PR_CLOSE |
55 | | -#endif |
56 | | - |
57 | | -void Delay_Init(void); |
58 | | -void Delay_Us(uint32_t n); |
59 | | -void Delay_Ms(uint32_t n); |
60 | | -void USART_Printf_Init(uint32_t baudrate); |
61 | | -void SDI_Printf_Enable(void); |
62 | | - |
63 | | -#ifdef __cplusplus |
64 | | -} |
65 | | -#endif |
66 | | - |
67 | | -#endif /* __DEBUG_H */ |
| 1 | +/********************************** (C) COPYRIGHT ******************************* |
| 2 | + * File Name : debug.h |
| 3 | + * Author : WCH |
| 4 | + * Version : V1.0.0 |
| 5 | + * Date : 2024/01/01 |
| 6 | + * Description : This file contains all the functions prototypes for UART |
| 7 | + * Printf , Delay functions. |
| 8 | + ********************************************************************************* |
| 9 | + * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. |
| 10 | + * Attention: This software (modified or not) and binary are used for |
| 11 | + * microcontroller manufactured by Nanjing Qinheng Microelectronics. |
| 12 | + *******************************************************************************/ |
| 13 | +#ifndef __DEBUG_H |
| 14 | +#define __DEBUG_H |
| 15 | + |
| 16 | +#ifdef __cplusplus |
| 17 | + extern "C" { |
| 18 | +#endif |
| 19 | + |
| 20 | +#include <ch32v00X.h> |
| 21 | +#include <stdio.h> |
| 22 | + |
| 23 | +/* UART Printf Definition */ |
| 24 | +#define DEBUG_UART1_NoRemap 1 //Tx-PD5 |
| 25 | +#define DEBUG_UART1_Remap1 2 //Tx-PD6 |
| 26 | +#define DEBUG_UART1_Remap2 3 //Tx-PD0 |
| 27 | +#define DEBUG_UART1_Remap3 4 //Tx-PC0 |
| 28 | +#define DEBUG_UART1_Remap4 5 //Tx-PD1 |
| 29 | +#define DEBUG_UART1_Remap5 6 //Tx-PB3 |
| 30 | +#define DEBUG_UART1_Remap6 7 //Tx-PC5 |
| 31 | +#define DEBUG_UART1_Remap7 8 //Tx-PB5 |
| 32 | +#define DEBUG_UART1_Remap8 9 //Tx-PA0 |
| 33 | + |
| 34 | +/* USART2 print function only for V005,V006,V007,M007 series*/ |
| 35 | +#if defined(CH32V005) || defined(CH32V006) || defined(CH32V007_M007) |
| 36 | +#define DEBUG_UART2_NoRemap 10 //Tx-PA7 |
| 37 | +#define DEBUG_UART2_Remap1 11 //Tx-PA4 |
| 38 | +#define DEBUG_UART2_Remap2 12 //Tx-PA2 |
| 39 | +#define DEBUG_UART2_Remap3 13 //Tx-PD2 |
| 40 | +#define DEBUG_UART2_Remap4 14 //Tx-PB0 |
| 41 | +#define DEBUG_UART2_Remap5 15 //Tx-PC4 |
| 42 | +#define DEBUG_UART2_Remap6 16 //Tx-PA6 |
| 43 | +#endif |
| 44 | +/* DEBUG UATR Definition */ |
| 45 | +#ifndef DEBUG |
| 46 | +#define DEBUG DEBUG_UART1_NoRemap |
| 47 | +#endif |
| 48 | + |
| 49 | +/* SDI Printf Definition */ |
| 50 | +#define SDI_PR_CLOSE 0 |
| 51 | +#define SDI_PR_OPEN 1 |
| 52 | + |
| 53 | +#ifndef SDI_PRINT |
| 54 | +#define SDI_PRINT SDI_PR_CLOSE |
| 55 | +#endif |
| 56 | + |
| 57 | +void Delay_Init(void); |
| 58 | +void Delay_Us(uint32_t n); |
| 59 | +void Delay_Ms(uint32_t n); |
| 60 | +void USART_Printf_Init(uint32_t baudrate); |
| 61 | +void SDI_Printf_Enable(void); |
| 62 | + |
| 63 | +#ifdef __cplusplus |
| 64 | +} |
| 65 | +#endif |
| 66 | + |
| 67 | +#endif /* __DEBUG_H */ |
0 commit comments