0
0
Fork 0

feat: Add static IP feature

This commit is contained in:
windowsair 2021-03-09 15:51:36 +08:00
parent 2863553018
commit 8429361cf8
5 changed files with 38 additions and 10 deletions

View File

@ -49,6 +49,8 @@ The default connected WIFI SSID is `DAP` , password `12345678`
You can change `WIFI_SSID` and ` WIFI_PASS` in [wifi_configuration.h](main/wifi_configuration.h) You can change `WIFI_SSID` and ` WIFI_PASS` in [wifi_configuration.h](main/wifi_configuration.h)
You can also specify your IP in the above file (We recommend using the static address binding feature of the router).
### Debugger ### Debugger
@ -184,7 +186,7 @@ When you select max clock, we will take the following actions:
1. Use WinUSB Mode(enabled by default): 1. Use WinUSB Mode(enabled by default):
change `USE_WINUSB` macor in [USBd_config.h](components/USBIP/USBd_config.h) change `USE_WINUSB` macor in [dap_configuration.h](main/dap_configuration.h)
@ -234,9 +236,9 @@ Credits to the following project, people and organizations:
> - https://github.com/cezanne/usbip-win for usbip windows > - https://github.com/cezanne/usbip-win for usbip windows
- @HeavenSpree - [@HeavenSpree](https://www.github.com/HeavenSpree)
- @Zy19930907 - [@Zy19930907](https://www.github.com/Zy19930907)
- @caiguang1997 - [@caiguang1997](https://www.github.com/caiguang1997)
## License ## License

View File

@ -120,7 +120,7 @@ This information includes:
#define DAP_PACKET_COUNT 255 ///< Specifies number of packets buffered. #define DAP_PACKET_COUNT 255 ///< Specifies number of packets buffered.
/// Indicates that the SWO function(UART SWO & Streaming Trace) is available /// Indicates that the SWO function(UART SWO & Streaming Trace) is available
#define SWO_FUNCTION_ENABLE 1 ///< SWO function: 1 = available, 0 = not available. #define SWO_FUNCTION_ENABLE 0 ///< SWO function: 1 = available, 0 = not available.
/// Indicate that UART Serial Wire Output (SWO) trace is available. /// Indicate that UART Serial Wire Output (SWO) trace is available.

View File

@ -115,7 +115,7 @@ void handle_dap_data_response(usbip_stage2_header *header)
void handle_swo_trace_response(usbip_stage2_header *header) void handle_swo_trace_response(usbip_stage2_header *header)
{ {
#if (SWO_FUNCTION_ENABLE == 1)
if (kSwoTransferBusy) if (kSwoTransferBusy)
{ {
// busy indicates that there is data to be send // busy indicates that there is data to be send
@ -128,6 +128,9 @@ void handle_swo_trace_response(usbip_stage2_header *header)
// nothing to send. // nothing to send.
send_stage2_submit(header, 0, 0); send_stage2_submit(header, 0, 0);
} }
#else
send_stage2_submit(header, 0, 0);
#endif
} }
// SWO Data Queue Transfer // SWO Data Queue Transfer

View File

@ -97,6 +97,22 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
static void initialise_wifi(void) static void initialise_wifi(void)
{ {
tcpip_adapter_init(); tcpip_adapter_init();
#if (USE_STATIC_IP == 1)
tcpip_adapter_dhcps_stop(TCPIP_ADAPTER_IF_STA);
tcpip_adapter_ip_info_t ip_info;
#define MY_IP4_ADDR(...) IP4_ADDR(__VA_ARGS__)
MY_IP4_ADDR(&ip_info.ip, DAP_IP_ADDRESS);
MY_IP4_ADDR(&ip_info.gw, DAP_IP_GATEWAY);
MY_IP4_ADDR(&ip_info.netmask, DAP_IP_NETMASK);
#undef MY_IP4_ADDR
tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info);
#endif // (USE_STATIC_IP == 1)
wifi_event_group = xEventGroupCreate(); wifi_event_group = xEventGroupCreate();
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL)); ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL));

View File

@ -3,9 +3,9 @@
* @brief Fill in your wifi configuration information here. * @brief Fill in your wifi configuration information here.
* @version 0.1 * @version 0.1
* @date 2020-01-22 * @date 2020-01-22
* *
* @copyright Copyright (c) 2020 * @copyright Copyright (c) 2020
* *
*/ */
#ifndef __WIFI_CONFIGURATION__ #ifndef __WIFI_CONFIGURATION__
#define __WIFI_CONFIGURATION__ #define __WIFI_CONFIGURATION__
@ -13,8 +13,15 @@
#define WIFI_SSID "DAP" #define WIFI_SSID "DAP"
#define WIFI_PASS "12345678" #define WIFI_PASS "12345678"
#define PORT 3240
#define USE_STATIC_IP 1
// If you don't want to specify the ip configuration, then ignore the following items.
#define DAP_IP_ADDRESS 192, 168, 137, 123
#define DAP_IP_GATEWAY 192, 168, 137, 1
#define DAP_IP_NETMASK 255, 255, 255, 0
// DO NOT CHANGE
#define PORT 3240
#define CONFIG_EXAMPLE_IPV4 1 #define CONFIG_EXAMPLE_IPV4 1
#endif #endif