system.h 1.6 KB

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