system.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. File Name : system.h
  3. Author : Yichip
  4. Version : V1.0
  5. Date : 2019/11/13
  6. Description : none.
  7. */
  8. #ifndef __SYSTEM_H__
  9. #define __SYSTEM_H__
  10. #include <string.h>
  11. #include "yc11xx_uart.h"
  12. #include "yc11xx_gpio.h"
  13. #include "ycdef.h"
  14. //#define ENABLE_LOG //Debug switch
  15. //#define DEBUG_ADC
  16. //#define DEBUG_OTP
  17. //#define DEBUG_QSPI
  18. //#define DEBUG_SYS
  19. //#define DEBUG_DRV_BT
  20. #define NEC_ENABLE 1
  21. #if (NEC_ENABLE==1)
  22. #define NEC_GPIO 31
  23. #endif
  24. #define DEBUG_USART 1
  25. #if (DEBUG_USART==1)
  26. #define PRINTPORT UARTB
  27. #define PRINTRXIO 6
  28. #define PRINTTXIO 23
  29. #else
  30. #define PRINTPORT UARTB
  31. #define PRINTRXIO 6
  32. #define PRINTTXIO 20
  33. #endif
  34. #define DEBUG_BLE_PRINTF 0
  35. #define BLE_SEND_HANDLE 0x001e
  36. #define ADC_GET_GPIOx 23
  37. #define BIT_SET(a,b) ((a) |= (1<<(b)))
  38. #define BIT_CLEAR(a,b) ((a) &= ~(1<<(b)))
  39. #define BIT_FLIP(a,b) ((a) ^= (1<<(b))) //bit Negation
  40. #define BIT_GET(a,b) (((a) & (1<<(b)))>>(b))
  41. typedef struct printportStruct
  42. {
  43. USART_TypeDef print_port;
  44. uint8_t print_rxio;
  45. uint8_t print_txio;
  46. }printport_CB;
  47. /**
  48. * @brief Print format string to serial port 0.You need to initialize the serial port 0 before you use MyPrintf.
  49. *
  50. * @param format : format string
  51. * @param ...: format parameter
  52. */
  53. void printport_init(void);
  54. void setprintport(USART_TypeDef UARTx);
  55. void getprintportcb(printport_CB *printportx);
  56. void MyPrintf(char *format, ...);
  57. void open_log_print(uint8_t isopen);
  58. void log_print(char *format, ...);
  59. void log2_print(char *format, ...);
  60. void printfsend(uint8_t* buf, int len);
  61. void delay_us(uint32_t num);
  62. #endif /*__SYSTEM_H__*/