Compare commits
16 Commits
master
...
feature/gi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57b5590553 | ||
|
|
f8bc3d2231 | ||
|
|
f4f0560ece | ||
|
|
d68ca918fa | ||
|
|
bcdcb934e9 | ||
|
|
3b75a1f3c1 | ||
|
|
1e314e1088 | ||
|
|
b5c1259408 | ||
|
|
83bfbd8dc1 | ||
|
|
54a4ec029b | ||
|
|
6166054d3f | ||
|
|
6bb642360e | ||
|
|
ec6e3b71a2 | ||
|
|
842f821333 | ||
|
|
a5d751893c | ||
|
|
0a5d8cd7ee |
@ -4,10 +4,15 @@ on: [push, pull_request]
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Unit-Tests:
|
Unit-Tests:
|
||||||
runs-on: fedora-cpp
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare environment
|
||||||
|
run: |
|
||||||
|
apt update
|
||||||
|
apt install -y --no-install-recommends build-essential cmake ninja-build
|
||||||
|
|
||||||
- name: Configure build
|
- name: Configure build
|
||||||
working-directory: ${{runner.workspace}}
|
working-directory: ${{runner.workspace}}
|
||||||
run: |
|
run: |
|
||||||
@ -23,19 +28,3 @@ jobs:
|
|||||||
- name: Run tests
|
- name: Run tests
|
||||||
working-directory: ${{runner.workspace}}/build
|
working-directory: ${{runner.workspace}}/build
|
||||||
run: ctest . --output-on-failure
|
run: ctest . --output-on-failure
|
||||||
Docs:
|
|
||||||
runs-on: fedora-cpp
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Configure build
|
|
||||||
working-directory: ${{runner.workspace}}
|
|
||||||
run: |
|
|
||||||
cmake . -B${{runner.workspace}}/build \
|
|
||||||
-G"Ninja" \
|
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DSKULLC_WITH_DOCS=ON
|
|
||||||
|
|
||||||
- name: Build docs
|
|
||||||
working-directory: ${{runner.workspace}}/build
|
|
||||||
run: ninja Sphinx
|
|
||||||
|
|||||||
@ -14,9 +14,6 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
|
|||||||
|
|
||||||
option(SKULLC_WITH_TESTS "Enable unit testing." OFF)
|
option(SKULLC_WITH_TESTS "Enable unit testing." OFF)
|
||||||
option(SKULLC_WITH_HAL "Enable the compiling and deployment of the HAL dependent sections." OFF)
|
option(SKULLC_WITH_HAL "Enable the compiling and deployment of the HAL dependent sections." OFF)
|
||||||
option(SKULLC_USE_HAL_ST "Enable the ST HAl when SKULLC_WITH_HAL is enabled." OFF)
|
|
||||||
option(SKULLC_USE_HAL_ESP "Enable the ESP HAL when SKULLC_WITH_HAL is enabled." OFF)
|
|
||||||
option(SKULLC_WITH_DOCS "Enable documentation building." OFF)
|
|
||||||
|
|
||||||
include(skullc-install)
|
include(skullc-install)
|
||||||
|
|
||||||
@ -29,10 +26,6 @@ if(SKULLC_WITH_TESTS)
|
|||||||
add_subdirectory(Tests)
|
add_subdirectory(Tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SKULLC_WITH_DOCS)
|
|
||||||
add_subdirectory(Docs)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
configure_file(skullc-config.cmake
|
configure_file(skullc-config.cmake
|
||||||
|
|||||||
@ -1,53 +0,0 @@
|
|||||||
find_package(Doxygen REQUIRED)
|
|
||||||
find_package(Sphinx REQUIRED)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE SKULLC_PUBLIC_HEADERS
|
|
||||||
${PROJECT_SOURCE_DIR}/Messaging/Inc/*
|
|
||||||
${PROJECT_SOURCE_DIR}/Threads/Inc/*
|
|
||||||
${PROJECT_SOURCE_DIR}/Utility/Inc/*
|
|
||||||
${PROJECT_SOURCE_DIR}/Peripherals/Inc/*
|
|
||||||
)
|
|
||||||
|
|
||||||
set(DOXYGEN_INPUT_DIRS "${PROJECT_SOURCE_DIR}/Messaging/Inc ${PROJECT_SOURCE_DIR}/Threads/Inc ${PROJECT_SOURCE_DIR}/Utility/Inc ${PROJECT_SOURCE_DIR}/Peripherals/Inc")
|
|
||||||
set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/docs/doxygen)
|
|
||||||
set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/xml/index.xml)
|
|
||||||
set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
|
|
||||||
set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
|
||||||
|
|
||||||
configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY)
|
|
||||||
|
|
||||||
file(MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR}) #Doxygen won't create this for us
|
|
||||||
add_custom_command(OUTPUT ${DOXYGEN_INDEX_FILE}
|
|
||||||
DEPENDS ${SKULLC_PUBLIC_HEADERS}
|
|
||||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT}
|
|
||||||
MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN}
|
|
||||||
COMMENT "Generating docs"
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(Doxygen ALL DEPENDS ${DOXYGEN_INDEX_FILE})
|
|
||||||
|
|
||||||
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/sphinx)
|
|
||||||
set(SPHINX_INDEX_FILE ${SPHINX_BUILD}/index.html)
|
|
||||||
file(GLOB SPHINX_RST_FILES ${SPHINX_SOURCE}/*.rst)
|
|
||||||
|
|
||||||
# Only regenerate Sphinx when:
|
|
||||||
# - Doxygen has rerun
|
|
||||||
# - Our doc files have been updated
|
|
||||||
# - The Sphinx config has been updated
|
|
||||||
add_custom_command(OUTPUT ${SPHINX_INDEX_FILE}
|
|
||||||
COMMAND
|
|
||||||
${SPHINX_EXECUTABLE} -b html
|
|
||||||
# Tell Breathe where to find the Doxygen output
|
|
||||||
-Dbreathe_projects.SkullCPeripheralsLibrary=${DOXYGEN_OUTPUT_DIR}/xml
|
|
||||||
${SPHINX_SOURCE} ${SPHINX_BUILD}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
DEPENDS
|
|
||||||
# Other docs files you want to track should go here (or in some variable)
|
|
||||||
${SPHINX_RST_FILES}
|
|
||||||
${DOXYGEN_INDEX_FILE}
|
|
||||||
MAIN_DEPENDENCY ${SPHINX_SOURCE}/conf.py
|
|
||||||
COMMENT "Generating documentation with Sphinx")
|
|
||||||
|
|
||||||
# Nice named target so we can run the job easily
|
|
||||||
add_custom_target(Sphinx ALL DEPENDS ${SPHINX_INDEX_FILE})
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
// Every other setting ends up being default.
|
|
||||||
|
|
||||||
GENERATE_XML = YES
|
|
||||||
GENERATE_HTML = YES
|
|
||||||
|
|
||||||
JAVADOC_AUTOBRIEF = YES
|
|
||||||
|
|
||||||
INPUT = @DOXYGEN_INPUT_DIRS@
|
|
||||||
RECURSIVE = YES
|
|
||||||
|
|
||||||
OUTPUT_DIRECTORY = "@DOXYGEN_OUTPUT_DIR@"
|
|
||||||
31
Docs/conf.py
31
Docs/conf.py
@ -1,31 +0,0 @@
|
|||||||
# Configuration file for the Sphinx documentation builder.
|
|
||||||
#
|
|
||||||
# For the full list of built-in configuration values, see the documentation:
|
|
||||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
||||||
|
|
||||||
# -- Project information -----------------------------------------------------
|
|
||||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
||||||
|
|
||||||
project = 'SkullC Peripherals Library'
|
|
||||||
copyright = '2023, Rusted Skull'
|
|
||||||
author = 'Rusted Skull'
|
|
||||||
|
|
||||||
# -- General configuration ---------------------------------------------------
|
|
||||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
||||||
|
|
||||||
extensions = [ "breathe" ]
|
|
||||||
|
|
||||||
templates_path = ['_templates']
|
|
||||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for HTML output -------------------------------------------------
|
|
||||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
||||||
|
|
||||||
html_theme = 'classic'
|
|
||||||
html_static_path = ['_static']
|
|
||||||
|
|
||||||
# -- Breathe Configuration"
|
|
||||||
breathe_default_project = "SkullCPeripheralsLibrary"
|
|
||||||
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
.. SkullC Peripherals Library documentation master file, created by
|
|
||||||
sphinx-quickstart on Thu Dec 28 23:16:21 2023.
|
|
||||||
You can adapt this file completely to your liking, but it should at least
|
|
||||||
contain the root `toctree` directive.
|
|
||||||
|
|
||||||
Welcome to SkullC Peripherals Library's documentation!
|
|
||||||
======================================================
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 2
|
|
||||||
:caption: Contents:
|
|
||||||
|
|
||||||
utility
|
|
||||||
peripherals
|
|
||||||
threads
|
|
||||||
messaging
|
|
||||||
|
|
||||||
Indices and tables
|
|
||||||
==================
|
|
||||||
|
|
||||||
* :ref:`genindex`
|
|
||||||
* :ref:`modindex`
|
|
||||||
* :ref:`search`
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
|
|
||||||
Messaging Library
|
|
||||||
=================
|
|
||||||
|
|
||||||
A small Packet and Parser implementation for framing random message structures on the wire.
|
|
||||||
|
|
||||||
Use the :cpp:struct:`Packet` to copy in various data. Then send the serialized version of the packet
|
|
||||||
onto the wire.
|
|
||||||
|
|
||||||
:cpp:class:`Messaging::Parser` will help you put bytes coming in from the wire into coherent packets, and will serve you
|
|
||||||
these packets as you're ready for them.
|
|
||||||
|
|
||||||
.. doxygennamespace:: Messaging
|
|
||||||
:project: SkullCPeripheralsLibrary
|
|
||||||
:content-only:
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
Peripherals Library
|
|
||||||
=================
|
|
||||||
|
|
||||||
.. doxygennamespace:: Peripherals
|
|
||||||
:project: SkullCPeripheralsLibrary
|
|
||||||
:content-only:
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
Threads Library
|
|
||||||
=================
|
|
||||||
|
|
||||||
.. doxygennamespace:: Threads
|
|
||||||
:project: SkullCPeripheralsLibrary
|
|
||||||
:content-only:
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
Utility Library
|
|
||||||
=================
|
|
||||||
|
|
||||||
.. doxygennamespace:: Utility
|
|
||||||
:project: SkullCPeripheralsLibrary
|
|
||||||
:content-only:
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by erki on 11/02/24.
|
|
||||||
//
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <concepts>
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
namespace Peripherals::Hal
|
|
||||||
{
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
concept Gpio = requires (T t, const T ct) {
|
|
||||||
t.set(true);
|
|
||||||
t.toggle();
|
|
||||||
{ ct.read() } -> std::same_as<bool>;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
concept SerialInterface = requires (T t, std::uint8_t* data, const std::uint32_t len) {
|
|
||||||
{ t.transmit(data, len) } -> std::same_as<bool>;
|
|
||||||
{ t.transmit(std::array<std::uint8_t, 10>{}) } -> std::same_as<bool>;
|
|
||||||
{ t.receive(data, len) } -> std::same_as<bool>;
|
|
||||||
{ t.receive(std::array<std::uint8_t, 10>{}) } -> std::same_as<bool>;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T, typename RegName>
|
|
||||||
concept RegisterInterface = requires (T t, RegName reg, std::uint8_t* data, const std::uint32_t len) {
|
|
||||||
t.writerRegister(reg, std::uint8_t{});
|
|
||||||
t.writeRegisterMultibyte(reg, data, len);
|
|
||||||
{ t.readRegister(reg, std::uint32_t{}) } -> std::same_as<std::uint8_t>;
|
|
||||||
t.readRegisterMultibyte(reg, data, len, std::uint32_t{});
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by erki on 11/02/24.
|
|
||||||
//
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef SKULLC_USE_HAL_ESP
|
|
||||||
|
|
||||||
#include <peripherals_hal_concepts.hpp>
|
|
||||||
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
namespace Peripherals::Hal::Esp
|
|
||||||
{
|
|
||||||
|
|
||||||
struct Gpio
|
|
||||||
{
|
|
||||||
gpio_num_t gpio;
|
|
||||||
const bool inverted = false;
|
|
||||||
|
|
||||||
Gpio() = delete;
|
|
||||||
explicit Gpio(gpio_num_t gpio, const bool inverted)
|
|
||||||
: gpio(gpio), inverted(inverted)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void set(const bool& state)
|
|
||||||
{
|
|
||||||
gpio_set_level(gpio, inverted ? !state : state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggle() { gpio_set_level(gpio, !gpio_get_level(gpio)); }
|
|
||||||
|
|
||||||
bool read() const
|
|
||||||
{
|
|
||||||
return inverted ? !bool(gpio_get_level(gpio)) : bool(gpio_get_level(gpio));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static_assert(Peripherals::Hal::Gpio<Gpio>);
|
|
||||||
|
|
||||||
#define CREATE_GPIO(name) \
|
|
||||||
Peripherals::Hal::Esp::Gpio{name, false}
|
|
||||||
|
|
||||||
#define CREATE_INV_GPIO(name) \
|
|
||||||
Peripherals::Hal::Esp::Gpio{name, true}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
# warning "ESP HAL included without SKULLC_USE_HAL_ESP being defined."
|
|
||||||
#endif /* SKULLC_USE_HAL_ESP */
|
|
||||||
@ -8,8 +8,6 @@
|
|||||||
#ifndef SKULLC_PERIPHERALS_HAL_ST_HPP_
|
#ifndef SKULLC_PERIPHERALS_HAL_ST_HPP_
|
||||||
#define SKULLC_PERIPHERALS_HAL_ST_HPP_
|
#define SKULLC_PERIPHERALS_HAL_ST_HPP_
|
||||||
|
|
||||||
#ifdef SKULLC_USE_HAL_ST
|
|
||||||
|
|
||||||
#include <main.h>
|
#include <main.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
@ -345,8 +343,4 @@ struct ItmSerialInterface
|
|||||||
}// namespace Hal
|
}// namespace Hal
|
||||||
}// namespace Peripherals
|
}// namespace Peripherals
|
||||||
|
|
||||||
#else
|
|
||||||
# warning "ESP HAL included without SKULLC_USE_HAL_ESP being defined."
|
|
||||||
#endif /* SKULLC_USE_HAL_ST */
|
|
||||||
|
|
||||||
#endif /* SKULLC_PERIPHERALS_HAL_ST_HPP_ */
|
#endif /* SKULLC_PERIPHERALS_HAL_ST_HPP_ */
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
#Look for an executable called sphinx-build
|
|
||||||
find_program(SPHINX_EXECUTABLE
|
|
||||||
NAMES sphinx-build
|
|
||||||
DOC "Path to sphinx-build executable")
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
#Handle standard arguments to find_package like REQUIRED and QUIET
|
|
||||||
find_package_handle_standard_args(Sphinx
|
|
||||||
"Failed to find sphinx-build executable"
|
|
||||||
SPHINX_EXECUTABLE)
|
|
||||||
Loading…
x
Reference in New Issue
Block a user