defines.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. #pragma once
  2. #ifndef defines_h
  3. #define defines_h
  4. /////////////////////////////////////////////
  5. //// Global definitions ////
  6. /////////////////////////////////////////////
  7. //********* debug options : *************
  8. //can be set in platformio with -D OPTION_TO_ACTIVATE
  9. //#define DEBUG_DISABLE_BROWNOUT_DETECTOR
  10. /* Uncomment this to generate task list with stack sizes using the /heap handler
  11. PLEASE BE AWARE: The following CONFIG parameters have to to be set in
  12. sdkconfig.defaults before use of this function is possible!!
  13. CONFIG_FREERTOS_USE_TRACE_FACILITY=1
  14. CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y
  15. CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y
  16. */
  17. // server_tflite.cpp
  18. //#define TASK_ANALYSIS_ON
  19. //Memory leak tracing
  20. //https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/heap_debug.html#heap-information
  21. //need CONFIG_HEAP_TRACING_STANDALONE=y or #define CONFIG_HEAP_TRACING_STANDALONE
  22. //all setup is predifined in [env:esp32cam-dev-task-analysis]
  23. //#define HEAP_TRACING_MAIN_WIFI || HEAP_TRACING_MAIN_START //enable heap tracing per function in main.cpp
  24. //all defines in [env:esp32cam-dev-task-analysis]
  25. //#define HEAP_TRACING_MAIN_WIFI
  26. //#define HEAP_TRACING_MAIN_START
  27. //#define HEAP_TRACING_CLASS_FLOW_CNN_GENERAL_DO_ALING_AND_CUT
  28. /* Uncomment this to keep the logfile open for appending.
  29. * If commented out, the logfile gets opened/closed for each log measage (old behaviour) */
  30. // ClassLogFile
  31. //#define KEEP_LOGFILE_OPEN_FOR_APPENDING
  32. //****************************************
  33. //compiler optimization for esp-tflite-micro
  34. #define XTENSA
  35. //#define CONFIG_IDF_TARGET_ARCH_XTENSA //not needed with platformio/espressif32 @ 5.2.0
  36. //ClassControllCamera
  37. #define CAM_LIVESTREAM_REFRESHRATE 500 // Camera livestream feature: Waiting time in milliseconds to refresh image
  38. // #define GRAYSCALE_AS_DEFAULT
  39. //server_GPIO
  40. #define __LEDGLOBAL
  41. #define MOUNT_POINT "/sdcard"
  42. //server_GPIO + server_file + SoftAP
  43. #define CONFIG_FILE "/sdcard/config/config.ini"
  44. #define CONFIG_FILE_BACKUP "/sdcard/config/config.bak"
  45. //interface_mqtt + read_wlanini
  46. #define __HIDE_PASSWORD
  47. #define STRING_ENCRYPTED_LABEL "**##**"
  48. //ClassFlowControll + Main + SoftAP
  49. #define WLAN_CONFIG_FILE "/sdcard/wlan.ini"
  50. #define NETWORK_CONFIG_FILE "/sdcard/network.ini"
  51. //main
  52. #define __SD_USE_ONE_LINE_MODE__
  53. // server_file + Helper
  54. #define FILE_PATH_MAX (255) //Max length a file path can have on storage
  55. //server_file +(ota_page.html + upload_script.html)
  56. #define MAX_FILE_SIZE (8000*1024) // 8 MB Max size of an individual file. Make sure this value is same as that set in upload_script.html and ota_page.html!
  57. #define MAX_FILE_SIZE_STR "8MB"
  58. #define LOGFILE_LAST_PART_BYTES 80 * 1024 // 80 kBytes // Size of partial log file to return
  59. #define SERVER_FILER_SCRATCH_BUFSIZE 4096
  60. #define SERVER_HELPER_SCRATCH_BUFSIZE 4096
  61. #define SERVER_OTA_SCRATCH_BUFSIZE 1024
  62. //server_file + server_help
  63. #define IS_FILE_EXT(filename, ext) \
  64. (strcasecmp(&filename[strlen(filename) - sizeof(ext) + 1], ext) == 0)
  65. //server_ota
  66. #define HASH_LEN 32 // SHA-256 digest length
  67. #define OTA_URL_SIZE 256
  68. //ClassFlow + ClassFlowImage + server_tflite
  69. #define LOGFILE_TIME_FORMAT "%Y%m%d-%H%M%S"
  70. #define LOGFILE_TIME_FORMAT_DATE_EXTR substr(0, 8)
  71. #define LOGFILE_TIME_FORMAT_HOUR_EXTR substr(9, 2)
  72. //ClassFlowControll
  73. #define READOUT_TYPE_VALUE 0
  74. #define READOUT_TYPE_PREVALUE 1
  75. #define READOUT_TYPE_RAWVALUE 2
  76. #define READOUT_TYPE_ERROR 3
  77. //ClassFlowControll: Serve alg_roi.jpg from memory as JPG
  78. #define ALGROI_LOAD_FROM_MEM_AS_JPG // Load ALG_ROI.JPG as rendered JPG from RAM
  79. //ClassFlowMQTT
  80. #define LWT_TOPIC "connection"
  81. #define LWT_CONNECTED "connected"
  82. #define LWT_DISCONNECTED "connection lost"
  83. //ClassFlowPostProcessing
  84. #define PREVALUE_TIME_FORMAT_OUTPUT "%Y-%m-%dT%H:%M:%S%z"
  85. #define PREVALUE_TIME_FORMAT_INPUT "%d-%d-%dT%d:%d:%d"
  86. //CImageBasis
  87. #define HTTP_BUFFER_SENT 1024
  88. #define MAX_JPG_SIZE 128000
  89. //make_stb + stb_image_resize + stb_image_write + stb_image //do not work if not in make_stb.cpp
  90. //#define STB_IMAGE_IMPLEMENTATION
  91. //#define STB_IMAGE_WRITE_IMPLEMENTATION
  92. //#define STB_IMAGE_RESIZE_IMPLEMENTATION
  93. #define STBI_ONLY_JPEG // (save 2% of Flash, but breaks the alignment mark generation, see https://github.com/jomjol/AI-on-the-edge-device/issues/1721)
  94. //interface_influxdb
  95. #define MAX_HTTP_OUTPUT_BUFFER 2048
  96. //server_mqtt
  97. #define LWT_TOPIC "connection"
  98. #define LWT_CONNECTED "connected"
  99. #define LWT_DISCONNECTED "connection lost"
  100. // connect_wlan.cpp
  101. //******************************
  102. /* WIFI roaming functionalities 802.11k+v (uses ca. 6kB - 8kB internal RAM; if SCAN CACHE activated: + 1kB / beacon)
  103. PLEASE BE AWARE: The following CONFIG parameters have to to be set in
  104. sdkconfig.defaults before use of this function is possible!!
  105. CONFIG_WPA_11KV_SUPPORT=y
  106. CONFIG_WPA_SCAN_CACHE=n
  107. CONFIG_WPA_MBO_SUPPORT=n
  108. CONFIG_WPA_11R_SUPPORT=n
  109. */
  110. //#define WLAN_USE_MESH_ROAMING // 802.11v (BSS Transition Management) + 802.11k (Radio Resource Management) (ca. 6kB - 8kB internal RAM neccessary)
  111. //#define WLAN_USE_MESH_ROAMING_ACTIVATE_CLIENT_TRIGGERED_QUERIES // Client can send query to AP requesting to roam (if RSSI lower than RSSI threshold)
  112. /* WIFI roaming only client triggered by scanning the channels after each round (only if RSSI < RSSIThreshold) and trigger a disconnect to switch AP */
  113. #define WLAN_USE_ROAMING_BY_SCANNING
  114. //ClassFlowCNNGeneral
  115. #define Analog_error 3
  116. #define AnalogToDigtalFehler 0.8
  117. #define Digit_Uncertainty 0.2
  118. #define DigitBand 3
  119. #define Digit_Transition_Range_Predecessor 2
  120. #define Digit_Transition_Area_Predecessor 0.7 // 9.3 - 0.7
  121. #define Digit_Transition_Area_Forward 9.7 // Pre-run zero crossing only happens from approx. 9.7 onwards
  122. /////////////////////////////////////////////
  123. //// PSRAM Allocations ////
  124. /////////////////////////////////////////////
  125. #define MAX_MODEL_SIZE (unsigned int)(1.3 * 1024 * 1024) // Space for the currently largest model (1.1 MB) + some spare
  126. #define TENSOR_ARENA_SIZE 800 * 1024 // Space for the Tensor Arena, (819200 Bytes)
  127. #define IMAGE_SIZE 640 * 480 * 3 // Space for a extracted image (921600 Bytes)
  128. /////////////////////////////////////////////
  129. //// Conditionnal definitions ////
  130. /////////////////////////////////////////////
  131. // ******* Board type ESP32CAM_AITHINKER
  132. #if defined(BOARD_ESP32CAM_AITHINKER) // ESP32Cam (AiThinker) PIN Map
  133. #define BoardType "ESP32CAM"
  134. // Uart
  135. //-------------------------------------------------
  136. #define UART_PORT_NUM UART_NUM_0
  137. #define UART_TX_GPIO_NUM GPIO_NUM_1
  138. #define UART_RX_GPIO_NUM GPIO_NUM_3
  139. #define UART_RTS_GPIO_NUM GPIO_NUM_NC
  140. #define UART_CTS_GPIO_NUM GPIO_NUM_NC
  141. #define UART_BUFFER_SIZE 2048
  142. // SD card (operated with SDMMC peripheral)
  143. //-------------------------------------------------
  144. #define GPIO_SDCARD_CLK GPIO_NUM_14
  145. #define GPIO_SDCARD_CMD GPIO_NUM_15
  146. #define GPIO_SDCARD_D0 GPIO_NUM_2
  147. #ifndef __SD_USE_ONE_LINE_MODE__
  148. #error "Board not suppotred SD_FOUR_LINE_MODE"
  149. // #define GPIO_SDCARD_D1 GPIO_NUM_4
  150. // #define GPIO_SDCARD_D2 GPIO_NUM_12
  151. // #define GPIO_SDCARD_D3 GPIO_NUM_13
  152. #else
  153. #define GPIO_SDCARD_D1 GPIO_NUM_NC
  154. #define GPIO_SDCARD_D2 GPIO_NUM_NC
  155. #define GPIO_SDCARD_D3 GPIO_NUM_13
  156. #endif
  157. // Camera (suppotred OV2640 or OV5640)
  158. //-------------------------------------------------
  159. #define CAM_PIN_PWDN GPIO_NUM_32
  160. #define CAM_PIN_RESET GPIO_NUM_NC // software reset will be performed
  161. #define CAM_PIN_XCLK GPIO_NUM_0
  162. #define CAM_PIN_SIOD GPIO_NUM_26
  163. #define CAM_PIN_SIOC GPIO_NUM_27
  164. #define CAM_PIN_D7 GPIO_NUM_35
  165. #define CAM_PIN_D6 GPIO_NUM_34
  166. #define CAM_PIN_D5 GPIO_NUM_39
  167. #define CAM_PIN_D4 GPIO_NUM_36
  168. #define CAM_PIN_D3 GPIO_NUM_21
  169. #define CAM_PIN_D2 GPIO_NUM_19
  170. #define CAM_PIN_D1 GPIO_NUM_18
  171. #define CAM_PIN_D0 GPIO_NUM_5
  172. #define CAM_PIN_VSYNC GPIO_NUM_25
  173. #define CAM_PIN_HREF GPIO_NUM_23
  174. #define CAM_PIN_PCLK GPIO_NUM_22
  175. #define CAM_XCLK_TIMER LEDC_TIMER_0
  176. #define CAM_XCLK_CHANNEL LEDC_CHANNEL_0
  177. // GpioHandler
  178. #define GPIO_IO1 GPIO_NUM_4
  179. #define GPIO_IO2 GPIO_NUM_12
  180. #define GPIO_IO3 GPIO_NUM_13
  181. #define GPIO_IO4 GPIO_NUM_NC
  182. // Statusled + ClassControllCamera
  183. #define BLINK_GPIO GPIO_NUM_33 // PIN for red board LED
  184. #define BLINK_GPIO_INVERT
  185. // ClassControllCamera
  186. #define FLASH_GPIO GPIO_NUM_4 // PIN for flashlight LED
  187. #define FLASH_MODE GPIO_PIN_MODE_BUILTIN_FLASH_PWM
  188. // ******* Board type WROVER_KIT_ESP32
  189. #elif defined(BOARD_WROVER_KIT_ESP32) // WROVER-KIT PIN Map
  190. #define BoardType "WROVER-KIT"
  191. // Uart
  192. //-------------------------------------------------
  193. #define UART_PORT_NUM UART_NUM_0
  194. #define UART_TX_GPIO_NUM GPIO_NUM_1
  195. #define UART_RX_GPIO_NUM GPIO_NUM_3
  196. #define UART_RTS_GPIO_NUM GPIO_NUM_NC
  197. #define UART_CTS_GPIO_NUM GPIO_NUM_NC
  198. #define UART_BUFFER_SIZE 2048
  199. // SD card (operated with SDMMC peripheral)
  200. //-------------------------------------------------
  201. #define GPIO_SDCARD_CLK GPIO_NUM_14
  202. #define GPIO_SDCARD_CMD GPIO_NUM_15
  203. #define GPIO_SDCARD_D0 GPIO_NUM_2
  204. #ifndef __SD_USE_ONE_LINE_MODE__
  205. #error "Board not suppotred SD_FOUR_LINE_MODE"
  206. // #define GPIO_SDCARD_D1 GPIO_NUM_4
  207. // #define GPIO_SDCARD_D2 GPIO_NUM_12
  208. // #define GPIO_SDCARD_D3 GPIO_NUM_13
  209. #else
  210. #define GPIO_SDCARD_D1 GPIO_NUM_NC
  211. #define GPIO_SDCARD_D2 GPIO_NUM_NC
  212. #define GPIO_SDCARD_D3 GPIO_NUM_13
  213. #endif
  214. #define CAM_PIN_PWDN GPIO_NUM_NC // power down is not used
  215. #define CAM_PIN_RESET GPIO_NUM_NC // software reset will be performed
  216. #define CAM_PIN_XCLK GPIO_NUM_21
  217. #define CAM_PIN_SIOD GPIO_NUM_26
  218. #define CAM_PIN_SIOC GPIO_NUM_27
  219. #define CAM_PIN_D7 GPIO_NUM_35
  220. #define CAM_PIN_D6 GPIO_NUM_34
  221. #define CAM_PIN_D5 GPIO_NUM_39
  222. #define CAM_PIN_D4 GPIO_NUM_36
  223. #define CAM_PIN_D3 GPIO_NUM_19
  224. #define CAM_PIN_D2 GPIO_NUM_18
  225. #define CAM_PIN_D1 GPIO_NUM_5
  226. #define CAM_PIN_D0 GPIO_NUM_4
  227. #define CAM_PIN_VSYNC GPIO_NUM_25
  228. #define CAM_PIN_HREF GPIO_NUM_23
  229. #define CAM_PIN_PCLK GPIO_NUM_22
  230. #define CAM_XCLK_TIMER LEDC_TIMER_0
  231. #define CAM_XCLK_CHANNEL LEDC_CHANNEL_0
  232. // GpioHandler
  233. #define GPIO_IO1 GPIO_NUM_12
  234. #define GPIO_IO2 GPIO_NUM_13
  235. #define GPIO_IO3 GPIO_NUM_33
  236. #define GPIO_IO4 GPIO_NUM_NC
  237. // Statusled + ClassControllCamera
  238. #define BLINK_GPIO GPIO_NUM_NC // PIN for red board LED, On the board the LED is on the IO2, but it is used for the SD
  239. // ClassControllCamera
  240. #define FLASH_GPIO GPIO_NUM_12 // PIN for flashlight LED
  241. #define FLASH_MODE GPIO_PIN_MODE_BUILTIN_FLASH_PWM
  242. // ******* Board type FREENOVE_ESP32S3
  243. #elif defined(BOARD_FREENOVE_ESP32S3)
  244. #define BoardType "ESP32-S3-CAM"
  245. // Uart
  246. //-------------------------------------------------
  247. #define UART_PORT_NUM UART_NUM_0
  248. #define UART_TX_GPIO_NUM GPIO_NUM_43
  249. #define UART_RX_GPIO_NUM GPIO_NUM_44
  250. #define UART_RTS_GPIO_NUM GPIO_NUM_NC
  251. #define UART_CTS_GPIO_NUM GPIO_NUM_NC
  252. #define UART_BUFFER_SIZE 2048
  253. // SD card (operated with SDMMC peripheral)
  254. //-------------------------------------------------
  255. #define GPIO_SDCARD_CLK GPIO_NUM_39 // MTCK, GPIO39, CLK_OUT3, SUBSPICS1
  256. #define GPIO_SDCARD_CMD GPIO_NUM_38 // GPIO38, FSPIWP, SUBSPIWP
  257. #define GPIO_SDCARD_D0 GPIO_NUM_40 // MTDO, GPIO40, CLK_OUT2
  258. #ifndef __SD_USE_ONE_LINE_MODE__
  259. #define GPIO_SDCARD_D1 GPIO_NUM_41 // MTDI, GPIO41, CLK_OUT1
  260. #define GPIO_SDCARD_D2 GPIO_NUM_14 // RTC_GPIO14, GPIO14, TOUCH14, ADC2_CH3, FSPIWP, FSPIDQS, SUBSPIWP
  261. #define GPIO_SDCARD_D3 GPIO_NUM_47 // SPICLK_P_DIFF, GPIO47, SUBSPICLK_P_DIFF
  262. #else
  263. #define GPIO_SDCARD_D1 GPIO_NUM_NC
  264. #define GPIO_SDCARD_D2 GPIO_NUM_NC
  265. #define GPIO_SDCARD_D3 GPIO_NUM_47
  266. #endif
  267. // Camera (suppotred OV2640 or OV5640)
  268. //-------------------------------------------------
  269. #define CAM_PIN_PWDN GPIO_NUM_NC
  270. #define CAM_PIN_RESET GPIO_NUM_NC // software reset will be performed
  271. #define CAM_PIN_XCLK GPIO_NUM_15
  272. #define CAM_PIN_SIOD GPIO_NUM_4
  273. #define CAM_PIN_SIOC GPIO_NUM_5
  274. #define CAM_PIN_D0 GPIO_NUM_11 // Y2_GPIO_NUM
  275. #define CAM_PIN_D1 GPIO_NUM_9 // Y3_GPIO_NUM
  276. #define CAM_PIN_D2 GPIO_NUM_8 // Y4_GPIO_NUM
  277. #define CAM_PIN_D3 GPIO_NUM_10 // Y5_GPIO_NUM
  278. #define CAM_PIN_D4 GPIO_NUM_12 // Y6_GPIO_NUM
  279. #define CAM_PIN_D5 GPIO_NUM_18 // Y7_GPIO_NUM
  280. #define CAM_PIN_D6 GPIO_NUM_17 // Y8_GPIO_NUM
  281. #define CAM_PIN_D7 GPIO_NUM_16 // Y9_GPIO_NUM
  282. #define CAM_PIN_VSYNC GPIO_NUM_6
  283. #define CAM_PIN_HREF GPIO_NUM_7
  284. #define CAM_PIN_PCLK GPIO_NUM_13
  285. #define CAM_XCLK_TIMER LEDC_TIMER_0
  286. #define CAM_XCLK_CHANNEL LEDC_CHANNEL_0
  287. // GpioHandler
  288. #define GPIO_IO1 GPIO_NUM_2
  289. #define GPIO_IO2 GPIO_NUM_21
  290. #define GPIO_IO3 GPIO_NUM_48
  291. #define GPIO_IO4 GPIO_NUM_NC
  292. // Statusled + ClassControllCamera
  293. #define BLINK_GPIO GPIO_NUM_2 // PIN for red board LED
  294. // #define BLINK_GPIO_INVERT
  295. // ClassControllCamera
  296. #define FLASH_GPIO GPIO_NUM_48 // PIN for flashlight LED
  297. #define FLASH_MODE GPIO_PIN_MODE_OUTPUT_WS281X
  298. #define FLASH_SMARTLED_TYPE LED_WS2812
  299. #define FLASH_SMARTLED_COLOR Rgb{127, 127, 127}
  300. #define FLASH_SMARTLED_QUANTITY 1
  301. // ******* Board type ESP32_S3_ETH_V1
  302. #elif defined(BOARD_ESP32_S3_ETH_V1)
  303. #define BoardType "ESP32-S3-ETH"
  304. // Uart
  305. //-------------------------------------------------
  306. #define UART_PORT_NUM UART_NUM_0
  307. #define UART_TX_GPIO_NUM GPIO_NUM_43
  308. #define UART_RX_GPIO_NUM GPIO_NUM_44
  309. #define UART_RTS_GPIO_NUM GPIO_NUM_NC
  310. #define UART_CTS_GPIO_NUM GPIO_NUM_NC
  311. #define UART_BUFFER_SIZE 2048
  312. // SD card (operated with SDMMC peripheral)
  313. //-------------------------------------------------
  314. #define GPIO_SDCARD_CLK GPIO_NUM_40
  315. #define GPIO_SDCARD_CMD GPIO_NUM_42
  316. #define GPIO_SDCARD_D0 GPIO_NUM_41
  317. #ifndef __SD_USE_ONE_LINE_MODE__
  318. #error "Board not suppotred SD_FOUR_LINE_MODE"
  319. #else
  320. #define GPIO_SDCARD_D1 GPIO_NUM_NC
  321. #define GPIO_SDCARD_D2 GPIO_NUM_NC
  322. #define GPIO_SDCARD_D3 GPIO_NUM_3
  323. #endif
  324. // SPI_ETHERNET_W5500
  325. //-------------------------------------------------
  326. #define PER_ENABLE GPIO_NUM_46
  327. #define ETH_SPI_EN GPIO_NUM_45
  328. #define ETH_SPI_NUM 1
  329. #define ETH_SPI_HOST SPI2_HOST
  330. #define ETH_SPI_CLOCK_MHZ 20 // SPI clock speed (MHz) (range 5 - 80, default 16)
  331. #define ETH_SPI_POLLING0_MS 10 // Set SPI Ethernet module polling period (default 10)
  332. #define ETH_SPI_PHY_ADDR0 ESP_ETH_PHY_ADDR_AUTO // PHY address, set -1 to enable PHY address detection at initialization stage
  333. #define ETH_SPI_CS0_GPIO GPIO_NUM_39
  334. #define ETH_SPI_INT0_GPIO GPIO_NUM_38
  335. #define ETH_SPI_PHY_RST0_GPIO GPIO_NUM_NC
  336. #define ETH_SPI_MISO_GPIO GPIO_NUM_14
  337. #define ETH_SPI_MOSI_GPIO GPIO_NUM_1
  338. #define ETH_SPI_SCLK_GPIO GPIO_NUM_21
  339. // Camera (suppotred OV2640 or OV5640)
  340. //-------------------------------------------------
  341. #define CAM_PIN_PWDN GPIO_NUM_NC
  342. #define CAM_PIN_RESET GPIO_NUM_NC // software reset will be performed
  343. #define CAM_PIN_XCLK GPIO_NUM_15
  344. #define CAM_PIN_SIOD GPIO_NUM_4
  345. #define CAM_PIN_SIOC GPIO_NUM_5
  346. #define CAM_PIN_D0 GPIO_NUM_11 // Y2_GPIO_NUM
  347. #define CAM_PIN_D1 GPIO_NUM_9 // Y3_GPIO_NUM
  348. #define CAM_PIN_D2 GPIO_NUM_8 // Y4_GPIO_NUM
  349. #define CAM_PIN_D3 GPIO_NUM_10 // Y5_GPIO_NUM
  350. #define CAM_PIN_D4 GPIO_NUM_12 // Y6_GPIO_NUM
  351. #define CAM_PIN_D5 GPIO_NUM_18 // Y7_GPIO_NUM
  352. #define CAM_PIN_D6 GPIO_NUM_17 // Y8_GPIO_NUM
  353. #define CAM_PIN_D7 GPIO_NUM_16 // Y9_GPIO_NUM
  354. #define CAM_PIN_VSYNC GPIO_NUM_6
  355. #define CAM_PIN_HREF GPIO_NUM_7
  356. #define CAM_PIN_PCLK GPIO_NUM_13
  357. #define CAM_XCLK_TIMER LEDC_TIMER_0
  358. #define CAM_XCLK_CHANNEL LEDC_CHANNEL_0
  359. // GpioHandler
  360. #define GPIO_IO1 GPIO_NUM_33
  361. #define GPIO_IO2 GPIO_NUM_34
  362. #define GPIO_IO3 GPIO_NUM_35
  363. #define GPIO_IO4 GPIO_NUM_36
  364. // Statusled + ClassControllCamera
  365. #define BLINK_GPIO GPIO_NUM_NC // PIN for red board LED
  366. // ClassControllCamera
  367. #define FLASH_GPIO GPIO_NUM_47 // PIN for flashlight LED
  368. #define FLASH_MODE GPIO_PIN_MODE_OUTPUT_WS281X
  369. #define FLASH_SMARTLED_TYPE LED_WS2812
  370. #define FLASH_SMARTLED_COLOR Rgb{127, 127, 127}
  371. #define FLASH_SMARTLED_QUANTITY 4
  372. // ******* Board type ESP32_S3_ETH_V2
  373. #elif defined(BOARD_ESP32_S3_ETH_V2)
  374. #define BoardType "ESP32-S3-ETH"
  375. // Uart
  376. //-------------------------------------------------
  377. #define UART_PORT_NUM UART_NUM_0
  378. #define UART_TX_GPIO_NUM GPIO_NUM_43
  379. #define UART_RX_GPIO_NUM GPIO_NUM_44
  380. #define UART_RTS_GPIO_NUM GPIO_NUM_NC
  381. #define UART_CTS_GPIO_NUM GPIO_NUM_NC
  382. #define UART_BUFFER_SIZE 2048
  383. // SD card (operated with SDMMC peripheral)
  384. //-------------------------------------------------
  385. #define GPIO_SDCARD_CLK GPIO_NUM_40
  386. #define GPIO_SDCARD_CMD GPIO_NUM_42
  387. #define GPIO_SDCARD_D0 GPIO_NUM_41
  388. #ifndef __SD_USE_ONE_LINE_MODE__
  389. #error "Board not suppotred SD_FOUR_LINE_MODE"
  390. #else
  391. #define GPIO_SDCARD_D1 GPIO_NUM_NC
  392. #define GPIO_SDCARD_D2 GPIO_NUM_NC
  393. #define GPIO_SDCARD_D3 GPIO_NUM_3
  394. #endif
  395. // SPI_ETHERNET_W5500
  396. //-------------------------------------------------
  397. #define PER_ENABLE GPIO_NUM_46
  398. #define ETH_SPI_EN GPIO_NUM_45
  399. #define ETH_SPI_NUM 1
  400. #define ETH_SPI_HOST SPI2_HOST
  401. #define ETH_SPI_CLOCK_MHZ 20 // SPI clock speed (MHz) (range 5 - 80, default 16)
  402. #define ETH_SPI_POLLING0_MS 10 // Set SPI Ethernet module polling period (default 10)
  403. #define ETH_SPI_PHY_ADDR0 ESP_ETH_PHY_ADDR_AUTO // PHY address, set -1 to enable PHY address detection at initialization stage
  404. #define ETH_SPI_CS0_GPIO GPIO_NUM_39
  405. #define ETH_SPI_INT0_GPIO GPIO_NUM_38
  406. #define ETH_SPI_PHY_RST0_GPIO GPIO_NUM_NC
  407. #define ETH_SPI_MISO_GPIO GPIO_NUM_14
  408. #define ETH_SPI_MOSI_GPIO GPIO_NUM_1
  409. #define ETH_SPI_SCLK_GPIO GPIO_NUM_21
  410. // Camera (suppotred OV2640 or OV5640)
  411. //-------------------------------------------------
  412. #define CAM_PIN_PWDN GPIO_NUM_NC
  413. #define CAM_PIN_RESET GPIO_NUM_NC // software reset will be performed
  414. #define CAM_PIN_XCLK GPIO_NUM_15
  415. #define CAM_PIN_SIOD GPIO_NUM_4
  416. #define CAM_PIN_SIOC GPIO_NUM_5
  417. #define CAM_PIN_D0 GPIO_NUM_11 // Y2_GPIO_NUM
  418. #define CAM_PIN_D1 GPIO_NUM_9 // Y3_GPIO_NUM
  419. #define CAM_PIN_D2 GPIO_NUM_8 // Y4_GPIO_NUM
  420. #define CAM_PIN_D3 GPIO_NUM_10 // Y5_GPIO_NUM
  421. #define CAM_PIN_D4 GPIO_NUM_47 // Y6_GPIO_NUM
  422. #define CAM_PIN_D5 GPIO_NUM_18 // Y7_GPIO_NUM
  423. #define CAM_PIN_D6 GPIO_NUM_17 // Y8_GPIO_NUM
  424. #define CAM_PIN_D7 GPIO_NUM_16 // Y9_GPIO_NUM
  425. #define CAM_PIN_VSYNC GPIO_NUM_6
  426. #define CAM_PIN_HREF GPIO_NUM_7
  427. #define CAM_PIN_PCLK GPIO_NUM_13
  428. #define CAM_XCLK_TIMER LEDC_TIMER_0
  429. #define CAM_XCLK_CHANNEL LEDC_CHANNEL_0
  430. // GpioHandler
  431. #define GPIO_IO1 GPIO_NUM_33
  432. #define GPIO_IO2 GPIO_NUM_34
  433. #define GPIO_IO3 GPIO_NUM_35
  434. #define GPIO_IO4 GPIO_NUM_36
  435. // Statusled + ClassControllCamera
  436. #define BLINK_GPIO GPIO_NUM_48 // PIN for red board LED
  437. // ClassControllCamera
  438. #define FLASH_GPIO GPIO_NUM_12 // PIN for flashlight LED
  439. #define FLASH_MODE GPIO_PIN_MODE_OUTPUT_WS281X
  440. #define FLASH_SMARTLED_TYPE LED_WS2812
  441. #define FLASH_SMARTLED_COLOR Rgb{127, 127, 127}
  442. #define FLASH_SMARTLED_QUANTITY 4
  443. #else
  444. #error "Board not selected"
  445. #endif // Board PIN Map
  446. // ******* LED definition
  447. //// PWM für Flash-LED
  448. #define LEDC_TIMER LEDC_TIMER_1
  449. #define LEDC_CHANNEL LEDC_CHANNEL_1
  450. #define LEDC_MODE LEDC_LOW_SPEED_MODE
  451. #define LEDC_DUTY_RES LEDC_TIMER_13_BIT // Set duty resolution to 13 bits
  452. #define LEDC_FREQUENCY (5000) // Frequency in Hertz. Set frequency at 5 kHz
  453. #define LEDC_OUTPUT_INVERT (0) // Enable (1) or disable (0) gpio output invert
  454. // softAP
  455. #define ESP_WIFI_AP_SSID "AI-on-the-Edge"
  456. #define ESP_WIFI_AP_IP "192.168.4.1"
  457. #define ESP_WIFI_AP_PASS ""
  458. #define ESP_WIFI_AP_CHANNEL 11
  459. #define ESP_WIFI_AP_MAX_STA_CONN 1
  460. #endif // ifndef defines_h