Skip to content

Commit

Permalink
🚚 Migrate to libhal-util (#8)
Browse files Browse the repository at this point in the history
- 🔥 remove place holder display.cpp file
  • Loading branch information
kammce authored Nov 30, 2024
1 parent b33e59d commit 01e42fe
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 92 deletions.
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,14 @@ libhal_test_and_make_library(
LIBRARY_NAME libhal-display

SOURCES
src/display.cpp
src/apa102.cpp
src/ws2812b.cpp

TEST_SOURCES
tests/display.test.cpp
tests/main.test.cpp
tests/apa102.test.cpp
tests/ws2812b.test.cpp

INCLUDES
.

LINK_LIBRARIES
libhal::soft

PACKAGES
libhal-soft
)
6 changes: 3 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def requirements(self):
# Adds libhal and libhal-util as transitive headers, meaning library
# consumers get the libhal and libhal-util headers downstream.
bootstrap = self.python_requires["libhal-bootstrap"]
bootstrap.module.add_library_requirements(self)
self.requires("libhal-soft/[^5.3.0]")
bootstrap.module.add_library_requirements(
self, override_libhal_util_version="5.3.0")

def package_info(self):
self.cpp_info.libs = ["libhal-display"]
self.cpp_info.set_property("cmake_target_name", "libhal::display")
7 changes: 3 additions & 4 deletions include/libhal-display/apa102.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <array>
#include <span>

#include <libhal-soft/inert_drivers/inert_output_pin.hpp>
#include <libhal-util/inert_drivers/inert_output_pin.hpp>
#include <libhal-util/output_pin.hpp>
#include <libhal-util/spi.hpp>

Expand Down Expand Up @@ -59,9 +59,8 @@ class apa102
* @param p_spi the spi bus that controls the LEDs
* @param p_chip_select output pin acting as the chip select for the spi bus
*/
apa102(
hal::spi& p_spi,
hal::output_pin& p_chip_select = hal::soft::default_inert_output_pin());
apa102(hal::spi& p_spi,
hal::output_pin& p_chip_select = hal::default_inert_output_pin());

/**
* @brief Update the state of the LEDs
Expand Down
20 changes: 0 additions & 20 deletions include/libhal-display/display.hpp

This file was deleted.

7 changes: 3 additions & 4 deletions include/libhal-display/ws2812b.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <array>

#include <libhal-soft/inert_drivers/inert_output_pin.hpp>
#include <libhal-util/inert_drivers/inert_output_pin.hpp>
#include <libhal-util/output_pin.hpp>
#include <libhal-util/spi.hpp>

Expand Down Expand Up @@ -72,9 +72,8 @@ class ws2812b
* select if the devices data line is connected to a multiplexer/switch.
* Defaults to an inert output pin if one is not provided.
*/
ws2812b(
hal::spi& p_spi,
hal::output_pin& p_chip_select = hal::soft::default_inert_output_pin());
ws2812b(hal::spi& p_spi,
hal::output_pin& p_chip_select = hal::default_inert_output_pin());

/**
* @brief Update the pixels to the currently stored color information.
Expand Down
18 changes: 0 additions & 18 deletions src/display.cpp

This file was deleted.

6 changes: 4 additions & 2 deletions test_package/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <libhal-display/display.hpp>
#include <libhal-display/apa102.hpp>
#include <libhal-util/mock/spi.hpp>

int main()
{
hal::display::display_replace_me bar;
hal::mock_write_only_spi mock_spi;
hal::display::apa102 test_object(mock_spi);
}
31 changes: 0 additions & 31 deletions tests/display.test.cpp

This file was deleted.

3 changes: 1 addition & 2 deletions tests/main.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
// limitations under the License.

namespace hal::display {
extern void display_test();
} // namespace hal::display

int main()
{
hal::display::display_test();
// [Position Dependent Test]:
}

0 comments on commit 01e42fe

Please sign in to comment.