Making callcack function __not_in_flash_functions

This commit is contained in:
Ulysse Cura 2025-05-26 21:26:47 +02:00
parent c5859a66a3
commit 34edb98912
1 changed files with 5 additions and 5 deletions

View File

@ -5,7 +5,7 @@
udp_client_t udp_client; udp_client_t udp_client;
static inline void handle_receive(struct pbuf *p, const ip_addr_t *addr, u16_t port) static inline void __not_in_flash_func(handle_receive)(struct pbuf *p, const ip_addr_t *addr, u16_t port)
{ {
if(p->len >= 2) if(p->len >= 2)
{ {
@ -18,22 +18,22 @@ static inline void handle_receive(struct pbuf *p, const ip_addr_t *addr, u16_t p
pbuf_free(p); pbuf_free(p);
} }
static void udp_receive_callback(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr, u16_t port) static void __not_in_flash_func(udp_receive_callback)(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)
{ {
udp_client_t *udp_client_received_data = (udp_client_t *)arg; udp_client_t *udp_client_received_data = (udp_client_t *)arg;
handle_receive(p, addr, port); handle_receive(p, addr, port);
} }
// Default callback func // Default callback func
static void default_message_callback(uint8_t *payload, uint16_t len, const ip_addr_t *addr, uint16_t port) static void __not_in_flash_func(default_message_callback)(uint8_t *payload, uint16_t len, const ip_addr_t *addr, uint16_t port)
{ {
printf("Received: packet=%d, len=%d from %s:%d\n", payload[0], len, ipaddr_ntoa(addr), port); printf("Received: packet=%d, len=%d from %s:%d\n", payload[0], len, ipaddr_ntoa(addr), port);
} }
void udp_client_init(void) void udp_client_init(void)
{ {
//udp_client.message_callback = udp_client_message_handler; udp_client.message_callback = udp_client_message_handler;
udp_client.message_callback = default_message_callback; //udp_client.message_callback = default_message_callback;
udp_client.pcb = udp_new(); udp_client.pcb = udp_new();
if(udp_client.pcb == NULL) if(udp_client.pcb == NULL)