espnowSimple 1
Loading...
Searching...
No Matches
espnowsimple.h File Reference
#include <esp_now.h>
#include <esp_wifi.h>
#include <WiFi.h>
Include dependency graph for espnowsimple.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  espNowSimplePkg

Macros

#define ESPNOW_SIMPLE_DATA_LGT   100

Functions

void espSimpleNowCallbackBinRcvd (const uint8_t *data, int len)
void espSimpleNowCallbackDataSent (const bool success)
uint8_t espSimpleNowInit (uint8_t macAddrLastByte)
void espSimpleNowSetMacAddr (uint8_t mac[6])
void espSimpleNowGetMacAddr (uint8_t mac[6])
uint8_t espSimpleNowBroadcastData (char *data, uint16_t len)

Variables

esp_err_t espNowSimpleErr
uint8_t espSimpleNowRunning

Macro Definition Documentation

◆ ESPNOW_SIMPLE_DATA_LGT

#define ESPNOW_SIMPLE_DATA_LGT   100

Definition at line 24 of file espnowsimple.h.

Function Documentation

◆ espSimpleNowBroadcastData()

uint8_t espSimpleNowBroadcastData ( char * data,
uint16_t len )

Simple binary data tx NB max size 250Byte pls use max 249 just to be sure

Returns
1: well.

Definition at line 130 of file espnowsimple.cpp.

References broadcastMAC, and espSimpleNowRunning.

Referenced by txTest().

Here is the caller graph for this function:

◆ espSimpleNowCallbackBinRcvd()

void espSimpleNowCallbackBinRcvd ( const uint8_t * data,
int len )

The callback you shall implement as to get data

void espSimpleNowCallbackBinRcvd(const uint8_t *data, int len) { your code }

the receiving function just copy the received package to local storage You might do it better by implementing a buffer system

Definition at line 33 of file espnowsimple.cpp.

References arSize, rxCount, rxData, rxPkg, rxPkg2, and txData.

Referenced by internalDataReceivedCallback().

Here is the caller graph for this function:

◆ espSimpleNowCallbackDataSent()

void espSimpleNowCallbackDataSent ( const bool success)

The callback you shall implement as to check if data has been send NB esp now do not guarantee if data is received in same order as you did tx - ifff you are heavily loading the system

void espSimpleNowCallbackDataSent(const bool success) { }

to check if data has been send to get data

Definition at line 34 of file espnowsimple.cpp.

Referenced by internalDataSentCallback().

Here is the caller graph for this function:

◆ espSimpleNowGetMacAddr()

void espSimpleNowGetMacAddr ( uint8_t mac[6])

you can get current mac addr

Returns
1: hej

Definition at line 148 of file espnowsimple.cpp.

References broadcastMAC.

Referenced by testMacAddr().

Here is the caller graph for this function:

◆ espSimpleNowInit()

uint8_t espSimpleNowInit ( uint8_t macAddrLastByte)

change last byte in MAC to To used for broadcast See esp now library NB parm must not n“edn on 1,3,5,7 (decimal) or just lsb bit must not be 1 return: -1 if macaddressbyte i odd - must be even (lsb bit0 ==0) rest of err codes comes from call to initESPNowMac 1: esp_wifi_sec_mac failed 2: esp_now_init failed 3: esp_wifi_set_protocol failed 4: esp_now_register_send_cb failed 5: esp_now_register_recv_cb failed 6: esp_now_add_peer failed

espNowSimpleErr (of type esp_err_t) holds the actual errorcode

Definition at line 114 of file espnowsimple.cpp.

References broadcastMAC, initESPNowMac(), and setMacAddr().

Referenced by setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ espSimpleNowSetMacAddr()

void espSimpleNowSetMacAddr ( uint8_t mac[6])

You can change broadcast mac address

Set new

Definition at line 142 of file espnowsimple.cpp.

References broadcastMAC.

Referenced by testMacAddr().

Here is the caller graph for this function:

Variable Documentation

◆ espNowSimpleErr

esp_err_t espNowSimpleErr
extern

Definition at line 19 of file espnowsimple.cpp.

Referenced by initESPNowMac().

◆ espSimpleNowRunning

uint8_t espSimpleNowRunning
extern

Definition at line 23 of file espnowsimple.cpp.

Referenced by espSimpleNowBroadcastData(), and initESPNowMac().