Skip to content

Commit

Permalink
hal: Expose only necessary headers in rofi::hal::esp32
Browse files Browse the repository at this point in the history
  • Loading branch information
Ondraceq committed Sep 22, 2022
1 parent 8f17870 commit c5eb728
Show file tree
Hide file tree
Showing 20 changed files with 22 additions and 16 deletions.
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
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
3 changes: 1 addition & 2 deletions softwareComponents/rofiHalEsp32/test-logic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ if("${TARGET}" STREQUAL "esp32")
endif()

add_executable(test-rofiHalEsp32 testPacket.cpp)
target_link_libraries(test-rofiHalEsp32 Catch2WithMain)
target_include_directories(test-rofiHalEsp32 PUBLIC ../src)
target_link_libraries(test-rofiHalEsp32 Catch2WithMain esp32++)
2 changes: 1 addition & 1 deletion softwareComponents/rofiHalEsp32/test-logic/testPacket.cpp
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 );
}
}
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

0 comments on commit c5eb728

Please sign in to comment.