config.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*****************************************************************************
  2. * Module : Config
  3. * File : config.h
  4. * Function : SDK配置文件
  5. *****************************************************************************/
  6. #ifndef USER_CONFIG_H
  7. #define USER_CONFIG_H
  8. #include "config_define.h"
  9. /*****************************************************************************
  10. * Module : Function选择相关配置
  11. *****************************************************************************/
  12. #define FUNC_BT_EN 0 //是否打开蓝牙功能
  13. #define FUNC_LE_FCC_EN 0 //是否打开蓝牙FCC测试功能, 使用单线串口通信,默认: PB3, 1500000
  14. #define FUNC_LE_BQB_RF_EN 0 //是否打开蓝牙BQB测试功能, 使用串口通信,默认: RX:PA0, TX:PA1, 9600
  15. #define FUNC_WIRELESS_EN 1 //是否打开2.4G私有协议功能
  16. #define FUNC_USBD_EN 0 //是否打开USBDevice模式
  17. #define FUNC_IODM_EN 0 //是否打开小牛测控功能, 使用单线串口通信,默认: VUSB, 115200
  18. #define FUNC_IDLE_EN 0 //是否打开IDLE功能
  19. /*****************************************************************************
  20. * Module : 系统功能选择配置
  21. *****************************************************************************/
  22. #define SYS_CLK_SEL SYS_160M //选择系统时钟
  23. #define BUCK_MODE_EN 0 //是否BUCK MODE, 0:LDO MODE 1:BUCK MODE
  24. #define VUSB_2_VDDIO_EN 0 //是否使能VUSB到VDDIO的电源通路(系统只有VUSB供电的方案需要使能)
  25. #define WK0_10S_RESET 0 //WK pin 10秒复位功能
  26. #define SOFT_POWER_ON_OFF 0 //是否使用软开关机功能
  27. #define SYS_SLEEP_LEVEL SLEEP_DISABLE //休眠等级设置,0为不使能休眠功能
  28. #define SYS_SLEEP_TIME 0 //自动休眠时间(秒), 0为不自动休眠
  29. #define SYS_OFF_TIME 0 //自动关机时间(秒), 0为不自动关机
  30. #define SYS_PWRUP_TIME 0 //长按开机时间(毫秒), 0为立即开机
  31. #define BSP_UART_DEBUG_EN PRINTF_PB3 //串口打印调试使能[Baud=1500000]
  32. #define BSP_ADKEY_EN 0 //AD按键使能[Default: PB0]
  33. #define BSP_IOKEY_EN 0 //IO按鍵使能[WK0:PP;]
  34. #define BSP_CHARGE_EN 0 //充电功能使能
  35. #define BSP_VBAT_DETECT_EN 0 //电量检测功能使能
  36. #define BSP_SDADC_EN 0 //SDADC音频采集使能
  37. #define BSP_MOUSE_SENSEN_EN 0 //鼠标传感器使能
  38. #define BSP_MOUSE_TEST 0 //光标轨迹测试
  39. /*****************************************************************************
  40. * Module : FLASH配置
  41. *****************************************************************************/
  42. #define FLASH_SIZE FSIZE_256K //芯片内置flash空间大小
  43. #define FLASH_RESERVE_SIZE CM_SIZE //程序保留区空间大小
  44. #define FLASH_CODE_SIZE (FLASH_SIZE-FLASH_RESERVE_SIZE) //程序使用空间大小
  45. #define FLASH_ERASE_4K 1 //是否支持4K擦除
  46. #define FLASH_DUAL_READ 1 //是否支持2线模式
  47. #define FLASH_QUAD_READ 0 //是否支持4线模式
  48. #define SPIFLASH_SPEED_UP_EN 1 //SPI FLASH提速。
  49. #define COMM_EX_SIZE 0 //拓展comm区 Unit(byte) Aligned(512)
  50. #define CM_SIZE 0x2000 //参数区大小,至少8k(需4K对齐)
  51. #define CM_START (FLASH_SIZE - CM_SIZE) //参数区默认放在flash最后面
  52. /*****************************************************************************
  53. * Module : FOTA功能配置
  54. *****************************************************************************/
  55. #define AB_FOT_EN 0 //FOTA升级使能
  56. #define AB_FOT_TYPE AB_FOT_TYPE_PACK //FOTA升级方式选择
  57. #define AB_FOT_CHANNEL AB_FOT_CHANNEL_USB //FOTA升级通信通道选择
  58. #if (FLASH_SIZE == FSIZE_256K)
  59. #define FOT_PACK_START 0x23000
  60. #define FOT_PACK_SIZE 0x19000
  61. #elif (FLASH_SIZE == FSIZE_512K)
  62. #define FOT_PACK_START 0x4B000
  63. #define FOT_PACK_SIZE 0x32000
  64. #endif
  65. /*****************************************************************************
  66. * Module : 蓝牙功能配置
  67. *****************************************************************************/
  68. #define LE_FCC_TEST_EN 0 //BLE FCC测试模式,上电直接进FCC TEST, 使用串口通信,默认PB3
  69. #define LE_BQB_RF_EN 0 //BLE BQB测试模式,上电直接进BQB RF TEST, 使用串口通信,默认RX:PA0, TX:PA1
  70. #define LE_CHECK_PEER_TYPE 0 //通过查询ANCS Service判断设备类型
  71. /*****************************************************************************
  72. * Module : usb device 配置
  73. *****************************************************************************/
  74. #define USB_HID_EN 0
  75. #define USB_SPEAKER_EN 0
  76. #define USB_MIC_EN 0
  77. #define USB_VENDOR_EN 0
  78. #define USB_AUDIO_EN (USB_SPEAKER_EN || USB_MIC_EN )
  79. #define USB_EN (USB_HID_EN || USB_AUDIO_EN || USB_VENDOR_EN) //USB功能使能
  80. /*****************************************************************************
  81. * Module : VDDIO配置
  82. *****************************************************************************/
  83. #define PMU_VDDIO_LEVEL PMU_VDDIO_2V4 //VDDIO电压,电压越低语音底噪越小
  84. /*****************************************************************************
  85. * Module : MIC配置
  86. *****************************************************************************/
  87. #define MIC_BIAS_EN 0 //MIC BIAS使能,PB1输出
  88. #define MIC_BIAS_LEVEL MIC_BIAS_1V8 //MIC BIAS电压,电压越低语音底噪越小
  89. #define MIC_BIAS_RES MIC_BIAS_RES_0K //MIC BIAS电阻
  90. #define MIC_ANA_GAIN MIC_ANA_GAIN_5 //MIC 模拟增益,6dB一挡
  91. /*****************************************************************************
  92. * Module : 语音解码配置
  93. *****************************************************************************/
  94. #define AUDIO_DEC_ADPCM_EN 0 //adpcm解码使能
  95. #define AUDIO_DEC_MSBC_EN 0 //msbc解码使能
  96. #define AUDIO_DEC_SBC_EN 0 //sbc解码使能
  97. #define AUDIO_OUT_LOCAL_DEBUG 0 //本地sddac调试: SDADC->(adpcm enc/dec)->SDDAC
  98. #if (AUDIO_DEC_ADPCM_EN)
  99. #define AUDIO_MIC_PACKET_SIZE 68 //无线传输编码单包字节长度
  100. #elif (AUDIO_DEC_MSBC_EN)
  101. #define AUDIO_MIC_PACKET_SIZE 57
  102. #elif (AUDIO_DEC_SBC_EN)
  103. #define AUDIO_MIC_PACKET_SIZE 60
  104. #else
  105. #define AUDIO_MIC_PACKET_SIZE 32
  106. #endif
  107. /*****************************************************************************
  108. * Module : wirelesss收发端配置
  109. *****************************************************************************/
  110. #define WIRELESS_PACKET_LEN_AUDIO AUDIO_MIC_PACKET_SIZE //无线传输音频数据长度
  111. #define WIRELESS_PACKET_LEN_HID 5 //无线传输hid信息长度
  112. #define WIRELESS_TRANSMIT_EN 1 //1: 发射端, 0: 接收端
  113. /*****************************************************************************
  114. * Module : 语音降噪功能配置
  115. *****************************************************************************/
  116. #define AINS3_EN 0 //AINS3降噪算法使能 ram:5K, flash:8K, clock:120M以上
  117. #define AINS3_PART_LEN 64 // !!!!!! 只支持 60 和 64 个样点处理一次, msbc 60, adpcm 64
  118. #define AINS3_NT 0 //0~20,降噪等级,越大降噪越强
  119. #define AINS3_PRIOR_OPT_IDX 6 //0~20,先验信噪比门限,越小人声越多
  120. #define AINS4_EN 0 //AINS4降噪算法使能 ram:11K, flash:20K, clock:120M以上
  121. #define AINS4_PART_LEN 64 // !!!!!! 只支持 60 和 64 个样点处理一次, msbc 60, adpcm 64
  122. #define AINS4_NR_SUPPRESS 10 //0~20,降噪等级,越大降噪越强
  123. #define AINS4_PRIOR_OPT_IDX 3 //0~20,先验信噪比门限,越小人声越多
  124. /*****************************************************************************
  125. * Module : 版本号管理
  126. *****************************************************************************/
  127. #define SW_VERSION "V1.0.1" //只能使用数字0-9,ota需要转码
  128. #include "config_extra.h"
  129. #endif