Finally external files working

This commit is contained in:
Florian Hoss 2022-07-25 16:01:07 +02:00
parent 2d36e41641
commit 0422eeeb9a
6 changed files with 31 additions and 28 deletions

View file

@ -1,5 +1,7 @@
{
"files.associations": {
"esp_wifi_default.h": "c"
"esp_wifi_default.h": "c",
"esp_log.h": "c",
"lwip_hooks.h": "c"
}
}

View file

@ -1,3 +1,20 @@
#pragma once
#ifndef _LWIP_HOOKS_H_
#define _LWIP_HOOKS_H_
#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_ */

View file

@ -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
}

View file

@ -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

View file

@ -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
View 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;
}