├── pics ├── STM32F407VET6.png ├── Async_AdvancedWebServer.png ├── AsyncWebServer_SendChunked.png ├── Async_AdvancedWebServer_1.png ├── Async_AdvancedWebServer_2.png ├── AsyncMultiWebServer_STM32_SVR1.png ├── AsyncMultiWebServer_STM32_SVR2.png ├── AsyncMultiWebServer_STM32_SVR3.png ├── Async_AdvancedWebServer_LAN8720.png ├── Async_AdvancedWebServer_favicon.png ├── AsyncMultiWebServer_STM32_LAN8720_SVR1.png ├── AsyncMultiWebServer_STM32_LAN8720_SVR2.png ├── AsyncMultiWebServer_STM32_LAN8720_SVR3.png └── Async_AdvancedWebServer_MemoryIssues_Send_CString.png ├── examples ├── AsyncFSBrowser_STM32 │ └── data │ │ ├── ace.js.gz │ │ ├── favicon.ico │ │ ├── mode-css.js.gz │ │ ├── mode-html.js.gz │ │ ├── worker-html.js.gz │ │ ├── ext-searchbox.js.gz │ │ ├── mode-javascript.js.gz │ │ └── index.htm ├── STM32_LAN8720 │ ├── AsyncFSBrowser_STM32_LAN8720 │ │ ├── data │ │ │ ├── ace.js.gz │ │ │ ├── favicon.ico │ │ │ ├── mode-css.js.gz │ │ │ ├── mode-html.js.gz │ │ │ ├── worker-html.js.gz │ │ │ ├── ext-searchbox.js.gz │ │ │ ├── mode-javascript.js.gz │ │ │ └── index.htm │ │ └── hal_conf_extra.h │ ├── WebClient_LAN8720 │ │ ├── hal_conf_extra.h │ │ ├── WebClient_LAN8720.ino │ │ └── defines.h │ ├── Async_HelloServer2_LAN8720 │ │ └── hal_conf_extra.h │ ├── Async_HelloServer_LAN8720 │ │ └── hal_conf_extra.h │ ├── Async_HttpBasicAuth_LAN8720 │ │ └── hal_conf_extra.h │ ├── Async_PostServer_LAN8720 │ │ └── hal_conf_extra.h │ ├── MQTTClient_Auth_LAN8720 │ │ ├── hal_conf_extra.h │ │ └── defines.h │ ├── MQTTClient_Basic_LAN8720 │ │ ├── hal_conf_extra.h │ │ ├── defines.h │ │ └── MQTTClient_Basic_LAN8720.ino │ ├── MQTT_ThingStream_LAN8720 │ │ ├── hal_conf_extra.h │ │ └── defines.h │ ├── WebClientRepeating_LAN8720 │ │ ├── hal_conf_extra.h │ │ ├── WebClientRepeating_LAN8720.ino │ │ └── defines.h │ ├── Async_AdvancedWebServer_LAN8720 │ │ └── hal_conf_extra.h │ ├── AsyncMultiWebServer_STM32_LAN8720 │ │ └── hal_conf_extra.h │ ├── Async_RegexPatterns_STM32_LAN8720 │ │ └── hal_conf_extra.h │ └── Async_SimpleWebServer_STM32_LAN8720 │ │ └── hal_conf_extra.h ├── WebClient │ ├── WebClient.ino │ └── defines.h ├── WebClientRepeating │ ├── WebClientRepeating.ino │ └── defines.h ├── AsyncWebServer_SendChunked │ └── defines.h ├── Async_AdvancedWebServer_SendChunked │ └── defines.h ├── MQTTClient_Auth │ └── defines.h ├── MQTTClient_Basic │ ├── defines.h │ └── MQTTClient_Basic.ino ├── MQTT_ThingStream │ └── defines.h └── Async_AdvancedWebServer_favicon │ └── favicon.h ├── utils ├── restyle.sh └── astyle_library.conf ├── .codespellrc ├── .github ├── workflows │ ├── report-size-deltas.yml │ └── spell-check.yml ├── dependabot.yml ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── stale.yml ├── library.properties ├── src ├── Crypto │ ├── Hash.h │ ├── Hash.cpp │ ├── md5.h │ └── sha1.h ├── libb64 │ ├── cdecode.h │ ├── cencode.h │ ├── cencode.c │ └── cdecode.c ├── AsyncWebAuthentication_STM32.h └── AsyncWebSynchronization_STM32.h ├── travis └── common.sh ├── library.json ├── CONTRIBUTING.md ├── Packages_Patches └── STM32 │ └── hardware │ └── stm32 │ ├── 1.9.0 │ └── variants │ │ ├── NUCLEO_L053R8 │ │ └── variant.h │ │ └── NUCLEO_F767ZI │ │ └── variant.h │ ├── 2.0.0 │ └── variants │ │ ├── L052R(6-8)H_L053R(6-8)H │ │ └── variant_generic.h │ │ └── STM32L0xx │ │ └── L052R(6-8)T_L053R(6-8)T_L063R8T │ │ └── variant_generic.h │ └── 2.1.0 │ └── variants │ └── STM32L0xx │ └── L052R(6-8)T_L053R(6-8)T_L063R8T │ └── variant_generic.h ├── changelog.md └── platformio └── platformio.ini /pics/STM32F407VET6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/STM32F407VET6.png -------------------------------------------------------------------------------- /pics/Async_AdvancedWebServer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/Async_AdvancedWebServer.png -------------------------------------------------------------------------------- /pics/AsyncWebServer_SendChunked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/AsyncWebServer_SendChunked.png -------------------------------------------------------------------------------- /pics/Async_AdvancedWebServer_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/Async_AdvancedWebServer_1.png -------------------------------------------------------------------------------- /pics/Async_AdvancedWebServer_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/Async_AdvancedWebServer_2.png -------------------------------------------------------------------------------- /pics/AsyncMultiWebServer_STM32_SVR1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/AsyncMultiWebServer_STM32_SVR1.png -------------------------------------------------------------------------------- /pics/AsyncMultiWebServer_STM32_SVR2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/AsyncMultiWebServer_STM32_SVR2.png -------------------------------------------------------------------------------- /pics/AsyncMultiWebServer_STM32_SVR3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/AsyncMultiWebServer_STM32_SVR3.png -------------------------------------------------------------------------------- /pics/Async_AdvancedWebServer_LAN8720.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/Async_AdvancedWebServer_LAN8720.png -------------------------------------------------------------------------------- /pics/Async_AdvancedWebServer_favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/Async_AdvancedWebServer_favicon.png -------------------------------------------------------------------------------- /examples/AsyncFSBrowser_STM32/data/ace.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/AsyncFSBrowser_STM32/data/ace.js.gz -------------------------------------------------------------------------------- /examples/AsyncFSBrowser_STM32/data/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/AsyncFSBrowser_STM32/data/favicon.ico -------------------------------------------------------------------------------- /pics/AsyncMultiWebServer_STM32_LAN8720_SVR1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/AsyncMultiWebServer_STM32_LAN8720_SVR1.png -------------------------------------------------------------------------------- /pics/AsyncMultiWebServer_STM32_LAN8720_SVR2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/AsyncMultiWebServer_STM32_LAN8720_SVR2.png -------------------------------------------------------------------------------- /pics/AsyncMultiWebServer_STM32_LAN8720_SVR3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/AsyncMultiWebServer_STM32_LAN8720_SVR3.png -------------------------------------------------------------------------------- /examples/AsyncFSBrowser_STM32/data/mode-css.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/AsyncFSBrowser_STM32/data/mode-css.js.gz -------------------------------------------------------------------------------- /examples/AsyncFSBrowser_STM32/data/mode-html.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/AsyncFSBrowser_STM32/data/mode-html.js.gz -------------------------------------------------------------------------------- /examples/AsyncFSBrowser_STM32/data/worker-html.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/AsyncFSBrowser_STM32/data/worker-html.js.gz -------------------------------------------------------------------------------- /examples/AsyncFSBrowser_STM32/data/ext-searchbox.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/AsyncFSBrowser_STM32/data/ext-searchbox.js.gz -------------------------------------------------------------------------------- /examples/AsyncFSBrowser_STM32/data/mode-javascript.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/AsyncFSBrowser_STM32/data/mode-javascript.js.gz -------------------------------------------------------------------------------- /pics/Async_AdvancedWebServer_MemoryIssues_Send_CString.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/pics/Async_AdvancedWebServer_MemoryIssues_Send_CString.png -------------------------------------------------------------------------------- /examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/ace.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/ace.js.gz -------------------------------------------------------------------------------- /examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/favicon.ico -------------------------------------------------------------------------------- /examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/mode-css.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/mode-css.js.gz -------------------------------------------------------------------------------- /examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/mode-html.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/mode-html.js.gz -------------------------------------------------------------------------------- /examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/worker-html.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/worker-html.js.gz -------------------------------------------------------------------------------- /examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/ext-searchbox.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/ext-searchbox.js.gz -------------------------------------------------------------------------------- /examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/mode-javascript.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khoih-prog/AsyncWebServer_STM32/HEAD/examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/mode-javascript.js.gz -------------------------------------------------------------------------------- /utils/restyle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for dir in . ; do 4 | find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.ino" \) -exec astyle --suffix=none --options=./utils/astyle_library.conf \{\} \; 5 | done 6 | 7 | -------------------------------------------------------------------------------- /.codespellrc: -------------------------------------------------------------------------------- 1 | # See: https://github.com/codespell-project/codespell#using-a-config-file 2 | [codespell] 3 | # In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: 4 | ignore-words-list = , 5 | check-filenames = 6 | check-hidden = 7 | skip = ./.git,./src,./examples,./Packages_Patches,./LibraryPatches 8 | -------------------------------------------------------------------------------- /.github/workflows/report-size-deltas.yml: -------------------------------------------------------------------------------- 1 | name: Report Size Deltas 2 | 3 | on: 4 | schedule: 5 | - cron: '*/5 * * * *' 6 | 7 | jobs: 8 | report: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Comment size deltas reports to PRs 13 | uses: arduino/report-size-deltas@v1 14 | with: 15 | # The name of the workflow artifact created by the "Compile Examples" workflow 16 | sketches-reports-source: sketches-reports 17 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # See: https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#about-the-dependabotyml-file 2 | version: 2 3 | 4 | updates: 5 | # Configure check for outdated GitHub Actions actions in workflows. 6 | # See: https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot 7 | - package-ecosystem: github-actions 8 | directory: / # Check the repository's workflows under /.github/workflows/ 9 | schedule: 10 | interval: daily 11 | -------------------------------------------------------------------------------- /.github/workflows/spell-check.yml: -------------------------------------------------------------------------------- 1 | name: Spell Check 2 | 3 | on: 4 | pull_request: 5 | push: 6 | schedule: 7 | # run every Tuesday at 3 AM UTC 8 | - cron: "0 3 * * 2" 9 | workflow_dispatch: 10 | repository_dispatch: 11 | 12 | jobs: 13 | spellcheck: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v3 19 | 20 | # See: https://github.com/codespell-project/actions-codespell/blob/master/README.md 21 | - name: Spell check 22 | uses: codespell-project/actions-codespell@master 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=AsyncWebServer_STM32 2 | version=1.6.1 3 | author=Hristo Gochkov,Khoi Hoang 4 | maintainer=Khoi Hoang 5 | sentence=AsyncWebServer for STM32F/L/H/G/WB/MP1 using LAN8720 or builtin LAN8742A Ethernet 6 | paragraph=This AsyncWebServer Library for STM32 is currently working on STM32F/L/H/G/WB/MP1 boards, such as Nucleo-144 F767ZI, etc., using LAN8720 or builtin LAN8742A Ethernet. Now support using CString to save heap to send very large data and examples to demo how to use beginChunkedResponse() to send large html in chunks 7 | category=Communication,AsyncWebServer 8 | url=https://github.com/khoih-prog/AsyncWebServer_STM32 9 | architectures=stm32 10 | repository=https://github.com/khoih-prog/AsyncWebServer_STM32 11 | license=GPLv3 12 | depends=STM32duino LwIP,STM32duino STM32Ethernet 13 | includes=LwIP.h,STM32Ethernet.h,AsyncWebServer_STM32.h 14 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | daysUntilStale: 60 4 | daysUntilClose: 14 5 | limitPerRun: 30 6 | staleLabel: stale 7 | exemptLabels: 8 | - pinned 9 | - security 10 | - "to be implemented" 11 | - "for reference" 12 | - "move to PR" 13 | - "enhancement" 14 | 15 | only: issues 16 | onlyLabels: [] 17 | exemptProjects: false 18 | exemptMilestones: false 19 | exemptAssignees: false 20 | 21 | markComment: > 22 | [STALE_SET] This issue has been automatically marked as stale because it has not had 23 | recent activity. It will be closed in 14 days if no further activity occurs. Thank you 24 | for your contributions. 25 | 26 | unmarkComment: > 27 | [STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it opening the future. 28 | 29 | closeComment: > 30 | [STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. 31 | 32 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/WebClient_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/Async_HelloServer2_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/Async_HelloServer_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/Async_HttpBasicAuth_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/Async_PostServer_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/MQTTClient_Auth_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/MQTTClient_Basic_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/MQTT_ThingStream_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/WebClientRepeating_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/Async_AdvancedWebServer_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/AsyncMultiWebServer_STM32_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/Async_RegexPatterns_STM32_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/Async_SimpleWebServer_STM32_LAN8720/hal_conf_extra.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | hal_conf_extra.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 run LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | // Note: Must replace 14 | // .arduino15/packages/STM32/hardware/stm32/x.y.z/system/STM32F4xx/stm32f4xx_hal_conf_default.h 15 | // as described in README.md 16 | 17 | #pragma once 18 | 19 | #ifndef HAL_CONF_EXTRA_STM32_H 20 | #define HAL_CONF_EXTRA_STM32_H 21 | 22 | #include 23 | 24 | // Don't need from core v2.3.0 25 | 26 | #if (STM32_CORE_VERSION < 0x2030000) 27 | #warning Using STM32 core < v2.3.0 28 | #define HAL_ETH_MODULE_ENABLED 29 | #endif 30 | 31 | #define LAN8742A_PHY_ADDRESS 0x01U 32 | 33 | #endif // HAL_CONF_EXTRA_STM32_H 34 | -------------------------------------------------------------------------------- /utils/astyle_library.conf: -------------------------------------------------------------------------------- 1 | # Code formatting rules for Arduino libraries, modified from for KH libraries: 2 | # 3 | # https://github.com/arduino/Arduino/blob/master/build/shared/examples_formatter.conf 4 | # 5 | 6 | # astyle --style=allman -s2 -t2 -C -S -xW -Y -M120 -f -p -xg -H -xb -c --xC120 -xL *.h *.cpp *.ino 7 | 8 | --mode=c 9 | --lineend=linux 10 | --style=allman 11 | 12 | # -r or -R 13 | #--recursive 14 | 15 | # -c => Converts tabs into spaces 16 | convert-tabs 17 | 18 | # -s2 => 2 spaces indentation 19 | --indent=spaces=2 20 | 21 | # -t2 => tab =2 spaces 22 | #--indent=tab=2 23 | 24 | # -C 25 | --indent-classes 26 | 27 | # -S 28 | --indent-switches 29 | 30 | # -xW 31 | --indent-preproc-block 32 | 33 | # -Y => indent classes, switches (and cases), comments starting at column 1 34 | --indent-col1-comments 35 | 36 | # -M120 => maximum of 120 spaces to indent a continuation line 37 | --max-continuation-indent=120 38 | 39 | # -xC120 => max‑code‑length will break a line if the code exceeds # characters 40 | --max-code-length=120 41 | 42 | # -f => 43 | --break-blocks 44 | 45 | # -p => put a space around operators 46 | --pad-oper 47 | 48 | # -xg => Insert space padding after commas 49 | --pad-comma 50 | 51 | # -H => put a space after if/for/while 52 | pad-header 53 | 54 | # -xb => Break one line headers (e.g. if/for/while) 55 | --break-one-line-headers 56 | 57 | # -c => Converts tabs into spaces 58 | #--convert-tabs 59 | 60 | # if you like one-liners, keep them 61 | #keep-one-line-statements 62 | 63 | # -xV 64 | --attach-closing-while 65 | 66 | #unpad-paren 67 | 68 | # -xp 69 | remove-comment-prefix 70 | 71 | -------------------------------------------------------------------------------- /src/Crypto/Hash.h: -------------------------------------------------------------------------------- 1 | /** 2 | @file Hash.h 3 | @date 20.05.2015 4 | @author Markus Sattler 5 | 6 | Copyright (c) 2015 Markus Sattler. All rights reserved. 7 | This file is part of the esp8266 core for Arduino environment. 8 | 9 | This library is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU Lesser General Public 11 | License as published by the Free Software Foundation; either 12 | version 2.1 of the License, or (at your option) any later version. 13 | 14 | This library is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public 20 | License along with this library; if not, write to the Free Software 21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 | 23 | */ 24 | 25 | #pragma once 26 | 27 | #ifndef HASH_H_ 28 | #define HASH_H_ 29 | 30 | #include "AsyncWebServer_Debug_STM32.h" 31 | 32 | #ifdef HASH_BUFFER_SIZE 33 | #undef HASH_BUFFER_SIZE 34 | #endif 35 | 36 | #define HASH_BUFFER_SIZE 20 37 | 38 | void sha1(const uint8_t* data, uint32_t size, uint8_t hash[HASH_BUFFER_SIZE]); 39 | void sha1(const char* data, uint32_t size, uint8_t hash[HASH_BUFFER_SIZE]); 40 | void sha1(const String& data, uint8_t hash[HASH_BUFFER_SIZE]); 41 | 42 | String sha1(const uint8_t* data, uint32_t size); 43 | String sha1(const char* data, uint32_t size); 44 | String sha1(const String& data); 45 | 46 | #endif /* HASH_H_ */ 47 | -------------------------------------------------------------------------------- /travis/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function build_examples() 4 | { 5 | # track the exit code for this platform 6 | local exit_code=0 7 | # loop through results and add them to the array 8 | examples=($(find $PWD/examples/ -name "*.pde" -o -name "*.ino")) 9 | 10 | # get the last example in the array 11 | local last="${examples[@]:(-1)}" 12 | 13 | # loop through example sketches 14 | for example in "${examples[@]}"; do 15 | 16 | # store the full path to the example's sketch directory 17 | local example_dir=$(dirname $example) 18 | 19 | # store the filename for the example without the path 20 | local example_file=$(basename $example) 21 | 22 | echo "$example_file: " 23 | local sketch="$example_dir/$example_file" 24 | echo "$sketch" 25 | #arduino -v --verbose-build --verify $sketch 26 | 27 | # verify the example, and save stdout & stderr to a variable 28 | # we have to avoid reading the exit code of local: 29 | # "when declaring a local variable in a function, the local acts as a command in its own right" 30 | local build_stdout 31 | build_stdout=$(arduino --verify $sketch 2>&1) 32 | 33 | # echo output if the build failed 34 | if [ $? -ne 0 ]; then 35 | # heavy X 36 | echo -e "\xe2\x9c\x96" 37 | echo -e "----------------------------- DEBUG OUTPUT -----------------------------\n" 38 | echo "$build_stdout" 39 | echo -e "\n------------------------------------------------------------------------\n" 40 | 41 | # mark as fail 42 | exit_code=1 43 | 44 | else 45 | # heavy checkmark 46 | echo -e "\xe2\x9c\x93" 47 | fi 48 | done 49 | 50 | return $exit_code 51 | } 52 | -------------------------------------------------------------------------------- /library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"AsyncWebServer_STM32", 3 | "version": "1.6.1", 4 | "keywords":"http, async, websocket, webserver, async-webserver, async-tcp, async-udp, async-websocket, async-http, ssl, tls, stm32, stm32f, stm32l, stm32h, stm32g, stm32wb, stm32mp1, ethernet, lan8742a, lan8720, bluepill, blackpill, f407ve, f767zi, nucleo, nucleo-144", 5 | "description":"Asynchronous HTTP and WebSocket Server Library for STM32F/L/H/G/WB/MP1 using LAN8720 or built-in LAN8742A Ethernet. Now support using CString to save heap to send very large data and examples to demo how to use beginChunkedResponse() to send large html in chunks", 6 | "authors": 7 | [ 8 | { 9 | "name": "Hristo Gochkov", 10 | "url": "https://github.com/me-no-dev" 11 | }, 12 | { 13 | "name": "Khoi Hoang", 14 | "url": "https://github.com/khoih-prog", 15 | "email": "khoih.prog@gmail.com", 16 | "maintainer": true 17 | } 18 | ], 19 | "repository": 20 | { 21 | "type": "git", 22 | "url": "https://github.com/khoih-prog/AsyncWebServer_STM32" 23 | }, 24 | "homepage": "https://github.com/khoih-prog/AsyncWebServer_STM32", 25 | "export": { 26 | "exclude": [ 27 | "linux", 28 | "extras", 29 | "tests" 30 | ] 31 | }, 32 | "dependencies": 33 | [ 34 | { 35 | "owner": "stm32duino", 36 | "name": "STM32duino LwIP", 37 | "version": "^2.1.2", 38 | "platforms": "ststm32" 39 | }, 40 | { 41 | "owner": "stm32duino", 42 | "name": "STM32Ethernet", 43 | "version": "^1.3.0", 44 | "platforms": "ststm32" 45 | }, 46 | { 47 | "name": "STM32AsyncTCP", 48 | "version": "https://github.com/khoih-prog/STM32AsyncTCP" 49 | } 50 | ], 51 | "license": "LGPL-3.0", 52 | "frameworks": "arduino", 53 | "platforms": ["ststm32"], 54 | "examples": "examples/*/*/*.ino", 55 | "headers": ["AsyncWebServer_STM32.h"] 56 | } 57 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing to AsyncWebServer_STM32 2 | 3 | ### Reporting Bugs 4 | 5 | Please report bugs in AsyncWebServer_STM32 if you find them. 6 | 7 | However, before reporting a bug please check through the following: 8 | 9 | * [Existing Open Issues](https://github.com/khoih-prog/AsyncWebServer_STM32/issues) - someone might have already encountered this. 10 | 11 | If you don't find anything, please [open a new issue](https://github.com/khoih-prog/AsyncWebServer_STM32/issues/new). 12 | 13 | ### How to submit a bug report 14 | 15 | Please ensure to specify the following: 16 | 17 | * Arduino IDE version (e.g. 1.8.19) or Platform.io version 18 | * `STM32` Core Version (e.g. STM32 core v2.3.0) 19 | * Board type and relevant info 20 | * Contextual information (e.g. what you were trying to achieve) 21 | * Simplest possible steps to reproduce 22 | * Anything that might be relevant in your opinion, such as: 23 | * Operating system (Windows, Ubuntu, etc.) and the output of `uname -a` 24 | * Network configuration 25 | 26 | 27 | ### Example 28 | 29 | ``` 30 | Arduino IDE version: 1.8.19 31 | STM32 Core Version 2.3.0 32 | Nucleo-144 STM32F7 NUCLEO_F767ZI 33 | OS: Ubuntu 20.04 LTS 34 | Linux xy-Inspiron-3593 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux 35 | 36 | Context: 37 | I encountered a crash while using this library 38 | Steps to reproduce: 39 | 1. ... 40 | 2. ... 41 | 3. ... 42 | 4. ... 43 | ``` 44 | 45 | ### Additional context 46 | 47 | Add any other context about the problem here. 48 | 49 | --- 50 | 51 | ### Sending Feature Requests 52 | 53 | Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful. 54 | 55 | There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/AsyncWebServer_STM32/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them. 56 | 57 | --- 58 | 59 | ### Sending Pull Requests 60 | 61 | Pull Requests with changes and fixes are also welcome! 62 | 63 | Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux) 64 | 65 | 1. Change directory to the library GitHub 66 | 67 | ``` 68 | xy@xy-Inspiron-3593:~$ cd Arduino/xy/AsyncWebServer_STM32_GitHub/ 69 | xy@xy-Inspiron-3593:~/Arduino/xy/AsyncWebServer_STM32_GitHub$ 70 | ``` 71 | 72 | 2. Issue astyle command 73 | 74 | ``` 75 | xy@xy-Inspiron-3593:~/Arduino/xy/AsyncWebServer_STM32_GitHub$ bash utils/restyle.sh 76 | ``` 77 | 78 | -------------------------------------------------------------------------------- /src/libb64/cdecode.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | cdecode.h - c header for a base64 decoding algorithm 3 | 4 | This is part of the libb64 project, and has been placed in the public domain. 5 | For details, see http://sourceforge.net/projects/libb64 6 | 7 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 8 | 9 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 10 | 11 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 12 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 13 | 14 | Copyright (c) 2016 Hristo Gochkov. All rights reserved. 15 | This file is part of the esp8266 core for Arduino environment. 16 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License 17 | as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. 18 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 20 | You should have received a copy of the GNU General Public License along with this program. 21 | If not, see . 22 | *****************************************************************************************************************************/ 23 | 24 | #pragma once 25 | 26 | // Reintroduce to prevent duplication compile error if other lib/core already has LIB64 27 | // pragma once can't prevent that 28 | #ifndef BASE64_CDECODE_H 29 | #define BASE64_CDECODE_H 30 | 31 | #define base64_decode_expected_len(n) ((n * 3) / 4) 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | typedef enum 38 | { 39 | step_a, step_b, step_c, step_d 40 | } base64_decodestep; 41 | 42 | typedef struct 43 | { 44 | base64_decodestep step; 45 | char plainchar; 46 | } base64_decodestate; 47 | 48 | void base64_init_decodestate(base64_decodestate* state_in); 49 | 50 | int base64_decode_value(int value_in); 51 | 52 | int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in); 53 | 54 | int base64_decode_chars(const char* code_in, const int length_in, char* plaintext_out); 55 | 56 | #ifdef __cplusplus 57 | } // extern "C" 58 | #endif 59 | 60 | #endif /* BASE64_CDECODE_H */ 61 | -------------------------------------------------------------------------------- /src/libb64/cencode.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | cencode.h - c header for a base64 encoding algorithm 3 | 4 | This is part of the libb64 project, and has been placed in the public domain. 5 | For details, see http://sourceforge.net/projects/libb64 6 | 7 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 8 | 9 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 10 | 11 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 12 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 13 | 14 | Copyright (c) 2016 Hristo Gochkov. All rights reserved. 15 | This file is part of the esp8266 core for Arduino environment. 16 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License 17 | as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. 18 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 20 | You should have received a copy of the GNU General Public License along with this program. 21 | If not, see . 22 | *****************************************************************************************************************************/ 23 | 24 | #pragma once 25 | 26 | // Reintroduce to prevent duplication compile error if other lib/core already has LIB64 27 | // pragma once can't prevent that 28 | #ifndef BASE64_CENCODE_H 29 | #define BASE64_CENCODE_H 30 | 31 | #define base64_encode_expected_len(n) ((((4 * n) / 3) + 3) & ~3) 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | typedef enum 38 | { 39 | step_A, step_B, step_C 40 | } base64_encodestep; 41 | 42 | typedef struct 43 | { 44 | base64_encodestep step; 45 | char result; 46 | int stepcount; 47 | } base64_encodestate; 48 | 49 | void base64_init_encodestate(base64_encodestate* state_in); 50 | 51 | char base64_encode_value(char value_in); 52 | 53 | int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in); 54 | 55 | int base64_encode_blockend(char* code_out, base64_encodestate* state_in); 56 | 57 | int base64_encode_chars(const char* plaintext_in, int length_in, char* code_out); 58 | 59 | #ifdef __cplusplus 60 | } // extern "C" 61 | #endif 62 | 63 | #endif /* BASE64_CENCODE_H */ 64 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Describe the bug 11 | 12 | A clear and concise description of what the bug is. 13 | 14 | ### Steps to Reproduce 15 | 16 | Steps to reproduce the behavior. Including the [MRE](https://stackoverflow.com/help/minimal-reproducible-example) sketches 17 | 18 | ### Expected behavior 19 | 20 | A clear and concise description of what you expected to happen. 21 | 22 | ### Actual behavior 23 | 24 | A clear and concise description of what you expected to happen. 25 | 26 | ### Debug and AT-command log (if applicable) 27 | 28 | A clear and concise description of what you expected to happen. 29 | 30 | ### Screenshots 31 | 32 | If applicable, add screenshots to help explain your problem. 33 | 34 | ### Information 35 | 36 | Please ensure to specify the following: 37 | 38 | * Arduino IDE version (e.g. 1.8.19) or Platform.io version 39 | * `STM32` Core Version (e.g. STM32 core v2.3.0) 40 | * Board type and relevant info 41 | * Contextual information (e.g. what you were trying to achieve) 42 | * Simplest possible steps to reproduce 43 | * Anything that might be relevant in your opinion, such as: 44 | * Operating system (Windows, Ubuntu, etc.) and the output of `uname -a` 45 | * Network configuration 46 | 47 | 48 | ### Example 49 | 50 | ``` 51 | Arduino IDE version: 1.8.19 52 | STM32 Core Version 2.3.0 53 | Nucleo-144 STM32F7 NUCLEO_F767ZI 54 | OS: Ubuntu 20.04 LTS 55 | Linux xy-Inspiron-3593 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux 56 | 57 | Context: 58 | I encountered a crash while using this library 59 | Steps to reproduce: 60 | 1. ... 61 | 2. ... 62 | 3. ... 63 | 4. ... 64 | ``` 65 | 66 | ### Additional context 67 | 68 | Add any other context about the problem here. 69 | 70 | --- 71 | 72 | ### Sending Feature Requests 73 | 74 | Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful. 75 | 76 | There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/AsyncWebServer_STM32/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them. 77 | 78 | --- 79 | 80 | ### Sending Pull Requests 81 | 82 | Pull Requests with changes and fixes are also welcome! 83 | 84 | Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux) 85 | 86 | 1. Change directory to the library GitHub 87 | 88 | ``` 89 | xy@xy-Inspiron-3593:~$ cd Arduino/xy/AsyncWebServer_STM32_GitHub/ 90 | xy@xy-Inspiron-3593:~/Arduino/xy/AsyncWebServer_STM32_GitHub$ 91 | ``` 92 | 93 | 2. Issue astyle command 94 | 95 | ``` 96 | xy@xy-Inspiron-3593:~/Arduino/xy/AsyncWebServer_STM32_GitHub$ bash utils/restyle.sh 97 | ``` 98 | 99 | -------------------------------------------------------------------------------- /src/Crypto/Hash.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | @file Hash.cpp 3 | @date 20.05.2015 4 | @author Markus Sattler 5 | 6 | Copyright (c) 2015 Markus Sattler. All rights reserved. 7 | This file is part of the esp8266 core for Arduino environment. 8 | 9 | This library is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU Lesser General Public 11 | License as published by the Free Software Foundation; either 12 | version 2.1 of the License, or (at your option) any later version. 13 | 14 | This library is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public 20 | License along with this library; if not, write to the Free Software 21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 | 23 | */ 24 | 25 | #include 26 | #include "bearssl_hash.h" 27 | 28 | #include "Hash.h" 29 | 30 | /** 31 | create a sha1 hash from data 32 | @param data uint8_t 33 | @param size uint32_t 34 | @param hash uint8_t[HASH_BUFFER_SIZE] 35 | */ 36 | void sha1(const uint8_t* data, uint32_t size, uint8_t hash[HASH_BUFFER_SIZE]) 37 | { 38 | br_sha1_context ctx; 39 | 40 | LOGDEBUG0("DATA:"); 41 | 42 | for (uint16_t i = 0; i < size; i++) 43 | { 44 | LOGDEBUG0(data[i]); 45 | } 46 | 47 | LOGDEBUG0("\nDATA:"); 48 | 49 | for (uint16_t i = 0; i < size; i++) 50 | { 51 | LOGDEBUG0((char) data[i]); 52 | 53 | } 54 | 55 | LOGDEBUG0("\n"); 56 | 57 | br_sha1_init(&ctx); 58 | br_sha1_update(&ctx, data, size); 59 | br_sha1_out(&ctx, hash); 60 | 61 | LOGDEBUG0("SHA1:"); 62 | 63 | for (uint16_t i = 0; i < HASH_BUFFER_SIZE; i++) 64 | { 65 | LOGDEBUG0(hash[i]); 66 | } 67 | 68 | LOGDEBUG0("\n"); 69 | } 70 | 71 | void sha1(const char* data, uint32_t size, uint8_t hash[HASH_BUFFER_SIZE]) 72 | { 73 | sha1((const uint8_t *) data, size, hash); 74 | } 75 | 76 | void sha1(const String& data, uint8_t hash[HASH_BUFFER_SIZE]) 77 | { 78 | sha1(data.c_str(), data.length(), hash); 79 | } 80 | 81 | String sha1(const uint8_t* data, uint32_t size) 82 | { 83 | uint8_t hash[HASH_BUFFER_SIZE]; 84 | 85 | String hashStr((const char*)nullptr); 86 | hashStr.reserve(HASH_BUFFER_SIZE * 2 + 1); 87 | 88 | sha1(&data[0], size, &hash[0]); 89 | 90 | for (uint16_t i = 0; i < HASH_BUFFER_SIZE; i++) 91 | { 92 | char hex[3]; 93 | snprintf(hex, sizeof(hex), "%02x", hash[i]); 94 | hashStr += hex; 95 | } 96 | 97 | return hashStr; 98 | } 99 | 100 | String sha1(const char* data, uint32_t size) 101 | { 102 | return sha1((const uint8_t*) data, size); 103 | } 104 | 105 | String sha1(const String& data) 106 | { 107 | return sha1(data.c_str(), data.length()); 108 | } 109 | 110 | -------------------------------------------------------------------------------- /src/Crypto/md5.h: -------------------------------------------------------------------------------- 1 | /** 2 | \file md5.h 3 | 4 | Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | 6 | Copyright (C) 2009 Paul Bakker 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 14 | * * Redistributions of source code must retain the above copyright 15 | notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | notice, this list of conditions and the following disclaimer in the 18 | documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #pragma once 37 | 38 | #ifndef LWIP_INCLUDED_POLARSSL_MD5_H 39 | #define LWIP_INCLUDED_POLARSSL_MD5_H 40 | 41 | #include "AsyncWebServer_Debug_STM32.h" 42 | 43 | /** 44 | \brief MD5 context structure 45 | */ 46 | typedef struct 47 | { 48 | unsigned long total[2]; /*!< number of bytes processed */ 49 | unsigned long state[4]; /*!< intermediate digest state */ 50 | unsigned char buffer[64]; /*!< data block being processed */ 51 | } 52 | md5_context; 53 | 54 | #ifdef __cplusplus 55 | extern "C" { 56 | #endif 57 | 58 | /** 59 | \brief MD5 context setup 60 | 61 | \param ctx context to be initialized 62 | */ 63 | void md5_starts( md5_context *ctx ); 64 | 65 | /** 66 | \brief MD5 process buffer 67 | 68 | \param ctx MD5 context 69 | \param input buffer holding the data 70 | \param ilen length of the input data 71 | */ 72 | void md5_update( md5_context *ctx, const unsigned char *input, int ilen ); 73 | 74 | /** 75 | \brief MD5 final digest 76 | 77 | \param ctx MD5 context 78 | \param output MD5 checksum result 79 | */ 80 | void md5_finish( md5_context *ctx, unsigned char output[16] ); 81 | 82 | /** 83 | \brief Output = MD5( input buffer ) 84 | 85 | \param input buffer holding the data 86 | \param ilen length of the input data 87 | \param output MD5 checksum result 88 | */ 89 | void md5( unsigned char *input, int ilen, unsigned char output[16] ); 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /* LWIP_INCLUDED_POLARSSL_MD5_H */ 96 | -------------------------------------------------------------------------------- /src/Crypto/sha1.h: -------------------------------------------------------------------------------- 1 | /** 2 | \file sha1.h 3 | 4 | Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | 6 | Copyright (C) 2009 Paul Bakker 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 14 | * * Redistributions of source code must retain the above copyright 15 | notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | notice, this list of conditions and the following disclaimer in the 18 | documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #pragma once 37 | 38 | #ifndef LWIP_INCLUDED_POLARSSL_SHA1_H 39 | #define LWIP_INCLUDED_POLARSSL_SHA1_H 40 | 41 | #include "AsyncWebServer_Debug_STM32.h" 42 | 43 | #ifdef SHA1_BUFFER_SIZE 44 | #undef SHA1_BUFFER_SIZE 45 | #endif 46 | 47 | #define SHA1_BUFFER_SIZE 20 48 | 49 | /** 50 | \brief SHA-1 context structure 51 | */ 52 | typedef struct 53 | { 54 | unsigned long total[2]; /*!< number of bytes processed */ 55 | unsigned long state[5]; /*!< intermediate digest state */ 56 | unsigned char buffer[64]; /*!< data block being processed */ 57 | } 58 | sha1_context; 59 | 60 | #ifdef __cplusplus 61 | extern "C" { 62 | #endif 63 | 64 | /** 65 | \brief SHA-1 context setup 66 | 67 | \param ctx context to be initialized 68 | */ 69 | void sha1_starts( sha1_context *ctx ); 70 | 71 | /** 72 | \brief SHA-1 process buffer 73 | 74 | \param ctx SHA-1 context 75 | \param input buffer holding the data 76 | \param ilen length of the input data 77 | */ 78 | void sha1_update( sha1_context *ctx, const unsigned char *input, int ilen ); 79 | 80 | /** 81 | \brief SHA-1 final digest 82 | 83 | \param ctx SHA-1 context 84 | \param output SHA-1 checksum result 85 | */ 86 | void sha1_finish( sha1_context *ctx, unsigned char output[SHA1_BUFFER_SIZE] ); 87 | 88 | /** 89 | \brief Output = SHA-1( input buffer ) 90 | 91 | \param input buffer holding the data 92 | \param ilen length of the input data 93 | \param output SHA-1 checksum result 94 | */ 95 | void sha1( unsigned char *input, int ilen, unsigned char output[SHA1_BUFFER_SIZE] ); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif /* LWIP_INCLUDED_POLARSSL_SHA1_H */ 102 | -------------------------------------------------------------------------------- /src/AsyncWebAuthentication_STM32.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | AsyncWebAuthentication_STM32.h - Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | 11 | Copyright (c) 2016 Hristo Gochkov. All rights reserved. 12 | This file is part of the esp8266 core for Arduino environment. 13 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License 14 | as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. 15 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | You should have received a copy of the GNU General Public License along with this program. 18 | If not, see 19 | 20 | Version: 1.6.1 21 | 22 | Version Modified By Date Comments 23 | ------- ----------- ---------- ----------- 24 | 1.2.3 K Hoang 02/09/2020 Initial coding for STM32 for built-in Ethernet (Nucleo-144, DISCOVERY, etc). 25 | Bump up version to v1.2.3 to sync with ESPAsyncWebServer v1.2.3 26 | 1.2.4 K Hoang 05/09/2020 Add back MD5/SHA1 authentication feature. 27 | 1.2.5 K Hoang 28/12/2020 Suppress all possible compiler warnings. Add examples. 28 | 1.2.6 K Hoang 22/03/2021 Fix dependency on STM32AsyncTCP Library 29 | 1.3.0 K Hoang 14/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 30 | 1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json` 31 | 1.4.0 K Hoang 14/12/2021 Fix base64 encoding of websocket client key and add WebServer progmem support 32 | 1.4.1 K Hoang 12/01/2022 Fix authenticate issue caused by libb64 33 | 1.5.0 K Hoang 22/06/2022 Update for STM32 core v2.3.0 34 | 1.6.0 K Hoang 06/10/2022 Option to use non-destroyed cString instead of String to save Heap 35 | 1.6.1 K Hoang 11/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks 36 | *****************************************************************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #ifndef ASYNCWEB_AUTHENTICATION_STM32_H_ 41 | #define ASYNCWEB_AUTHENTICATION_STM32_H_ 42 | 43 | #include "Arduino.h" 44 | #include "AsyncWebServer_Debug_STM32.h" 45 | 46 | ///////////////////////////////////////////////// 47 | 48 | bool checkBasicAuthentication(const char * header, const char * username, const char * password); 49 | 50 | String requestDigestAuthentication(const char * realm); 51 | 52 | bool checkDigestAuthentication(const char * header, const char * method, const char * username, const char * password, 53 | const char * realm, bool passwordIsHash, const char * nonce, const char * opaque, const char * uri); 54 | 55 | //for storing hashed versions on the device that can be authenticated against 56 | String generateDigestHash(const char * username, const char * password, const char * realm); 57 | 58 | ///////////////////////////////////////////////// 59 | 60 | #endif // ASYNCWEB_AUTHENTICATION_STM32_H_ 61 | -------------------------------------------------------------------------------- /examples/WebClient/WebClient.ino: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | WebClient.h - Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | /* 13 | Currently support 14 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 15 | - Nucleo-144 (F429ZI, F767ZI) 16 | - Discovery (STM32F746G-DISCOVERY) 17 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 18 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 19 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 20 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 21 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 22 | */ 23 | 24 | #include "defines.h" 25 | 26 | char server[] = "arduino.cc"; 27 | 28 | // Initialize the Web client object 29 | EthernetClient client; 30 | 31 | void setup() 32 | { 33 | // Open serial communications and wait for port to open: 34 | Serial.begin(115200); 35 | while (!Serial); 36 | 37 | Serial.print("\nStart WebClient on "); Serial.print(BOARD_NAME); 38 | Serial.print(" with "); Serial.println(SHIELD_TYPE); 39 | Serial.println(ASYNC_WEBSERVER_STM32_VERSION); 40 | 41 | #if (_ASYNCWEBSERVER_STM32_LOGLEVEL_ > 2) 42 | Serial.print("STM32 Core version v"); Serial.print(STM32_CORE_VERSION_MAJOR); 43 | Serial.print("."); Serial.print(STM32_CORE_VERSION_MINOR); 44 | Serial.print("."); Serial.println(STM32_CORE_VERSION_PATCH); 45 | #endif 46 | 47 | // start the ethernet connection and the server 48 | // Use random mac 49 | uint16_t index = millis() % NUMBER_OF_MAC; 50 | 51 | // Use Static IP 52 | //Ethernet.begin(mac[index], ip); 53 | // Use DHCP dynamic IP and random mac 54 | Ethernet.begin(mac[index]); 55 | 56 | // you're connected now, so print out the data 57 | Serial.print(F("You're connected to the network, IP = ")); 58 | Serial.println(Ethernet.localIP()); 59 | 60 | Serial.println(); 61 | Serial.println(F("Starting connection to server...")); 62 | 63 | // if you get a connection, report back via serial 64 | if (client.connect(server, 80)) 65 | { 66 | Serial.println(F("Connected to server")); 67 | // Make a HTTP request 68 | client.println(F("GET /asciilogo.txt HTTP/1.1")); 69 | client.println(F("Host: arduino.cc")); 70 | client.println(F("Connection: close")); 71 | client.println(); 72 | } 73 | } 74 | 75 | void printoutData(void) 76 | { 77 | // if there are incoming bytes available 78 | // from the server, read them and print them 79 | while (client.available()) 80 | { 81 | char c = client.read(); 82 | Serial.write(c); 83 | } 84 | } 85 | 86 | void loop() 87 | { 88 | printoutData(); 89 | 90 | // if the server's disconnected, stop the client 91 | if (!client.connected()) 92 | { 93 | Serial.println(); 94 | Serial.println(F("Disconnecting from server...")); 95 | client.stop(); 96 | 97 | // do nothing forevermore 98 | while (true); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/WebClient_LAN8720/WebClient_LAN8720.ino: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | WebClient_LAN8720.h - Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | /* 13 | Currently support 14 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 15 | - Nucleo-144 (F429ZI, F767ZI) 16 | - Discovery (STM32F746G-DISCOVERY) 17 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 18 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 19 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 20 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 21 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 22 | */ 23 | 24 | #include "defines.h" 25 | 26 | char server[] = "arduino.cc"; 27 | 28 | // Initialize the Web client object 29 | EthernetClient client; 30 | 31 | void setup() 32 | { 33 | // Open serial communications and wait for port to open: 34 | Serial.begin(115200); 35 | delay(2000); 36 | 37 | Serial.print("\nStart WebClient_LAN8720 on "); Serial.print(BOARD_NAME); 38 | Serial.print(" with "); Serial.println(SHIELD_TYPE); 39 | Serial.println(ASYNC_WEBSERVER_STM32_VERSION); 40 | 41 | #if (_ASYNCWEBSERVER_STM32_LOGLEVEL_ > 2) 42 | Serial.print("STM32 Core version v"); Serial.print(STM32_CORE_VERSION_MAJOR); 43 | Serial.print("."); Serial.print(STM32_CORE_VERSION_MINOR); 44 | Serial.print("."); Serial.println(STM32_CORE_VERSION_PATCH); 45 | #endif 46 | 47 | // start the ethernet connection and the server 48 | // Use random mac 49 | uint16_t index = millis() % NUMBER_OF_MAC; 50 | 51 | // Use Static IP 52 | //Ethernet.begin(mac[index], ip); 53 | // Use DHCP dynamic IP and random mac 54 | Ethernet.begin(mac[index]); 55 | 56 | // you're connected now, so print out the data 57 | Serial.print(F("You're connected to the network, IP = ")); 58 | Serial.println(Ethernet.localIP()); 59 | 60 | Serial.println(); 61 | Serial.println(F("Starting connection to server...")); 62 | 63 | // if you get a connection, report back via serial 64 | if (client.connect(server, 80)) 65 | { 66 | Serial.println(F("Connected to server")); 67 | // Make a HTTP request 68 | client.println(F("GET /asciilogo.txt HTTP/1.1")); 69 | client.println(F("Host: arduino.cc")); 70 | client.println(F("Connection: close")); 71 | client.println(); 72 | } 73 | } 74 | 75 | void printoutData(void) 76 | { 77 | // if there are incoming bytes available 78 | // from the server, read them and print them 79 | while (client.available()) 80 | { 81 | char c = client.read(); 82 | Serial.write(c); 83 | } 84 | } 85 | 86 | void loop() 87 | { 88 | printoutData(); 89 | 90 | // if the server's disconnected, stop the client 91 | if (!client.connected()) 92 | { 93 | Serial.println(); 94 | Serial.println(F("Disconnecting from server...")); 95 | client.stop(); 96 | 97 | // do nothing forevermore 98 | while (true); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/AsyncWebSynchronization_STM32.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | AsyncWebSynchronization_STM32.h - Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | 11 | Copyright (c) 2016 Hristo Gochkov. All rights reserved. 12 | This file is part of the esp8266 core for Arduino environment. 13 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License 14 | as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. 15 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | You should have received a copy of the GNU General Public License along with this program. 18 | If not, see 19 | 20 | Version: 1.6.1 21 | 22 | Version Modified By Date Comments 23 | ------- ----------- ---------- ----------- 24 | 1.2.3 K Hoang 02/09/2020 Initial coding for STM32 for built-in Ethernet (Nucleo-144, DISCOVERY, etc). 25 | Bump up version to v1.2.3 to sync with ESPAsyncWebServer v1.2.3 26 | 1.2.4 K Hoang 05/09/2020 Add back MD5/SHA1 authentication feature. 27 | 1.2.5 K Hoang 28/12/2020 Suppress all possible compiler warnings. Add examples. 28 | 1.2.6 K Hoang 22/03/2021 Fix dependency on STM32AsyncTCP Library 29 | 1.3.0 K Hoang 14/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 30 | 1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json` 31 | 1.4.0 K Hoang 14/12/2021 Fix base64 encoding of websocket client key and add WebServer progmem support 32 | 1.4.1 K Hoang 12/01/2022 Fix authenticate issue caused by libb64 33 | 1.5.0 K Hoang 22/06/2022 Update for STM32 core v2.3.0 34 | 1.6.0 K Hoang 06/10/2022 Option to use non-destroyed cString instead of String to save Heap 35 | 1.6.1 K Hoang 11/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks 36 | *****************************************************************************************************************************/ 37 | 38 | #pragma once 39 | 40 | #ifndef ASYNCWEBSYNCHRONIZATION_STM32_H_ 41 | #define ASYNCWEBSYNCHRONIZATION_STM32_H_ 42 | 43 | // Synchronisation is only available on ESP32, as the ESP8266 isn't using FreeRTOS by default 44 | 45 | #include 46 | 47 | ///////////////////////////////////////////////// 48 | 49 | // This is the STM32 version of the Sync Lock which is currently unimplemented 50 | class AsyncWebLock 51 | { 52 | 53 | public: 54 | AsyncWebLock() {} 55 | 56 | ~AsyncWebLock() {} 57 | 58 | ///////////////////////////////////////////////// 59 | 60 | inline bool lock() const 61 | { 62 | return false; 63 | } 64 | 65 | ///////////////////////////////////////////////// 66 | 67 | inline void unlock() const {} 68 | }; 69 | 70 | class AsyncWebLockGuard 71 | { 72 | private: 73 | const AsyncWebLock *_lock; 74 | 75 | public: 76 | 77 | ///////////////////////////////////////////////// 78 | 79 | AsyncWebLockGuard(const AsyncWebLock &l) 80 | { 81 | if (l.lock()) 82 | { 83 | _lock = &l; 84 | } 85 | else 86 | { 87 | _lock = NULL; 88 | } 89 | } 90 | 91 | ///////////////////////////////////////////////// 92 | 93 | ~AsyncWebLockGuard() 94 | { 95 | if (_lock) 96 | { 97 | _lock->unlock(); 98 | } 99 | } 100 | }; 101 | 102 | #endif // ASYNCWEBSYNCHRONIZATION_STM32_H_ 103 | -------------------------------------------------------------------------------- /examples/WebClientRepeating/WebClientRepeating.ino: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | WebClientRepeating.ino - Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | /* 13 | Currently support 14 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 15 | - Nucleo-144 (F429ZI, F767ZI) 16 | - Discovery (STM32F746G-DISCOVERY) 17 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 18 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 19 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 20 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 21 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 22 | */ 23 | 24 | #include "defines.h" 25 | 26 | char server[] = "arduino.cc"; 27 | 28 | unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds 29 | const unsigned long postingInterval = 10000L; // delay between updates, in milliseconds 30 | 31 | // Initialize the Web client object 32 | EthernetClient client; 33 | 34 | // this method makes a HTTP connection to the server 35 | void httpRequest() 36 | { 37 | Serial.println(); 38 | 39 | // close any connection before send a new request 40 | // this will free the socket on the WiFi shield 41 | client.stop(); 42 | 43 | // if there's a successful connection 44 | if (client.connect(server, 80)) 45 | { 46 | Serial.println(F("Connecting...")); 47 | 48 | // send the HTTP PUT request 49 | client.println(F("GET /asciilogo.txt HTTP/1.1")); 50 | client.println(F("Host: arduino.cc")); 51 | client.println(F("Connection: close")); 52 | client.println(); 53 | 54 | // note the time that the connection was made 55 | lastConnectionTime = millis(); 56 | } 57 | else 58 | { 59 | // if you couldn't make a connection 60 | Serial.println(F("Connection failed")); 61 | } 62 | } 63 | 64 | void setup() 65 | { 66 | // Open serial communications and wait for port to open: 67 | Serial.begin(115200); 68 | while (!Serial); 69 | 70 | Serial.print("\nStart WebClientRepeating on "); Serial.print(BOARD_NAME); 71 | Serial.print(" with "); Serial.println(SHIELD_TYPE); 72 | Serial.println(ASYNC_WEBSERVER_STM32_VERSION); 73 | 74 | #if (_ASYNCWEBSERVER_STM32_LOGLEVEL_ > 2) 75 | Serial.print("STM32 Core version v"); Serial.print(STM32_CORE_VERSION_MAJOR); 76 | Serial.print("."); Serial.print(STM32_CORE_VERSION_MINOR); 77 | Serial.print("."); Serial.println(STM32_CORE_VERSION_PATCH); 78 | #endif 79 | 80 | // start the ethernet connection and the server 81 | // Use random mac 82 | uint16_t index = millis() % NUMBER_OF_MAC; 83 | 84 | // Use Static IP 85 | //Ethernet.begin(mac[index], ip); 86 | // Use DHCP dynamic IP and random mac 87 | Ethernet.begin(mac[index]); 88 | 89 | // you're connected now, so print out the data 90 | Serial.print(F("You're connected to the network, IP = ")); 91 | Serial.println(Ethernet.localIP()); 92 | } 93 | 94 | void loop() 95 | { 96 | // if there's incoming data from the net connection send it out the serial port 97 | // this is for debugging purposes only 98 | while (client.available()) 99 | { 100 | char c = client.read(); 101 | Serial.write(c); 102 | } 103 | 104 | // if 10 seconds have passed since your last connection, 105 | // then connect again and send data 106 | if (millis() - lastConnectionTime > postingInterval) 107 | { 108 | httpRequest(); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/WebClientRepeating_LAN8720/WebClientRepeating_LAN8720.ino: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | WebClientRepeating_LAN8720.ino - Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | /* 13 | Currently support 14 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 15 | - Nucleo-144 (F429ZI, F767ZI) 16 | - Discovery (STM32F746G-DISCOVERY) 17 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 18 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 19 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 20 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 21 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 22 | */ 23 | 24 | #include "defines.h" 25 | 26 | char server[] = "arduino.cc"; 27 | 28 | unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds 29 | const unsigned long postingInterval = 60000L; // delay between updates, in milliseconds 30 | 31 | // Initialize the Web client object 32 | EthernetClient client; 33 | 34 | // this method makes a HTTP connection to the server 35 | void httpRequest() 36 | { 37 | Serial.println(); 38 | 39 | // close any connection before send a new request 40 | // this will free the socket on the WiFi shield 41 | client.stop(); 42 | 43 | // if there's a successful connection 44 | if (client.connect(server, 80)) 45 | { 46 | Serial.println(F("Connecting...")); 47 | 48 | // send the HTTP PUT request 49 | client.println(F("GET /asciilogo.txt HTTP/1.1")); 50 | client.println(F("Host: arduino.cc")); 51 | client.println(F("Connection: close")); 52 | client.println(); 53 | 54 | // note the time that the connection was made 55 | lastConnectionTime = millis(); 56 | } 57 | else 58 | { 59 | // if you couldn't make a connection 60 | Serial.println(F("Connection failed")); 61 | } 62 | } 63 | 64 | void setup() 65 | { 66 | // Open serial communications and wait for port to open: 67 | Serial.begin(115200); 68 | delay(2000); 69 | 70 | Serial.print("\nStart WebClientRepeating_LAN8720 on "); Serial.print(BOARD_NAME); 71 | Serial.print(" with "); Serial.println(SHIELD_TYPE); 72 | Serial.println(ASYNC_WEBSERVER_STM32_VERSION); 73 | 74 | #if (_ASYNCWEBSERVER_STM32_LOGLEVEL_ > 2) 75 | Serial.print("STM32 Core version v"); Serial.print(STM32_CORE_VERSION_MAJOR); 76 | Serial.print("."); Serial.print(STM32_CORE_VERSION_MINOR); 77 | Serial.print("."); Serial.println(STM32_CORE_VERSION_PATCH); 78 | #endif 79 | 80 | // start the ethernet connection and the server 81 | // Use random mac 82 | uint16_t index = millis() % NUMBER_OF_MAC; 83 | 84 | // Use Static IP 85 | //Ethernet.begin(mac[index], ip); 86 | // Use DHCP dynamic IP and random mac 87 | Ethernet.begin(mac[index]); 88 | 89 | // you're connected now, so print out the data 90 | Serial.print(F("You're connected to the network, IP = ")); 91 | Serial.println(Ethernet.localIP()); 92 | } 93 | 94 | void loop() 95 | { 96 | // if there's incoming data from the net connection send it out the serial port 97 | // this is for debugging purposes only 98 | while (client.available()) 99 | { 100 | char c = client.read(); 101 | Serial.write(c); 102 | } 103 | 104 | // if 10 seconds have passed since your last connection, 105 | // then connect again and send data 106 | if (millis() - lastConnectionTime > postingInterval) 107 | { 108 | httpRequest(); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /examples/AsyncFSBrowser_STM32/data/index.htm: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | WebSocketTester 23 | 52 | 124 | 125 | 126 |

127 |     
128 | $ 129 |
130 | 131 | 132 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/AsyncFSBrowser_STM32_LAN8720/data/index.htm: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | WebSocketTester 23 | 52 | 124 | 125 | 126 |

127 |     
128 | $ 129 |
130 | 131 | 132 | -------------------------------------------------------------------------------- /Packages_Patches/STM32/hardware/stm32/1.9.0/variants/NUCLEO_L053R8/variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _VARIANT_ARDUINO_STM32_ 20 | #define _VARIANT_ARDUINO_STM32_ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif // __cplusplus 25 | 26 | /*---------------------------------------------------------------------------- 27 | * Pins 28 | *----------------------------------------------------------------------------*/ 29 | 30 | #define PA3 0 31 | #define PA2 1 32 | #define PA10 2 33 | #define PB3 3 34 | #define PB5 4 35 | #define PB4 5 36 | #define PB10 6 37 | #define PA8 7 38 | #define PA9 8 39 | #define PC7 9 40 | #define PB6 10 41 | #define PA7 A6 42 | #define PA6 A7 43 | #define PA5 13 44 | #define PB9 14 45 | #define PB8 15 46 | // ST Morpho 47 | // CN7 Left Side 48 | #define PC10 16 49 | #define PC12 17 50 | // 18 is NC - BOOT0 51 | #define PA13 19 // SWD 52 | #define PA14 20 // SWD 53 | #define PA15 21 54 | #define PB7 22 55 | #define PC13 23 56 | #define PC14 24 57 | #define PC15 25 58 | #define PH0 26 59 | #define PH1 27 60 | #define PC2 A8 61 | #define PC3 A9 62 | // CN7 Right Side 63 | #define PC11 30 64 | #define PD2 31 65 | // CN10 Left Side 66 | #define PC9 32 67 | // CN10 Right side 68 | #define PC8 33 69 | #define PC6 34 70 | #define PC5 A10 71 | #define PA12 36 72 | #define PA11 37 73 | #define PB12 38 74 | #define PB11 39 75 | #define PB2 40 76 | #define PB1 41 77 | #define PB15 42 78 | #define PB14 43 79 | #define PB13 44 80 | #define PC4 A11 81 | #define PA0 A0 82 | #define PA1 A1 83 | #define PA4 A2 84 | #define PB0 A3 85 | #define PC1 A4 86 | #define PC0 A5 87 | 88 | // This must be a literal 89 | #define NUM_DIGITAL_PINS 52 90 | // This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS 91 | #define NUM_ANALOG_INPUTS 12 92 | 93 | // On-board LED pin number 94 | #define LED_BUILTIN 13 95 | #define LED_GREEN LED_BUILTIN 96 | 97 | // On-board user button 98 | #define USER_BTN PC13 99 | 100 | // Timer Definitions 101 | // Use TIM6 when possible as servo and tone don't need GPIO output pin 102 | #define TIMER_TONE TIM6 103 | #define TIMER_SERVO TIM2 104 | 105 | // UART Definitions 106 | #define SERIAL_UART_INSTANCE 2 //Connected to ST-Link 107 | // Default pin used for 'Serial' instance (ex: ST-Link) 108 | // Mandatory for Firmata 109 | #define PIN_SERIAL_RX 0 110 | #define PIN_SERIAL_TX 1 111 | 112 | /* Extra HAL modules */ 113 | #define HAL_DAC_MODULE_ENABLED 114 | 115 | #ifdef __cplusplus 116 | } // extern "C" 117 | #endif 118 | /*---------------------------------------------------------------------------- 119 | * Arduino objects - C++ only 120 | *----------------------------------------------------------------------------*/ 121 | 122 | #ifdef __cplusplus 123 | // These serial port names are intended to allow libraries and architecture-neutral 124 | // sketches to automatically default to the correct port name for a particular type 125 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, 126 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. 127 | // 128 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor 129 | // 130 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial 131 | // 132 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library 133 | // 134 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. 135 | // 136 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX 137 | // pins are NOT connected to anything by default. 138 | #define SERIAL_PORT_MONITOR Serial 139 | 140 | // KH mod to add Serial1, for ESP-AT 141 | //#define SERIAL_PORT_HARDWARE Serial 142 | #define SERIAL_PORT_HARDWARE Serial1 143 | #endif 144 | 145 | #endif /* _VARIANT_ARDUINO_STM32_ */ 146 | -------------------------------------------------------------------------------- /examples/AsyncWebServer_SendChunked/defines.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | defines.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under GPLv3 license 11 | ***************************************************************************************************************************************/ 12 | 13 | #ifndef defines_h 14 | #define defines_h 15 | 16 | /* 17 | Currently support 18 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 19 | - Nucleo-144 (F429ZI, F767ZI) 20 | - Discovery (STM32F746G-DISCOVERY) 21 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 22 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 23 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 24 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 25 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 26 | */ 27 | 28 | #if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \ 29 | defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \ 30 | defined(STM32WB) || defined(STM32MP1) ) 31 | #error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting. 32 | #endif 33 | 34 | #define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 4 35 | 36 | #if defined(STM32F0) 37 | #warning STM32F0 board selected 38 | #define BOARD_TYPE "STM32F0" 39 | #elif defined(STM32F1) 40 | #warning STM32F1 board selected 41 | #define BOARD_TYPE "STM32F1" 42 | #elif defined(STM32F2) 43 | #warning STM32F2 board selected 44 | #define BOARD_TYPE "STM32F2" 45 | #elif defined(STM32F3) 46 | #warning STM32F3 board selected 47 | #define BOARD_TYPE "STM32F3" 48 | #elif defined(STM32F4) 49 | #warning STM32F4 board selected 50 | #define BOARD_TYPE "STM32F4" 51 | #elif defined(STM32F7) 52 | #warning STM32F7 board selected 53 | #define BOARD_TYPE "STM32F7" 54 | #elif defined(STM32L0) 55 | #warning STM32L0 board selected 56 | #define BOARD_TYPE "STM32L0" 57 | #elif defined(STM32L1) 58 | #warning STM32L1 board selected 59 | #define BOARD_TYPE "STM32L1" 60 | #elif defined(STM32L4) 61 | #warning STM32L4 board selected 62 | #define BOARD_TYPE "STM32L4" 63 | #elif defined(STM32H7) 64 | #warning STM32H7 board selected 65 | #define BOARD_TYPE "STM32H7" 66 | #elif defined(STM32G0) 67 | #warning STM32G0 board selected 68 | #define BOARD_TYPE "STM32G0" 69 | #elif defined(STM32G4) 70 | #warning STM32G4 board selected 71 | #define BOARD_TYPE "STM32G4" 72 | #elif defined(STM32WB) 73 | #warning STM32WB board selected 74 | #define BOARD_TYPE "STM32WB" 75 | #elif defined(STM32MP1) 76 | #warning STM32MP1 board selected 77 | #define BOARD_TYPE "STM32MP1" 78 | #else 79 | #warning STM32 unknown board selected 80 | #define BOARD_TYPE "STM32 Unknown" 81 | #endif 82 | 83 | #ifndef BOARD_NAME 84 | #define BOARD_NAME BOARD_TYPE 85 | #endif 86 | 87 | #define SHIELD_TYPE "LAN8742A built-in Ethernet" 88 | 89 | #include 90 | #include 91 | #include 92 | 93 | // Enter a MAC address and IP address for your controller below. 94 | #define NUMBER_OF_MAC 20 95 | 96 | byte mac[][NUMBER_OF_MAC] = 97 | { 98 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 }, 99 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 }, 100 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 }, 101 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 }, 102 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 }, 103 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 }, 104 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 }, 105 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 }, 106 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 }, 107 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0A }, 108 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0B }, 109 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0C }, 110 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0D }, 111 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0E }, 112 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0F }, 113 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 }, 114 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 }, 115 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 }, 116 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 }, 117 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 }, 118 | }; 119 | // Select the IP address according to your local network 120 | IPAddress ip(192, 168, 2, 232); 121 | 122 | #endif //defines_h 123 | -------------------------------------------------------------------------------- /examples/Async_AdvancedWebServer_SendChunked/defines.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | defines.h 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under GPLv3 license 11 | ***************************************************************************************************************************************/ 12 | 13 | #ifndef defines_h 14 | #define defines_h 15 | 16 | /* 17 | Currently support 18 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 19 | - Nucleo-144 (F429ZI, F767ZI) 20 | - Discovery (STM32F746G-DISCOVERY) 21 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 22 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 23 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 24 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 25 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 26 | */ 27 | 28 | #if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \ 29 | defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \ 30 | defined(STM32WB) || defined(STM32MP1) ) 31 | #error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting. 32 | #endif 33 | 34 | #define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 4 35 | 36 | #if defined(STM32F0) 37 | #warning STM32F0 board selected 38 | #define BOARD_TYPE "STM32F0" 39 | #elif defined(STM32F1) 40 | #warning STM32F1 board selected 41 | #define BOARD_TYPE "STM32F1" 42 | #elif defined(STM32F2) 43 | #warning STM32F2 board selected 44 | #define BOARD_TYPE "STM32F2" 45 | #elif defined(STM32F3) 46 | #warning STM32F3 board selected 47 | #define BOARD_TYPE "STM32F3" 48 | #elif defined(STM32F4) 49 | #warning STM32F4 board selected 50 | #define BOARD_TYPE "STM32F4" 51 | #elif defined(STM32F7) 52 | #warning STM32F7 board selected 53 | #define BOARD_TYPE "STM32F7" 54 | #elif defined(STM32L0) 55 | #warning STM32L0 board selected 56 | #define BOARD_TYPE "STM32L0" 57 | #elif defined(STM32L1) 58 | #warning STM32L1 board selected 59 | #define BOARD_TYPE "STM32L1" 60 | #elif defined(STM32L4) 61 | #warning STM32L4 board selected 62 | #define BOARD_TYPE "STM32L4" 63 | #elif defined(STM32H7) 64 | #warning STM32H7 board selected 65 | #define BOARD_TYPE "STM32H7" 66 | #elif defined(STM32G0) 67 | #warning STM32G0 board selected 68 | #define BOARD_TYPE "STM32G0" 69 | #elif defined(STM32G4) 70 | #warning STM32G4 board selected 71 | #define BOARD_TYPE "STM32G4" 72 | #elif defined(STM32WB) 73 | #warning STM32WB board selected 74 | #define BOARD_TYPE "STM32WB" 75 | #elif defined(STM32MP1) 76 | #warning STM32MP1 board selected 77 | #define BOARD_TYPE "STM32MP1" 78 | #else 79 | #warning STM32 unknown board selected 80 | #define BOARD_TYPE "STM32 Unknown" 81 | #endif 82 | 83 | #ifndef BOARD_NAME 84 | #define BOARD_NAME BOARD_TYPE 85 | #endif 86 | 87 | #define SHIELD_TYPE "LAN8742A built-in Ethernet" 88 | 89 | #include 90 | #include 91 | #include 92 | 93 | // Enter a MAC address and IP address for your controller below. 94 | #define NUMBER_OF_MAC 20 95 | 96 | byte mac[][NUMBER_OF_MAC] = 97 | { 98 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 }, 99 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 }, 100 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 }, 101 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 }, 102 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 }, 103 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 }, 104 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 }, 105 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 }, 106 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 }, 107 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0A }, 108 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0B }, 109 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0C }, 110 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0D }, 111 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0E }, 112 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0F }, 113 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 }, 114 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 }, 115 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 }, 116 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 }, 117 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 }, 118 | }; 119 | // Select the IP address according to your local network 120 | IPAddress ip(192, 168, 2, 232); 121 | 122 | #endif //defines_h 123 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # AsyncWebServer_STM32 2 | 3 | [![arduino-library-badge](https://www.ardu-badge.com/badge/AsyncWebServer_STM32.svg?)](https://www.ardu-badge.com/AsyncWebServer_STM32) 4 | [![GitHub release](https://img.shields.io/github/release/khoih-prog/AsyncWebServer_STM32.svg)](https://github.com/khoih-prog/AsyncWebServer_STM32/releases) 5 | [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing) 6 | [![GitHub issues](https://img.shields.io/github/issues/khoih-prog/AsyncWebServer_STM32.svg)](http://github.com/khoih-prog/AsyncWebServer_STM32/issues) 7 | 8 | Donate to my libraries using BuyMeACoffee 9 | 10 | 11 | --- 12 | --- 13 | 14 | ## Table of contents 15 | 16 | * [Table of contents](#table-of-contents) 17 | * [Changelog](#changelog) 18 | * [Releases v1.6.1](#releases-v161) 19 | * [Releases v1.6.0](#releases-v160) 20 | * [Releases v1.5.0](#releases-v150) 21 | * [Releases v1.4.1](#releases-v141) 22 | * [Releases v1.4.0](#releases-v140) 23 | * [Releases v1.3.1](#releases-v131) 24 | * [Releases v1.3.0](#releases-v130) 25 | * [Releases v1.2.6](#releases-v126) 26 | * [Releases v1.2.5](#releases-v125) 27 | * [Releases v1.2.4](#releases-v124) 28 | * [Releases v1.2.3](#releases-v123) 29 | 30 | --- 31 | --- 32 | 33 | ## Changelog 34 | 35 | #### Releases v1.6.1 36 | 37 | 1. Add examples [Async_AdvancedWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_STM32/tree/master/examples/Async_AdvancedWebServer_SendChunked) and [AsyncWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_STM32/tree/master/examples/AsyncWebServer_SendChunked) to demo how to use `beginChunkedResponse()` to send large `html` in chunks 38 | 2. Use `allman astyle` and add `utils` 39 | 40 | ### Releases v1.6.0 41 | 42 | 1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/8) 43 | 2. Add functions and example `Async_AdvancedWebServer_favicon` to support `favicon.ico` 44 | 3. Add multiple examples to demo the new feature 45 | 4. Fix issue with slow browsers or network 46 | 5. Change license from `MIT` to `GPLv3` to match with original [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer) license 47 | 48 | 49 | ### Releases v1.5.0 50 | 51 | 1. Update examples for new STM32 core v2.3.0 52 | 2. Update `Packages' Patches` 53 | 54 | ### Releases v1.4.1 55 | 56 | 1. Fix authenticate issue caused by libb64 57 | 58 | ### Releases v1.4.0 59 | 60 | 1. Fix base64 encoding of websocket client key and add WebServer progmem support. Check PR [Fix base64 encoding of websocket client key and progmem support for webserver #7](https://github.com/khoih-prog/AsyncWebServer_STM32/pull/7) 61 | 62 | 63 | ### Releases v1.3.1 64 | 65 | 1. Update `platform.ini` and `library.json` to use original `khoih-prog` instead of `khoih.prog` after PIO fix 66 | 2. Update `Packages' Patches` 67 | 68 | ### Releases v1.3.0 69 | 70 | 1. Add support to **LAN8720** Ethernet for many **STM32F4** (F407xx, NUCLEO_F429ZI) and **STM32F7** (DISCO_F746NG, NUCLEO_F746ZG, NUCLEO_F756ZG) boards. 71 | 2. Add LAN8720 examples 72 | 3. Add Packages' Patches for STM32 to use LAN8720 with STM32Ethernet and LwIP libraries 73 | 4. Reduce compiled code size. 74 | 75 | ### Releases v1.2.6 76 | 77 | 1. Fix dependency on unpublished [**STM32AsyncTCP Library**](https://github.com/philbowles/STM32AsyncTCP). Check [Compilation broken due to error in STM32AsyncTCP dependency](https://github.com/khoih-prog/AsyncWebServer_STM32/issues/4) and [how to run one of the examples?](https://github.com/khoih-prog/AsyncWebServer_STM32/issues/2). 78 | 79 | ### Releases v1.2.5 80 | 81 | 1. Clean-up all compiler warnings possible. 82 | 2. Update Table of Contents 83 | 3. Add examples 84 | 4. Add Version String 85 | 86 | ### Releases v1.2.4 87 | 88 | 1. Add back MD5/SHA1 authentication feature. 89 | 2. Add example, update README.md, clean up. 90 | 91 | #### Releases v1.2.3 92 | 93 | 1. Initial coding to port [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer) to STM32 boards using builtin LAN8742A Ethernet. More supports will be added gradually later, such as AsyncUDP, other Ethernet / WiFi shields. 94 | 2. Add more examples. 95 | 3. Add debugging features. 96 | 4. Bump up to v1.2.3 to sync with [ESPAsyncWebServer v1.2.3](https://github.com/me-no-dev/ESPAsyncWebServer). 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /examples/WebClient/defines.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | defines.h 3 | 4 | Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 5 | 6 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 7 | 8 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 9 | 10 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 11 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 12 | Licensed under MIT license 13 | *****************************************************************************************************************************/ 14 | /* 15 | Currently support 16 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 17 | - Nucleo-144 (F429ZI, F767ZI) 18 | - Discovery (STM32F746G-DISCOVERY) 19 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 20 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 21 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 22 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 23 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 24 | */ 25 | 26 | #ifndef defines_h 27 | #define defines_h 28 | 29 | #if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \ 30 | defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \ 31 | defined(STM32WB) || defined(STM32MP1) ) 32 | #error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting. 33 | #endif 34 | 35 | #define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 4 36 | 37 | #if defined(STM32F0) 38 | #warning STM32F0 board selected 39 | #define BOARD_TYPE "STM32F0" 40 | #elif defined(STM32F1) 41 | #warning STM32F1 board selected 42 | #define BOARD_TYPE "STM32F1" 43 | #elif defined(STM32F2) 44 | #warning STM32F2 board selected 45 | #define BOARD_TYPE "STM32F2" 46 | #elif defined(STM32F3) 47 | #warning STM32F3 board selected 48 | #define BOARD_TYPE "STM32F3" 49 | #elif defined(STM32F4) 50 | #warning STM32F4 board selected 51 | #define BOARD_TYPE "STM32F4" 52 | #elif defined(STM32F7) 53 | #warning STM32F7 board selected 54 | #define BOARD_TYPE "STM32F7" 55 | #elif defined(STM32L0) 56 | #warning STM32L0 board selected 57 | #define BOARD_TYPE "STM32L0" 58 | #elif defined(STM32L1) 59 | #warning STM32L1 board selected 60 | #define BOARD_TYPE "STM32L1" 61 | #elif defined(STM32L4) 62 | #warning STM32L4 board selected 63 | #define BOARD_TYPE "STM32L4" 64 | #elif defined(STM32H7) 65 | #warning STM32H7 board selected 66 | #define BOARD_TYPE "STM32H7" 67 | #elif defined(STM32G0) 68 | #warning STM32G0 board selected 69 | #define BOARD_TYPE "STM32G0" 70 | #elif defined(STM32G4) 71 | #warning STM32G4 board selected 72 | #define BOARD_TYPE "STM32G4" 73 | #elif defined(STM32WB) 74 | #warning STM32WB board selected 75 | #define BOARD_TYPE "STM32WB" 76 | #elif defined(STM32MP1) 77 | #warning STM32MP1 board selected 78 | #define BOARD_TYPE "STM32MP1" 79 | #else 80 | #warning STM32 unknown board selected 81 | #define BOARD_TYPE "STM32 Unknown" 82 | #endif 83 | 84 | #ifndef BOARD_NAME 85 | #define BOARD_NAME BOARD_TYPE 86 | #endif 87 | 88 | #define SHIELD_TYPE "LAN8742A built-in Ethernet" 89 | 90 | #include 91 | #include 92 | #include 93 | 94 | // Enter a MAC address and IP address for your controller below. 95 | #define NUMBER_OF_MAC 20 96 | 97 | byte mac[][NUMBER_OF_MAC] = 98 | { 99 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 }, 100 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 }, 101 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 }, 102 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 }, 103 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 }, 104 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 }, 105 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 }, 106 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 }, 107 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 }, 108 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0A }, 109 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0B }, 110 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0C }, 111 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0D }, 112 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0E }, 113 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0F }, 114 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 }, 115 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 }, 116 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 }, 117 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 }, 118 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 }, 119 | }; 120 | // Select the IP address according to your local network 121 | IPAddress ip(192, 168, 2, 232); 122 | 123 | #endif //defines_h 124 | -------------------------------------------------------------------------------- /examples/MQTTClient_Auth/defines.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | defines.h 3 | 4 | Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 5 | 6 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 7 | 8 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 9 | 10 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 11 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 12 | Licensed under MIT license 13 | *****************************************************************************************************************************/ 14 | /* 15 | Currently support 16 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 17 | - Nucleo-144 (F429ZI, F767ZI) 18 | - Discovery (STM32F746G-DISCOVERY) 19 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 20 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 21 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 22 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 23 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 24 | */ 25 | 26 | #ifndef defines_h 27 | #define defines_h 28 | 29 | #if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \ 30 | defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \ 31 | defined(STM32WB) || defined(STM32MP1) ) 32 | #error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting. 33 | #endif 34 | 35 | #define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 4 36 | 37 | #if defined(STM32F0) 38 | #warning STM32F0 board selected 39 | #define BOARD_TYPE "STM32F0" 40 | #elif defined(STM32F1) 41 | #warning STM32F1 board selected 42 | #define BOARD_TYPE "STM32F1" 43 | #elif defined(STM32F2) 44 | #warning STM32F2 board selected 45 | #define BOARD_TYPE "STM32F2" 46 | #elif defined(STM32F3) 47 | #warning STM32F3 board selected 48 | #define BOARD_TYPE "STM32F3" 49 | #elif defined(STM32F4) 50 | #warning STM32F4 board selected 51 | #define BOARD_TYPE "STM32F4" 52 | #elif defined(STM32F7) 53 | #warning STM32F7 board selected 54 | #define BOARD_TYPE "STM32F7" 55 | #elif defined(STM32L0) 56 | #warning STM32L0 board selected 57 | #define BOARD_TYPE "STM32L0" 58 | #elif defined(STM32L1) 59 | #warning STM32L1 board selected 60 | #define BOARD_TYPE "STM32L1" 61 | #elif defined(STM32L4) 62 | #warning STM32L4 board selected 63 | #define BOARD_TYPE "STM32L4" 64 | #elif defined(STM32H7) 65 | #warning STM32H7 board selected 66 | #define BOARD_TYPE "STM32H7" 67 | #elif defined(STM32G0) 68 | #warning STM32G0 board selected 69 | #define BOARD_TYPE "STM32G0" 70 | #elif defined(STM32G4) 71 | #warning STM32G4 board selected 72 | #define BOARD_TYPE "STM32G4" 73 | #elif defined(STM32WB) 74 | #warning STM32WB board selected 75 | #define BOARD_TYPE "STM32WB" 76 | #elif defined(STM32MP1) 77 | #warning STM32MP1 board selected 78 | #define BOARD_TYPE "STM32MP1" 79 | #else 80 | #warning STM32 unknown board selected 81 | #define BOARD_TYPE "STM32 Unknown" 82 | #endif 83 | 84 | #ifndef BOARD_NAME 85 | #define BOARD_NAME BOARD_TYPE 86 | #endif 87 | 88 | #define SHIELD_TYPE "LAN8742A built-in Ethernet" 89 | 90 | #include 91 | #include 92 | #include 93 | 94 | // Enter a MAC address and IP address for your controller below. 95 | #define NUMBER_OF_MAC 20 96 | 97 | byte mac[][NUMBER_OF_MAC] = 98 | { 99 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 }, 100 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 }, 101 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 }, 102 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 }, 103 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 }, 104 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 }, 105 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 }, 106 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 }, 107 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 }, 108 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0A }, 109 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0B }, 110 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0C }, 111 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0D }, 112 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0E }, 113 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0F }, 114 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 }, 115 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 }, 116 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 }, 117 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 }, 118 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 }, 119 | }; 120 | // Select the IP address according to your local network 121 | IPAddress ip(192, 168, 2, 232); 122 | 123 | #endif //defines_h 124 | -------------------------------------------------------------------------------- /examples/MQTTClient_Basic/defines.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | defines.h 3 | 4 | Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 5 | 6 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 7 | 8 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 9 | 10 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 11 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 12 | Licensed under MIT license 13 | *****************************************************************************************************************************/ 14 | /* 15 | Currently support 16 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 17 | - Nucleo-144 (F429ZI, F767ZI) 18 | - Discovery (STM32F746G-DISCOVERY) 19 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 20 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 21 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 22 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 23 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 24 | */ 25 | 26 | #ifndef defines_h 27 | #define defines_h 28 | 29 | #if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \ 30 | defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \ 31 | defined(STM32WB) || defined(STM32MP1) ) 32 | #error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting. 33 | #endif 34 | 35 | #define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 4 36 | 37 | #if defined(STM32F0) 38 | #warning STM32F0 board selected 39 | #define BOARD_TYPE "STM32F0" 40 | #elif defined(STM32F1) 41 | #warning STM32F1 board selected 42 | #define BOARD_TYPE "STM32F1" 43 | #elif defined(STM32F2) 44 | #warning STM32F2 board selected 45 | #define BOARD_TYPE "STM32F2" 46 | #elif defined(STM32F3) 47 | #warning STM32F3 board selected 48 | #define BOARD_TYPE "STM32F3" 49 | #elif defined(STM32F4) 50 | #warning STM32F4 board selected 51 | #define BOARD_TYPE "STM32F4" 52 | #elif defined(STM32F7) 53 | #warning STM32F7 board selected 54 | #define BOARD_TYPE "STM32F7" 55 | #elif defined(STM32L0) 56 | #warning STM32L0 board selected 57 | #define BOARD_TYPE "STM32L0" 58 | #elif defined(STM32L1) 59 | #warning STM32L1 board selected 60 | #define BOARD_TYPE "STM32L1" 61 | #elif defined(STM32L4) 62 | #warning STM32L4 board selected 63 | #define BOARD_TYPE "STM32L4" 64 | #elif defined(STM32H7) 65 | #warning STM32H7 board selected 66 | #define BOARD_TYPE "STM32H7" 67 | #elif defined(STM32G0) 68 | #warning STM32G0 board selected 69 | #define BOARD_TYPE "STM32G0" 70 | #elif defined(STM32G4) 71 | #warning STM32G4 board selected 72 | #define BOARD_TYPE "STM32G4" 73 | #elif defined(STM32WB) 74 | #warning STM32WB board selected 75 | #define BOARD_TYPE "STM32WB" 76 | #elif defined(STM32MP1) 77 | #warning STM32MP1 board selected 78 | #define BOARD_TYPE "STM32MP1" 79 | #else 80 | #warning STM32 unknown board selected 81 | #define BOARD_TYPE "STM32 Unknown" 82 | #endif 83 | 84 | #ifndef BOARD_NAME 85 | #define BOARD_NAME BOARD_TYPE 86 | #endif 87 | 88 | #define SHIELD_TYPE "LAN8742A built-in Ethernet" 89 | 90 | #include 91 | #include 92 | #include 93 | 94 | // Enter a MAC address and IP address for your controller below. 95 | #define NUMBER_OF_MAC 20 96 | 97 | byte mac[][NUMBER_OF_MAC] = 98 | { 99 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 }, 100 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 }, 101 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 }, 102 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 }, 103 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 }, 104 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 }, 105 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 }, 106 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 }, 107 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 }, 108 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0A }, 109 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0B }, 110 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0C }, 111 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0D }, 112 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0E }, 113 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0F }, 114 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 }, 115 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 }, 116 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 }, 117 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 }, 118 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 }, 119 | }; 120 | // Select the IP address according to your local network 121 | IPAddress ip(192, 168, 2, 232); 122 | 123 | #endif //defines_h 124 | -------------------------------------------------------------------------------- /examples/MQTT_ThingStream/defines.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | defines.h 3 | 4 | Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 5 | 6 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 7 | 8 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 9 | 10 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 11 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 12 | Licensed under MIT license 13 | *****************************************************************************************************************************/ 14 | /* 15 | Currently support 16 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 17 | - Nucleo-144 (F429ZI, F767ZI) 18 | - Discovery (STM32F746G-DISCOVERY) 19 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 20 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 21 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 22 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 23 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 24 | */ 25 | 26 | #ifndef defines_h 27 | #define defines_h 28 | 29 | #if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \ 30 | defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \ 31 | defined(STM32WB) || defined(STM32MP1) ) 32 | #error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting. 33 | #endif 34 | 35 | #define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 4 36 | 37 | #if defined(STM32F0) 38 | #warning STM32F0 board selected 39 | #define BOARD_TYPE "STM32F0" 40 | #elif defined(STM32F1) 41 | #warning STM32F1 board selected 42 | #define BOARD_TYPE "STM32F1" 43 | #elif defined(STM32F2) 44 | #warning STM32F2 board selected 45 | #define BOARD_TYPE "STM32F2" 46 | #elif defined(STM32F3) 47 | #warning STM32F3 board selected 48 | #define BOARD_TYPE "STM32F3" 49 | #elif defined(STM32F4) 50 | #warning STM32F4 board selected 51 | #define BOARD_TYPE "STM32F4" 52 | #elif defined(STM32F7) 53 | #warning STM32F7 board selected 54 | #define BOARD_TYPE "STM32F7" 55 | #elif defined(STM32L0) 56 | #warning STM32L0 board selected 57 | #define BOARD_TYPE "STM32L0" 58 | #elif defined(STM32L1) 59 | #warning STM32L1 board selected 60 | #define BOARD_TYPE "STM32L1" 61 | #elif defined(STM32L4) 62 | #warning STM32L4 board selected 63 | #define BOARD_TYPE "STM32L4" 64 | #elif defined(STM32H7) 65 | #warning STM32H7 board selected 66 | #define BOARD_TYPE "STM32H7" 67 | #elif defined(STM32G0) 68 | #warning STM32G0 board selected 69 | #define BOARD_TYPE "STM32G0" 70 | #elif defined(STM32G4) 71 | #warning STM32G4 board selected 72 | #define BOARD_TYPE "STM32G4" 73 | #elif defined(STM32WB) 74 | #warning STM32WB board selected 75 | #define BOARD_TYPE "STM32WB" 76 | #elif defined(STM32MP1) 77 | #warning STM32MP1 board selected 78 | #define BOARD_TYPE "STM32MP1" 79 | #else 80 | #warning STM32 unknown board selected 81 | #define BOARD_TYPE "STM32 Unknown" 82 | #endif 83 | 84 | #ifndef BOARD_NAME 85 | #define BOARD_NAME BOARD_TYPE 86 | #endif 87 | 88 | #define SHIELD_TYPE "LAN8742A built-in Ethernet" 89 | 90 | #include 91 | #include 92 | #include 93 | 94 | // Enter a MAC address and IP address for your controller below. 95 | #define NUMBER_OF_MAC 20 96 | 97 | byte mac[][NUMBER_OF_MAC] = 98 | { 99 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 }, 100 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 }, 101 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 }, 102 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 }, 103 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 }, 104 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 }, 105 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 }, 106 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 }, 107 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 }, 108 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0A }, 109 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0B }, 110 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0C }, 111 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0D }, 112 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0E }, 113 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0F }, 114 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 }, 115 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 }, 116 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 }, 117 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 }, 118 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 }, 119 | }; 120 | // Select the IP address according to your local network 121 | IPAddress ip(192, 168, 2, 232); 122 | 123 | #endif //defines_h 124 | -------------------------------------------------------------------------------- /examples/WebClientRepeating/defines.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | defines.h 3 | 4 | Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 5 | 6 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 7 | 8 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 9 | 10 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 11 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 12 | Licensed under MIT license 13 | *****************************************************************************************************************************/ 14 | /* 15 | Currently support 16 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 17 | - Nucleo-144 (F429ZI, F767ZI) 18 | - Discovery (STM32F746G-DISCOVERY) 19 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 20 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 21 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 22 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 23 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 24 | */ 25 | 26 | #ifndef defines_h 27 | #define defines_h 28 | 29 | #if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \ 30 | defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \ 31 | defined(STM32WB) || defined(STM32MP1) ) 32 | #error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting. 33 | #endif 34 | 35 | #define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 4 36 | 37 | #if defined(STM32F0) 38 | #warning STM32F0 board selected 39 | #define BOARD_TYPE "STM32F0" 40 | #elif defined(STM32F1) 41 | #warning STM32F1 board selected 42 | #define BOARD_TYPE "STM32F1" 43 | #elif defined(STM32F2) 44 | #warning STM32F2 board selected 45 | #define BOARD_TYPE "STM32F2" 46 | #elif defined(STM32F3) 47 | #warning STM32F3 board selected 48 | #define BOARD_TYPE "STM32F3" 49 | #elif defined(STM32F4) 50 | #warning STM32F4 board selected 51 | #define BOARD_TYPE "STM32F4" 52 | #elif defined(STM32F7) 53 | #warning STM32F7 board selected 54 | #define BOARD_TYPE "STM32F7" 55 | #elif defined(STM32L0) 56 | #warning STM32L0 board selected 57 | #define BOARD_TYPE "STM32L0" 58 | #elif defined(STM32L1) 59 | #warning STM32L1 board selected 60 | #define BOARD_TYPE "STM32L1" 61 | #elif defined(STM32L4) 62 | #warning STM32L4 board selected 63 | #define BOARD_TYPE "STM32L4" 64 | #elif defined(STM32H7) 65 | #warning STM32H7 board selected 66 | #define BOARD_TYPE "STM32H7" 67 | #elif defined(STM32G0) 68 | #warning STM32G0 board selected 69 | #define BOARD_TYPE "STM32G0" 70 | #elif defined(STM32G4) 71 | #warning STM32G4 board selected 72 | #define BOARD_TYPE "STM32G4" 73 | #elif defined(STM32WB) 74 | #warning STM32WB board selected 75 | #define BOARD_TYPE "STM32WB" 76 | #elif defined(STM32MP1) 77 | #warning STM32MP1 board selected 78 | #define BOARD_TYPE "STM32MP1" 79 | #else 80 | #warning STM32 unknown board selected 81 | #define BOARD_TYPE "STM32 Unknown" 82 | #endif 83 | 84 | #ifndef BOARD_NAME 85 | #define BOARD_NAME BOARD_TYPE 86 | #endif 87 | 88 | #define SHIELD_TYPE "LAN8742A built-in Ethernet" 89 | 90 | #include 91 | #include 92 | #include 93 | 94 | // Enter a MAC address and IP address for your controller below. 95 | #define NUMBER_OF_MAC 20 96 | 97 | byte mac[][NUMBER_OF_MAC] = 98 | { 99 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 }, 100 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 }, 101 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 }, 102 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 }, 103 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 }, 104 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 }, 105 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 }, 106 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 }, 107 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 }, 108 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0A }, 109 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0B }, 110 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0C }, 111 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0D }, 112 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0E }, 113 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0F }, 114 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 }, 115 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 }, 116 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 }, 117 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 }, 118 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 }, 119 | }; 120 | // Select the IP address according to your local network 121 | IPAddress ip(192, 168, 2, 232); 122 | 123 | #endif //defines_h 124 | -------------------------------------------------------------------------------- /platformio/platformio.ini: -------------------------------------------------------------------------------- 1 | ;PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [platformio] 12 | ; ============================================================ 13 | ; chose environment: 14 | ; STM32 15 | 16 | ; ============================================================ 17 | default_envs = STM32 18 | 19 | [env] 20 | ; ============================================================ 21 | ; Serial configuration 22 | ; choose upload speed, serial-monitor speed 23 | ; ============================================================ 24 | upload_speed = 921600 25 | ;upload_port = COM11 26 | ;monitor_speed = 9600 27 | ;monitor_port = COM11 28 | 29 | ; Checks for the compatibility with frameworks and dev/platforms 30 | lib_compat_mode = strict 31 | lib_ldf_mode = chain+ 32 | ;lib_ldf_mode = deep+ 33 | 34 | lib_deps = 35 | ; PlatformIO 4.x 36 | ; STM32duino LwIP@~2.1.2 37 | ; STM32duino STM32Ethernet@~1.3.0 38 | ; STM32AsyncTCP 39 | ; https://github.com/khoih-prog/STM32AsyncTCP.git 40 | ; PlatformIO 5.x 41 | stm32duino/STM32duino LwIP@~2.1.2 42 | stm32duino/STM32duino STM32Ethernet@~1.3.0 43 | ; philbowles/STM32AsyncTCP 44 | https://github.com/khoih-prog/STM32AsyncTCP.git 45 | 46 | build_flags = 47 | ; set your build_flags 48 | 49 | [env:STM32] 50 | platform = ststm32 51 | framework = arduino 52 | 53 | ; ============================================================ 54 | ; Choose your board by uncommenting one of the following lines 55 | ; ============================================================ 56 | 57 | ; ============================================================ 58 | ; Board configuration Nucleo-144 59 | ; ============================================================ 60 | 61 | ;board = nucleo_f207zg 62 | ;board = nucleo_f429zi 63 | ;board = nucleo_f746zg 64 | ;board = nucleo_f756zg 65 | board = nucleo_f767zi 66 | ;board = nucleo_h743zi 67 | ;board = nucleo_l496zg 68 | ;board = nucleo_l496zg-p 69 | ;board = nucleo_l4r5zi 70 | ;board = nucleo_l4r5zi-p 71 | 72 | ; ============================================================ 73 | ; Board configuration Nucleo-64 74 | ; ============================================================ 75 | 76 | ;board = nucleo_f030r8 77 | ;board = nucleo_f072rb 78 | 79 | ;board = nucleo_f091rc 80 | ;board = nucleo_f103rb 81 | ;board = nucleo_f302r8 82 | ;board = nucleo_f303re 83 | ;board = nucleo_f401re 84 | ;board = nucleo_f411re 85 | ;board = nucleo_f446re 86 | ;board = nucleo_g071rb 87 | ;board = nucleo_g431rb 88 | ;board = nucleo_g474re 89 | ;board = nucleo_l053r8 90 | ;board = nucleo_l073rz 91 | ;board = nucleo_l152re 92 | ;board = nucleo_l433rc_p 93 | ;board = nucleo_l452re 94 | ;board = nucleo_l452re-p 95 | ;board = nucleo_l476rg 96 | ;board = pnucleo_wb55rg 97 | 98 | ; ============================================================ 99 | ; Board configuration Nucleo-32 100 | ; ============================================================ 101 | 102 | ;board = nucleo_f031k6 103 | ;board = nucleo_l031k6 104 | ;board = nucleo_l412kb 105 | ;board = nucleo_l432lc 106 | ;board = nucleo_f303k8 107 | ;board = nucleo_g431kb 108 | 109 | ; ============================================================ 110 | ; Board configuration Discovery Boards 111 | ; ============================================================ 112 | 113 | ;board = disco_f030r8 114 | ;board = disco_f072rb 115 | ;board = disco_f030r8 116 | ;board = disco_f100rb 117 | ;board = disco_f407vg 118 | ;board = disco_f413zh 119 | ;board = disco_f746ng 120 | ;board = disco_g0316 121 | ;board = disco_l475vg_iot 122 | ;board = disco_f072cz-lrwan1 123 | 124 | ; ============================================================ 125 | ; Board configuration STM32MP1 Boards 126 | ; ============================================================ 127 | 128 | ;board = stm32mp157a-dk1 129 | ;board = stm32mp157c-dk2 130 | 131 | ; ============================================================ 132 | ; Board configuration Generic Boards 133 | ; ============================================================ 134 | 135 | ;board = bluepill_f103c6 136 | ;board = bluepill_f103c8 137 | ;board = blackpill_f103c8 138 | ;board = stm32f103cx 139 | ;board = stm32f103rx 140 | ;board = stm32f103tx 141 | ;board = stm32f103vx 142 | ;board = stm32f103zx 143 | ;board = stm32f103zet6 144 | ;board = maplemini_f103cb 145 | ;board = blackpill_f303cc 146 | ;board = black_f407ve 147 | ;board = black_f407vg 148 | ;board = black_f407ze 149 | ;board = black_f407zg 150 | ;board = blue_f407ve_mini 151 | ;board = blackpill_f401cc 152 | ;board = blackpill_f411ce 153 | ;board = coreboard_f401rc 154 | ;board = feather_f405 155 | 156 | ; ============================================================ 157 | ; Board configuration Many more Boards to be filled 158 | ; ============================================================ 159 | 160 | 161 | -------------------------------------------------------------------------------- /examples/Async_AdvancedWebServer_favicon/favicon.h: -------------------------------------------------------------------------------- 1 | /*! \file 2 | \brief Favicon stored in progmem. 3 | 4 | `#include "favicon.h"` then 5 | @code 6 | // Serve favicon from PROGMEM: #include 7 | HTTP.on("/favicon.ico", HTTP_GET, [](AsyncWebServerRequest * request) { 8 | AsyncWebServerResponse *response = request->beginResponse_P(200, "image/x-icon", favicon_ico_gz, favicon_ico_gz_len); 9 | response->addHeader("Content-Encoding", "gzip"); 10 | request->send(response); 11 | }); 12 | @endcode 13 | */ 14 | 15 | #pragma once 16 | 17 | /* 18 | 19 | Provided from me-no-dev Async WebServer for ESP8266 20 | https://github.com/me-no-dev/ESPAsyncWebServer 21 | 22 | */ 23 | 24 | //File: favicon.ico.gz, Size: 726 25 | #define favicon_ico_gz_len 726 26 | const uint8_t favicon_ico_gz[] /*PROGMEM*/ = 27 | { 28 | 0x1F, 0x8B, 0x08, 0x08, 0x0B, 0x87, 0x90, 0x57, 0x00, 0x03, 0x66, 0x61, 0x76, 0x69, 0x63, 0x6F, 29 | 0x6E, 0x2E, 0x69, 0x63, 0x6F, 0x00, 0xCD, 0x53, 0x5F, 0x48, 0x9A, 0x51, 0x14, 0xBF, 0x62, 0x6D, 30 | 0x86, 0x96, 0xA9, 0x64, 0xD3, 0xFE, 0xA8, 0x99, 0x65, 0x1A, 0xB4, 0x8A, 0xA8, 0x51, 0x54, 0x23, 31 | 0xA8, 0x11, 0x49, 0x51, 0x8A, 0x34, 0x62, 0x93, 0x85, 0x31, 0x58, 0x44, 0x12, 0x45, 0x2D, 0x58, 32 | 0xF5, 0x52, 0x41, 0x10, 0x23, 0x82, 0xA0, 0x20, 0x98, 0x2F, 0xC1, 0x26, 0xED, 0xA1, 0x20, 0x89, 33 | 0x04, 0xD7, 0x83, 0x58, 0x20, 0x28, 0x04, 0xAB, 0xD1, 0x9B, 0x8C, 0xE5, 0xC3, 0x60, 0x32, 0x64, 34 | 0x0E, 0x56, 0xBF, 0x9D, 0xEF, 0xF6, 0x30, 0x82, 0xED, 0xAD, 0x87, 0xDD, 0x8F, 0xF3, 0xDD, 0x8F, 35 | 0x73, 0xCF, 0xEF, 0x9C, 0xDF, 0x39, 0xBF, 0xFB, 0x31, 0x26, 0xA2, 0x27, 0x37, 0x97, 0xD1, 0x5B, 36 | 0xCF, 0x9E, 0x67, 0x30, 0xA6, 0x66, 0x8C, 0x99, 0xC9, 0xC8, 0x45, 0x9E, 0x6B, 0x3F, 0x5F, 0x74, 37 | 0xA6, 0x94, 0x5E, 0xDB, 0xFF, 0xB2, 0xE6, 0xE7, 0xE7, 0xF9, 0xDE, 0xD6, 0xD6, 0x96, 0xDB, 0xD8, 38 | 0xD8, 0x78, 0xBF, 0xA1, 0xA1, 0xC1, 0xDA, 0xDC, 0xDC, 0x2C, 0xEB, 0xED, 0xED, 0x15, 0x9B, 0xCD, 39 | 0xE6, 0x4A, 0x83, 0xC1, 0xE0, 0x2E, 0x29, 0x29, 0x99, 0xD6, 0x6A, 0xB5, 0x4F, 0x75, 0x3A, 0x9D, 40 | 0x61, 0x75, 0x75, 0x95, 0xB5, 0xB7, 0xB7, 0xDF, 0xC8, 0xD1, 0xD4, 0xD4, 0xF4, 0xB0, 0xBA, 0xBA, 41 | 0xFA, 0x83, 0xD5, 0x6A, 0xFD, 0x5A, 0x5E, 0x5E, 0x9E, 0x28, 0x2D, 0x2D, 0x0D, 0x10, 0xC6, 0x4B, 42 | 0x98, 0x78, 0x5E, 0x5E, 0xDE, 0x95, 0x42, 0xA1, 0x40, 0x4E, 0x4E, 0xCE, 0x65, 0x76, 0x76, 0xF6, 43 | 0x47, 0xB5, 0x5A, 0x6D, 0x4F, 0x26, 0x93, 0xA2, 0xD6, 0xD6, 0x56, 0x8E, 0x6D, 0x69, 0x69, 0xD1, 44 | 0x11, 0x36, 0x62, 0xB1, 0x58, 0x60, 0x32, 0x99, 0xA0, 0xD7, 0xEB, 0x51, 0x58, 0x58, 0x88, 0xFC, 45 | 0xFC, 0x7C, 0x10, 0x16, 0x02, 0x56, 0x2E, 0x97, 0x43, 0x2A, 0x95, 0x42, 0x2C, 0x16, 0x23, 0x33, 46 | 0x33, 0x33, 0xAE, 0x52, 0xA9, 0x1E, 0x64, 0x65, 0x65, 0x71, 0x7C, 0x7D, 0x7D, 0xBD, 0x93, 0xEA, 47 | 0xFE, 0x30, 0x1A, 0x8D, 0xE8, 0xEC, 0xEC, 0xC4, 0xE2, 0xE2, 0x22, 0x6A, 0x6A, 0x6A, 0x40, 0x39, 48 | 0x41, 0xB5, 0x38, 0x4E, 0xC8, 0x33, 0x3C, 0x3C, 0x0C, 0x87, 0xC3, 0xC1, 0x6B, 0x54, 0x54, 0x54, 49 | 0xBC, 0xE9, 0xEB, 0xEB, 0x93, 0x5F, 0x5C, 0x5C, 0x30, 0x8A, 0x9D, 0x2E, 0x2B, 0x2B, 0xBB, 0xA2, 50 | 0x3E, 0x41, 0xBD, 0x21, 0x1E, 0x8F, 0x63, 0x6A, 0x6A, 0x0A, 0x81, 0x40, 0x00, 0x94, 0x1B, 0x3D, 51 | 0x3D, 0x3D, 0x42, 0x3C, 0x96, 0x96, 0x96, 0x70, 0x7E, 0x7E, 0x8E, 0xE3, 0xE3, 0x63, 0xF8, 0xFD, 52 | 0xFE, 0xB4, 0xD7, 0xEB, 0xF5, 0x8F, 0x8F, 0x8F, 0x5B, 0x68, 0x5E, 0x6F, 0x05, 0xCE, 0xB4, 0xE3, 53 | 0xE8, 0xE8, 0x08, 0x27, 0x27, 0x27, 0xD8, 0xDF, 0xDF, 0xC7, 0xD9, 0xD9, 0x19, 0x6C, 0x36, 0x1B, 54 | 0x36, 0x36, 0x36, 0x38, 0x9F, 0x85, 0x85, 0x05, 0xAC, 0xAF, 0xAF, 0x23, 0x1A, 0x8D, 0x22, 0x91, 55 | 0x48, 0x20, 0x16, 0x8B, 0xFD, 0xDA, 0xDA, 0xDA, 0x7A, 0x41, 0x33, 0x7E, 0x57, 0x50, 0x50, 0x80, 56 | 0x89, 0x89, 0x09, 0x84, 0xC3, 0x61, 0x6C, 0x6F, 0x6F, 0x23, 0x12, 0x89, 0xE0, 0xE0, 0xE0, 0x00, 57 | 0x43, 0x43, 0x43, 0x58, 0x5E, 0x5E, 0xE6, 0x9C, 0x7D, 0x3E, 0x1F, 0x46, 0x47, 0x47, 0x79, 0xBE, 58 | 0xBD, 0xBD, 0x3D, 0xE1, 0x3C, 0x1D, 0x0C, 0x06, 0x9F, 0x10, 0xB7, 0xC7, 0x84, 0x4F, 0xF6, 0xF7, 59 | 0xF7, 0x63, 0x60, 0x60, 0x00, 0x83, 0x83, 0x83, 0x18, 0x19, 0x19, 0xC1, 0xDC, 0xDC, 0x1C, 0x8F, 60 | 0x17, 0x7C, 0xA4, 0x27, 0xE7, 0x34, 0x39, 0x39, 0x89, 0x9D, 0x9D, 0x1D, 0x6E, 0x54, 0xE3, 0x13, 61 | 0xE5, 0x34, 0x11, 0x37, 0x49, 0x51, 0x51, 0xD1, 0x4B, 0xA5, 0x52, 0xF9, 0x45, 0x26, 0x93, 0x5D, 62 | 0x0A, 0xF3, 0x92, 0x48, 0x24, 0xA0, 0x6F, 0x14, 0x17, 0x17, 0xA3, 0xB6, 0xB6, 0x16, 0x5D, 0x5D, 63 | 0x5D, 0x7C, 0x1E, 0xBB, 0xBB, 0xBB, 0x9C, 0xD7, 0xE1, 0xE1, 0x21, 0x42, 0xA1, 0xD0, 0x6B, 0xD2, 64 | 0x45, 0x4C, 0x33, 0x12, 0x34, 0xCC, 0xA0, 0x19, 0x54, 0x92, 0x56, 0x0E, 0xD2, 0xD9, 0x43, 0xF8, 65 | 0xCF, 0x82, 0x56, 0xC2, 0xDC, 0xEB, 0xEA, 0xEA, 0x38, 0x7E, 0x6C, 0x6C, 0x4C, 0xE0, 0xFE, 0x9D, 66 | 0xB8, 0xBF, 0xA7, 0xFA, 0xAF, 0x56, 0x56, 0x56, 0xEE, 0x6D, 0x6E, 0x6E, 0xDE, 0xB8, 0x47, 0x55, 67 | 0x55, 0x55, 0x6C, 0x66, 0x66, 0x46, 0x44, 0xDA, 0x3B, 0x34, 0x1A, 0x4D, 0x94, 0xB0, 0x3F, 0x09, 68 | 0x7B, 0x45, 0xBD, 0xA5, 0x5D, 0x2E, 0x57, 0x8C, 0x7A, 0x73, 0xD9, 0xED, 0xF6, 0x3B, 0x84, 0xFF, 69 | 0xE7, 0x7D, 0xA6, 0x3A, 0x2C, 0x95, 0x4A, 0xB1, 0x8E, 0x8E, 0x0E, 0x6D, 0x77, 0x77, 0xB7, 0xCD, 70 | 0xE9, 0x74, 0x3E, 0x73, 0xBB, 0xDD, 0x8F, 0x3C, 0x1E, 0x8F, 0xE6, 0xF4, 0xF4, 0x94, 0xAD, 0xAD, 71 | 0xAD, 0xDD, 0xDE, 0xCF, 0x73, 0x0B, 0x0B, 0xB8, 0xB6, 0xE0, 0x5D, 0xC6, 0x66, 0xC5, 0xE4, 0x10, 72 | 0x4C, 0xF4, 0xF7, 0xD8, 0x59, 0xF2, 0x7F, 0xA3, 0xB8, 0xB4, 0xFC, 0x0F, 0xEE, 0x37, 0x70, 0xEC, 73 | 0x16, 0x4A, 0x7E, 0x04, 0x00, 0x00 74 | }; 75 | -------------------------------------------------------------------------------- /src/libb64/cencode.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | cencode.c - c source to a base64 encoding algorithm implementation 3 | 4 | This is part of the libb64 project, and has been placed in the public domain. 5 | For details, see http://sourceforge.net/projects/libb64 6 | 7 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 8 | 9 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 10 | 11 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 12 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 13 | 14 | Copyright (c) 2016 Hristo Gochkov. All rights reserved. 15 | This file is part of the esp8266 core for Arduino environment. 16 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License 17 | as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. 18 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 20 | You should have received a copy of the GNU General Public License along with this program. 21 | If not, see . 22 | *****************************************************************************************************************************/ 23 | 24 | #include "cencode.h" 25 | 26 | const int CHARS_PER_LINE = 72; 27 | 28 | void base64_init_encodestate(base64_encodestate* state_in) 29 | { 30 | state_in->step = step_A; 31 | state_in->result = 0; 32 | state_in->stepcount = 0; 33 | } 34 | 35 | char base64_encode_value(char value_in) 36 | { 37 | static const char* encoding = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 38 | 39 | if (value_in > 63) 40 | return '='; 41 | 42 | return encoding[(unsigned int)value_in]; 43 | } 44 | 45 | int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in) 46 | { 47 | const char* plainchar = plaintext_in; 48 | const char* const plaintextend = plaintext_in + length_in; 49 | char* codechar = code_out; 50 | char result; 51 | char fragment; 52 | 53 | result = state_in->result; 54 | 55 | switch (state_in->step) 56 | { 57 | while (1) 58 | { 59 | case step_A: 60 | if (plainchar == plaintextend) 61 | { 62 | state_in->result = result; 63 | state_in->step = step_A; 64 | return codechar - code_out; 65 | } 66 | 67 | fragment = *plainchar++; 68 | result = (fragment & 0x0fc) >> 2; 69 | *codechar++ = base64_encode_value(result); 70 | result = (fragment & 0x003) << 4; 71 | 72 | // fall through 73 | 74 | case step_B: 75 | if (plainchar == plaintextend) 76 | { 77 | state_in->result = result; 78 | state_in->step = step_B; 79 | return codechar - code_out; 80 | } 81 | 82 | fragment = *plainchar++; 83 | result |= (fragment & 0x0f0) >> 4; 84 | *codechar++ = base64_encode_value(result); 85 | result = (fragment & 0x00f) << 2; 86 | 87 | // fall through 88 | 89 | case step_C: 90 | if (plainchar == plaintextend) 91 | { 92 | state_in->result = result; 93 | state_in->step = step_C; 94 | return codechar - code_out; 95 | } 96 | 97 | fragment = *plainchar++; 98 | result |= (fragment & 0x0c0) >> 6; 99 | *codechar++ = base64_encode_value(result); 100 | result = (fragment & 0x03f) >> 0; 101 | *codechar++ = base64_encode_value(result); 102 | 103 | ++(state_in->stepcount); 104 | 105 | if (state_in->stepcount == CHARS_PER_LINE / 4) 106 | { 107 | *codechar++ = '\n'; 108 | state_in->stepcount = 0; 109 | } 110 | 111 | // fall through 112 | } 113 | } 114 | 115 | /* control should not reach here */ 116 | return codechar - code_out; 117 | } 118 | 119 | int base64_encode_blockend(char* code_out, base64_encodestate* state_in) 120 | { 121 | char* codechar = code_out; 122 | 123 | switch (state_in->step) 124 | { 125 | case step_B: 126 | *codechar++ = base64_encode_value(state_in->result); 127 | *codechar++ = '='; 128 | *codechar++ = '='; 129 | break; 130 | 131 | case step_C: 132 | *codechar++ = base64_encode_value(state_in->result); 133 | *codechar++ = '='; 134 | break; 135 | 136 | case step_A: 137 | break; 138 | } 139 | 140 | *codechar = 0x00; 141 | 142 | return codechar - code_out; 143 | } 144 | 145 | int base64_encode_chars(const char* plaintext_in, int length_in, char* code_out) 146 | { 147 | base64_encodestate _state; 148 | base64_init_encodestate(&_state); 149 | int len = base64_encode_block(plaintext_in, length_in, code_out, &_state); 150 | 151 | return len + base64_encode_blockend((code_out + len), &_state); 152 | } 153 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/WebClient_LAN8720/defines.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | defines.h 3 | 4 | Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 5 | 6 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 7 | 8 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 9 | 10 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 11 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 12 | Licensed under MIT license 13 | *****************************************************************************************************************************/ 14 | /* 15 | Currently support 16 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 17 | - Nucleo-144 (F429ZI, F767ZI) 18 | - Discovery (STM32F746G-DISCOVERY) 19 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 20 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 21 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 22 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 23 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 24 | */ 25 | 26 | #ifndef defines_h 27 | #define defines_h 28 | 29 | #if !( defined(ARDUINO_BLACK_F407VE) || defined(ARDUINO_BLACK_F407VG) || defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) || \ 30 | defined(ARDUINO_BLUE_F407VE_Mini) || defined(ARDUINO_DIYMORE_F407VGT) || defined(ARDUINO_FK407M1) || defined(ARDUINO_NUCLEO_F429ZI) || \ 31 | defined(ARDUINO_DISCO_F746NG) || defined(ARDUINO_NUCLEO_F746ZG) || defined(ARDUINO_NUCLEO_F756ZG) || defined(ARDUINO_NUCLEO_H743ZI) ) 32 | #error This code is designed to run on some STM32F407XX NUCLEO-F429ZI, STM32F746 and STM32F756 platform! Please check your Tools->Board setting. 33 | #endif 34 | 35 | #define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 4 36 | 37 | #define USING_LAN8720 true 38 | 39 | #if defined(STM32F0) 40 | #warning STM32F0 board selected 41 | #define BOARD_TYPE "STM32F0" 42 | #elif defined(STM32F1) 43 | #warning STM32F1 board selected 44 | #define BOARD_TYPE "STM32F1" 45 | #elif defined(STM32F2) 46 | #warning STM32F2 board selected 47 | #define BOARD_TYPE "STM32F2" 48 | #elif defined(STM32F3) 49 | #warning STM32F3 board selected 50 | #define BOARD_TYPE "STM32F3" 51 | #elif defined(STM32F4) 52 | #warning STM32F4 board selected 53 | #define BOARD_TYPE "STM32F4" 54 | #elif defined(STM32F7) 55 | #warning STM32F7 board selected 56 | #define BOARD_TYPE "STM32F7" 57 | #elif defined(STM32L0) 58 | #warning STM32L0 board selected 59 | #define BOARD_TYPE "STM32L0" 60 | #elif defined(STM32L1) 61 | #warning STM32L1 board selected 62 | #define BOARD_TYPE "STM32L1" 63 | #elif defined(STM32L4) 64 | #warning STM32L4 board selected 65 | #define BOARD_TYPE "STM32L4" 66 | #elif defined(STM32H7) 67 | #warning STM32H7 board selected 68 | #define BOARD_TYPE "STM32H7" 69 | #elif defined(STM32G0) 70 | #warning STM32G0 board selected 71 | #define BOARD_TYPE "STM32G0" 72 | #elif defined(STM32G4) 73 | #warning STM32G4 board selected 74 | #define BOARD_TYPE "STM32G4" 75 | #elif defined(STM32WB) 76 | #warning STM32WB board selected 77 | #define BOARD_TYPE "STM32WB" 78 | #elif defined(STM32MP1) 79 | #warning STM32MP1 board selected 80 | #define BOARD_TYPE "STM32MP1" 81 | #else 82 | #warning STM32 unknown board selected 83 | #define BOARD_TYPE "STM32 Unknown" 84 | #endif 85 | 86 | #ifndef BOARD_NAME 87 | #define BOARD_NAME BOARD_TYPE 88 | #endif 89 | 90 | #define SHIELD_TYPE "LAN8720 Ethernet" 91 | 92 | #include 93 | #include 94 | #include 95 | 96 | // Enter a MAC address and IP address for your controller below. 97 | #define NUMBER_OF_MAC 20 98 | 99 | byte mac[][NUMBER_OF_MAC] = 100 | { 101 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 }, 102 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 }, 103 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 }, 104 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 }, 105 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 }, 106 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 }, 107 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 }, 108 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 }, 109 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 }, 110 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0A }, 111 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0B }, 112 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0C }, 113 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0D }, 114 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0E }, 115 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0F }, 116 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 }, 117 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 }, 118 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 }, 119 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 }, 120 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 }, 121 | }; 122 | // Select the IP address according to your local network 123 | IPAddress ip(192, 168, 2, 232); 124 | 125 | #endif //defines_h 126 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/MQTTClient_Auth_LAN8720/defines.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | defines.h 3 | 4 | Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 5 | 6 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 7 | 8 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 9 | 10 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 11 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 12 | Licensed under MIT license 13 | *****************************************************************************************************************************/ 14 | /* 15 | Currently support 16 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 17 | - Nucleo-144 (F429ZI, F767ZI) 18 | - Discovery (STM32F746G-DISCOVERY) 19 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 20 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 21 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 22 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 23 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 24 | */ 25 | 26 | #ifndef defines_h 27 | #define defines_h 28 | 29 | #if !( defined(ARDUINO_BLACK_F407VE) || defined(ARDUINO_BLACK_F407VG) || defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) || \ 30 | defined(ARDUINO_BLUE_F407VE_Mini) || defined(ARDUINO_DIYMORE_F407VGT) || defined(ARDUINO_FK407M1) || defined(ARDUINO_NUCLEO_F429ZI) || \ 31 | defined(ARDUINO_DISCO_F746NG) || defined(ARDUINO_NUCLEO_F746ZG) || defined(ARDUINO_NUCLEO_F756ZG) || defined(ARDUINO_NUCLEO_H743ZI) ) 32 | #error This code is designed to run on some STM32F407XX NUCLEO-F429ZI, STM32F746 and STM32F756 platform! Please check your Tools->Board setting. 33 | #endif 34 | 35 | #define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 4 36 | 37 | #define USING_LAN8720 true 38 | 39 | #if defined(STM32F0) 40 | #warning STM32F0 board selected 41 | #define BOARD_TYPE "STM32F0" 42 | #elif defined(STM32F1) 43 | #warning STM32F1 board selected 44 | #define BOARD_TYPE "STM32F1" 45 | #elif defined(STM32F2) 46 | #warning STM32F2 board selected 47 | #define BOARD_TYPE "STM32F2" 48 | #elif defined(STM32F3) 49 | #warning STM32F3 board selected 50 | #define BOARD_TYPE "STM32F3" 51 | #elif defined(STM32F4) 52 | #warning STM32F4 board selected 53 | #define BOARD_TYPE "STM32F4" 54 | #elif defined(STM32F7) 55 | #warning STM32F7 board selected 56 | #define BOARD_TYPE "STM32F7" 57 | #elif defined(STM32L0) 58 | #warning STM32L0 board selected 59 | #define BOARD_TYPE "STM32L0" 60 | #elif defined(STM32L1) 61 | #warning STM32L1 board selected 62 | #define BOARD_TYPE "STM32L1" 63 | #elif defined(STM32L4) 64 | #warning STM32L4 board selected 65 | #define BOARD_TYPE "STM32L4" 66 | #elif defined(STM32H7) 67 | #warning STM32H7 board selected 68 | #define BOARD_TYPE "STM32H7" 69 | #elif defined(STM32G0) 70 | #warning STM32G0 board selected 71 | #define BOARD_TYPE "STM32G0" 72 | #elif defined(STM32G4) 73 | #warning STM32G4 board selected 74 | #define BOARD_TYPE "STM32G4" 75 | #elif defined(STM32WB) 76 | #warning STM32WB board selected 77 | #define BOARD_TYPE "STM32WB" 78 | #elif defined(STM32MP1) 79 | #warning STM32MP1 board selected 80 | #define BOARD_TYPE "STM32MP1" 81 | #else 82 | #warning STM32 unknown board selected 83 | #define BOARD_TYPE "STM32 Unknown" 84 | #endif 85 | 86 | #ifndef BOARD_NAME 87 | #define BOARD_NAME BOARD_TYPE 88 | #endif 89 | 90 | #define SHIELD_TYPE "LAN8720 Ethernet" 91 | 92 | #include 93 | #include 94 | #include 95 | 96 | // Enter a MAC address and IP address for your controller below. 97 | #define NUMBER_OF_MAC 20 98 | 99 | byte mac[][NUMBER_OF_MAC] = 100 | { 101 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 }, 102 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 }, 103 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 }, 104 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 }, 105 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 }, 106 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 }, 107 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 }, 108 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 }, 109 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 }, 110 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0A }, 111 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0B }, 112 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0C }, 113 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0D }, 114 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0E }, 115 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0F }, 116 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 }, 117 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 }, 118 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 }, 119 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 }, 120 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 }, 121 | }; 122 | // Select the IP address according to your local network 123 | IPAddress ip(192, 168, 2, 232); 124 | 125 | #endif //defines_h 126 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/MQTTClient_Basic_LAN8720/defines.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | defines.h 3 | 4 | Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 5 | 6 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 7 | 8 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 9 | 10 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 11 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 12 | Licensed under MIT license 13 | *****************************************************************************************************************************/ 14 | /* 15 | Currently support 16 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 17 | - Nucleo-144 (F429ZI, F767ZI) 18 | - Discovery (STM32F746G-DISCOVERY) 19 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 20 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 21 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 22 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 23 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 24 | */ 25 | 26 | #ifndef defines_h 27 | #define defines_h 28 | 29 | #if !( defined(ARDUINO_BLACK_F407VE) || defined(ARDUINO_BLACK_F407VG) || defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) || \ 30 | defined(ARDUINO_BLUE_F407VE_Mini) || defined(ARDUINO_DIYMORE_F407VGT) || defined(ARDUINO_FK407M1) || defined(ARDUINO_NUCLEO_F429ZI) || \ 31 | defined(ARDUINO_DISCO_F746NG) || defined(ARDUINO_NUCLEO_F746ZG) || defined(ARDUINO_NUCLEO_F756ZG) || defined(ARDUINO_NUCLEO_H743ZI) ) 32 | #error This code is designed to run on some STM32F407XX NUCLEO-F429ZI, STM32F746 and STM32F756 platform! Please check your Tools->Board setting. 33 | #endif 34 | 35 | #define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 4 36 | 37 | #define USING_LAN8720 true 38 | 39 | #if defined(STM32F0) 40 | #warning STM32F0 board selected 41 | #define BOARD_TYPE "STM32F0" 42 | #elif defined(STM32F1) 43 | #warning STM32F1 board selected 44 | #define BOARD_TYPE "STM32F1" 45 | #elif defined(STM32F2) 46 | #warning STM32F2 board selected 47 | #define BOARD_TYPE "STM32F2" 48 | #elif defined(STM32F3) 49 | #warning STM32F3 board selected 50 | #define BOARD_TYPE "STM32F3" 51 | #elif defined(STM32F4) 52 | #warning STM32F4 board selected 53 | #define BOARD_TYPE "STM32F4" 54 | #elif defined(STM32F7) 55 | #warning STM32F7 board selected 56 | #define BOARD_TYPE "STM32F7" 57 | #elif defined(STM32L0) 58 | #warning STM32L0 board selected 59 | #define BOARD_TYPE "STM32L0" 60 | #elif defined(STM32L1) 61 | #warning STM32L1 board selected 62 | #define BOARD_TYPE "STM32L1" 63 | #elif defined(STM32L4) 64 | #warning STM32L4 board selected 65 | #define BOARD_TYPE "STM32L4" 66 | #elif defined(STM32H7) 67 | #warning STM32H7 board selected 68 | #define BOARD_TYPE "STM32H7" 69 | #elif defined(STM32G0) 70 | #warning STM32G0 board selected 71 | #define BOARD_TYPE "STM32G0" 72 | #elif defined(STM32G4) 73 | #warning STM32G4 board selected 74 | #define BOARD_TYPE "STM32G4" 75 | #elif defined(STM32WB) 76 | #warning STM32WB board selected 77 | #define BOARD_TYPE "STM32WB" 78 | #elif defined(STM32MP1) 79 | #warning STM32MP1 board selected 80 | #define BOARD_TYPE "STM32MP1" 81 | #else 82 | #warning STM32 unknown board selected 83 | #define BOARD_TYPE "STM32 Unknown" 84 | #endif 85 | 86 | #ifndef BOARD_NAME 87 | #define BOARD_NAME BOARD_TYPE 88 | #endif 89 | 90 | #define SHIELD_TYPE "LAN8720 Ethernet" 91 | 92 | #include 93 | #include 94 | #include 95 | 96 | // Enter a MAC address and IP address for your controller below. 97 | #define NUMBER_OF_MAC 20 98 | 99 | byte mac[][NUMBER_OF_MAC] = 100 | { 101 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 }, 102 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 }, 103 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 }, 104 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 }, 105 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 }, 106 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 }, 107 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 }, 108 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 }, 109 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 }, 110 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0A }, 111 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0B }, 112 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0C }, 113 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0D }, 114 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0E }, 115 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0F }, 116 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 }, 117 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 }, 118 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 }, 119 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 }, 120 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 }, 121 | }; 122 | // Select the IP address according to your local network 123 | IPAddress ip(192, 168, 2, 232); 124 | 125 | #endif //defines_h 126 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/MQTT_ThingStream_LAN8720/defines.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | defines.h 3 | 4 | Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 5 | 6 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 7 | 8 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 9 | 10 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 11 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 12 | Licensed under MIT license 13 | *****************************************************************************************************************************/ 14 | /* 15 | Currently support 16 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 17 | - Nucleo-144 (F429ZI, F767ZI) 18 | - Discovery (STM32F746G-DISCOVERY) 19 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 20 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 21 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 22 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 23 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 24 | */ 25 | 26 | #ifndef defines_h 27 | #define defines_h 28 | 29 | #if !( defined(ARDUINO_BLACK_F407VE) || defined(ARDUINO_BLACK_F407VG) || defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) || \ 30 | defined(ARDUINO_BLUE_F407VE_Mini) || defined(ARDUINO_DIYMORE_F407VGT) || defined(ARDUINO_FK407M1) || defined(ARDUINO_NUCLEO_F429ZI) || \ 31 | defined(ARDUINO_DISCO_F746NG) || defined(ARDUINO_NUCLEO_F746ZG) || defined(ARDUINO_NUCLEO_F756ZG) || defined(ARDUINO_NUCLEO_H743ZI) ) 32 | #error This code is designed to run on some STM32F407XX NUCLEO-F429ZI, STM32F746 and STM32F756 platform! Please check your Tools->Board setting. 33 | #endif 34 | 35 | #define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 4 36 | 37 | #define USING_LAN8720 true 38 | 39 | #if defined(STM32F0) 40 | #warning STM32F0 board selected 41 | #define BOARD_TYPE "STM32F0" 42 | #elif defined(STM32F1) 43 | #warning STM32F1 board selected 44 | #define BOARD_TYPE "STM32F1" 45 | #elif defined(STM32F2) 46 | #warning STM32F2 board selected 47 | #define BOARD_TYPE "STM32F2" 48 | #elif defined(STM32F3) 49 | #warning STM32F3 board selected 50 | #define BOARD_TYPE "STM32F3" 51 | #elif defined(STM32F4) 52 | #warning STM32F4 board selected 53 | #define BOARD_TYPE "STM32F4" 54 | #elif defined(STM32F7) 55 | #warning STM32F7 board selected 56 | #define BOARD_TYPE "STM32F7" 57 | #elif defined(STM32L0) 58 | #warning STM32L0 board selected 59 | #define BOARD_TYPE "STM32L0" 60 | #elif defined(STM32L1) 61 | #warning STM32L1 board selected 62 | #define BOARD_TYPE "STM32L1" 63 | #elif defined(STM32L4) 64 | #warning STM32L4 board selected 65 | #define BOARD_TYPE "STM32L4" 66 | #elif defined(STM32H7) 67 | #warning STM32H7 board selected 68 | #define BOARD_TYPE "STM32H7" 69 | #elif defined(STM32G0) 70 | #warning STM32G0 board selected 71 | #define BOARD_TYPE "STM32G0" 72 | #elif defined(STM32G4) 73 | #warning STM32G4 board selected 74 | #define BOARD_TYPE "STM32G4" 75 | #elif defined(STM32WB) 76 | #warning STM32WB board selected 77 | #define BOARD_TYPE "STM32WB" 78 | #elif defined(STM32MP1) 79 | #warning STM32MP1 board selected 80 | #define BOARD_TYPE "STM32MP1" 81 | #else 82 | #warning STM32 unknown board selected 83 | #define BOARD_TYPE "STM32 Unknown" 84 | #endif 85 | 86 | #ifndef BOARD_NAME 87 | #define BOARD_NAME BOARD_TYPE 88 | #endif 89 | 90 | #define SHIELD_TYPE "LAN8720 Ethernet" 91 | 92 | #include 93 | #include 94 | #include 95 | 96 | // Enter a MAC address and IP address for your controller below. 97 | #define NUMBER_OF_MAC 20 98 | 99 | byte mac[][NUMBER_OF_MAC] = 100 | { 101 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 }, 102 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 }, 103 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 }, 104 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 }, 105 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 }, 106 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 }, 107 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 }, 108 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 }, 109 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 }, 110 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0A }, 111 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0B }, 112 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0C }, 113 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0D }, 114 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0E }, 115 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0F }, 116 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 }, 117 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 }, 118 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 }, 119 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 }, 120 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 }, 121 | }; 122 | // Select the IP address according to your local network 123 | IPAddress ip(192, 168, 2, 232); 124 | 125 | #endif //defines_h 126 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/WebClientRepeating_LAN8720/defines.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | defines.h 3 | 4 | Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 5 | 6 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 7 | 8 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 9 | 10 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 11 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 12 | Licensed under MIT license 13 | *****************************************************************************************************************************/ 14 | /* 15 | Currently support 16 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 17 | - Nucleo-144 (F429ZI, F767ZI) 18 | - Discovery (STM32F746G-DISCOVERY) 19 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 20 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 21 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 22 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 23 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 24 | */ 25 | 26 | #ifndef defines_h 27 | #define defines_h 28 | 29 | #if !( defined(ARDUINO_BLACK_F407VE) || defined(ARDUINO_BLACK_F407VG) || defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) || \ 30 | defined(ARDUINO_BLUE_F407VE_Mini) || defined(ARDUINO_DIYMORE_F407VGT) || defined(ARDUINO_FK407M1) || defined(ARDUINO_NUCLEO_F429ZI) || \ 31 | defined(ARDUINO_DISCO_F746NG) || defined(ARDUINO_NUCLEO_F746ZG) || defined(ARDUINO_NUCLEO_F756ZG) || defined(ARDUINO_NUCLEO_H743ZI) ) 32 | #error This code is designed to run on some STM32F407XX NUCLEO-F429ZI, STM32F746 and STM32F756 platform! Please check your Tools->Board setting. 33 | #endif 34 | 35 | #define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 4 36 | 37 | #define USING_LAN8720 true 38 | 39 | #if defined(STM32F0) 40 | #warning STM32F0 board selected 41 | #define BOARD_TYPE "STM32F0" 42 | #elif defined(STM32F1) 43 | #warning STM32F1 board selected 44 | #define BOARD_TYPE "STM32F1" 45 | #elif defined(STM32F2) 46 | #warning STM32F2 board selected 47 | #define BOARD_TYPE "STM32F2" 48 | #elif defined(STM32F3) 49 | #warning STM32F3 board selected 50 | #define BOARD_TYPE "STM32F3" 51 | #elif defined(STM32F4) 52 | #warning STM32F4 board selected 53 | #define BOARD_TYPE "STM32F4" 54 | #elif defined(STM32F7) 55 | #warning STM32F7 board selected 56 | #define BOARD_TYPE "STM32F7" 57 | #elif defined(STM32L0) 58 | #warning STM32L0 board selected 59 | #define BOARD_TYPE "STM32L0" 60 | #elif defined(STM32L1) 61 | #warning STM32L1 board selected 62 | #define BOARD_TYPE "STM32L1" 63 | #elif defined(STM32L4) 64 | #warning STM32L4 board selected 65 | #define BOARD_TYPE "STM32L4" 66 | #elif defined(STM32H7) 67 | #warning STM32H7 board selected 68 | #define BOARD_TYPE "STM32H7" 69 | #elif defined(STM32G0) 70 | #warning STM32G0 board selected 71 | #define BOARD_TYPE "STM32G0" 72 | #elif defined(STM32G4) 73 | #warning STM32G4 board selected 74 | #define BOARD_TYPE "STM32G4" 75 | #elif defined(STM32WB) 76 | #warning STM32WB board selected 77 | #define BOARD_TYPE "STM32WB" 78 | #elif defined(STM32MP1) 79 | #warning STM32MP1 board selected 80 | #define BOARD_TYPE "STM32MP1" 81 | #else 82 | #warning STM32 unknown board selected 83 | #define BOARD_TYPE "STM32 Unknown" 84 | #endif 85 | 86 | #ifndef BOARD_NAME 87 | #define BOARD_NAME BOARD_TYPE 88 | #endif 89 | 90 | #define SHIELD_TYPE "LAN8720 Ethernet" 91 | 92 | #include 93 | #include 94 | #include 95 | 96 | // Enter a MAC address and IP address for your controller below. 97 | #define NUMBER_OF_MAC 20 98 | 99 | byte mac[][NUMBER_OF_MAC] = 100 | { 101 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x01 }, 102 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x02 }, 103 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x03 }, 104 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 }, 105 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x05 }, 106 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x06 }, 107 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x07 }, 108 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x08 }, 109 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x09 }, 110 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0A }, 111 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0B }, 112 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0C }, 113 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0D }, 114 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0E }, 115 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x0F }, 116 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x10 }, 117 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x11 }, 118 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x12 }, 119 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x13 }, 120 | { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x14 }, 121 | }; 122 | // Select the IP address according to your local network 123 | IPAddress ip(192, 168, 2, 232); 124 | 125 | #endif //defines_h 126 | -------------------------------------------------------------------------------- /src/libb64/cdecode.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | cdecode.c - c source to a base64 decoding algorithm implementation 3 | 4 | This is part of the libb64 project, and has been placed in the public domain. 5 | For details, see http://sourceforge.net/projects/libb64 6 | 7 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 8 | 9 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 10 | 11 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 12 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 13 | 14 | Copyright (c) 2016 Hristo Gochkov. All rights reserved. 15 | This file is part of the esp8266 core for Arduino environment. 16 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License 17 | as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. 18 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 20 | You should have received a copy of the GNU General Public License along with this program. 21 | If not, see . 22 | *****************************************************************************************************************************/ 23 | 24 | #include "cdecode.h" 25 | 26 | int base64_decode_value(int value_in) 27 | { 28 | static const char decoding[] = 29 | { 30 | 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, 31 | 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, 32 | -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 33 | 47, 48, 49, 50, 51 34 | }; 35 | 36 | static const char decoding_size = sizeof(decoding); 37 | value_in -= 43; 38 | 39 | if (value_in < 0 || value_in > decoding_size) 40 | return -1; 41 | 42 | return decoding[(int)value_in]; 43 | } 44 | 45 | void base64_init_decodestate(base64_decodestate* state_in) 46 | { 47 | state_in->step = step_a; 48 | state_in->plainchar = 0; 49 | } 50 | 51 | int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in) 52 | { 53 | const char* codechar = code_in; 54 | char* plainchar = plaintext_out; 55 | int fragment; 56 | 57 | *plainchar = state_in->plainchar; 58 | 59 | switch (state_in->step) 60 | { 61 | while (1) 62 | { 63 | case step_a: 64 | do 65 | { 66 | if (codechar == code_in + length_in) 67 | { 68 | state_in->step = step_a; 69 | state_in->plainchar = *plainchar; 70 | return plainchar - plaintext_out; 71 | } 72 | 73 | fragment = base64_decode_value(*codechar++); 74 | } while (fragment < 0); 75 | 76 | *plainchar = (fragment & 0x03f) << 2; 77 | 78 | // fall through 79 | 80 | case step_b: 81 | do 82 | { 83 | if (codechar == code_in + length_in) 84 | { 85 | state_in->step = step_b; 86 | state_in->plainchar = *plainchar; 87 | return plainchar - plaintext_out; 88 | } 89 | 90 | fragment = base64_decode_value(*codechar++); 91 | } while (fragment < 0); 92 | 93 | *plainchar++ |= (fragment & 0x030) >> 4; 94 | *plainchar = (fragment & 0x00f) << 4; 95 | 96 | // fall through 97 | 98 | case step_c: 99 | do 100 | { 101 | if (codechar == code_in + length_in) 102 | { 103 | state_in->step = step_c; 104 | state_in->plainchar = *plainchar; 105 | return plainchar - plaintext_out; 106 | } 107 | 108 | fragment = base64_decode_value(*codechar++); 109 | } while (fragment < 0); 110 | 111 | *plainchar++ |= (fragment & 0x03c) >> 2; 112 | *plainchar = (fragment & 0x003) << 6; 113 | 114 | // fall through 115 | 116 | case step_d: 117 | do 118 | { 119 | if (codechar == code_in + length_in) 120 | { 121 | state_in->step = step_d; 122 | state_in->plainchar = *plainchar; 123 | return plainchar - plaintext_out; 124 | } 125 | 126 | fragment = base64_decode_value(*codechar++); 127 | } while (fragment < 0); 128 | 129 | *plainchar++ |= (fragment & 0x03f); 130 | 131 | // fall through 132 | } 133 | } 134 | 135 | /* control should not reach here */ 136 | return plainchar - plaintext_out; 137 | } 138 | 139 | int base64_decode_chars(const char* code_in, const int length_in, char* plaintext_out) 140 | { 141 | 142 | base64_decodestate _state; 143 | base64_init_decodestate(&_state); 144 | int len = base64_decode_block(code_in, length_in, plaintext_out, &_state); 145 | 146 | if (len > 0) 147 | plaintext_out[len] = 0; 148 | 149 | return len; 150 | } 151 | -------------------------------------------------------------------------------- /Packages_Patches/STM32/hardware/stm32/1.9.0/variants/NUCLEO_F767ZI/variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _VARIANT_ARDUINO_STM32_ 20 | #define _VARIANT_ARDUINO_STM32_ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif // __cplusplus 25 | 26 | /*---------------------------------------------------------------------------- 27 | * Pins 28 | *----------------------------------------------------------------------------*/ 29 | 30 | #define PG9 0 31 | #define PG14 1 32 | #define PF15 2 33 | #define PE13 3 34 | #define PF14 4 35 | #define PE11 5 36 | #define PE9 6 37 | #define PF13 7 38 | #define PF12 8 39 | #define PD15 9 40 | #define PD14 10 41 | #define PA7 A10 42 | #define PA6 A11 43 | #define PA5 A12 44 | #define PB9 14 45 | #define PB8 15 46 | #define PC6 16 47 | #define PB15 17 48 | #define PB13 18 49 | #define PB12 19 50 | #define PA15 20 51 | #define PC7 21 52 | #define PB5 22 53 | #define PB3 23 54 | #define PA4 A13 55 | #define PB4 25 56 | #define PB6 26 57 | #define PB2 27 58 | #define PD13 28 59 | #define PD12 29 60 | #define PD11 30 61 | #define PE2 31 62 | #define PA0 A14 63 | #define PB0 33 // LED_GREEN 64 | #define PE0 34 65 | #define PB11 35 66 | #define PB10 36 67 | #define PE15 37 68 | #define PE14 38 69 | #define PE12 39 70 | #define PE10 40 71 | #define PE7 41 72 | #define PE8 42 73 | #define PC8 43 74 | #define PC9 44 75 | #define PC10 45 76 | #define PC11 46 77 | #define PC12 47 78 | #define PD2 48 79 | #define PG2 49 80 | #define PG3 50 81 | #define PD7 51 82 | #define PD6 52 83 | #define PD5 53 84 | #define PD4 54 85 | #define PD3 55 86 | // 56 is PE2 (31) 87 | #define PE4 57 88 | #define PE5 58 89 | #define PE6 59 90 | #define PE3 60 91 | #define PF8 A15 92 | #define PF7 A16 93 | #define PF9 A17 94 | #define PG1 64 95 | #define PG0 65 96 | #define PD1 66 97 | #define PD0 67 98 | #define PF0 68 99 | #define PF1 69 100 | #define PF2 70 101 | // 71 is PA7 (11) 102 | // 72 is NC 103 | #define PB7 73 // LED_BLUE 104 | #define PB14 74 // LED_RED 105 | #define PC13 75 // USER_BTN 106 | #define PD9 76 // Serial Rx 107 | #define PD8 77 // Serial Tx 108 | #define PA3 A0 109 | #define PC0 A1 110 | #define PC3 A2 111 | #define PF3 A3 112 | #define PF5 A4 113 | #define PF10 A5 114 | #define PB1 A6 115 | #define PC2 A7 116 | #define PF4 A8 117 | #define PF6 A9 118 | 119 | // This must be a literal 120 | #define NUM_DIGITAL_PINS 88 121 | // This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS 122 | #define NUM_ANALOG_INPUTS 18 123 | 124 | // On-board LED pin number 125 | #define LED_BUILTIN PB0 126 | #define LED_GREEN LED_BUILTIN 127 | #define LED_BLUE PB7 128 | #define LED_RED PB14 129 | 130 | // On-board user button 131 | #define USER_BTN PC13 132 | 133 | // Timer Definitions 134 | // Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin 135 | #define TIMER_TONE TIM6 136 | #define TIMER_SERVO TIM7 137 | 138 | // UART Definitions 139 | #define SERIAL_UART_INSTANCE 3 //Connected to ST-Link 140 | 141 | // Serial pin used for console (ex: stlink) 142 | // Rerquired by Firmata 143 | #define PIN_SERIAL_RX PD9 144 | #define PIN_SERIAL_TX PD8 145 | 146 | /* Extra HAL modules */ 147 | #define HAL_DAC_MODULE_ENABLED 148 | #define HAL_ETH_MODULE_ENABLED 149 | 150 | // Last Flash sector used for EEPROM emulation, address/sector depends on single/dual bank configuration. 151 | // By default 2MB single bank 152 | #define FLASH_BASE_ADDRESS 0x081C0000 153 | #define FLASH_DATA_SECTOR 11 154 | 155 | #ifdef __cplusplus 156 | } // extern "C" 157 | #endif 158 | /*---------------------------------------------------------------------------- 159 | * Arduino objects - C++ only 160 | *----------------------------------------------------------------------------*/ 161 | 162 | #ifdef __cplusplus 163 | // These serial port names are intended to allow libraries and architecture-neutral 164 | // sketches to automatically default to the correct port name for a particular type 165 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, 166 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. 167 | // 168 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor 169 | // 170 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial 171 | // 172 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library 173 | // 174 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. 175 | // 176 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX 177 | // pins are NOT connected to anything by default. 178 | #define SERIAL_PORT_MONITOR Serial 179 | 180 | // KH mod to add Serial1, for ESP-AT 181 | //#define SERIAL_PORT_HARDWARE Serial 182 | #define SERIAL_PORT_HARDWARE Serial1 183 | #endif 184 | 185 | #endif /* _VARIANT_ARDUINO_STM32_ */ 186 | -------------------------------------------------------------------------------- /examples/MQTTClient_Basic/MQTTClient_Basic.ino: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | MQTTClient_Basic.ino - Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | /* 13 | Currently support 14 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 15 | - Nucleo-144 (F429ZI, F767ZI) 16 | - Discovery (STM32F746G-DISCOVERY) 17 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 18 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 19 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 20 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 21 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 22 | */ 23 | 24 | /* 25 | Basic MQTT example (without SSL!) with Authentication 26 | This sketch demonstrates the basic capabilities of the library. 27 | It connects to an MQTT server then: 28 | - providing username and password 29 | - publishes "hello world" to the topic "outTopic" 30 | - subscribes to the topic "inTopic", printing out any messages 31 | it receives. NB - it assumes the received payloads are strings not binary 32 | 33 | It will reconnect to the server if the connection is lost using a blocking 34 | reconnect function. See the 'mqtt_reconnect_nonblocking' example for how to 35 | achieve the same result without blocking the main loop. 36 | */ 37 | 38 | // To remove boolean warnings caused by PubSubClient library 39 | #define boolean bool 40 | 41 | #include "defines.h" 42 | 43 | #include 44 | 45 | // Update these with values suitable for your network. 46 | const char* mqttServer = "broker.emqx.io"; // Broker address 47 | 48 | const char *ID = "MQTTClient_SSL-Client"; // Name of our device, must be unique 49 | const char *TOPIC = "MQTT_Pub"; // Topic to subcribe to 50 | const char *subTopic = "MQTT_Sub"; // Topic to subcribe to 51 | 52 | //IPAddress mqttServer(172, 16, 0, 2); 53 | 54 | void callback(char* topic, byte* payload, unsigned int length) 55 | { 56 | Serial.print("Message arrived ["); 57 | Serial.print(topic); 58 | Serial.print("] "); 59 | 60 | for (unsigned int i = 0; i < length; i++) 61 | { 62 | Serial.print((char)payload[i]); 63 | } 64 | 65 | Serial.println(); 66 | } 67 | 68 | EthernetClient ethClient; 69 | PubSubClient client(mqttServer, 1883, callback, ethClient); 70 | 71 | String data = "Hello from MQTTClient_Basic on " + String(BOARD_NAME) + " with " + String(SHIELD_TYPE); 72 | const char *pubData = data.c_str(); 73 | 74 | void reconnect() 75 | { 76 | // Loop until we're reconnected 77 | while (!client.connected()) 78 | { 79 | Serial.print("Attempting MQTT connection to "); 80 | Serial.print(mqttServer); 81 | 82 | // Attempt to connect 83 | if (client.connect(ID, "try", "try")) 84 | { 85 | Serial.println("...connected"); 86 | 87 | // Once connected, publish an announcement... 88 | client.publish(TOPIC, data.c_str()); 89 | 90 | //Serial.println("Published connection message successfully!"); 91 | //Serial.print("Subcribed to: "); 92 | //Serial.println(subTopic); 93 | 94 | client.subscribe(subTopic); 95 | // for loopback testing 96 | client.subscribe(TOPIC); 97 | } 98 | else 99 | { 100 | Serial.print("...failed, rc="); 101 | Serial.print(client.state()); 102 | Serial.println(" try again in 5 seconds"); 103 | 104 | // Wait 5 seconds before retrying 105 | delay(5000); 106 | } 107 | } 108 | } 109 | 110 | void setup() 111 | { 112 | // Open serial communications and wait for port to open: 113 | Serial.begin(115200); 114 | while (!Serial); 115 | 116 | Serial.print("\nStart MQTTClient_Basic on "); Serial.print(BOARD_NAME); 117 | Serial.print(" with "); Serial.println(SHIELD_TYPE); 118 | Serial.println(ASYNC_WEBSERVER_STM32_VERSION); 119 | 120 | #if (_ASYNCWEBSERVER_STM32_LOGLEVEL_ > 2) 121 | Serial.print("STM32 Core version v"); Serial.print(STM32_CORE_VERSION_MAJOR); 122 | Serial.print("."); Serial.print(STM32_CORE_VERSION_MINOR); 123 | Serial.print("."); Serial.println(STM32_CORE_VERSION_PATCH); 124 | #endif 125 | 126 | // start the ethernet connection and the server 127 | // Use random mac 128 | uint16_t index = millis() % NUMBER_OF_MAC; 129 | 130 | // Use Static IP 131 | //Ethernet.begin(mac[index], ip); 132 | // Use DHCP dynamic IP and random mac 133 | Ethernet.begin(mac[index]); 134 | 135 | Serial.print("\nConnected to network. IP = "); 136 | Serial.println(Ethernet.localIP()); 137 | 138 | client.setServer(mqttServer, 1883); 139 | client.setCallback(callback); 140 | 141 | // Allow the hardware to sort itself out 142 | delay(1500); 143 | } 144 | 145 | #define MQTT_PUBLISH_INTERVAL_MS 5000L 146 | 147 | unsigned long lastMsg = 0; 148 | 149 | void loop() 150 | { 151 | static unsigned long now; 152 | 153 | if (!client.connected()) 154 | { 155 | reconnect(); 156 | } 157 | 158 | // Sending Data 159 | now = millis(); 160 | 161 | if (now - lastMsg > MQTT_PUBLISH_INTERVAL_MS) 162 | { 163 | lastMsg = now; 164 | 165 | if (!client.publish(TOPIC, pubData)) 166 | { 167 | Serial.println("Message failed to send."); 168 | } 169 | 170 | Serial.print("Message Send : " + String(TOPIC) + " => "); 171 | Serial.println(data); 172 | } 173 | 174 | client.loop(); 175 | } 176 | -------------------------------------------------------------------------------- /examples/STM32_LAN8720/MQTTClient_Basic_LAN8720/MQTTClient_Basic_LAN8720.ino: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | MQTTClient_Basic_LAN8720.ino - Dead simple AsyncWebServer for STM32 LAN8720 or built-in LAN8742A Ethernet 3 | 4 | For STM32 with LAN8720 (STM32F4/F7) or built-in LAN8742A Ethernet (Nucleo-144, DISCOVERY, etc) 5 | 6 | AsyncWebServer_STM32 is a library for the STM32 with LAN8720 or built-in LAN8742A Ethernet WebServer 7 | 8 | Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer) 9 | Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32 10 | Licensed under MIT license 11 | *****************************************************************************************************************************/ 12 | 13 | /* 14 | Currently support 15 | 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as : 16 | - Nucleo-144 (F429ZI, F767ZI) 17 | - Discovery (STM32F746G-DISCOVERY) 18 | - STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet, 19 | - See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1) 20 | 2) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running ENC28J60 shields (to use USE_BUILTIN_ETHERNET = false) 21 | 3) STM32F/L/H/G/WB/MP1 boards (with 64+K Flash) running W5x00 shields 22 | 4) STM32F4 and STM32F7 boards (with 64+K Flash) running LAN8720 shields 23 | */ 24 | 25 | /* 26 | Basic MQTT example (without SSL!) with Authentication 27 | This sketch demonstrates the basic capabilities of the library. 28 | It connects to an MQTT server then: 29 | - providing username and password 30 | - publishes "hello world" to the topic "outTopic" 31 | - subscribes to the topic "inTopic", printing out any messages 32 | it receives. NB - it assumes the received payloads are strings not binary 33 | 34 | It will reconnect to the server if the connection is lost using a blocking 35 | reconnect function. See the 'mqtt_reconnect_nonblocking' example for how to 36 | achieve the same result without blocking the main loop. 37 | */ 38 | 39 | // To remove boolean warnings caused by PubSubClient library 40 | #define boolean bool 41 | 42 | #include "defines.h" 43 | 44 | #include 45 | 46 | // Update these with values suitable for your network. 47 | const char* mqttServer = "broker.emqx.io"; // Broker address 48 | 49 | const char *ID = "MQTTClient_SSL-Client"; // Name of our device, must be unique 50 | const char *TOPIC = "MQTT_Pub"; // Topic to subcribe to 51 | const char *subTopic = "MQTT_Sub"; // Topic to subcribe to 52 | 53 | //IPAddress mqttServer(172, 16, 0, 2); 54 | 55 | void callback(char* topic, byte* payload, unsigned int length) 56 | { 57 | Serial.print("Message arrived ["); 58 | Serial.print(topic); 59 | Serial.print("] "); 60 | 61 | for (unsigned int i = 0; i < length; i++) 62 | { 63 | Serial.print((char)payload[i]); 64 | } 65 | 66 | Serial.println(); 67 | } 68 | 69 | EthernetClient ethClient; 70 | PubSubClient client(mqttServer, 1883, callback, ethClient); 71 | 72 | String data = "Hello from MQTTClient_Basic_LAN8720 on " + String(BOARD_NAME) + " with " + String(SHIELD_TYPE); 73 | const char *pubData = data.c_str(); 74 | 75 | void reconnect() 76 | { 77 | // Loop until we're reconnected 78 | while (!client.connected()) 79 | { 80 | Serial.print("Attempting MQTT connection to "); 81 | Serial.print(mqttServer); 82 | 83 | // Attempt to connect 84 | if (client.connect(ID, "try", "try")) 85 | { 86 | Serial.println("...connected"); 87 | 88 | // Once connected, publish an announcement... 89 | client.publish(TOPIC, data.c_str()); 90 | 91 | //Serial.println("Published connection message successfully!"); 92 | //Serial.print("Subcribed to: "); 93 | //Serial.println(subTopic); 94 | 95 | client.subscribe(subTopic); 96 | // for loopback testing 97 | client.subscribe(TOPIC); 98 | } 99 | else 100 | { 101 | Serial.print("...failed, rc="); 102 | Serial.print(client.state()); 103 | Serial.println(" try again in 5 seconds"); 104 | 105 | // Wait 5 seconds before retrying 106 | delay(5000); 107 | } 108 | } 109 | } 110 | 111 | void setup() 112 | { 113 | // Open serial communications and wait for port to open: 114 | Serial.begin(115200); 115 | delay(2000); 116 | 117 | Serial.print("\nStart MQTTClient_Basic_LAN8720 on "); Serial.print(BOARD_NAME); 118 | Serial.print(" with "); Serial.println(SHIELD_TYPE); 119 | Serial.println(ASYNC_WEBSERVER_STM32_VERSION); 120 | 121 | #if (_ASYNCWEBSERVER_STM32_LOGLEVEL_ > 2) 122 | Serial.print("STM32 Core version v"); Serial.print(STM32_CORE_VERSION_MAJOR); 123 | Serial.print("."); Serial.print(STM32_CORE_VERSION_MINOR); 124 | Serial.print("."); Serial.println(STM32_CORE_VERSION_PATCH); 125 | #endif 126 | 127 | // start the ethernet connection and the server 128 | // Use random mac 129 | uint16_t index = millis() % NUMBER_OF_MAC; 130 | 131 | // Use Static IP 132 | //Ethernet.begin(mac[index], ip); 133 | // Use DHCP dynamic IP and random mac 134 | Ethernet.begin(mac[index]); 135 | 136 | Serial.print("\nConnected to network. IP = "); 137 | Serial.println(Ethernet.localIP()); 138 | 139 | client.setServer(mqttServer, 1883); 140 | client.setCallback(callback); 141 | 142 | // Allow the hardware to sort itself out 143 | delay(1500); 144 | } 145 | 146 | #define MQTT_PUBLISH_INTERVAL_MS 5000L 147 | 148 | unsigned long lastMsg = 0; 149 | 150 | void loop() 151 | { 152 | static unsigned long now; 153 | 154 | if (!client.connected()) 155 | { 156 | reconnect(); 157 | } 158 | 159 | // Sending Data 160 | now = millis(); 161 | 162 | if (now - lastMsg > MQTT_PUBLISH_INTERVAL_MS) 163 | { 164 | lastMsg = now; 165 | 166 | if (!client.publish(TOPIC, pubData)) 167 | { 168 | Serial.println("Message failed to send."); 169 | } 170 | 171 | Serial.print("Message Send : " + String(TOPIC) + " => "); 172 | Serial.println(data); 173 | } 174 | 175 | client.loop(); 176 | } 177 | -------------------------------------------------------------------------------- /Packages_Patches/STM32/hardware/stm32/2.0.0/variants/L052R(6-8)H_L053R(6-8)H/variant_generic.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (c) 2020-2021, STMicroelectronics 4 | * All rights reserved. 5 | * 6 | * This software component is licensed by ST under BSD 3-Clause license, 7 | * the "License"; You may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * opensource.org/licenses/BSD-3-Clause 10 | * 11 | ******************************************************************************* 12 | */ 13 | #pragma once 14 | 15 | /*---------------------------------------------------------------------------- 16 | * STM32 pins number 17 | *----------------------------------------------------------------------------*/ 18 | #define PA0 PIN_A0 19 | #define PA1 PIN_A1 20 | #define PA2 PIN_A2 21 | #define PA3 PIN_A3 22 | #define PA4 PIN_A4 23 | #define PA5 PIN_A5 24 | #define PA6 PIN_A6 25 | #define PA7 PIN_A7 26 | #define PA8 8 27 | #define PA9 9 28 | #define PA10 10 29 | #define PA11 11 30 | #define PA12 12 31 | #define PA13 13 32 | #define PA14 14 33 | #define PA15 15 34 | #define PB0 PIN_A8 35 | #define PB1 PIN_A9 36 | #define PB2 18 37 | #define PB3 19 38 | #define PB4 20 39 | #define PB5 21 40 | #define PB6 22 41 | #define PB7 23 42 | #define PB8 24 43 | #define PB9 25 44 | #define PB10 26 45 | #define PB11 27 46 | #define PB12 28 47 | #define PB13 29 48 | #define PB14 30 49 | #define PB15 31 50 | #define PC0 PIN_A10 51 | #define PC1 PIN_A11 52 | #define PC2 PIN_A12 53 | #define PC4 PIN_A13 54 | #define PC5 PIN_A14 55 | #define PC6 37 56 | #define PC7 38 57 | #define PC8 39 58 | #define PC9 40 59 | #define PC10 41 60 | #define PC11 42 61 | #define PC12 43 62 | #define PC13 44 63 | #define PC14 45 64 | #define PC15 46 65 | #define PD2 47 66 | #define PH0 48 67 | #define PH1 49 68 | 69 | // Alternate pins number 70 | #define PA2_ALT1 (PA2 | ALT1) 71 | #define PA3_ALT1 (PA3 | ALT1) 72 | 73 | #define NUM_DIGITAL_PINS 50 74 | #define NUM_ANALOG_INPUTS 15 75 | 76 | // On-board LED pin number 77 | #ifndef LED_BUILTIN 78 | #define LED_BUILTIN PNUM_NOT_DEFINED 79 | #endif 80 | 81 | // On-board user button 82 | #ifndef USER_BTN 83 | #define USER_BTN PNUM_NOT_DEFINED 84 | #endif 85 | 86 | // SPI definitions 87 | #ifndef PIN_SPI_SS 88 | #define PIN_SPI_SS PA4 89 | #endif 90 | #ifndef PIN_SPI_SS1 91 | #define PIN_SPI_SS1 PA15 92 | #endif 93 | #ifndef PIN_SPI_SS2 94 | #define PIN_SPI_SS2 PNUM_NOT_DEFINED 95 | #endif 96 | #ifndef PIN_SPI_SS3 97 | #define PIN_SPI_SS3 PNUM_NOT_DEFINED 98 | #endif 99 | #ifndef PIN_SPI_MOSI 100 | #define PIN_SPI_MOSI PA7 101 | #endif 102 | #ifndef PIN_SPI_MISO 103 | #define PIN_SPI_MISO PA6 104 | #endif 105 | #ifndef PIN_SPI_SCK 106 | #define PIN_SPI_SCK PA5 107 | #endif 108 | 109 | // I2C definitions 110 | #ifndef PIN_WIRE_SDA 111 | #define PIN_WIRE_SDA PB7 112 | #endif 113 | #ifndef PIN_WIRE_SCL 114 | #define PIN_WIRE_SCL PB6 115 | #endif 116 | 117 | // Timer Definitions 118 | // Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin 119 | #ifndef TIMER_TONE 120 | #define TIMER_TONE TIM6 121 | #endif 122 | #ifndef TIMER_SERVO 123 | #define TIMER_SERVO TIM21 124 | #endif 125 | 126 | // UART Definitions 127 | #ifndef SERIAL_UART_INSTANCE 128 | #define SERIAL_UART_INSTANCE 2 129 | #endif 130 | 131 | // Default pin used for generic 'Serial' instance 132 | // Mandatory for Firmata 133 | #ifndef PIN_SERIAL_RX 134 | #define PIN_SERIAL_RX PA3 135 | #endif 136 | #ifndef PIN_SERIAL_TX 137 | #define PIN_SERIAL_TX PA2 138 | #endif 139 | 140 | // Extra HAL modules 141 | #if !defined(HAL_DAC_MODULE_DISABLED) 142 | #define HAL_DAC_MODULE_ENABLED 143 | #endif 144 | 145 | /*---------------------------------------------------------------------------- 146 | * Arduino objects - C++ only 147 | *----------------------------------------------------------------------------*/ 148 | 149 | #ifdef __cplusplus 150 | // These serial port names are intended to allow libraries and architecture-neutral 151 | // sketches to automatically default to the correct port name for a particular type 152 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, 153 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. 154 | // 155 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor 156 | // 157 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial 158 | // 159 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library 160 | // 161 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. 162 | // 163 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX 164 | // pins are NOT connected to anything by default. 165 | #ifndef SERIAL_PORT_MONITOR 166 | #define SERIAL_PORT_MONITOR Serial 167 | #endif 168 | #ifndef SERIAL_PORT_HARDWARE 169 | // KH mod to add Serial1, for ESP-AT 170 | //#define SERIAL_PORT_HARDWARE Serial 171 | #define SERIAL_PORT_HARDWARE Serial1 172 | #endif 173 | #endif 174 | -------------------------------------------------------------------------------- /Packages_Patches/STM32/hardware/stm32/2.0.0/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/variant_generic.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (c) 2020-2021, STMicroelectronics 4 | * All rights reserved. 5 | * 6 | * This software component is licensed by ST under BSD 3-Clause license, 7 | * the "License"; You may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * opensource.org/licenses/BSD-3-Clause 10 | * 11 | ******************************************************************************* 12 | */ 13 | #pragma once 14 | 15 | /*---------------------------------------------------------------------------- 16 | * STM32 pins number 17 | *----------------------------------------------------------------------------*/ 18 | #define PA0 PIN_A0 19 | #define PA1 PIN_A1 20 | #define PA2 PIN_A2 21 | #define PA3 PIN_A3 22 | #define PA4 PIN_A4 23 | #define PA5 PIN_A5 24 | #define PA6 PIN_A6 25 | #define PA7 PIN_A7 26 | #define PA8 8 27 | #define PA9 9 28 | #define PA10 10 29 | #define PA11 11 30 | #define PA12 12 31 | #define PA13 13 32 | #define PA14 14 33 | #define PA15 15 34 | #define PB0 PIN_A8 35 | #define PB1 PIN_A9 36 | #define PB2 18 37 | #define PB3 19 38 | #define PB4 20 39 | #define PB5 21 40 | #define PB6 22 41 | #define PB7 23 42 | #define PB8 24 43 | #define PB9 25 44 | #define PB10 26 45 | #define PB11 27 46 | #define PB12 28 47 | #define PB13 29 48 | #define PB14 30 49 | #define PB15 31 50 | #define PC0 PIN_A10 51 | #define PC1 PIN_A11 52 | #define PC2 PIN_A12 53 | #define PC4 PIN_A13 54 | #define PC5 PIN_A14 55 | #define PC6 37 56 | #define PC7 38 57 | #define PC8 39 58 | #define PC9 40 59 | #define PC10 41 60 | #define PC11 42 61 | #define PC12 43 62 | #define PC13 44 63 | #define PC14 45 64 | #define PC15 46 65 | #define PD2 47 66 | #define PH0 48 67 | #define PH1 49 68 | 69 | // Alternate pins number 70 | #define PA2_ALT1 (PA2 | ALT1) 71 | #define PA3_ALT1 (PA3 | ALT1) 72 | 73 | #define NUM_DIGITAL_PINS 50 74 | #define NUM_ANALOG_INPUTS 15 75 | 76 | // On-board LED pin number 77 | #ifndef LED_BUILTIN 78 | #define LED_BUILTIN PNUM_NOT_DEFINED 79 | #endif 80 | 81 | // On-board user button 82 | #ifndef USER_BTN 83 | #define USER_BTN PNUM_NOT_DEFINED 84 | #endif 85 | 86 | // SPI definitions 87 | #ifndef PIN_SPI_SS 88 | #define PIN_SPI_SS PA4 89 | #endif 90 | #ifndef PIN_SPI_SS1 91 | #define PIN_SPI_SS1 PA15 92 | #endif 93 | #ifndef PIN_SPI_SS2 94 | #define PIN_SPI_SS2 PNUM_NOT_DEFINED 95 | #endif 96 | #ifndef PIN_SPI_SS3 97 | #define PIN_SPI_SS3 PNUM_NOT_DEFINED 98 | #endif 99 | #ifndef PIN_SPI_MOSI 100 | #define PIN_SPI_MOSI PA7 101 | #endif 102 | #ifndef PIN_SPI_MISO 103 | #define PIN_SPI_MISO PA6 104 | #endif 105 | #ifndef PIN_SPI_SCK 106 | #define PIN_SPI_SCK PA5 107 | #endif 108 | 109 | // I2C definitions 110 | #ifndef PIN_WIRE_SDA 111 | #define PIN_WIRE_SDA PB7 112 | #endif 113 | #ifndef PIN_WIRE_SCL 114 | #define PIN_WIRE_SCL PB6 115 | #endif 116 | 117 | // Timer Definitions 118 | // Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin 119 | #ifndef TIMER_TONE 120 | #define TIMER_TONE TIM6 121 | #endif 122 | #ifndef TIMER_SERVO 123 | #define TIMER_SERVO TIM21 124 | #endif 125 | 126 | // UART Definitions 127 | #ifndef SERIAL_UART_INSTANCE 128 | #define SERIAL_UART_INSTANCE 2 129 | #endif 130 | 131 | // Default pin used for generic 'Serial' instance 132 | // Mandatory for Firmata 133 | #ifndef PIN_SERIAL_RX 134 | #define PIN_SERIAL_RX PA3 135 | #endif 136 | #ifndef PIN_SERIAL_TX 137 | #define PIN_SERIAL_TX PA2 138 | #endif 139 | 140 | // Extra HAL modules 141 | #if !defined(HAL_DAC_MODULE_DISABLED) 142 | #define HAL_DAC_MODULE_ENABLED 143 | #endif 144 | 145 | /*---------------------------------------------------------------------------- 146 | * Arduino objects - C++ only 147 | *----------------------------------------------------------------------------*/ 148 | 149 | #ifdef __cplusplus 150 | // These serial port names are intended to allow libraries and architecture-neutral 151 | // sketches to automatically default to the correct port name for a particular type 152 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, 153 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. 154 | // 155 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor 156 | // 157 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial 158 | // 159 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library 160 | // 161 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. 162 | // 163 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX 164 | // pins are NOT connected to anything by default. 165 | #ifndef SERIAL_PORT_MONITOR 166 | #define SERIAL_PORT_MONITOR Serial 167 | #endif 168 | #ifndef SERIAL_PORT_HARDWARE 169 | // KH mod to add Serial1, for ESP-AT 170 | //#define SERIAL_PORT_HARDWARE Serial 171 | #define SERIAL_PORT_HARDWARE Serial1 172 | #endif 173 | #endif 174 | -------------------------------------------------------------------------------- /Packages_Patches/STM32/hardware/stm32/2.1.0/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/variant_generic.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (c) 2020-2021, STMicroelectronics 4 | * All rights reserved. 5 | * 6 | * This software component is licensed by ST under BSD 3-Clause license, 7 | * the "License"; You may not use this file except in compliance with the 8 | * License. You may obtain a copy of the License at: 9 | * opensource.org/licenses/BSD-3-Clause 10 | * 11 | ******************************************************************************* 12 | */ 13 | #pragma once 14 | 15 | /*---------------------------------------------------------------------------- 16 | * STM32 pins number 17 | *----------------------------------------------------------------------------*/ 18 | #define PA0 PIN_A0 19 | #define PA1 PIN_A1 20 | #define PA2 PIN_A2 21 | #define PA3 PIN_A3 22 | #define PA4 PIN_A4 23 | #define PA5 PIN_A5 24 | #define PA6 PIN_A6 25 | #define PA7 PIN_A7 26 | #define PA8 8 27 | #define PA9 9 28 | #define PA10 10 29 | #define PA11 11 30 | #define PA12 12 31 | #define PA13 13 32 | #define PA14 14 33 | #define PA15 15 34 | #define PB0 PIN_A8 35 | #define PB1 PIN_A9 36 | #define PB2 18 37 | #define PB3 19 38 | #define PB4 20 39 | #define PB5 21 40 | #define PB6 22 41 | #define PB7 23 42 | #define PB8 24 43 | #define PB9 25 44 | #define PB10 26 45 | #define PB11 27 46 | #define PB12 28 47 | #define PB13 29 48 | #define PB14 30 49 | #define PB15 31 50 | #define PC0 PIN_A10 51 | #define PC1 PIN_A11 52 | #define PC2 PIN_A12 53 | #define PC4 PIN_A13 54 | #define PC5 PIN_A14 55 | #define PC6 37 56 | #define PC7 38 57 | #define PC8 39 58 | #define PC9 40 59 | #define PC10 41 60 | #define PC11 42 61 | #define PC12 43 62 | #define PC13 44 63 | #define PC14 45 64 | #define PC15 46 65 | #define PD2 47 66 | #define PH0 48 67 | #define PH1 49 68 | 69 | // Alternate pins number 70 | #define PA2_ALT1 (PA2 | ALT1) 71 | #define PA3_ALT1 (PA3 | ALT1) 72 | 73 | #define NUM_DIGITAL_PINS 50 74 | #define NUM_ANALOG_INPUTS 15 75 | 76 | // On-board LED pin number 77 | #ifndef LED_BUILTIN 78 | #define LED_BUILTIN PNUM_NOT_DEFINED 79 | #endif 80 | 81 | // On-board user button 82 | #ifndef USER_BTN 83 | #define USER_BTN PNUM_NOT_DEFINED 84 | #endif 85 | 86 | // SPI definitions 87 | #ifndef PIN_SPI_SS 88 | #define PIN_SPI_SS PA4 89 | #endif 90 | #ifndef PIN_SPI_SS1 91 | #define PIN_SPI_SS1 PA15 92 | #endif 93 | #ifndef PIN_SPI_SS2 94 | #define PIN_SPI_SS2 PNUM_NOT_DEFINED 95 | #endif 96 | #ifndef PIN_SPI_SS3 97 | #define PIN_SPI_SS3 PNUM_NOT_DEFINED 98 | #endif 99 | #ifndef PIN_SPI_MOSI 100 | #define PIN_SPI_MOSI PA7 101 | #endif 102 | #ifndef PIN_SPI_MISO 103 | #define PIN_SPI_MISO PA6 104 | #endif 105 | #ifndef PIN_SPI_SCK 106 | #define PIN_SPI_SCK PA5 107 | #endif 108 | 109 | // I2C definitions 110 | #ifndef PIN_WIRE_SDA 111 | #define PIN_WIRE_SDA PB7 112 | #endif 113 | #ifndef PIN_WIRE_SCL 114 | #define PIN_WIRE_SCL PB6 115 | #endif 116 | 117 | // Timer Definitions 118 | // Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin 119 | #ifndef TIMER_TONE 120 | #define TIMER_TONE TIM6 121 | #endif 122 | #ifndef TIMER_SERVO 123 | #define TIMER_SERVO TIM21 124 | #endif 125 | 126 | // UART Definitions 127 | #ifndef SERIAL_UART_INSTANCE 128 | #define SERIAL_UART_INSTANCE 2 129 | #endif 130 | 131 | // Default pin used for generic 'Serial' instance 132 | // Mandatory for Firmata 133 | #ifndef PIN_SERIAL_RX 134 | #define PIN_SERIAL_RX PA3 135 | #endif 136 | #ifndef PIN_SERIAL_TX 137 | #define PIN_SERIAL_TX PA2 138 | #endif 139 | 140 | // Extra HAL modules 141 | #if !defined(HAL_DAC_MODULE_DISABLED) 142 | #define HAL_DAC_MODULE_ENABLED 143 | #endif 144 | 145 | /*---------------------------------------------------------------------------- 146 | * Arduino objects - C++ only 147 | *----------------------------------------------------------------------------*/ 148 | 149 | #ifdef __cplusplus 150 | // These serial port names are intended to allow libraries and architecture-neutral 151 | // sketches to automatically default to the correct port name for a particular type 152 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, 153 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. 154 | // 155 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor 156 | // 157 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial 158 | // 159 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library 160 | // 161 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. 162 | // 163 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX 164 | // pins are NOT connected to anything by default. 165 | #ifndef SERIAL_PORT_MONITOR 166 | #define SERIAL_PORT_MONITOR Serial 167 | #endif 168 | #ifndef SERIAL_PORT_HARDWARE 169 | // KH mod to add Serial1, for ESP-AT 170 | //#define SERIAL_PORT_HARDWARE Serial 171 | #define SERIAL_PORT_HARDWARE Serial1 172 | #endif 173 | #endif 174 | --------------------------------------------------------------------------------