Compare commits
No commits in common. "6765df9cf2395c505e366dc1fb666e2e40088a26" and "2a9abffffbbcc8c93b1e5733a88258a01248ff96" have entirely different histories.
6765df9cf2
...
2a9abffffb
@ -1,67 +0,0 @@
|
|||||||
# Generated from CLion C/C++ Code Style settings
|
|
||||||
BasedOnStyle: LLVM
|
|
||||||
AccessModifierOffset: -2
|
|
||||||
AlignAfterOpenBracket: Align
|
|
||||||
#AlignConsecutiveAssignments: false
|
|
||||||
AlignOperands: true
|
|
||||||
AllowAllArgumentsOnNextLine: false
|
|
||||||
AllowAllConstructorInitializersOnNextLine: false
|
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false
|
|
||||||
AllowShortBlocksOnASingleLine: Always
|
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
|
||||||
AllowShortFunctionsOnASingleLine: All
|
|
||||||
AllowShortIfStatementsOnASingleLine: Always
|
|
||||||
AllowShortLambdasOnASingleLine: All
|
|
||||||
AllowShortLoopsOnASingleLine: true
|
|
||||||
AlwaysBreakAfterReturnType: None
|
|
||||||
AlwaysBreakTemplateDeclarations: Yes
|
|
||||||
BreakBeforeBraces: Custom
|
|
||||||
BraceWrapping:
|
|
||||||
AfterCaseLabel: true
|
|
||||||
AfterClass: true
|
|
||||||
AfterControlStatement: Always
|
|
||||||
AfterEnum: true
|
|
||||||
AfterFunction: true
|
|
||||||
AfterNamespace: true
|
|
||||||
AfterUnion: true
|
|
||||||
AfterStruct: true
|
|
||||||
BeforeCatch: true
|
|
||||||
BeforeElse: true
|
|
||||||
IndentBraces: false
|
|
||||||
SplitEmptyFunction: false
|
|
||||||
SplitEmptyRecord: true
|
|
||||||
BreakBeforeBinaryOperators: None
|
|
||||||
BreakBeforeTernaryOperators: true
|
|
||||||
BreakConstructorInitializers: BeforeColon
|
|
||||||
BreakInheritanceList: BeforeComma
|
|
||||||
ColumnLimit: 0
|
|
||||||
CompactNamespaces: false
|
|
||||||
ContinuationIndentWidth: 8
|
|
||||||
IndentCaseLabels: true
|
|
||||||
IndentPPDirectives: None
|
|
||||||
IndentWidth: 2
|
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
|
||||||
MaxEmptyLinesToKeep: 2
|
|
||||||
NamespaceIndentation: None
|
|
||||||
ObjCSpaceAfterProperty: false
|
|
||||||
ObjCSpaceBeforeProtocolList: true
|
|
||||||
PointerAlignment: Left
|
|
||||||
ReflowComments: false
|
|
||||||
SpaceAfterCStyleCast: true
|
|
||||||
SpaceAfterLogicalNot: false
|
|
||||||
SpaceAfterTemplateKeyword: false
|
|
||||||
SpaceBeforeAssignmentOperators: true
|
|
||||||
SpaceBeforeCpp11BracedList: false
|
|
||||||
SpaceBeforeCtorInitializerColon: true
|
|
||||||
SpaceBeforeInheritanceColon: true
|
|
||||||
SpaceBeforeParens: ControlStatements
|
|
||||||
SpaceBeforeRangeBasedForLoopColon: true
|
|
||||||
SpaceInEmptyParentheses: false
|
|
||||||
SpacesBeforeTrailingComments: 0
|
|
||||||
SpacesInAngles: false
|
|
||||||
SpacesInCStyleCastParentheses: false
|
|
||||||
SpacesInContainerLiterals: false
|
|
||||||
SpacesInParentheses: false
|
|
||||||
SpacesInSquareBrackets: false
|
|
||||||
TabWidth: 2
|
|
||||||
UseTab: Never
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,5 +3,3 @@ sdkconfig
|
|||||||
sdkconfig.old
|
sdkconfig.old
|
||||||
|
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
cmake-build-*/
|
|
||||||
|
|||||||
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
@ -1,8 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
1
.idea/.name
generated
1
.idea/.name
generated
@ -1 +0,0 @@
|
|||||||
esp-tunnel
|
|
||||||
5
.idea/codeStyles/codeStyleConfig.xml
generated
5
.idea/codeStyles/codeStyleConfig.xml
generated
@ -1,5 +0,0 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
|
||||||
<state>
|
|
||||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
|
||||||
</state>
|
|
||||||
</component>
|
|
||||||
2
.idea/esp-tunnel.git.iml
generated
2
.idea/esp-tunnel.git.iml
generated
@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
|
||||||
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
|
||||||
</project>
|
|
||||||
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/esp-tunnel.git.iml" filepath="$PROJECT_DIR$/.idea/esp-tunnel.git.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@ -5,4 +5,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
project(esp-tunnel)
|
project(espnow-testies)
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
idf_component_register(SRCS "esp_tunnel.cpp"
|
idf_component_register(SRCS "esp_tunnel.cpp"
|
||||||
"app_networking.cpp"
|
"app_networking.cpp"
|
||||||
"app_serial.cpp"
|
|
||||||
INCLUDE_DIRS ".")
|
INCLUDE_DIRS ".")
|
||||||
|
|||||||
@ -1,109 +1,36 @@
|
|||||||
#include "app_networking.hpp"
|
#include "app_networking.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cstring>
|
|
||||||
#include <variant>
|
|
||||||
|
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
#include "esp_mac.h"
|
|
||||||
#include "esp_netif.h"
|
#include "esp_netif.h"
|
||||||
#include "esp_now.h"
|
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
|
#include "esp_now.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
using namespace Networking;
|
|
||||||
|
|
||||||
static_assert(std::is_standard_layout_v<EspNowEvent> && std::is_trivial_v<EspNowEvent>,
|
|
||||||
"EspNowEvent is not compatible with a FreeRTOS queue.");
|
|
||||||
|
|
||||||
QueueHandle_t s_esp_now_queue = nullptr;
|
|
||||||
std::array<std::uint8_t, 128> s_rx_buffer;
|
|
||||||
std::variant<MacAddress, std::monostate> s_peer;
|
|
||||||
bool s_tx_inflight = false;
|
|
||||||
|
|
||||||
bool s_isBroadcastAddress(const std::uint8_t* mac)
|
|
||||||
{
|
|
||||||
constexpr MacAddress broadcast_mac{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
|
||||||
return std::memcmp(mac, broadcast_mac.begin(), ESP_NOW_ETH_ALEN) == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool s_isBroadcastAddress(const esp_now_recv_info_t* sender)
|
namespace App
|
||||||
{
|
|
||||||
return s_isBroadcastAddress(sender->src_addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void s_cbEspNowSendComplete(const std::uint8_t* peer_mac, esp_now_send_status_t status)
|
|
||||||
{
|
|
||||||
s_tx_inflight = false;
|
|
||||||
|
|
||||||
EspNowEvent event = { EspNowEvent::MSG_SEND_COMPLETE, 0 };
|
|
||||||
xQueueSend(s_esp_now_queue, &event, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void s_cbEspNowReceiveComplete(const esp_now_recv_info_t* recv_info, const std::uint8_t* data, int len)
|
|
||||||
{
|
|
||||||
const std::size_t rx_len = std::min<std::size_t>(len, s_rx_buffer.size());
|
|
||||||
std::copy_n(data, rx_len, s_rx_buffer.begin());
|
|
||||||
|
|
||||||
EspNowEvent event = { EspNowEvent::MSG_RECEIVED, rx_len };
|
|
||||||
xQueueSend(s_esp_now_queue, &event, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Networking
|
|
||||||
{
|
{
|
||||||
|
|
||||||
void setupWifi()
|
void setupWifi()
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
ESP_ERROR_CHECK(esp_netif_init());
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
|
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
ESP_ERROR_CHECK(esp_wifi_init(&cfg) );
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM));
|
ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM));
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
||||||
ESP_ERROR_CHECK(esp_wifi_start());
|
ESP_ERROR_CHECK(esp_wifi_start());
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_channel(1, WIFI_SECOND_CHAN_NONE));
|
ESP_ERROR_CHECK(esp_wifi_set_channel(1, WIFI_SECOND_CHAN_NONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueHandle_t setupEspNow()
|
void setupEspNow()
|
||||||
{
|
{
|
||||||
s_esp_now_queue = xQueueCreate(4, sizeof(EspNowEvent));
|
ESP_ERROR_CHECK(esp_now_init());
|
||||||
ESP_ERROR_CHECK(s_esp_now_queue != nullptr);
|
// ESP_ERROR_CHECK(esp_now_set_pmk(nullptr));
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_now_init());
|
|
||||||
// ESP_ERROR_CHECK(esp_now_set_pmk(nullptr));
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_now_register_send_cb(s_cbEspNowSendComplete));
|
|
||||||
ESP_ERROR_CHECK(esp_now_register_recv_cb(s_cbEspNowReceiveComplete));
|
|
||||||
|
|
||||||
s_peer = MacAddress{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
|
||||||
|
|
||||||
return s_esp_now_queue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isTxInFlight()
|
}
|
||||||
{
|
|
||||||
return s_tx_inflight;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::array<std::uint8_t, 128>& getRxBuffer()
|
|
||||||
{
|
|
||||||
return s_rx_buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void sendData(const std::array<std::uint8_t, 128>& buffer, const std::size_t length)
|
|
||||||
{
|
|
||||||
if (const MacAddress* peer_mac = std::get_if<MacAddress>(&s_peer);
|
|
||||||
!s_tx_inflight && peer_mac != nullptr)
|
|
||||||
{
|
|
||||||
esp_now_send(peer_mac->data(), buffer.data(), length);
|
|
||||||
s_tx_inflight = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}// namespace App
|
|
||||||
@ -1,32 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
namespace App
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/queue.h"
|
|
||||||
|
|
||||||
namespace Networking
|
|
||||||
{
|
{
|
||||||
|
|
||||||
struct EspNowEvent
|
|
||||||
{
|
|
||||||
enum : std::uint8_t
|
|
||||||
{
|
|
||||||
MSG_RECEIVED,
|
|
||||||
MSG_SEND_COMPLETE
|
|
||||||
} type;
|
|
||||||
|
|
||||||
std::size_t rx_length;
|
|
||||||
};
|
|
||||||
|
|
||||||
using MacAddress = std::array<std::uint8_t, 6>;
|
|
||||||
|
|
||||||
void setupWifi();
|
void setupWifi();
|
||||||
[[nodiscard]] QueueHandle_t setupEspNow();
|
void setupEspNow();
|
||||||
|
|
||||||
void sendData(const std::array<std::uint8_t, 128>& buffer, const std::size_t length);
|
}
|
||||||
bool isTxInFlight();
|
|
||||||
const std::array<std::uint8_t, 128>& getRxBuffer();
|
|
||||||
|
|
||||||
}// namespace App
|
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by erki on 6/3/23.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "app_serial.hpp"
|
|
||||||
|
|
||||||
#include "driver/uart.h"
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
QueueHandle_t s_uart_queue = nullptr;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Serial
|
|
||||||
{
|
|
||||||
|
|
||||||
QueueHandle_t setupSerial()
|
|
||||||
{
|
|
||||||
uart_config_t config = {
|
|
||||||
.baud_rate = 115200,
|
|
||||||
.data_bits = UART_DATA_8_BITS,
|
|
||||||
.parity = UART_PARITY_DISABLE,
|
|
||||||
.stop_bits = UART_STOP_BITS_1,
|
|
||||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
|
||||||
.source_clk = UART_SCLK_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(uart_driver_install(UART_NUM_0, 128, 128 * 2, 4, &s_uart_queue, 0));
|
|
||||||
ESP_ERROR_CHECK(uart_param_config(UART_NUM_0, &config));
|
|
||||||
ESP_ERROR_CHECK(uart_set_pin(UART_NUM_0, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
|
|
||||||
|
|
||||||
return s_uart_queue;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by erki on 6/3/23.
|
|
||||||
//
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/queue.h"
|
|
||||||
|
|
||||||
namespace Serial
|
|
||||||
{
|
|
||||||
|
|
||||||
[[nodiscard]] QueueHandle_t setupSerial();
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,14 +1,11 @@
|
|||||||
#include <cstdint>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include "app_networking.hpp"
|
#include "app_networking.hpp"
|
||||||
#include "app_serial.hpp"
|
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/queue.h"
|
#include "freertos/queue.h"
|
||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#include "driver/uart.h"
|
#include "esp_now.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -19,75 +16,65 @@ QueueSetHandle_t s_queue_set = nullptr;
|
|||||||
QueueHandle_t s_esp_now_queue = nullptr;
|
QueueHandle_t s_esp_now_queue = nullptr;
|
||||||
QueueHandle_t s_uart_queue = nullptr;
|
QueueHandle_t s_uart_queue = nullptr;
|
||||||
|
|
||||||
void s_sendUartData()
|
void s_cbEspNowSendComplete(const std::uint8_t* peer_mac, esp_now_send_status_t status)
|
||||||
{
|
{
|
||||||
std::size_t uart_rx_size = 0;
|
|
||||||
uart_get_buffered_data_len(UART_NUM_0, &uart_rx_size);
|
|
||||||
if (uart_rx_size > 128 / 2)
|
|
||||||
{
|
|
||||||
std::array<std::uint8_t, 128> tx_buffer;
|
|
||||||
uart_read_bytes(UART_NUM_0, tx_buffer.data(), uart_rx_size, 0);
|
|
||||||
Networking::sendData(tx_buffer, uart_rx_size);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[[noreturn]] void s_mainTask(void*)
|
void s_cbEspNowReceiveComplete(const esp_now_recv_info_t* recv_info, const std::uint8_t* data, int len)
|
||||||
{
|
{
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
QueueSetMemberHandle_t queue_select = xQueueSelectFromSet(s_queue_set, portMAX_DELAY);
|
|
||||||
|
|
||||||
if (queue_select == s_esp_now_queue)
|
|
||||||
{
|
|
||||||
Networking::EspNowEvent event;
|
|
||||||
xQueueReceive(queue_select, &event, 0);
|
|
||||||
|
|
||||||
if (event.type == Networking::EspNowEvent::MSG_RECEIVED)
|
|
||||||
{
|
|
||||||
std::size_t uart_free = 0;
|
|
||||||
uart_get_tx_buffer_free_size(UART_NUM_0, &uart_free);
|
|
||||||
if (uart_free >= event.rx_length)
|
|
||||||
{
|
|
||||||
const auto& esp_rx_buffer = Networking::getRxBuffer();
|
|
||||||
uart_write_bytes(UART_NUM_0, esp_rx_buffer.data(), event.rx_length);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// log data drop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (event.type == Networking::EspNowEvent::MSG_SEND_COMPLETE && Networking::isTxInFlight())
|
|
||||||
{
|
|
||||||
// check if we have an UART_RX buffer, send if possible.
|
|
||||||
s_sendUartData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (queue_select == s_uart_queue)
|
|
||||||
{
|
|
||||||
uart_event_t event;
|
|
||||||
xQueueReceive(s_uart_queue, &event, 0);
|
|
||||||
|
|
||||||
if (event.type == UART_DATA)
|
|
||||||
{
|
|
||||||
s_sendUartData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}// namespace
|
void s_mainTask(void*)
|
||||||
|
{
|
||||||
|
bool radio_tx_busy = false;
|
||||||
|
bool uart_tx_busy = false;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
const std::uint32_t notification = ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||||
|
|
||||||
|
if (notification & (1 << 0))
|
||||||
|
{
|
||||||
|
// Radio RX complete.
|
||||||
|
// Send to uart.
|
||||||
|
uart_tx_busy = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notification & (1 << 1))
|
||||||
|
{
|
||||||
|
// UART RX ISR fired. Send to radio.
|
||||||
|
// UART RX FIFO is 128 bytes for C3. UART_RXFIFO_FULL_INT, set by UART_RXFIFO_THRHD.
|
||||||
|
|
||||||
|
radio_tx_busy = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notification & (1 << 2))
|
||||||
|
{
|
||||||
|
radio_tx_busy = false;
|
||||||
|
// radio TX complete.
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notification & (1 << 3))
|
||||||
|
{
|
||||||
|
uart_tx_busy = false;
|
||||||
|
// uart TX complete. UART_TX_DONE_INT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void app_main(void)
|
extern "C" void app_main(void)
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(nvs_flash_init());
|
ESP_ERROR_CHECK(nvs_flash_init());
|
||||||
|
|
||||||
Networking::setupWifi();
|
App::setupWifi();
|
||||||
s_esp_now_queue = Networking::setupEspNow();
|
App::setupEspNow();
|
||||||
s_uart_queue = Serial::setupSerial();
|
|
||||||
|
|
||||||
s_queue_set = xQueueCreateSet(4 + 4);
|
ESP_ERROR_CHECK(esp_now_register_send_cb(s_cbMessageSendComplete));
|
||||||
xQueueAddToSet(s_esp_now_queue, s_queue_set);
|
ESP_ERROR_CHECK(esp_now_register_recv_cb(s_cbMessageReceiveComplete));
|
||||||
xQueueAddToSet(s_uart_queue, s_queue_set);
|
|
||||||
|
|
||||||
xTaskCreate(s_mainTask, "main_task", 2048, nullptr, 4, &s_main_task);
|
xTaskCreate(s_mainTask, "main_task", 2048, nullptr, 4, &s_main_task);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user