Hi, Cristiano,
I suggest you develop the code in SDK platform and FreeRtos os. After the I2S received the predefined size of data, a callback function is called, you can set a flag in the I2S callback function.
In the LWIP thread, you can set the ip address and port in the buff and use the netconn_send(conn, buf); function to send the data if the flag in the callback function is set.
I do not know how to compress the audio data.
Hope it can help you
BR
XiangJun Rong
static void udpecho_thread(void *arg)
{
static struct netconn *conn;
static struct netbuf *buf;
char buffer[100];
err_t err;
LWIP_UNUSED_ARG(arg);
netif_set_up(&fsl_netif0);
conn = netconn_new(NETCONN_UDP);
LWIP_ASSERT("con != NULL", conn != NULL);
netconn_bind(conn, NULL, 7);
while (1)
{
// err = netconn_recv(conn, &buf);
if (err == ERR_OK)
{
if (netbuf_copy(buf, buffer, buf->p->tot_len) != buf->p->tot_len)
{
LWIP_DEBUGF(UDPECHO_DBG, ("netbuf_copy failed\r\n"));
}
else
{
buffer[buf->p->tot_len] = '\0';
err = netconn_send(conn, buf);
if (err != ERR_OK)
{
LWIP_DEBUGF(UDPECHO_DBG, ("netconn_send failed: %d\r\n", (int)err));
}
else
{
LWIP_DEBUGF(UDPECHO_DBG, ("got %s\r\n", buffer));
}
}
netbuf_delete(buf);
}
}
}