feat: Add static IP feature
This commit is contained in:
parent
2863553018
commit
8429361cf8
10
README.md
10
README.md
|
@ -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 also specify your IP in the above file (We recommend using the static address binding feature of the router).
|
||||
|
||||
### Debugger
|
||||
|
||||
|
||||
|
@ -184,7 +186,7 @@ When you select max clock, we will take the following actions:
|
|||
|
||||
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
|
||||
|
||||
|
||||
- @HeavenSpree
|
||||
- @Zy19930907
|
||||
- @caiguang1997
|
||||
- [@HeavenSpree](https://www.github.com/HeavenSpree)
|
||||
- [@Zy19930907](https://www.github.com/Zy19930907)
|
||||
- [@caiguang1997](https://www.github.com/caiguang1997)
|
||||
|
||||
|
||||
## License
|
||||
|
|
|
@ -120,7 +120,7 @@ This information includes:
|
|||
#define DAP_PACKET_COUNT 255 ///< Specifies number of packets buffered.
|
||||
|
||||
/// 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.
|
||||
|
|
|
@ -115,7 +115,7 @@ void handle_dap_data_response(usbip_stage2_header *header)
|
|||
|
||||
void handle_swo_trace_response(usbip_stage2_header *header)
|
||||
{
|
||||
|
||||
#if (SWO_FUNCTION_ENABLE == 1)
|
||||
if (kSwoTransferBusy)
|
||||
{
|
||||
// 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.
|
||||
send_stage2_submit(header, 0, 0);
|
||||
}
|
||||
#else
|
||||
send_stage2_submit(header, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
// SWO Data Queue Transfer
|
||||
|
|
16
main/main.c
16
main/main.c
|
@ -97,6 +97,22 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
|
|||
static void initialise_wifi(void)
|
||||
{
|
||||
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();
|
||||
|
||||
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL));
|
||||
|
|
|
@ -13,8 +13,15 @@
|
|||
#define WIFI_SSID "DAP"
|
||||
#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
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue