config.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #ifndef _BOARD_CONFIG_H_
  2. #define _BOARD_CONFIG_H_
  3. #include <driver/gpio.h>
  4. #include "driver/spi_common.h"
  5. #include "esp_io_expander.h"
  6. // SSCMA Client Configuration
  7. #define CONFIG_SSCMA_EVENT_QUEUE_SIZE 1
  8. #define CONFIG_SSCMA_TX_BUFFER_SIZE 8192
  9. #define CONFIG_SSCMA_RX_BUFFER_SIZE 98304
  10. // SSCMA Client Process Task
  11. #define CONFIG_SSCMA_PROCESS_TASK_STACK_SIZE 10240
  12. #define CONFIG_SSCMA_PROCESS_TASK_PRIORITY 5
  13. #define CONFIG_SSCMA_PROCESS_TASK_AFFINITY_CPU1 1
  14. #define CONFIG_SSCMA_PROCESS_TASK_AFFINITY 1
  15. #define CONFIG_SSCMA_PROCESS_TASK_STACK_ALLOC_EXTERNAL 1
  16. // SSCMA Client Monitor Task
  17. #define CONFIG_SSCMA_MONITOR_TASK_STACK_SIZE 10240
  18. #define CONFIG_SSCMA_MONITOR_TASK_PRIORITY 4
  19. #define CONFIG_SSCMA_MONITOR_TASK_AFFINITY_CPU1 1
  20. #define CONFIG_SSCMA_MONITOR_TASK_AFFINITY 1
  21. #define CONFIG_SSCMA_MONITOR_TASK_STACK_ALLOC_EXTERNAL 1
  22. #define CONFIG_SSCMA_ALLOC_SMALL_SHORTTERM_MEM_EXTERNALLY 1
  23. /* General I2C */
  24. #define BSP_GENERAL_I2C_NUM (I2C_NUM_0)
  25. #define BSP_GENERAL_I2C_SDA (GPIO_NUM_47)
  26. #define BSP_GENERAL_I2C_SCL (GPIO_NUM_48)
  27. /* Audio */
  28. #define AUDIO_INPUT_SAMPLE_RATE 24000
  29. #define AUDIO_OUTPUT_SAMPLE_RATE 24000
  30. #define AUDIO_INPUT_REFERENCE false
  31. #define AUDIO_I2S_GPIO_MCLK GPIO_NUM_10
  32. #define AUDIO_I2S_GPIO_WS GPIO_NUM_12
  33. #define AUDIO_I2S_GPIO_BCLK GPIO_NUM_11
  34. #define AUDIO_I2S_GPIO_DIN GPIO_NUM_15
  35. #define AUDIO_I2S_GPIO_DOUT GPIO_NUM_16
  36. #define AUDIO_CODEC_PA_PIN GPIO_NUM_NC
  37. #define AUDIO_CODEC_ES8311_ADDR ES8311_CODEC_DEFAULT_ADDR
  38. #define AUDIO_CODEC_ES7243E_ADDR (0x14)
  39. #define BUILTIN_LED_GPIO GPIO_NUM_40
  40. #define BOOT_BUTTON_GPIO GPIO_NUM_0
  41. #define VOLUME_UP_BUTTON_GPIO GPIO_NUM_NC
  42. #define VOLUME_DOWN_BUTTON_GPIO GPIO_NUM_NC
  43. /* Expander */
  44. #define BSP_IO_EXPANDER_INT (GPIO_NUM_2)
  45. #define DRV_IO_EXP_INPUT_MASK (0x20ff) // P0.0 ~ P0.7 | P1.3
  46. #define DRV_IO_EXP_OUTPUT_MASK (0xDf00) // P1.0 ~ P1.7 & ~P1.3
  47. /* Expander IO PIN */
  48. #define BSP_PWR_CHRG_DET (IO_EXPANDER_PIN_NUM_0)
  49. #define BSP_PWR_STDBY_DET (IO_EXPANDER_PIN_NUM_1)
  50. #define BSP_PWR_VBUS_IN_DET (IO_EXPANDER_PIN_NUM_2)
  51. #define BSP_PWR_SDCARD (IO_EXPANDER_PIN_NUM_8)
  52. #define BSP_PWR_LCD (IO_EXPANDER_PIN_NUM_9)
  53. #define BSP_PWR_SYSTEM (IO_EXPANDER_PIN_NUM_10)
  54. #define BSP_PWR_AI_CHIP (IO_EXPANDER_PIN_NUM_11)
  55. #define BSP_PWR_CODEC_PA (IO_EXPANDER_PIN_NUM_12)
  56. #define BSP_PWR_BAT_DET (IO_EXPANDER_PIN_NUM_13)
  57. #define BSP_PWR_GROVE (IO_EXPANDER_PIN_NUM_14)
  58. #define BSP_PWR_BAT_ADC (IO_EXPANDER_PIN_NUM_15)
  59. #define BSP_PWR_START_UP (BSP_PWR_SDCARD | BSP_PWR_LCD | BSP_PWR_SYSTEM | BSP_PWR_AI_CHIP | BSP_PWR_CODEC_PA | BSP_PWR_GROVE | BSP_PWR_BAT_ADC)
  60. #define BSP_KNOB_BTN (IO_EXPANDER_PIN_NUM_3)
  61. #define BSP_KNOB_A_PIN GPIO_NUM_41
  62. #define BSP_KNOB_B_PIN GPIO_NUM_42
  63. /* SPI */
  64. #define BSP_SPI2_HOST_SCLK (GPIO_NUM_4)
  65. #define BSP_SPI2_HOST_MOSI (GPIO_NUM_5)
  66. #define BSP_SPI2_HOST_MISO (GPIO_NUM_6)
  67. /* SD Card */
  68. #define BSP_SD_SPI_NUM (SPI2_HOST)
  69. #define BSP_SD_SPI_CS (GPIO_NUM_46)
  70. #define BSP_SD_GPIO_DET (IO_EXPANDER_PIN_NUM_4)
  71. /* QSPI */
  72. #define BSP_SPI3_HOST_PCLK (GPIO_NUM_7)
  73. #define BSP_SPI3_HOST_DATA0 (GPIO_NUM_9)
  74. #define BSP_SPI3_HOST_DATA1 (GPIO_NUM_1)
  75. #define BSP_SPI3_HOST_DATA2 (GPIO_NUM_14)
  76. #define BSP_SPI3_HOST_DATA3 (GPIO_NUM_13)
  77. /* LCD */
  78. #define BSP_LCD_SPI_NUM (SPI3_HOST)
  79. #define BSP_LCD_SPI_CS (GPIO_NUM_45)
  80. #define BSP_LCD_GPIO_RST (GPIO_NUM_NC)
  81. #define BSP_LCD_GPIO_DC (GPIO_NUM_1)
  82. #define DISPLAY_WIDTH 412
  83. #define DISPLAY_HEIGHT 412
  84. #define DISPLAY_MIRROR_X false
  85. #define DISPLAY_MIRROR_Y false
  86. #define DISPLAY_SWAP_XY false
  87. #define DISPLAY_OFFSET_X 0
  88. #define DISPLAY_OFFSET_Y 0
  89. #define DISPLAY_BACKLIGHT_PIN GPIO_NUM_8
  90. #define DISPLAY_BACKLIGHT_OUTPUT_INVERT false
  91. /* Touch */
  92. #define BSP_TOUCH_I2C_NUM (1)
  93. #define BSP_TOUCH_GPIO_INT (IO_EXPANDER_PIN_NUM_5)
  94. #define BSP_TOUCH_I2C_SDA (GPIO_NUM_39)
  95. #define BSP_TOUCH_I2C_SCL (GPIO_NUM_38)
  96. #define BSP_TOUCH_I2C_CLK (400000)
  97. /* Settings */
  98. #define DRV_LCD_PIXEL_CLK_HZ (40 * 1000 * 1000)
  99. #define DRV_LCD_CMD_BITS (32)
  100. #define DRV_LCD_PARAM_BITS (8)
  101. #define DRV_LCD_RGB_ELEMENT_ORDER (LCD_RGB_ELEMENT_ORDER_RGB)
  102. #define DRV_LCD_BITS_PER_PIXEL (16)
  103. #define CONFIG_BSP_LCD_SPI_DMA_SIZE_DIV 16
  104. /* ADC */
  105. #define BSP_BAT_ADC_CHAN (ADC_CHANNEL_2) // GPIO3
  106. #define BSP_BAT_ADC_ATTEN (ADC_ATTEN_DB_2_5) // 0 ~ 1100 mV
  107. #define BSP_BAT_VOL_RATIO ((62 + 20) / 20)
  108. /* Himax */
  109. #define BSP_SSCMA_CLIENT_RST (IO_EXPANDER_PIN_NUM_7)
  110. #define BSP_SSCMA_CLIENT_RST_USE_EXPANDER (true)
  111. #define BSP_SSCMA_CLIENT_SPI_NUM (SPI2_HOST)
  112. #define BSP_SSCMA_CLIENT_SPI_CS (GPIO_NUM_21)
  113. #define BSP_SSCMA_CLIENT_SPI_SYNC (IO_EXPANDER_PIN_NUM_6)
  114. #define BSP_SSCMA_CLIENT_SPI_SYNC_USE_EXPANDER (true)
  115. #define BSP_SSCMA_CLIENT_SPI_CLK (12 * 1000 * 1000)
  116. #define BSP_SSCMA_FLASHER_UART_NUM (UART_NUM_1)
  117. #define BSP_SSCMA_FLASHER_UART_TX (GPIO_NUM_17)
  118. #define BSP_SSCMA_FLASHER_UART_RX (GPIO_NUM_18)
  119. #define BSP_SSCMA_FLASHER_UART_BAUD_RATE (921600)
  120. #endif // _BOARD_CONFIG_H_