Hi,
I’ll split my answer into two parts.
1. Examples utilizing some of the Espressif examples
As it so happens I have been working on exactly this recently in my spare time
. I’ve put my current state of the art up on github for you to have a look at. I currently have two examples
- A http webserver that you can hit to view an image captured by a camera attached to the esp32
- A mqtt client that will publish and image taken by a camera attached to the esp32
It’s still early days but I think it should give you a good starting point for integrating HaLow into other examples in the esp-idf. Any feedback or additions would be more than welcome.
2. How can you glue the MM6108 to the network stack
I think a good starting point to understanding this is to take a look at this comment Documentation SPI Command Set MM6108-MF08651-US - #8 by matt . In that comment you can see the ‘LWIP Shim’ is the glue that allows the network interface to talk to the MM6108. The code for this can be found here for the mm-iot-esp32 repo. An important thing to keep in mind is this is just the data-path (i.e. Ethernet frames) and does not cover WLAN control API (connect, disconnect), they are all handled separately through the mmwlan API.
So effectively there is going to be a call to transmit date and a call the receive data. In the case of mm-iot-esp32-2.6.4 these are (glossing over details like packet allocation and link status):
/**
* Transmit the given packet. The packet must start with an 802.3 header, which will be
* translated into an 802.11 header by this function.
....
*/
enum mmwlan_status mmwlan_tx_pkt(struct mmpkt *pkt, const struct mmwlan_tx_metadata *metadata);
and
/**
* Receive data packet callback function.
*
* @param header Buffer containing the 802.3 header for this packet.
* @param header_len Length of the @p header.
* @param payload Packet payload (excluding header).
* @param payload_len Length of @p payload.
* @param arg Opaque argument that was given when the callback was registered.
*/
typedef void (*mmwlan_rx_cb_t)(uint8_t *header, unsigned header_len,
uint8_t *payload, unsigned payload_len,
void *arg);
/**
* Register a receive callback.
*
* @note Only one receive callback may be registered. Further registration will overwrite the
* previously registered callback.
*
* @note Only a single receive callback may be registered at a time.
*
* @param callback The callback to register (@c NULL to unregister).
* @param arg Opaque argument to be passed to the callback.
*
* @return @ref MMWLAN_SUCCESS on success, else an appropriate error code.
*/
enum mmwlan_status mmwlan_register_rx_cb(mmwlan_rx_cb_t callback, void *arg);
See mm-iot-esp32/framework/morselib/include/mmwlan.h at main · MorseMicro/mm-iot-esp32 · GitHub for more detail.
Another, place to look is ESP-NETIF Developer's manual - ESP32 - — ESP-IDF Programming Guide v5.4 documentation