debug.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /********************************** (C) COPYRIGHT *******************************
  2. * File Name : debug.h
  3. * Author : WCH
  4. * Version : V1.0.0
  5. * Date : 2023/10/24
  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. #include "stdio.h"
  16. #include "ch32v20x.h"
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /* UART Printf Definition */
  21. #define DEBUG_UART1 1
  22. #define DEBUG_UART2 2
  23. #define DEBUG_UART3 3
  24. /* DEBUG UATR Definition */
  25. #ifndef DEBUG
  26. #define DEBUG DEBUG_UART1
  27. #endif
  28. /* SDI Printf Definition */
  29. #define SDI_PR_CLOSE 0
  30. #define SDI_PR_OPEN 1
  31. #ifndef SDI_PRINT
  32. #define SDI_PRINT SDI_PR_CLOSE
  33. #endif
  34. void Delay_Init(void);
  35. void Delay_Us(uint32_t n);
  36. void Delay_Ms(uint32_t n);
  37. void USART_Printf_Init(uint32_t baudrate);
  38. void SDI_Printf_Enable(void);
  39. #if(DEBUG)
  40. #define PRINT(format, ...) printf(format, ##__VA_ARGS__)
  41. #else
  42. #define PRINT(X...)
  43. #endif
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif