Finally external files working
This commit is contained in:
parent
2d36e41641
commit
0422eeeb9a
6 changed files with 31 additions and 28 deletions
4
ESPTest/.vscode/settings.json
vendored
4
ESPTest/.vscode/settings.json
vendored
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"esp_wifi_default.h": "c"
|
||||
"esp_wifi_default.h": "c",
|
||||
"esp_log.h": "c",
|
||||
"lwip_hooks.h": "c"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
#pragma once
|
||||
#ifndef _LWIP_HOOKS_H_
|
||||
#define _LWIP_HOOKS_H_
|
||||
|
||||
#define LWIP_HOOK_IP4_INPUT lwip_hook_ip4_input
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
int lwip_hook_ip4_input(struct pbuf *pbuf, struct netif *input_netif);
|
||||
#define LWIP_HOOK_IP4_INPUT lwip_hook_ip4_input
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LWIP_HOOKS_H_ */
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
#include "lwip/netif.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
int lwip_hook_ip4_input(struct pbuf *pbuf, struct netif *input_netif)
|
||||
{
|
||||
ESP_LOGI("HOOK", "Testing...");
|
||||
return 0; // we don't consume the packet
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/pbuf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
int lwip_hook_ip4_input(struct pbuf *pbuf, struct netif *input_netif);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -14,4 +14,5 @@ board = az-delivery-devkit-v4
|
|||
framework = espidf
|
||||
monitor_speed = 115200
|
||||
build_flags =
|
||||
'-DLWIP_HOOK_IP4_INPUT(pbuf, input_netif)=({ESP_LOGI("HOOK","TEST");0;})'
|
||||
'-Iinclude'
|
||||
'-DESP_IDF_LWIP_HOOK_FILENAME="lwip_hooks.h"'
|
||||
|
|
7
ESPTest/src/lwip_hooks.c
Normal file
7
ESPTest/src/lwip_hooks.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "lwip_hooks.h"
|
||||
|
||||
int lwip_hook_ip4_input(struct pbuf *pbuf, struct netif *input_netif)
|
||||
{
|
||||
ESP_LOGI("Hook", "Testing...");
|
||||
return 0;
|
||||
}
|
Reference in a new issue