debug.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include <ch32v00X.h>
  19. #include <stdio.h>
  20. /* UART Printf Definition */
  21. #define DEBUG_UART1_NoRemap 1 //Tx-PD5
  22. #define DEBUG_UART1_Remap1 2 //Tx-PD6
  23. #define DEBUG_UART1_Remap2 3 //Tx-PD0
  24. #define DEBUG_UART1_Remap3 4 //Tx-PC0
  25. #define DEBUG_UART1_Remap4 5 //Tx-PD1
  26. #define DEBUG_UART1_Remap5 6 //Tx-PB3
  27. #define DEBUG_UART1_Remap6 7 //Tx-PC5
  28. #define DEBUG_UART1_Remap7 8 //Tx-PB5
  29. #define DEBUG_UART1_Remap8 9 //Tx-PA0
  30. /* USART2 print function only for V005,V006,V007,M007 series*/
  31. #if defined(CH32V005) || defined(CH32V006) || defined(CH32V007_M007)
  32. #define DEBUG_UART2_NoRemap 10 //Tx-PA7
  33. #define DEBUG_UART2_Remap1 11 //Tx-PA4
  34. #define DEBUG_UART2_Remap2 12 //Tx-PA2
  35. #define DEBUG_UART2_Remap3 13 //Tx-PD2
  36. #define DEBUG_UART2_Remap4 14 //Tx-PB0
  37. #define DEBUG_UART2_Remap5 15 //Tx-PC4
  38. #define DEBUG_UART2_Remap6 16 //Tx-PA6
  39. #endif
  40. /* DEBUG UATR Definition */
  41. // #ifndef DEBUG
  42. // #define DEBUG DEBUG_UART1_NoRemap
  43. // #endif
  44. /* SDI Printf Definition */
  45. #define SDI_PR_CLOSE 0
  46. #define SDI_PR_OPEN 1
  47. #ifndef SDI_PRINT
  48. #define SDI_PRINT SDI_PR_CLOSE
  49. #endif
  50. void Delay_Init(void);
  51. void Delay_Us(uint32_t n);
  52. void Delay_Ms(uint32_t n);
  53. void USART_Printf_Init(uint32_t baudrate);
  54. void SDI_Printf_Enable(void);
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58. #endif /* __DEBUG_H */