-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native code for ESPNOW feature #2218
base: develop
Are you sure you want to change the base?
Changes from 39 commits
f825c67
e64a009
158b388
ba2a3ea
4facdea
f9924e2
1e217a2
a86a438
3a21efa
27ee936
91f74eb
8a2337c
8984090
544e356
7f302e0
6dfc20a
05469e5
20fa635
493a142
4405474
926e96e
9adbb9b
2ac5ff2
f8aa531
5844619
3b287c9
d94745c
f9fc2ad
aaa2c68
908fe63
b317504
9ad1360
e49de06
a38271e
859c329
543da36
2743ce2
dd68109
d159e0f
5189ea3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -292,7 +292,8 @@ | |||||
"API_nanoFramework.Hardware.Esp32.Rmt": "ON", | ||||||
"API_System.Device.Dac": "ON", | ||||||
"API_nanoFramework.Graphics": "OFF", | ||||||
"API_nanoFramework.Device.Bluetooth": "ON" | ||||||
"API_nanoFramework.Device.Bluetooth": "ON", | ||||||
"API_nanoFramework.Espnow": "ON" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
}, | ||||||
"ESP32_REV0": { | ||||||
|
@@ -339,7 +340,8 @@ | |||||
"API_nanoFramework.Hardware.Esp32.Rmt": "ON", | ||||||
"API_System.Device.Dac": "ON", | ||||||
"API_nanoFramework.Graphics": "OFF", | ||||||
"API_nanoFramework.Device.Bluetooth": "OFF" | ||||||
"API_nanoFramework.Device.Bluetooth": "OFF", | ||||||
"API_nanoFramework.Espnow": "ON" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
}, | ||||||
"ESP32_BLE_REV0": { | ||||||
|
@@ -387,7 +389,8 @@ | |||||
"API_nanoFramework.Hardware.Esp32.Rmt": "ON", | ||||||
"API_System.Device.Dac": "ON", | ||||||
"API_nanoFramework.Graphics": "OFF", | ||||||
"API_nanoFramework.Device.Bluetooth": "ON" | ||||||
"API_nanoFramework.Device.Bluetooth": "ON", | ||||||
"API_nanoFramework.Espnow": "ON" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
}, | ||||||
"ESP32_PICO": { | ||||||
|
@@ -435,7 +438,8 @@ | |||||
"API_Windows.Devices.Adc": "ON", | ||||||
"API_nanoFramework.Devices.OneWire": "ON", | ||||||
"API_nanoFramework.Graphics": "OFF", | ||||||
"API_nanoFramework.Device.Bluetooth": "OFF" | ||||||
"API_nanoFramework.Device.Bluetooth": "OFF", | ||||||
"API_nanoFramework.Espnow": "ON" | ||||||
} | ||||||
}, | ||||||
"ESP_WROVER_KIT": { | ||||||
|
@@ -483,7 +487,7 @@ | |||||
"API_nanoFramework.Hardware.Esp32.Rmt": "ON", | ||||||
"API_nanoFramework.Device.Bluetooth": "OFF", | ||||||
"API_nanoFramework.Graphics": "ON", | ||||||
"API_Windows.Devices.Adc": "ON", | ||||||
"API_nanoFramework.Espnow": "ON", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
"GRAPHICS_DISPLAY": "ILI9341_240x320_SPI.cpp", | ||||||
"TOUCHPANEL_DEVICE": "XPT2046.cpp", | ||||||
"GRAPHICS_DISPLAY_INTERFACE": "Spi_To_Display.cpp", | ||||||
|
@@ -535,7 +539,8 @@ | |||||
"API_System.Device.Dac": "ON", | ||||||
"API_nanoFramework.Devices.OneWire": "OFF", | ||||||
"API_nanoFramework.Graphics": "OFF", | ||||||
"API_nanoFramework.Device.Bluetooth": "OFF" | ||||||
"API_nanoFramework.Device.Bluetooth": "OFF", | ||||||
"API_nanoFramework.Espnow": "ON" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
}, | ||||||
"KALUGA_1": { | ||||||
|
@@ -583,8 +588,9 @@ | |||||
"API_nanoFramework.Device.Bluetooth": "OFF", | ||||||
"API_nanoFramework.Devices.OneWire": "OFF", | ||||||
"API_nanoFramework.Graphics": "ON", | ||||||
"API_nanoFramework.Espnow": "ON", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
"GRAPHICS_DISPLAY": "ILI9341_240x320_SPI.cpp", | ||||||
"GRAPHICS_DISPLAY_INTERFACE": "Spi_To_Display.cpp", | ||||||
"GRAPHICS_DISPLAY_INTERFACE": "Spi_To_Display.cpp" | ||||||
} | ||||||
}, | ||||||
"M5Core": { | ||||||
|
@@ -630,6 +636,7 @@ | |||||
"API_nanoFramework.Device.Bluetooth": "OFF", | ||||||
"API_System.Device.Dac": "ON", | ||||||
"API_nanoFramework.Graphics": "ON", | ||||||
"API_nanoFramework.Espnow": "ON", | ||||||
"GRAPHICS_DISPLAY": "ILI9341_240x320_SPI.cpp", | ||||||
"TOUCHPANEL_DEVICE": "XPT2046.cpp", | ||||||
"GRAPHICS_DISPLAY_INTERFACE": "Spi_To_Display.cpp", | ||||||
|
@@ -682,8 +689,8 @@ | |||||
"API_nanoFramework.Devices.OneWire": "ON", | ||||||
"API_System.Device.Dac": "ON", | ||||||
"API_nanoFramework.Graphics": "OFF", | ||||||
"API_nanoFramework.Device.Bluetooth": "OFF" | ||||||
"API_nanoFramework.Device.Bluetooth": "OFF", | ||||||
"API_nanoFramework.Espnow": "ON" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
}, | ||||||
"TI_CC1352R1_LAUNCHXL": { | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -115,6 +115,7 @@ | |||||
"API_nanoFramework.TI.EasyLink": "OFF-default-ON-to-add-this-API", | ||||||
"API_nanoFramework.Hardware.Esp32.Rmt": "OFF-default-ON-to-add-this-API", | ||||||
"API_nanoFramework.Device.Bluetooth": "OFF-default-ON-to-add-this-API", | ||||||
"API_nanoFramework.Espnow": "OFF-default-ON-to-add-this-API", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
"API_System.Device.WiFi": "OFF-default-ON-to-add-this-API" | ||||||
} | ||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -39,6 +39,8 @@ option(API_nanoFramework.Device.Bluetooth "option for nanoFramework.Device | |||||
# Esp32 only | ||||||
option(API_Hardware.Esp32 "option for Hardware.Esp32") | ||||||
option(API_nanoFramework.Hardware.Esp32.Rmt "option for nanoFramework.Hardware.Esp32.Rmt") | ||||||
option(API_nanoFramework.Espnow "option for nanoFramework.Espnow") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
|
||||||
|
||||||
# Stm32 only | ||||||
|
@@ -177,6 +179,12 @@ if(API_nanoFramework.Hardware.Esp32.Rmt) | |||||
PerformSettingsForApiEntry("nanoFramework.Hardware.Esp32.Rmt") | ||||||
endif() | ||||||
|
||||||
# nanoFramework.Espnow | ||||||
if(API_nanoFramework.Espnow) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
##### API name here (doted name) | ||||||
PerformSettingsForApiEntry("nanoFramework.Espnow") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
endif() | ||||||
|
||||||
# nanoFramework.Device.Bluetooth | ||||||
if(API_nanoFramework.Device.Bluetooth) | ||||||
##### API name here (doted name) | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# | ||
# Copyright (c) .NET Foundation and Contributors | ||
# See LICENSE file in the project root for full license information. | ||
# | ||
|
||
# native code directory | ||
set(BASE_PATH_FOR_THIS_MODULE ${BASE_PATH_FOR_CLASS_LIBRARIES_MODULES}/nanoFramework.Espnow) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename file and options to match the option EspNow (mind the capital N) |
||
|
||
|
||
# set include directories | ||
list(APPEND nanoFramework.Espnow_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/CLR/Core) | ||
list(APPEND nanoFramework.Espnow_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/CLR/Include) | ||
list(APPEND nanoFramework.Espnow_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/HAL/Include) | ||
list(APPEND nanoFramework.Espnow_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/PAL/Include) | ||
list(APPEND nanoFramework.Espnow_INCLUDE_DIRS ${BASE_PATH_FOR_THIS_MODULE}) | ||
list(APPEND nanoFramework.Espnow_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/nanoFramework.Espnow) | ||
|
||
# source files | ||
set(nanoFramework.Espnow_SRCS | ||
|
||
nanoFramework_espnow_native.cpp | ||
|
||
|
||
nanoFramework_espnow_native_nanoFramework_Espnow_EspNowController.cpp | ||
nanoFramework_espnow_native_nanoFramework_Espnow_EspNowController__EspNowEventHandler.cpp | ||
|
||
) | ||
|
||
foreach(SRC_FILE ${nanoFramework.Espnow_SRCS}) | ||
set(nanoFramework.Espnow_SRC_FILE SRC_FILE-NOTFOUND) | ||
find_file(nanoFramework.Espnow_SRC_FILE ${SRC_FILE} | ||
PATHS | ||
${BASE_PATH_FOR_THIS_MODULE} | ||
${TARGET_BASE_LOCATION} | ||
${PROJECT_SOURCE_DIR}/src/nanoFramework.Espnow | ||
|
||
CMAKE_FIND_ROOT_PATH_BOTH | ||
) | ||
# message("${SRC_FILE} >> ${nanoFramework.Espnow_SRC_FILE}") # debug helper | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please follow the same pattern as the other CMake on the inclusion of this line with the debug output option |
||
list(APPEND nanoFramework.Espnow_SOURCES ${nanoFramework.Espnow_SRC_FILE}) | ||
endforeach() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(nanoFramework.Espnow DEFAULT_MSG nanoFramework.Espnow_INCLUDE_DIRS nanoFramework.Espnow_SOURCES) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -180,9 +180,9 @@ elseif ($TargetBoard -eq "ESP32_WROOM_32") { | |||||
-DAPI_nanoFramework.System.Collections=ON | ||||||
-DAPI_nanoFramework.System.Text=ON | ||||||
-DAPI_nanoFramework.Hardware.Esp32.Rmt=ON | ||||||
-DAPI_nanoFramework.Espnow=ON | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
-DAPI_System.Device.Dac=ON | ||||||
"@ | ||||||
|
||||||
# CMake prep | ||||||
$cmakePrep = @" | ||||||
-G Ninja | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,7 @@ | |
"API_System.Device.Spi": "ON", | ||
"API_Hardware.Esp32": "ON", | ||
"API_nanoFramework.Hardware.Esp32.Rmt": "ON", | ||
"API_nanoFramework.Espnow": "ON", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename here too please |
||
"API_nanoFramework.Devices.OneWire": "ON", | ||
"API_nanoFramework.Graphics": "OFF", | ||
"API_nanoFramework.Device.Bluetooth": "OFF" | ||
|
@@ -113,6 +114,7 @@ | |
"API_System.Device.Spi": "ON", | ||
"API_Hardware.Esp32": "ON", | ||
"API_nanoFramework.Hardware.Esp32.Rmt": "ON", | ||
"API_nanoFramework.Espnow": "ON", | ||
"API_nanoFramework.Devices.OneWire": "ON", | ||
"API_nanoFramework.Graphics": "OFF", | ||
"API_nanoFramework.Device.Bluetooth": "OFF" | ||
|
@@ -162,6 +164,7 @@ | |
"API_System.Device.Spi": "ON", | ||
"API_Hardware.Esp32": "ON", | ||
"API_nanoFramework.Hardware.Esp32.Rmt": "ON", | ||
"API_nanoFramework.Espnow": "ON", | ||
"API_nanoFramework.Devices.OneWire": "ON", | ||
"API_nanoFramework.Graphics": "OFF", | ||
"API_nanoFramework.Device.Bluetooth": "ON" | ||
|
@@ -212,6 +215,7 @@ | |
"API_System.Device.Spi": "ON", | ||
"API_Hardware.Esp32": "ON", | ||
"API_nanoFramework.Hardware.Esp32.Rmt": "ON", | ||
"API_nanoFramework.Espnow": "ON", | ||
"API_nanoFramework.Devices.OneWire": "ON", | ||
"API_nanoFramework.Graphics": "OFF", | ||
"API_nanoFramework.Device.Bluetooth": "OFF" | ||
|
@@ -260,6 +264,7 @@ | |
"API_Windows.Storage": "ON", | ||
"API_Hardware.Esp32": "ON", | ||
"API_nanoFramework.Hardware.Esp32.Rmt": "ON", | ||
"API_nanoFramework.Espnow": "ON", | ||
"API_nanoFramework.Device.Bluetooth": "OFF", | ||
"API_nanoFramework.Graphics": "ON", | ||
"GRAPHICS_DISPLAY": "ILI9341_240x320_SPI.cpp", | ||
|
@@ -311,6 +316,7 @@ | |
"API_Windows.Storage": "ON", | ||
"API_Hardware.Esp32": "ON", | ||
"API_nanoFramework.Hardware.Esp32.Rmt": "ON", | ||
"API_nanoFramework.Espnow": "ON", | ||
"API_nanoFramework.Device.Bluetooth": "OFF", | ||
"API_nanoFramework.Graphics": "ON", | ||
"GRAPHICS_DISPLAY": "ILI9341_240x320_SPI.cpp", | ||
|
@@ -416,6 +422,7 @@ | |
"API_System.Device.Spi": "ON", | ||
"API_Hardware.Esp32": "ON", | ||
"API_nanoFramework.Hardware.Esp32.Rmt": "ON", | ||
"API_nanoFramework.Espnow": "ON", | ||
"API_nanoFramework.Devices.OneWire": "ON", | ||
"API_nanoFramework.Graphics": "OFF", | ||
"API_nanoFramework.Device.Bluetooth": "OFF" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "nanoFramework_espnow_native.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing license header. |
||
|
||
// clang-format off | ||
|
||
static const CLR_RT_MethodHandler method_lookup[] = | ||
{ | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
Library_nanoFramework_espnow_native_nanoFramework_Espnow_EspNowController::NativeInitialize___I4, | ||
Library_nanoFramework_espnow_native_nanoFramework_Espnow_EspNowController::NativeDispose___VOID__BOOLEAN, | ||
Library_nanoFramework_espnow_native_nanoFramework_Espnow_EspNowController::NativeEspNowSend___I4__SZARRAY_U1__SZARRAY_U1__I4, | ||
Library_nanoFramework_espnow_native_nanoFramework_Espnow_EspNowController::NativeEspNowAddPeer___I4__SZARRAY_U1__U1, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
Library_nanoFramework_espnow_native_nanoFramework_Espnow_EspNowController__EspNowEventHandler::ProcessEvent___nanoFrameworkRuntimeEventsBaseEvent__U4__U4__SystemDateTime, | ||
NULL, | ||
NULL, | ||
}; | ||
|
||
const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Espnow = | ||
{ | ||
"nanoFramework.Espnow", | ||
0x3C8132ED, | ||
method_lookup, | ||
{ 0, 9, 99, 999 } | ||
}; | ||
|
||
// clang-format on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in this file don't belong to this PR, please revert.