Skip to content
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

hal: Expose only necessary header files #190

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion examples/hal/servo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ add_rofi_firmware(hal_example_servo.elf
FLASH_SIZE 4MB
SOURCES main.cpp)
target_link_libraries(hal_example_servo.elf
idf::esp32 idf::freertos idf::spi_flash rofi::hal)
idf::esp32 idf::freertos idf::spi_flash esp32++ rofi::hal::esp32)
set_partition_table(hal_example_servo.elf partitions.csv)

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ add_rofi_firmware(dynamixelConfigurator.elf
FLASH_SIZE 4MB
SOURCES main.cpp)
target_link_libraries(dynamixelConfigurator.elf
idf::esp32 idf::freertos idf::spi_flash idf::console rofi::hal
idf::esp32 idf::freertos idf::spi_flash idf::console esp32++ rofi::hal::esp32
magic_enum libfort::fort)
set_partition_table(dynamixelConfigurator.elf partitions.csv)
7 changes: 7 additions & 0 deletions softwareComponents/esp32++/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
file(GLOB_RECURSE SRC src/*.cpp)

add_library(esp32++ ${SRC})
set_property(TARGET esp32++ PROPERTY CXX_STANDARD 17)
target_include_directories(esp32++ PUBLIC include)
target_link_libraries(esp32++ PUBLIC idf::driver atoms)
target_compile_options(esp32++ PUBLIC -mtext-section-literals -mlongcalls)
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ void spiWrite( spi_device_handle_t dev, uint8_t ( &what )[ size ] ) {
spi_device_transmit( dev, &t );
}

} // namespace rofi::esp32
} // namespace rofi::esp32
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,4 @@ class Timer {
TimerHandle_t _t;
};

} // namespace rtos
} // namespace rtos
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ void error(const std::string_view& message,
}

} // namespace rofi::log

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "gpio.hpp"
#include "espDriver/gpio.hpp"

std::ostream& operator<<( std::ostream& o, gpio_config_t s ) {
o << "pin_bit_mask: " << s.pin_bit_mask << "\n";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "spi.hpp"
#include "espDriver/spi.hpp"

std::ostream& rofi::esp32::operator<<( std::ostream& o, spi_bus_config_t s ) {
o << "mosi_io_num: " << s.mosi_io_num << "\n";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.11)

if("${TARGET}" STREQUAL "esp32")
message(FATAL_ERROR "The logic-tests are not intendet to be compiled for ESP32")
message(FATAL_ERROR "The logic-tests are not intended to be compiled for ESP32")
endif()

add_executable(test-rofiHalEsp32 testPacket.cpp)
target_link_libraries(test-rofiHalEsp32 Catch2WithMain)
target_include_directories(test-rofiHalEsp32 PUBLIC ../src)
target_include_directories(test-rofiHalEsp32 PRIVATE ../include)
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ TEST_CASE( "Ping packet parsing" ) {

std::vector< uint8_t > pData( p.raw(), p.raw() + p.rawSize() );
REQUIRE( ref == pData );
}
}
4 changes: 2 additions & 2 deletions softwareComponents/rofiHalEsp32/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
file(GLOB_RECURSE SRC src/*.cpp src/*.c)

add_library(rofi_hal_esp32 ${SRC})
target_include_directories(rofi_hal_esp32 PUBLIC src)
set_property(TARGET rofi_hal_esp32 PROPERTY CXX_STANDARD 17)
target_link_libraries(rofi_hal_esp32 PUBLIC idf::driver atoms rofi::hal::inc)
target_link_libraries(rofi_hal_esp32 PRIVATE esp32++ atoms)
target_link_libraries(rofi_hal_esp32 PUBLIC rofi::hal::inc)
target_compile_options(rofi_hal_esp32 PUBLIC -mtext-section-literals -mlongcalls)

add_library(rofi::hal::esp32 ALIAS rofi_hal_esp32)
2 changes: 1 addition & 1 deletion softwareComponents/rofiHalEsp32/src/bsp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
#include "bsp/v0.2.hpp"
#else
#error "Unsupported Universal Module board version"
#endif
#endif
2 changes: 1 addition & 1 deletion softwareComponents/rofiHalEsp32/src/bsp/v0.2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ inline std::string errorName( dynamixel::HardwareError e ) {
}


}; // rofi::hal::bsp
} // rofi::hal::bsp
2 changes: 1 addition & 1 deletion softwareComponents/rofiHalEsp32/src/cGlue.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
wifi_init_config_t getDefaultWifiCfg() {
wifi_init_config_t t = WIFI_INIT_CONFIG_DEFAULT();
return t;
}
}
2 changes: 1 addition & 1 deletion softwareComponents/rofiHalEsp32/src/rofi_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <espDriver/gpio.hpp>
#include <espDriver/spi.hpp>

#include <bsp.hpp>
#include "bsp.hpp"
#include <atoms/util.hpp>
#include <logging.hpp>

Expand Down
2 changes: 1 addition & 1 deletion suites/desktop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ if (${BUILD_GAZEBO})
endif()

# Add logic tests for the hardware-related suites
add_subdirectory($ENV{ROFI_ROOT}/softwareComponents/rofiHalEsp32/test-logic rofiHalEsp32-test)
add_subdirectory($ENV{ROFI_ROOT}/softwareComponents/esp32++/test-logic rofiHalEsp32-test)


list_targets()
Expand Down
1 change: 1 addition & 0 deletions suites/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ set_target_properties(build_hack PROPERTIES EXCLUDE_FROM_ALL "exclude-NOTFOUND")
add_component(atoms)
add_component(lwip++)
add_component(lwipcore)
add_component(esp32++)
add_component(rofiHalInc)
add_component(rofiHalEsp32)
add_component(libfi)
Expand Down