Loading...
Searching...
No Matches
esp_now_netdev.h File Reference

Netdev interface for the ESP-NOW WiFi P2P protocol. More...

Detailed Description

Netdev interface for the ESP-NOW WiFi P2P protocol.

Author
Gunar Schorcht gunar.nosp@m.@sch.nosp@m.orcht.nosp@m..net
Timo Rothenpieler timo..nosp@m.roth.nosp@m.enpie.nosp@m.ler@.nosp@m.uni-b.nosp@m.reme.nosp@m.n.de

Definition in file esp_now_netdev.h.

#include "net/netdev.h"
#include "mutex.h"
#include "net/ethernet/hdr.h"
+ Include dependency graph for esp_now_netdev.h:

Go to the source code of this file.

Data Structures

struct  esp_now_pkt_hdr_t
 Header with necessary flags for ESP-NOW packets. More...
 
struct  esp_now_netdev_t
 Device descriptor for ESP-NOW devices. More...
 
#define ESP_NOW_MAX_SIZE_RAW   (250)
 Maximum raw packet size that can be used with ESP-NOW (including headers)
 
#define ESP_NOW_ADDR_LEN   ETHERNET_ADDR_LEN
 Length of ESP-NOW addresses.
 
#define ESP_NOW_HEADER_LENGTH   (sizeof(esp_now_pkt_hdr_t))
 Size of non-data header elements in ESP-NOW packet.
 
#define ESP_NOW_MAX_SIZE   (ESP_NOW_MAX_SIZE_RAW - ESP_NOW_HEADER_LENGTH)
 Maximum packet size that can be used with ESP-NOW.
 
#define ESP_NOW_BUFSIZE   (ESP_NOW_MAX_SIZE_RAW + ESP_NOW_ADDR_LEN)
 buffer size used for RX buffering
 
#define ESP_NOW_PKT_HDR_FLAG_SIXLO   (1)
 Packet is carrying 6Lo data.
 
const netdev_driver_t esp_now_driver
 Reference to the netdev device driver struct.
 
esp_now_netdev_tnetdev_esp_now_setup (void)
 ESP-NOW netdev initialization function.
 
int esp_now_set_channel (uint8_t channel)
 Set the channel used by ESP-NOW netdev.
 

Macro Definition Documentation

◆ ESP_NOW_ADDR_LEN

#define ESP_NOW_ADDR_LEN   ETHERNET_ADDR_LEN

Length of ESP-NOW addresses.

Definition at line 42 of file esp_now_netdev.h.

◆ ESP_NOW_BUFSIZE

#define ESP_NOW_BUFSIZE   (ESP_NOW_MAX_SIZE_RAW + ESP_NOW_ADDR_LEN)

buffer size used for RX buffering

The buffer is use to store a ESP-NOW packet and the source MAC address.

Definition at line 60 of file esp_now_netdev.h.

◆ ESP_NOW_HEADER_LENGTH

#define ESP_NOW_HEADER_LENGTH   (sizeof(esp_now_pkt_hdr_t))

Size of non-data header elements in ESP-NOW packet.

Definition at line 47 of file esp_now_netdev.h.

◆ ESP_NOW_MAX_SIZE

#define ESP_NOW_MAX_SIZE   (ESP_NOW_MAX_SIZE_RAW - ESP_NOW_HEADER_LENGTH)

Maximum packet size that can be used with ESP-NOW.

Definition at line 52 of file esp_now_netdev.h.

◆ ESP_NOW_MAX_SIZE_RAW

#define ESP_NOW_MAX_SIZE_RAW   (250)

Maximum raw packet size that can be used with ESP-NOW (including headers)

Definition at line 37 of file esp_now_netdev.h.

◆ ESP_NOW_PKT_HDR_FLAG_SIXLO

#define ESP_NOW_PKT_HDR_FLAG_SIXLO   (1)

Packet is carrying 6Lo data.

Definition at line 79 of file esp_now_netdev.h.

Function Documentation

◆ esp_now_set_channel()

int esp_now_set_channel ( uint8_t  channel)

Set the channel used by ESP-NOW netdev.

Parameters
channelChannel to be used
Returns
ESP_OK on success, an ESP error code otherwise

◆ netdev_esp_now_setup()

esp_now_netdev_t * netdev_esp_now_setup ( void  )

ESP-NOW netdev initialization function.

Returns
NULL on error, pointer to esp_now_netdev on success