/* sim-driver: ESP-NOW goes to the page (src/espnow_sim.cpp), which is the radio between strips and the bridge. */ #pragma once #include #include #include "esp_err.h" #include "esp_wifi.h" #ifdef __cplusplus extern "C" { #endif #define ESP_NOW_ETH_ALEN 6 #define ESP_NOW_MAX_DATA_LEN 250 #define ESP_ERR_ESPNOW_BASE 0x3066 #define ESP_ERR_ESPNOW_NOT_INIT (ESP_ERR_ESPNOW_BASE + 1) #define ESP_ERR_ESPNOW_ARG (ESP_ERR_ESPNOW_BASE + 2) #define ESP_ERR_ESPNOW_NO_MEM (ESP_ERR_ESPNOW_BASE + 3) #define ESP_ERR_ESPNOW_FULL (ESP_ERR_ESPNOW_BASE + 4) #define ESP_ERR_ESPNOW_NOT_FOUND (ESP_ERR_ESPNOW_BASE + 5) #define ESP_ERR_ESPNOW_INTERNAL (ESP_ERR_ESPNOW_BASE + 6) #define ESP_ERR_ESPNOW_EXIST (ESP_ERR_ESPNOW_BASE + 7) typedef struct { uint8_t peer_addr[ESP_NOW_ETH_ALEN]; uint8_t lmk[16]; uint8_t channel; wifi_interface_t ifidx; bool encrypt; void *priv; } esp_now_peer_info_t; typedef struct { uint8_t *src_addr; uint8_t *des_addr; void *rx_ctrl; } esp_now_recv_info_t; typedef void (*esp_now_recv_cb_t)(const esp_now_recv_info_t *info, const uint8_t *data, int len); esp_err_t esp_now_init(void); esp_err_t esp_now_deinit(void); esp_err_t esp_now_register_recv_cb(esp_now_recv_cb_t cb); esp_err_t esp_now_add_peer(const esp_now_peer_info_t *peer); bool esp_now_is_peer_exist(const uint8_t *mac); esp_err_t esp_now_send(const uint8_t *mac, const uint8_t *data, size_t len); #ifdef __cplusplus } #endif