Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
format-check:
runs-on: ubuntu-latest
container: espressif/idf:v5.5
container: espressif/idf:release-v6.0
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -30,7 +30,7 @@ jobs:

build:
runs-on: ubuntu-latest
container: espressif/idf:v5.5
container: espressif/idf:release-v6.0
strategy:
fail-fast: false
matrix:
Expand All @@ -52,6 +52,22 @@ jobs:
idf.py reconfigure
idf.py build

build-compat:
runs-on: ubuntu-latest
container: espressif/idf:v5.5
name: build (compat-v5.5)
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build
run: |
. $IDF_PATH/export.sh
idf.py set-target esp32s3
cp sdkconfig.defaults sdkconfig
idf.py reconfigure
idf.py build

discover-examples:
runs-on: ubuntu-latest
outputs:
Expand All @@ -76,7 +92,7 @@ jobs:
build-example:
needs: discover-examples
runs-on: ubuntu-latest
container: espressif/idf:v5.5
container: espressif/idf:release-v6.0
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.discover-examples.outputs.matrix) }}
Expand All @@ -94,7 +110,7 @@ jobs:

qemu-test:
runs-on: ubuntu-latest
container: espressif/idf:v5.5
container: espressif/idf:release-v6.0
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -131,7 +147,7 @@ jobs:
. $IDF_PATH/export.sh
# Run QEMU in background, capture PID, and exit when tests complete or timeout
mkfifo qemu_pipe
timeout 180s qemu-system-xtensa \
timeout 300s qemu-system-xtensa \
-machine esp32s3 \
-nographic \
-drive file=qemu_flash.bin,if=mtd,format=raw > qemu_pipe 2>&1 &
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
container: espressif/idf:v5.5
container: espressif/idf:release-v6.0
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
6 changes: 6 additions & 0 deletions components/idfxx_button/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ idf_component_register(

target_compile_features(${COMPONENT_LIB} PUBLIC cxx_std_23)
set_target_properties(${COMPONENT_LIB} PROPERTIES CXX_EXTENSIONS OFF)

# Register test sources for the central test app
file(GLOB _test_sources "${CMAKE_CURRENT_SOURCE_DIR}/tests/*_test.cpp")
if(_test_sources)
set_property(GLOBAL APPEND PROPERTY IDFXX_TEST_SOURCES ${_test_sources})
endif()
29 changes: 14 additions & 15 deletions components/idfxx_button/examples/button_demo/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,20 @@ extern "C" void app_main() {
.pin = idfxx::gpio_0,
.pressed_level = idfxx::gpio::level::low,
.enable_pull = true,
.callback =
[](idfxx::button::event_type event) {
switch (event) {
case idfxx::button::event_type::pressed:
break;
case idfxx::button::event_type::released:
break;
case idfxx::button::event_type::clicked:
click_count.fetch_add(1, std::memory_order_relaxed);
break;
case idfxx::button::event_type::long_press:
long_press_count.fetch_add(1, std::memory_order_relaxed);
break;
}
},
.callback = [](idfxx::button::event_type event) {
switch (event) {
case idfxx::button::event_type::pressed:
break;
case idfxx::button::event_type::released:
break;
case idfxx::button::event_type::clicked:
click_count.fetch_add(1, std::memory_order_relaxed);
break;
case idfxx::button::event_type::long_press:
long_press_count.fetch_add(1, std::memory_order_relaxed);
break;
}
},
});

logger.info("Button created with config:");
Expand Down
6 changes: 6 additions & 0 deletions components/idfxx_console/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ idf_component_register(

target_compile_features(${COMPONENT_LIB} PUBLIC cxx_std_23)
set_target_properties(${COMPONENT_LIB} PROPERTIES CXX_EXTENSIONS OFF)

# Register test sources for the central test app
file(GLOB _test_sources "${CMAKE_CURRENT_SOURCE_DIR}/tests/*_test.cpp")
if(_test_sources)
set_property(GLOBAL APPEND PROPERTY IDFXX_TEST_SOURCES ${_test_sources})
endif()
13 changes: 12 additions & 1 deletion components/idfxx_core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
set(core_requires freertos esp_system esp_hw_support)
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
list(APPEND core_requires esp_hal_uart)
endif()

idf_component_register(
SRCS "src/error.cpp" "src/net.cpp" "src/sched.cpp" "src/system.cpp" "src/app.cpp"
INCLUDE_DIRS "include"
REQUIRES freertos esp_system esp_hw_support
REQUIRES ${core_requires}
PRIV_REQUIRES esp_app_format
)

target_compile_features(${COMPONENT_LIB} PUBLIC cxx_std_23)
set_target_properties(${COMPONENT_LIB} PROPERTIES CXX_EXTENSIONS OFF)

# Register test sources for the central test app
file(GLOB _test_sources "${CMAKE_CURRENT_SOURCE_DIR}/tests/*_test.cpp")
if(_test_sources)
set_property(GLOBAL APPEND PROPERTY IDFXX_TEST_SOURCES ${_test_sources})
endif()
4 changes: 3 additions & 1 deletion components/idfxx_core/include/idfxx/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ namespace idfxx::memory {
* @note `spiram` requires a device with external PSRAM and `CONFIG_SPIRAM` enabled.
*/
enum class caps : uint32_t {
exec = MALLOC_CAP_EXEC, ///< Executable memory
#ifdef CONFIG_HEAP_HAS_EXEC_HEAP
exec = MALLOC_CAP_EXEC, ///< Executable memory
#endif
access_32bit = MALLOC_CAP_32BIT, ///< 32-bit aligned access
access_8bit = MALLOC_CAP_8BIT, ///< 8/16/32-bit access
dma = MALLOC_CAP_DMA, ///< DMA-capable memory
Expand Down
4 changes: 2 additions & 2 deletions components/idfxx_core/tests/sched_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ using namespace std::chrono_literals;
// Delay tests
// =============================================================================

TEST_CASE("delay() with zero duration returns immediately", "[idfxx][sched]") {
TEST_CASE("delay() with zero duration returns immediately", "[idfxx][sched][hw]") {
auto start = xTaskGetTickCount();
idfxx::delay(0ms);
auto elapsed = xTaskGetTickCount() - start;
TEST_ASSERT_EQUAL(0, elapsed);
}

TEST_CASE("delay() with negative duration returns immediately", "[idfxx][sched]") {
TEST_CASE("delay() with negative duration returns immediately", "[idfxx][sched][hw]") {
auto start = xTaskGetTickCount();
idfxx::delay(-100ms);
auto elapsed = xTaskGetTickCount() - start;
Expand Down
6 changes: 6 additions & 0 deletions components/idfxx_ds18x20/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ idf_component_register(

target_compile_features(${COMPONENT_LIB} PUBLIC cxx_std_23)
set_target_properties(${COMPONENT_LIB} PROPERTIES CXX_EXTENSIONS OFF)

# Register test sources for the central test app
file(GLOB _test_sources "${CMAKE_CURRENT_SOURCE_DIR}/tests/*_test.cpp")
if(_test_sources)
set_property(GLOBAL APPEND PROPERTY IDFXX_TEST_SOURCES ${_test_sources})
endif()
6 changes: 6 additions & 0 deletions components/idfxx_event/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ idf_component_register(

target_compile_features(${COMPONENT_LIB} PUBLIC cxx_std_23)
set_target_properties(${COMPONENT_LIB} PROPERTIES CXX_EXTENSIONS OFF)

# Register test sources for the central test app
file(GLOB _test_sources "${CMAKE_CURRENT_SOURCE_DIR}/tests/*_test.cpp")
if(_test_sources)
set_property(GLOBAL APPEND PROPERTY IDFXX_TEST_SOURCES ${_test_sources})
endif()
6 changes: 6 additions & 0 deletions components/idfxx_event_group/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ idf_component_register(

target_compile_features(${COMPONENT_LIB} INTERFACE cxx_std_23)
set_target_properties(${COMPONENT_LIB} PROPERTIES CXX_EXTENSIONS OFF)

# Register test sources for the central test app
file(GLOB _test_sources "${CMAKE_CURRENT_SOURCE_DIR}/tests/*_test.cpp")
if(_test_sources)
set_property(GLOBAL APPEND PROPERTY IDFXX_TEST_SOURCES ${_test_sources})
endif()
6 changes: 6 additions & 0 deletions components/idfxx_gpio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ idf_component_register(

target_compile_features(${COMPONENT_LIB} PUBLIC cxx_std_23)
set_target_properties(${COMPONENT_LIB} PROPERTIES CXX_EXTENSIONS OFF)

# Register test sources for the central test app
file(GLOB _test_sources "${CMAKE_CURRENT_SOURCE_DIR}/tests/*_test.cpp")
if(_test_sources)
set_property(GLOBAL APPEND PROPERTY IDFXX_TEST_SOURCES ${_test_sources})
endif()
26 changes: 15 additions & 11 deletions components/idfxx_gpio/src/gpio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,13 @@ result<gpio::isr_handle> gpio::try_isr_handler_add(std::move_only_function<void(

portENTER_CRITICAL(&active_mux);
uint32_t id = next_id++;
gpio_handler.functional.push_back(functional_entry{
.id = id,
.fn = std::move(handler),
.active = true,
});
gpio_handler.functional.push_back(
functional_entry{
.id = id,
.fn = std::move(handler),
.active = true,
}
);
portEXIT_CRITICAL(&active_mux);

portEXIT_CRITICAL(&handlers_mux);
Expand All @@ -340,12 +342,14 @@ result<gpio::isr_handle> gpio::try_isr_handler_add(void (*fn)(void*), void* arg)

portENTER_CRITICAL(&active_mux);
uint32_t id = next_id++;
gpio_handler.raw.push_back(raw_entry{
.id = id,
.fn = fn,
.arg = arg,
.active = true,
});
gpio_handler.raw.push_back(
raw_entry{
.id = id,
.fn = fn,
.arg = arg,
.active = true,
}
);
portEXIT_CRITICAL(&active_mux);

portEXIT_CRITICAL(&handlers_mux);
Expand Down
2 changes: 1 addition & 1 deletion components/idfxx_gpio/tests/gpio_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ TEST_CASE("gpio toggle_level", "[idfxx][gpio][hw]") {
TEST_ASSERT_EQUAL(gpio::level::low, g.get_level());
}

TEST_CASE("gpio drive capability", "[idfxx][gpio]") {
TEST_CASE("gpio drive capability", "[idfxx][gpio][hw]") {
gpio g = gpio::make(0).value();

// Set drive capability
Expand Down
6 changes: 6 additions & 0 deletions components/idfxx_http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ idf_component_register(

target_compile_features(${COMPONENT_LIB} PUBLIC cxx_std_23)
set_target_properties(${COMPONENT_LIB} PROPERTIES CXX_EXTENSIONS OFF)

# Register test sources for the central test app
file(GLOB _test_sources "${CMAKE_CURRENT_SOURCE_DIR}/tests/*_test.cpp")
if(_test_sources)
set_property(GLOBAL APPEND PROPERTY IDFXX_TEST_SOURCES ${_test_sources})
endif()
6 changes: 6 additions & 0 deletions components/idfxx_http_client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ idf_component_register(

target_compile_features(${COMPONENT_LIB} PUBLIC cxx_std_23)
set_target_properties(${COMPONENT_LIB} PROPERTIES CXX_EXTENSIONS OFF)

# Register test sources for the central test app
file(GLOB _test_sources "${CMAKE_CURRENT_SOURCE_DIR}/tests/*_test.cpp")
if(_test_sources)
set_property(GLOBAL APPEND PROPERTY IDFXX_TEST_SOURCES ${_test_sources})
endif()
26 changes: 18 additions & 8 deletions components/idfxx_http_client/include/idfxx/http/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <chrono>
#include <cstdint>
#include <esp_idf_version.h>
#include <functional>
#include <optional>
#include <span>
Expand All @@ -42,14 +43,23 @@ namespace idfxx::http {
*/
enum class event_id : int {
// clang-format off
error = 0, ///< An error occurred during the HTTP operation
on_connected = 1, ///< Connected to the server
headers_sent = 2, ///< All request headers have been sent
on_header = 3, ///< Received a response header
on_data = 4, ///< Received response body data
on_finish = 5, ///< Finished a complete HTTP session
disconnected = 6, ///< Disconnected from the server
redirect = 7, ///< Intercepting a redirect
error = 0, ///< An error occurred during the HTTP operation
on_connected = 1, ///< Connected to the server
headers_sent = 2, ///< All request headers have been sent
on_header = 3, ///< Received a response header
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
on_headers_complete = 4, ///< All response headers have been received
on_status_code = 5, ///< Received the HTTP status code from the server
on_data = 6, ///< Received response body data
on_finish = 7, ///< Finished a complete HTTP session
disconnected = 8, ///< Disconnected from the server
redirect = 9, ///< Intercepting a redirect
#else
on_data = 4, ///< Received response body data
on_finish = 5, ///< Finished a complete HTTP session
disconnected = 6, ///< Disconnected from the server
redirect = 7, ///< Intercepting a redirect
#endif
// clang-format on
};

Expand Down
10 changes: 10 additions & 0 deletions components/idfxx_http_client/src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ static_assert(std::to_underlying(idfxx::http::event_id::error) == HTTP_EVENT_ERR
static_assert(std::to_underlying(idfxx::http::event_id::on_connected) == HTTP_EVENT_ON_CONNECTED);
static_assert(std::to_underlying(idfxx::http::event_id::headers_sent) == HTTP_EVENT_HEADERS_SENT);
static_assert(std::to_underlying(idfxx::http::event_id::on_header) == HTTP_EVENT_ON_HEADER);
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
static_assert(std::to_underlying(idfxx::http::event_id::on_headers_complete) == HTTP_EVENT_ON_HEADERS_COMPLETE);
static_assert(std::to_underlying(idfxx::http::event_id::on_status_code) == HTTP_EVENT_ON_STATUS_CODE);
#endif
static_assert(std::to_underlying(idfxx::http::event_id::on_data) == HTTP_EVENT_ON_DATA);
static_assert(std::to_underlying(idfxx::http::event_id::on_finish) == HTTP_EVENT_ON_FINISH);
static_assert(std::to_underlying(idfxx::http::event_id::disconnected) == HTTP_EVENT_DISCONNECTED);
Expand Down Expand Up @@ -90,6 +94,12 @@ std::string to_string(http::event_id id) {
return "HEADERS_SENT";
case http::event_id::on_header:
return "ON_HEADER";
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
case http::event_id::on_headers_complete:
return "ON_HEADERS_COMPLETE";
case http::event_id::on_status_code:
return "ON_STATUS_CODE";
#endif
case http::event_id::on_data:
return "ON_DATA";
case http::event_id::on_finish:
Expand Down
6 changes: 6 additions & 0 deletions components/idfxx_http_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ idf_component_register(

target_compile_features(${COMPONENT_LIB} PUBLIC cxx_std_23)
set_target_properties(${COMPONENT_LIB} PROPERTIES CXX_EXTENSIONS OFF)

# Register test sources for the central test app
file(GLOB _test_sources "${CMAKE_CURRENT_SOURCE_DIR}/tests/*_test.cpp")
if(_test_sources)
set_property(GLOBAL APPEND PROPERTY IDFXX_TEST_SOURCES ${_test_sources})
endif()
Loading
Loading