driver_config.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*!
  2. * \file driver_item.h
  3. * \brief 驱动配置项定义
  4. * \details
  5. * \author
  6. * \date
  7. * \copyright Actions
  8. */
  9. #ifndef ZEPHYR_INCLUDE_DRIVERS_DRIVER_ITEM_H_
  10. #define ZEPHYR_INCLUDE_DRIVERS_DRIVER_ITEM_H_
  11. #define UART_DRV_ID 0X03
  12. #define LED_DRV_ID 0X11
  13. #define ONOFF_DRV_ID 0X0A
  14. #define LRADC_DRV_ID 0X0B
  15. #define GPIO_DRV_ID 0X0C
  16. #define TAP_DRV_ID 0X0D
  17. #define AUDIO_DRV_ID 0X18
  18. #define CHARGE_DRV_ID 0X1E
  19. #define CHARGEBOX_DRV_ID 0X1F
  20. #define BATTERY_DRV_ID 0X20
  21. #define NTC_DRV_ID 0x21
  22. #define SYS_DRV_ID 0x4C
  23. // 各个驱动具体的配置项ITEM
  24. /* UART */
  25. #define ITEM_UART_TX_PIN ((UART_DRV_ID<<16) | 1)
  26. #define ITEM_UART_RX_PIN ((UART_DRV_ID<<16) | 2)
  27. #define ITEM_UART_BAUDRATE ((UART_DRV_ID<<16) | 3)
  28. #define ITEM_UART_PRINT_TIME_STAMP ((UART_DRV_ID<<16) | 4)
  29. /* LED */
  30. #define ITEM_LED_LED ((LED_DRV_ID<<16) | 1)
  31. /* ONOFF KEY */
  32. #define ITEM_ONOFF_USE_INNER_ONOFF_KEY ((ONOFF_DRV_ID<<16) | 1)
  33. #define ITEM_ONOFF_CONTINUE_KEY_FUNCTION_AFTER_WAKE_UP ((ONOFF_DRV_ID<<16) | 2)
  34. #define ITEM_ONOFF_KEY_VALUE ((ONOFF_DRV_ID<<16) | 3)
  35. #define ITEM_ONOFF_TIME_PRESS_POWER_ON ((ONOFF_DRV_ID<<16) | 4)
  36. #define ITEM_ONOFF_TIME_LONG_PRESS_RESET ((ONOFF_DRV_ID<<16) | 5)
  37. #define ITEM_ONOFF_BOOT_HOLD_KEY_FUNC ((ONOFF_DRV_ID<<16) | 6)
  38. #define ITEM_ONOFF_BOOT_HOLD_KEY_TIME_MS ((ONOFF_DRV_ID<<16) | 7)
  39. #define ITEM_ONOFF_DEBOUNCE_TIME_MS ((ONOFF_DRV_ID<<16) | 8)
  40. #define ITEM_ONOFF_REBOOT_AFTER_BOOT_HOLD_KEY_CLEAR_PAIRED_LIST ((ONOFF_DRV_ID<<16) | 9)
  41. /* LRADC KEY */
  42. #define ITEM_LRADC_KEY ((LRADC_DRV_ID<<16) | 1)
  43. #define ITEM_LRADC_CTRL ((LRADC_DRV_ID<<16) | 2)
  44. #define ITEM_LRADC_PULL_UP ((LRADC_DRV_ID<<16) | 3)
  45. #define ITEM_LRADC_KEY_WAKE_UP ((LRADC_DRV_ID<<16) | 4)
  46. #define ITEM_LRADC_VALUE_TEST ((LRADC_DRV_ID<<16) | 5)
  47. #define ITEM_LRADC_DEBOUNCE_TIME_MS ((LRADC_DRV_ID<<16) | 6)
  48. /* GPIO KEY */
  49. #define ITEM_GPIO_KEY ((GPIO_DRV_ID<<16) | 1)
  50. /* TAP KEY */
  51. #define ITEM_TAP_KEY_CONTROL ((TAP_DRV_ID<<16) | 1)
  52. /* AUDIO */
  53. #define ITEM_AUDIO_OUT_MODE ((AUDIO_DRV_ID<<16) | 1)
  54. #define ITEM_AUDIO_I2STX_SELECT_GPIO ((AUDIO_DRV_ID<<16) | 2)
  55. #define ITEM_AUDIO_CHANNEL_SELECT_MODE ((AUDIO_DRV_ID<<16) | 3)
  56. #define ITEM_AUDIO_CHANNEL_SELECT_GPIO ((AUDIO_DRV_ID<<16) | 4)
  57. #define ITEM_AUDIO_CHANNEL_SELECT_LRADC ((AUDIO_DRV_ID<<16) | 5)
  58. #define ITEM_AUDIO_TWS_ALONE_AUDIO_CHANNEL ((AUDIO_DRV_ID<<16) | 6)
  59. #define ITEM_AUDIO_L_SPEAKER_OUT ((AUDIO_DRV_ID<<16) | 7)
  60. #define ITEM_AUDIO_R_SPEAKER_OUT ((AUDIO_DRV_ID<<16) | 8)
  61. #define ITEM_AUDIO_ADC_BIAS_SETTING ((AUDIO_DRV_ID<<16) | 9)
  62. #define ITEM_AUDIO_DAC_BIAS_SETTING ((AUDIO_DRV_ID<<16) | 10)
  63. #define ITEM_AUDIO_KEEP_DA_ENABLED_WHEN_PLAY_PAUSE ((AUDIO_DRV_ID<<16) | 11)
  64. #define ITEM_AUDIO_DISABLE_PA_WHEN_RECONNECT ((AUDIO_DRV_ID<<16) | 12)
  65. #define ITEM_AUDIO_EXTERN_PA_CONTROL ((AUDIO_DRV_ID<<16) | 13)
  66. #define ITEM_AUDIO_LARGE_NOISE_OPTIMIZE_ENABLE ((AUDIO_DRV_ID<<16) | 14)
  67. #define ITEM_AUDIO_ANTIPOP_PROCESS_DISABLE ((AUDIO_DRV_ID<<16) | 15)
  68. #define ITEM_AUDIO_DMIC01_CHANNEL_ALIGNING ((AUDIO_DRV_ID<<16) | 16)
  69. #define ITEM_AUDIO_DMIC23_CHANNEL_ALIGNING ((AUDIO_DRV_ID<<16) | 17)
  70. #define ITEM_AUDIO_DMIC_SELECT_GPIO ((AUDIO_DRV_ID<<16) | 18)
  71. #define ITEM_AUDIO_ENABLE_ANC ((AUDIO_DRV_ID<<16) | 19)
  72. #define ITEM_AUDIO_ANCDMIC_SELECT_GPIO ((AUDIO_DRV_ID<<16) | 20)
  73. #define ITEM_AUDIO_RECORD_ADC_SELECT ((AUDIO_DRV_ID<<16) | 21)
  74. #define ITEM_AUDIO_ENABLE_VMIC ((AUDIO_DRV_ID<<16) | 22)
  75. #define ITEM_AUDIO_HW_AEC_SELECT ((AUDIO_DRV_ID<<16) | 23)
  76. #define ITEM_AUDIO_TM_ADC_SELECT ((AUDIO_DRV_ID<<16) | 24)
  77. #define ITEM_AUDIO_MIC_CONFIG ((AUDIO_DRV_ID<<16) | 25)
  78. #define ITEM_AUDIO_ADC_INPUT_SELECT ((AUDIO_DRV_ID<<16) | 26)
  79. #define ITEM_AUDIO_PA_GAIN ((AUDIO_DRV_ID<<16) | 27)
  80. #define ITEM_AUDIO_DUAL_MIC_EXCHANGE_ENABLE ((AUDIO_DRV_ID<<16) | 28)
  81. #define ITEM_AUDIO_LARGE_CURRENT_PROTOTECT_ENABLE ((AUDIO_DRV_ID<<16) | 29)
  82. #define ITEM_AUDIO_ANALOG_GAIN_SETTINGS ((AUDIO_DRV_ID<<16) | 30)
  83. /* CHARGE */
  84. #define ITEM_CHARGE_SELECT_CHARGE_MODE ((CHARGE_DRV_ID<<16) | 1)
  85. #define ITEM_CHARGE_CURRENT ((CHARGE_DRV_ID<<16) | 2)
  86. #define ITEM_CHARGE_VOLTAGE ((CHARGE_DRV_ID<<16) | 3)
  87. #define ITEM_CHARGE_STOP_MODE ((CHARGE_DRV_ID<<16) | 4)
  88. #define ITEM_CHARGE_STOP_VOLTAGE ((CHARGE_DRV_ID<<16) | 5)
  89. #define ITEM_CHARGE_STOP_CURRENT ((CHARGE_DRV_ID<<16) | 6)
  90. #define ITEM_CHARGE_PRECHARGE_STOP_VOLTAGE ((CHARGE_DRV_ID<<16) | 7)
  91. #define ITEM_CHARGE_PRECHARGE_CURRENT ((CHARGE_DRV_ID<<16) | 8)
  92. #define ITEM_CHARGE_PRECHARGE_CURRENT_MIN_LIMIT ((CHARGE_DRV_ID<<16) | 9)
  93. #define ITEM_CHARGE_FAST_CHARGE_ENABLE ((CHARGE_DRV_ID<<16) | 10)
  94. #define ITEM_CHARGE_FAST_CHARGE_CURRENT ((CHARGE_DRV_ID<<16) | 11)
  95. #define ITEM_CHARGE_FAST_CHARGE_VOLTAGE_THRESHOLD ((CHARGE_DRV_ID<<16) | 12)
  96. #define ITEM_CHARGE_ENABLE_BATTERY_RECHARGE ((CHARGE_DRV_ID<<16) | 13)
  97. #define ITEM_CHARGE_BATTERY_RECHARGE_THRESHOLD ((CHARGE_DRV_ID<<16) | 14)
  98. #define ITEM_CHARGE_BATTERY_CHARGE_TOTAL_TIME_LIMIT ((CHARGE_DRV_ID<<16) | 15)
  99. #define ITEM_CHARGE_BATTERY_CHECK_PERIOD_SEC ((CHARGE_DRV_ID<<16) | 16)
  100. #define ITEM_CHARGE_CHECK_PERIOD_SEC ((CHARGE_DRV_ID<<16) | 17)
  101. #define ITEM_CHARGE_FULL_CONTINUE_SEC ((CHARGE_DRV_ID<<16) | 18)
  102. #define ITEM_CHARGE_FRONT_CHARGE_FULL_POWER_OFF_WAIT_SEC ((CHARGE_DRV_ID<<16) | 19)
  103. #define ITEM_CHARGE_DC5V_DETECT_DEBOUNCE_TIME_MS ((CHARGE_DRV_ID<<16) | 20)
  104. /* CHARGER BOX */
  105. #define ITEM_CHARGEBOX_ENABLE_CHARGER_BOX ((CHARGEBOX_DRV_ID<<16) | 1)
  106. #define ITEM_CHARGEBOX_DC5V_PULL_DOWN_CURRENT ((CHARGEBOX_DRV_ID<<16) | 2)
  107. #define ITEM_CHARGEBOX_DC5V_PULL_DOWN_HOLD_MS ((CHARGEBOX_DRV_ID<<16) | 3)
  108. #define ITEM_CHARGEBOX_STANDBY_DELAY_MS ((CHARGEBOX_DRV_ID<<16) | 4)
  109. #define ITEM_CHARGEBOX_STANDBY_VOLTAGE ((CHARGEBOX_DRV_ID<<16) | 5)
  110. #define ITEM_CHARGEBOX_WAKE_DELAY_MS ((CHARGEBOX_DRV_ID<<16) | 6)
  111. #define ITEM_CHARGEBOX_BOX_STANDBY_CURRENT ((CHARGEBOX_DRV_ID<<16) | 7)
  112. #define ITEM_CHARGEBOX_DC5V_UART_COMM_SETTINGS ((CHARGEBOX_DRV_ID<<16) | 8)
  113. #define ITEM_CHARGEBOX_DC5V_IO_COMM_SETTINGS ((CHARGEBOX_DRV_ID<<16) | 9)
  114. /* BATTERY */
  115. #define ITEM_BATTERY_LEVEL ((BATTERY_DRV_ID<<16) | 1)
  116. #define ITEM_BATTERY_TOO_LOW_VOLTAGE ((BATTERY_DRV_ID<<16) | 2)
  117. #define ITEM_BATTERY_LOW_VOLTAGE ((BATTERY_DRV_ID<<16) | 3)
  118. #define ITEM_BATTERY_LOW_VOLTAGE_EX ((BATTERY_DRV_ID<<16) | 4)
  119. #define ITEM_BATTERY_LOW_PROMPT_INTERVAL_SEC ((BATTERY_DRV_ID<<16) | 5)
  120. /* NTC */
  121. #define ITEM_NTC_SETTING ((NTC_DRV_ID<<16) | 1)
  122. #define ITEM_NTC_RANGES ((NTC_DRV_ID<<16) | 2)
  123. /* OTHER - SYS MORE CONFIG */
  124. #define ITEM_SYS_SETTINGS_SUPPORT_FEATURES ((SYS_DRV_ID<<16) | 1)
  125. /*!
  126. * \brief 读取驱动配置数据
  127. * \n
  128. * \param item_key : 各驱动定义的item ID, 见driver_config.h
  129. * \param data : 保存配置数据
  130. * \param size : data 大小
  131. * \return
  132. * 成功: 数据长度
  133. * \n 失败: 0
  134. */
  135. int cfg_get_by_key(uint32_t item_key, void *data, int size);
  136. #endif // ZEPHYR_INCLUDE_DRIVERS_DRIVER_ITEM_H_