Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • avn/swd/skyward-boardcore
  • emilio.corigliano/skyward-boardcore
  • ettore.pane/skyward-boardcore
  • giulia.facchi/skyward-boardcore
  • valerio.flamminii/skyward-boardcore
  • nicolo.caruso/skyward-boardcore
6 results
Select Git revision
Show changes
Commits on Source (23)
Showing
with 3042 additions and 111 deletions
......@@ -34,3 +34,4 @@ __pycache__
/scripts/generators/scxmls
scripts/logdecoder/logdecoder
doc/output
\ No newline at end of file
......@@ -23,35 +23,29 @@ variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- build-release
- build-debug
- build-logdecoder
- build
- test
- lint
- documentation
# Stage build-release
# Stage build
build-release:
stage: build-release
release:
stage: build
tags:
- miosix
script:
- ./sbs
# Stage build-debug
build-debug:
stage: build-debug
debug:
stage: build
tags:
- miosix
script:
- ./sbs --debug
# Stage build-logdecoder
build-logdecoder:
stage: build-logdecoder
logdecoder:
stage: build
tags:
- miosix
script:
......@@ -99,16 +93,13 @@ find:
# Stage documentation
documentation:
pages:
stage: documentation
only:
- master
tags:
- copyright
- main
script:
- echo "Generate documentation to https://documentation.skywarder.eu/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}"
- rm -rf doc/output
- doxygen doc/Doxyfile
- rm -rf /srv/code_documentation/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}
- mkdir -p /srv/code_documentation/${CI_PROJECT_NAME}/
- mv doc/output/html /srv/code_documentation/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}
- mv doc/output/html public
artifacts:
paths:
- public
[submodule "Catch2"]
path = libs/Catch2
url = ../third-party/Catch2.git
url = https://git.skywarder.eu/avn/swd/third-party/Catch2.git
[submodule "Eigen"]
path = libs/eigen
url = ../third-party/eigen.git
url = https://git.skywarder.eu/avn/swd/third-party/eigen.git
[submodule "Modern formatting library"]
path = libs/fmt
url = ../third-party/fmt.git
url = https://git.skywarder.eu/avn/swd/third-party/fmt.git
[submodule "MAVLink Skyward library"]
path = libs/mavlink-skyward-lib
url = ../mavlink/mavlink-skyward-lib
url = https://git.skywarder.eu/avn/swd/mavlink/mavlink-skyward-lib
[submodule "Miosix Host"]
path = libs/miosix-host
url = ../miosix-host.git
url = https://git.skywarder.eu/avn/swd/miosix-host.git
[submodule "Miosix Kernel"]
path = libs/miosix-kernel
url = ../miosix-kernel.git
url = https://git.skywarder.eu/avn/swd/miosix-kernel.git
[submodule "Miosix GUI library"]
path = libs/mxgui
url = ../third-party/mxgui.git
url = https://git.skywarder.eu/avn/swd/third-party/mxgui.git
[submodule "Trivial serialization for C++"]
path = libs/tscpp
url = ../third-party/tscpp.git
url = https://git.skywarder.eu/avn/swd/third-party/tscpp.git
......@@ -318,6 +318,61 @@
"limitSymbolsToIncludedHeaders": true
}
},
{
"name": "stm32f429zi_skyward_groundstation_v2",
"cStandard": "c11",
"cppStandard": "c++14",
"compilerPath": "/opt/arm-miosix-eabi/bin/arm-miosix-eabi-g++",
"defines": [
"DEBUG",
"_ARCH_CORTEXM4_STM32F4",
"_BOARD_STM32F429ZI_SKYWARD_GS_V2",
"_MIOSIX_BOARDNAME=stm32f429zi_skyward_groundstation_v2",
"HSE_VALUE=8000000",
"SYSCLK_FREQ_168MHz=168000000",
"_MIOSIX",
"__cplusplus=201103L"
],
"includePath": [
"${workspaceFolder}/libs/miosix-kernel/miosix/config/arch/cortexM4_stm32f4/stm32f429zi_skyward_groundstation_v2",
"${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_groundstation_v2",
"${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/common",
"${workspaceFolder}/libs/miosix-kernel/miosix/arch/common",
"${workspaceFolder}/libs/miosix-kernel/miosix",
"${workspaceFolder}/libs/mxgui/mxgui",
"${workspaceFolder}/libs/mxgui",
"${workspaceFolder}/libs/mavlink-skyward-lib",
"${workspaceFolder}/libs/fmt/include",
"${workspaceFolder}/libs/eigen",
"${workspaceFolder}/libs/tscpp",
"${workspaceFolder}/libs",
"${workspaceFolder}/src/shared",
"${workspaceFolder}/src/tests"
],
"browse": {
"path": [
"${workspaceFolder}/libs/miosix-kernel/miosix/config/arch/cortexM4_stm32f4/stm32f429zi_skyward_groundstation_v2",
"${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_groundstation_v2",
"${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/common",
"${workspaceFolder}/libs/miosix-kernel/miosix/stdlib_integration",
"${workspaceFolder}/libs/miosix-kernel/miosix/arch/common",
"${workspaceFolder}/libs/miosix-kernel/miosix/interfaces",
"${workspaceFolder}/libs/miosix-kernel/miosix/filesystem",
"${workspaceFolder}/libs/miosix-kernel/miosix/kernel",
"${workspaceFolder}/libs/miosix-kernel/miosix/util",
"${workspaceFolder}/libs/miosix-kernel/miosix/e20",
"${workspaceFolder}/libs/miosix-kernel/miosix/*",
"${workspaceFolder}/libs/mavlink-skyward-lib",
"${workspaceFolder}/libs/eigen",
"${workspaceFolder}/libs/tscpp",
"${workspaceFolder}/libs/mxgui",
"${workspaceFolder}/libs/fmt",
"${workspaceFolder}/src/shared",
"${workspaceFolder}/src/tests"
],
"limitSymbolsToIncludedHeaders": true
}
},
{
"name": "stm32f205rc_skyward_ciuti",
"cStandard": "c11",
......
......@@ -57,6 +57,14 @@ sbs_target(runcam-settings stm32f407vg_stm32f4discovery)
add_executable(sdcard-benchmark src/entrypoints/sdcard-benchmark.cpp)
sbs_target(sdcard-benchmark stm32f429zi_skyward_death_stack_x)
add_executable(sx1278fsk-serial src/entrypoints/sx1278-serial.cpp)
target_compile_definitions(sx1278fsk-serial PRIVATE SX1278_IS_FSK)
sbs_target(sx1278fsk-serial stm32f429zi_skyward_groundstation_v2)
add_executable(sx1278lora-serial src/entrypoints/sx1278-serial.cpp)
target_compile_definitions(sx1278lora-serial PRIVATE SX1278_IS_LORA)
sbs_target(sx1278lora-serial stm32f429zi_skyward_groundstation_v2)
#-----------------------------------------------------------------------------#
# Tests #
#-----------------------------------------------------------------------------#
......@@ -107,6 +115,7 @@ add_executable(catch-tests-boardcore
src/tests/catch/test-packetqueue.cpp
src/tests/catch/test-sensormanager-catch.cpp
src/tests/catch/xbee/test-xbee-parser.cpp
src/tests/catch/test-modulemanager.cpp
)
target_compile_definitions(catch-tests-boardcore PRIVATE USE_MOCK_PERIPHERALS)
sbs_target(catch-tests-boardcore stm32f429zi_stm32f4discovery)
......@@ -241,6 +250,12 @@ sbs_target(test-xbee-snd stm32f429zi_stm32f4discovery)
add_executable(test-usart src/tests/drivers/usart/test-usart.cpp)
sbs_target(test-usart stm32f407vg_stm32f4discovery)
add_executable(test-i2c-driver src/tests/drivers/i2c/test-i2c-driver.cpp)
sbs_target(test-i2c-driver stm32f429zi_stm32f4discovery)
add_executable(test-i2c src/tests/drivers/i2c/test-i2c.cpp)
sbs_target(test-i2c stm32f429zi_stm32f4discovery)
add_executable(test-internal-temp src/tests/drivers/test-internal-temp.cpp)
sbs_target(test-internal-temp stm32f407vg_stm32f4discovery)
......@@ -255,42 +270,47 @@ sbs_target(test-fsm stm32f429zi_stm32f4discovery)
# Tests - Radio #
#-----------------------------------------------------------------------------#
# add_executable(test-sx1278-bidir src/tests/drivers/sx1278/test-sx1278-bidir.cpp)
# sbs_target(test-sx1278-bidir stm32f407vg_stm32f4discovery)
add_executable(test-sx1278fsk-bidir src/tests/radio/sx1278/fsk/test-sx1278-bidir.cpp)
sbs_target(test-sx1278fsk-bidir stm32f429zi_skyward_groundstation_v2)
add_executable(test-sx1278fsk-tx src/tests/radio/sx1278/fsk/test-sx1278-bench-serial.cpp)
target_compile_definitions(test-sx1278fsk-tx PRIVATE DISABLE_RX)
sbs_target(test-sx1278fsk-tx stm32f429zi_skyward_groundstation_v2)
add_executable(test-sx1278-bidir-gs src/tests/drivers/sx1278/test-sx1278-bidir.cpp)
sbs_target(test-sx1278-bidir-gs stm32f429zi_skyward_groundstation)
add_executable(test-sx1278fsk-rx src/tests/radio/sx1278/fsk/test-sx1278-bench-serial.cpp)
target_compile_definitions(test-sx1278fsk-rx PRIVATE DISABLE_TX)
sbs_target(test-sx1278fsk-rx stm32f429zi_skyward_groundstation_v2)
add_executable(test-sx1278-bidir-v3 src/tests/drivers/sx1278/test-sx1278-bidir.cpp)
sbs_target(test-sx1278-bidir-v3 stm32f429zi_skyward_death_stack_v3)
add_executable(test-sx1278fsk-gui src/tests/radio/sx1278/fsk/test-sx1278-bench-gui.cpp)
sbs_target(test-sx1278fsk-gui stm32f429zi_skyward_groundstation_v2)
add_executable(test-sx1278-tx src/tests/drivers/sx1278/test-sx1278-bench-serial.cpp)
target_compile_definitions(test-sx1278-tx PRIVATE DISABLE_RX)
sbs_target(test-sx1278-tx stm32f429zi_skyward_groundstation)
add_executable(test-sx1278fsk-gui-rx src/tests/radio/sx1278/fsk/test-sx1278-bench-gui.cpp)
target_compile_definitions(test-sx1278fsk-gui-rx PRIVATE DISABLE_TX)
sbs_target(test-sx1278fsk-gui-rx stm32f429zi_skyward_groundstation_v2)
add_executable(test-sx1278-rx src/tests/drivers/sx1278/test-sx1278-bench-serial.cpp)
target_compile_definitions(test-sx1278-rx PRIVATE DISABLE_TX)
sbs_target(test-sx1278-rx stm32f429zi_skyward_groundstation)
add_executable(test-sx1278fsk-gui-tx src/tests/radio/sx1278/fsk/test-sx1278-bench-gui.cpp)
target_compile_definitions(test-sx1278fsk-gui-tx PRIVATE DISABLE_RX)
sbs_target(test-sx1278fsk-gui-tx stm32f429zi_skyward_groundstation_v2)
add_executable(test-sx1278-gui src/tests/drivers/sx1278/test-sx1278-bench-gui.cpp)
sbs_target(test-sx1278-gui stm32f429zi_skyward_groundstation)
add_executable(test-sx1278fsk-mavlink src/tests/radio/sx1278/fsk/test-sx1278-mavlink.cpp)
sbs_target(test-sx1278fsk-mavlink stm32f429zi_skyward_groundstation_v2)
add_executable(test-sx1278-gui-rx src/tests/drivers/sx1278/test-sx1278-bench-gui.cpp)
target_compile_definitions(test-sx1278-gui-rx PRIVATE DISABLE_TX)
sbs_target(test-sx1278-gui-rx stm32f429zi_skyward_groundstation)
# add_executable(test-mavlinkdriver src/tests/radio/test-mavlinkdriver.cpp)
# sbs_target(test-mavlinkdriver stm32f407vg_stm32f4discovery)
add_executable(test-sx1278-gui-tx src/tests/drivers/sx1278/test-sx1278-bench-gui.cpp)
target_compile_definitions(test-sx1278-gui-tx PRIVATE DISABLE_RX)
sbs_target(test-sx1278-gui-tx stm32f429zi_skyward_groundstation)
add_executable(test-sx1278lora-bidir src/tests/radio/sx1278/lora/test-sx1278-bidir.cpp)
sbs_target(test-sx1278lora-bidir stm32f429zi_skyward_groundstation_v2)
add_executable(test-sx1278-mavlink src/tests/drivers/sx1278/test-sx1278-mavlink.cpp)
sbs_target(test-sx1278-mavlink stm32f429zi_skyward_groundstation_v2)
add_executable(test-sx1278lora-mavlink src/tests/radio/sx1278/lora/test-sx1278-mavlink.cpp)
sbs_target(test-sx1278lora-mavlink stm32f429zi_skyward_groundstation_v2)
add_executable(test-sx1278-serial src/tests/drivers/sx1278/test-sx1278-serial.cpp)
sbs_target(test-sx1278-serial stm32f429zi_stm32f4discovery)
add_executable(test-sx1278lora-rx src/tests/radio/sx1278/lora/test-sx1278-simple.cpp)
target_compile_definitions(test-sx1278lora-rx PRIVATE ENABLE_RX)
sbs_target(test-sx1278lora-rx stm32f429zi_skyward_groundstation_v2)
add_executable(test-mavlinkdriver src/tests/radio/test-mavlinkdriver.cpp)
sbs_target(test-mavlinkdriver stm32f407vg_stm32f4discovery)
add_executable(test-sx1278lora-tx src/tests/radio/sx1278/lora/test-sx1278-simple.cpp)
target_compile_definitions(test-sx1278lora-tx PRIVATE ENABLE_TX)
sbs_target(test-sx1278lora-tx stm32f429zi_skyward_groundstation_v2)
#-----------------------------------------------------------------------------#
# Tests - Sensors #
......
![alt text](https://avatars2.githubusercontent.com/u/8077370?s=200&v=4)
<div align="center">
<img src="https://avatars2.githubusercontent.com/u/8077370?s=200&v=4" alt="Skyward" width="200"></a>
<h2>Skyward Boardcore</h2>
<a href="https://git.skywarder.eu/avn/swd/skyward-boardcore/-/pipelines"><img src="https://git.skywarder.eu/avn/swd/skyward-boardcore/badges/main/pipeline.svg"></a>
</div>
Skyward Boardcore
[![pipeline status](https://git.skywarder.eu/scs/skyward-boardcore/badges/master/pipeline.svg)](https://git.skywarder.eu/scs/skyward-boardcore/commits/master)
-------------
Boardcore is a framework for developing and building rockets software for custom boards with Miosix.
Boardcore is a framework for developing and building missile software for custom boards with Miosix.
[Miosix](https://miosix.org/) is a lightweight OS for embedded developing which provides support for basic things such as Threads, GPIO, Time and many other. You can find our fork of the kernel here: [skyward/miosix-kernel](https://git.skywarder.eu/avn/swd/miosix-kernel)
[Miosix](https://miosix.org/) is a lightweight OS for embedded developing which provides support for basic things such as Threads, GPIO, Time and many other. You can find our fork of the kernel here: [skyward/miosix-kernel](https://git.skywarder.eu/scs/miosix-kernel)
Building is made with [SBS](https://git.skywarder.eu/avn/swd/skyward-boardcore/wikis/Skyward-Build-System-(SBS)), which was created to easily compile and reuse code for different boards.
Building is made with [SBS](https://git.skywarder.eu/scs/skyward-boardcore/wikis/Skyward-Build-System-(SBS)), which was created to easily compile and reuse code for different boards.
## Content
### Content
| **src/** | sources! |
| ------------ | ------------------------------------------------------- |
| shared/ | objects, drivers and other stuff written by us |
| entrypoints/ | each file here is a 'main' |
| tests/ | contains the 'main' of every test |
| **build/** | compiled binaries that can be flashed on a target board |
| **data/** | configuration (barely used now) |
| **libs/** | external libs (Miosix kernel as a git submodule) |
| **scripts/** | some tools (e.g. script for flashing on the boards) |
| Path | Description |
| ---------------- | ----------------------------------------------------------- |
| src/shared/ | Objects, drivers and other stuff written by us |
| src/entrypoints/ | Each file here is a 'main' |
| src/tests/ | Contains the 'main' of every test |
| build/ | Compiled binaries that can be flashed on a target board |
| libs/ | External libs (Miosix kernel and others as a git submodule) |
| scripts/ | Some tools (e.g. script for flashing on the boards) |
In the main folder you will find **CMakeLists.txt** which is used to configure the build system.
### Getting Started
## Getting Started
#### Dependencies
### Dependencies
* CMake
* Git
......@@ -34,17 +33,24 @@ In the main folder you will find **CMakeLists.txt** which is used to configure t
Also, Ccache, Ninja, OpenOCD, Cppcheck, clang-format and pre-commit are recommended for a better experience.
#### Cloning the repo
### Cloning the repo
Clone this repo with the `--recursive` option.
```sh
git clone --recursive https://git.skywarder.eu/scs/skyward-boardcore.git
git clone --recursive https://git.skywarder.eu/avn/swd/skyward-boardcore.git
cd skyward-boardcore
```
### Building
## Building
You can build everything using CMake:
You can build everything using the SBS script:
```sh
./sbs
```
The build system will start building all the targets (entrypoints and tests). Depending on how many targets there are, this operation may take several minutes. If you installed ccache, subsequent runs will be much faster.
Or you can use directly CMake:
```sh
mkdir build
cd build
......@@ -52,14 +58,11 @@ cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -D
cmake --build .
```
Or using the SBS wrapper script:
```sh
./sbs
```
## Documentation
The build system will start building all the targets (entrypoints and tests). Depending on how many targets there are, this operation may take several minutes.
The code is documented with Doxygen, check it [here](http://avn.pages.skywarder.eu/swd/skyward-boardcore).
### Contributing
## Contributing
You can install a pre-commit hook to ensure changes to the code will pass CI:
......@@ -67,10 +70,10 @@ You can install a pre-commit hook to ensure changes to the code will pass CI:
pre-commit install
```
### What's next?
## What's next?
In the [Wiki](https://git.skywarder.eu/scs/skyward-boardcore/wikis/home) you will find some first-steps **guides** (configuring the IDE, building a firmware, etc.) as well as the **coding guidelines** and some **best practices** we adopt.
In the [Wiki](https://git.skywarder.eu/avn/swd/skyward-boardcore/wikis/home) you will find some first-steps **guides** (configuring the IDE, building a firmware, etc.) as well as the **coding guidelines** and some **best practices** we adopt.
If you want to contribute to this repository, please read [Git Workflow](https://git.skywarder.eu/scs/skyward-boardcore/wikis/Git-Workflow).
If you want to contribute to this repository, please read [Git Workflow](https://git.skywarder.eu/avn/swd/skyward-boardcore/wikis/Git-Workflow).
If you just want to start messing around, try [this](https://git.skywarder.eu/scs/skyward-boardcore/wikis/Boardcore-Quick-Start).
If you just want to start messing around, try [this](https://git.skywarder.eu/avn/swd/skyward-boardcore/-/wikis/LED-Blink).
......@@ -51,13 +51,14 @@ foreach(OPT_BOARD ${BOARDS})
${SBS_BASE}/src/shared/drivers/canbus/CanDriver/CanDriver.cpp
${SBS_BASE}/src/shared/drivers/canbus/CanDriver/CanInterrupt.cpp
${SBS_BASE}/src/shared/drivers/canbus/CanProtocol/CanProtocol.cpp
${SBS_BASE}/src/shared/drivers/i2c/stm32f2_f4_i2c.cpp
${SBS_BASE}/src/shared/drivers/interrupt/external_interrupts.cpp
${SBS_BASE}/src/shared/drivers/timer/PWM.cpp
${SBS_BASE}/src/shared/drivers/timer/TimestampTimer.cpp
${SBS_BASE}/src/shared/drivers/runcam/Runcam.cpp
${SBS_BASE}/src/shared/drivers/spi/SPITransaction.cpp
${SBS_BASE}/src/shared/drivers/usart/USART.cpp
${SBS_BASE}/src/shared/drivers/i2c/I2CDriver.cpp
${SBS_BASE}/src/shared/drivers/i2c/I2C.cpp
# Events
${SBS_BASE}/src/shared/events/EventBroker.cpp
......@@ -69,7 +70,10 @@ foreach(OPT_BOARD ${BOARDS})
${SBS_BASE}/src/shared/radio/gamma868/Gamma868.cpp
${SBS_BASE}/src/shared/radio/Xbee/APIFrameParser.cpp
${SBS_BASE}/src/shared/radio/Xbee/Xbee.cpp
${SBS_BASE}/src/shared/radio/SX1278/SX1278.cpp
${SBS_BASE}/src/shared/radio/SX1278/SX1278Fsk.cpp
${SBS_BASE}/src/shared/radio/SX1278/SX1278Lora.cpp
${SBS_BASE}/src/shared/radio/SX1278/SX1278Common.cpp
${SBS_BASE}/src/shared/radio/SX1278/Ebyte.cpp
# Scheduler
${SBS_BASE}/src/shared/scheduler/TaskScheduler.cpp
......
......@@ -1192,7 +1192,8 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_STYLESHEET =
HTML_EXTRA_STYLESHEET = doc/doxygen-awesome.css \
doc/doxygen-awesome-sidebar-only.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
......
/**
Doxygen Awesome
https://github.com/jothepro/doxygen-awesome-css
MIT License
Copyright (c) 2021 jothepro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
html {
/* side nav width. MUST be = `TREEVIEW_WIDTH`.
* Make sure it is wide enough to contain the page title (logo + title + version)
*/
--side-nav-fixed-width: 335px;
--menu-display: none;
--top-height: 120px;
--toc-sticky-top: -25px;
--toc-max-height: calc(100vh - 2 * var(--spacing-medium) - 25px);
}
#projectname {
white-space: nowrap;
}
@media screen and (min-width: 768px) {
html {
--searchbar-background: var(--page-background-color);
}
#side-nav {
min-width: var(--side-nav-fixed-width);
max-width: var(--side-nav-fixed-width);
top: var(--top-height);
overflow: visible;
}
#nav-tree, #side-nav {
height: calc(100vh - var(--top-height)) !important;
}
#nav-tree {
padding: 0;
}
#top {
display: block;
border-bottom: none;
height: var(--top-height);
margin-bottom: calc(0px - var(--top-height));
max-width: var(--side-nav-fixed-width);
overflow: hidden;
background: var(--side-nav-background);
}
#main-nav {
float: left;
padding-right: 0;
}
.ui-resizable-handle {
cursor: default;
width: 1px !important;
box-shadow: 0 calc(-2 * var(--top-height)) 0 0 var(--separator-color);
}
#nav-path {
position: fixed;
right: 0;
left: var(--side-nav-fixed-width);
bottom: 0;
width: auto;
}
#doc-content {
height: calc(100vh - 31px) !important;
padding-bottom: calc(3 * var(--spacing-large));
padding-top: calc(var(--top-height) - 80px);
box-sizing: border-box;
margin-left: var(--side-nav-fixed-width) !important;
}
#MSearchBox {
width: calc(var(--side-nav-fixed-width) - calc(2 * var(--spacing-medium)));
}
#MSearchField {
width: calc(var(--side-nav-fixed-width) - calc(2 * var(--spacing-medium)) - 65px);
}
#MSearchResultsWindow {
left: var(--spacing-medium) !important;
right: auto;
}
}
This diff is collapsed.
Subproject commit c205269d52a78438fc3adbb2fb247d861fadce17
Subproject commit e6813cafd01fadb6a72c4d5077719f5a5fe74d91
Subproject commit 1e4cd2758830329dcb299b5063d6548d1dc036b4
Subproject commit f47be87ab9c2cec159c2ed630e791e33d19ad60c
Subproject commit 39e7d33dd161de1239e835d223e6f83611a79ab1
Subproject commit 869df434d44b9786a7ad7de42cd268653a23ab5a
/* Copyright (c) 2021 Skyward Experimental Rocketry
/* Copyright (c) 2022 Skyward Experimental Rocketry
* Author: Davide Mor
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
......@@ -22,61 +22,114 @@
#include <drivers/interrupt/external_interrupts.h>
#include <filesystem/console/console_device.h>
#include <radio/SX1278/SX1278.h>
#include <thread>
// SX1278 includes
#include <radio/SX1278/Ebyte.h>
#include <radio/SX1278/SX1278Fsk.h>
#include <radio/SX1278/SX1278Lora.h>
#include "common.h"
#include <thread>
using namespace Boardcore;
using namespace miosix;
SPIBus bus(SPI4);
// Uncomment the following line to enable Lora mode
// Or use SBS to define it for you
// #define SX1278_IS_LORA
#if defined _BOARD_STM32F429ZI_SKYWARD_GS_V2
#include "interfaces-impl/hwmapping.h"
// Uncomment the following line to enable Ebyte module
// #define SX1278_IS_EBYTE
using cs = peripherals::ra01::pc13::cs;
using dio0 = peripherals::ra01::pc13::dio0;
using dio1 = peripherals::ra01::pc13::dio1;
using dio3 = peripherals::ra01::pc13::dio3;
using sck = interfaces::spi4::sck;
using miso = interfaces::spi4::miso;
using mosi = interfaces::spi4::mosi;
#ifdef SX1278_IS_EBYTE
using txen = Gpio<GPIOE_BASE, 4>;
using rxen = Gpio<GPIOD_BASE, 4>;
#endif
#define SX1278_SPI SPI4
GpioPin sck(GPIOE_BASE, 2);
GpioPin miso(GPIOE_BASE, 5);
GpioPin mosi(GPIOE_BASE, 6);
GpioPin cs(GPIOC_BASE, 1);
GpioPin dio(GPIOF_BASE, 10);
#define SX1278_IRQ_DIO0 EXTI6_IRQHandlerImpl
#define SX1278_IRQ_DIO1 EXTI2_IRQHandlerImpl
#define SX1278_IRQ_DIO3 EXTI11_IRQHandlerImpl
SX1278* sx1278 = nullptr;
#else
#error "Target not supported"
#endif
void __attribute__((used)) EXTI10_IRQHandlerImpl()
#ifdef SX1278_IS_LORA
static constexpr size_t SX1278_MTU = SX1278Lora::MTU;
SX1278Lora *sx1278 = nullptr;
#else
static constexpr size_t SX1278_MTU = SX1278Fsk::MTU;
SX1278Fsk *sx1278 = nullptr;
#endif
#ifdef SX1278_IRQ_DIO0
void __attribute__((used)) SX1278_IRQ_DIO0()
{
if (sx1278)
sx1278->handleDioIRQ();
sx1278->handleDioIRQ(SX1278::Dio::DIO0);
}
#endif
/// Initialize stm32f407g board.
void initBoard()
#ifdef SX1278_IRQ_DIO1
void __attribute__((used)) SX1278_IRQ_DIO1()
{
if (sx1278)
sx1278->handleDioIRQ(SX1278::Dio::DIO1);
}
#endif
#ifdef SX1278_IRQ_DIO3
void __attribute__((used)) SX1278_IRQ_DIO3()
{
miosix::FastInterruptDisableLock dLock;
// Enable SPI3
RCC->APB2ENR |= RCC_APB2ENR_SPI4EN; // Enable SPI4 bus
RCC_SYNC();
// Setup SPI pins
sck.mode(miosix::Mode::ALTERNATE);
sck.alternateFunction(5);
miso.mode(miosix::Mode::ALTERNATE);
miso.alternateFunction(5);
mosi.mode(miosix::Mode::ALTERNATE);
mosi.alternateFunction(5);
cs.mode(miosix::Mode::OUTPUT);
dio.mode(miosix::Mode::INPUT);
if (sx1278)
sx1278->handleDioIRQ(SX1278::Dio::DIO3);
}
#endif
cs.high();
enableExternalInterrupt(dio.getPort(), dio.getNumber(),
void initBoard()
{
#ifdef SX1278_IS_EBYTE
rxen::mode(Mode::OUTPUT);
txen::mode(Mode::OUTPUT);
rxen::low();
txen::low();
#endif
#ifdef SX1278_IRQ_DIO0
GpioPin dio0_pin = dio0::getPin();
enableExternalInterrupt(dio0_pin.getPort(), dio0_pin.getNumber(),
InterruptTrigger::RISING_EDGE);
#endif
#ifdef SX1278_IRQ_DIO1
GpioPin dio1_pin = dio1::getPin();
enableExternalInterrupt(dio1_pin.getPort(), dio1_pin.getNumber(),
InterruptTrigger::RISING_EDGE);
#endif
#ifdef SX1278_IRQ_DIO3
GpioPin dio3_pin = dio3::getPin();
enableExternalInterrupt(dio3_pin.getPort(), dio3_pin.getNumber(),
InterruptTrigger::RISING_EDGE);
#endif
}
void recvLoop()
{
uint8_t msg[256];
uint8_t msg[SX1278_MTU];
while (1)
{
int len = sx1278->receive(msg, sizeof(msg));
......@@ -90,22 +143,14 @@ void recvLoop()
void sendLoop()
{
// I create a GPIO with the onboard led to tell the user that
// a package is being sent
miosix::GpioPin led(GPIOG_BASE, 13);
led.mode(miosix::Mode::OUTPUT);
led.low();
uint8_t msg[63];
uint8_t msg[SX1278_MTU];
while (1)
{
auto serial = miosix::DefaultConsole::instance().get();
int len = serial->readBlock(msg, sizeof(msg), 0);
if (len > 0)
{
led.high();
sx1278->send(msg, len);
led.low();
}
}
}
......@@ -114,35 +159,61 @@ int main()
{
initBoard();
SX1278::Config config;
SX1278::Error err;
// Generic SPI configuration
SPIBusConfig spi_config;
spi_config.clockDivider = SPI::ClockDivider::DIV_64;
spi_config.mode = SPI::Mode::MODE_0;
spi_config.bitOrder = SPI::BitOrder::MSB_FIRST;
SPIBus bus(SX1278_SPI);
GpioPin cs = cs::getPin();
SPISlave spi(bus, cs, spi_config);
#ifdef SX1278_IS_LORA
// Run default configuration
SX1278Lora::Config config;
SX1278Lora::Error err;
sx1278 = new SX1278(bus, cs);
#ifdef SX1278_IS_EBYTE
sx1278 = new EbyteLora(spi, txen::getPin(), rxen::getPin());
#else
sx1278 = new SX1278Lora(spi);
#endif
printf("\n[sx1278] Configuring sx1278...\n");
printConfig(config);
if ((err = sx1278->init(config)) != SX1278::Error::NONE)
if ((err = sx1278->init(config)) != SX1278Lora::Error::NONE)
{
printf("[sx1278] sx1278->init error: %s\n", stringFromErr(err));
printf("[sx1278] sx1278->init error\n");
return -1;
}
printConfig(config);
printf("\n[sx1278] Initialization complete!\n");
#else
// Run default configuration
SX1278Fsk::Config config;
SX1278Fsk::Error err;
std::thread recv([]() { recvLoop(); });
std::thread send([]() { sendLoop(); });
#ifdef SX1278_IS_EBYTE
sx1278 = new EbyteFsk(spi, txen::getPin(), rxen::getPin());
#else
sx1278 = new SX1278Fsk(spi);
#endif
for (;;)
printf("\n[sx1278] Configuring sx1278...\n");
if ((err = sx1278->init(config)) != SX1278Fsk::Error::NONE)
{
miosix::Thread::sleep(100);
// FIXME: Why does clang-format put this line up here?
printf("[sx1278] sx1278->init error\n");
return -1;
}
// God please forgive me
// FIXME(davide.mor): ABSOLUTELY fix this
// miosix::Thread::sleep(20000);
// miosix::reboot();
printf("\n[sx1278] Initialization complete!\n");
#endif
// Actually spawn threads
std::thread send([]() { sendLoop(); });
recvLoop();
return 0;
}
......@@ -25,6 +25,8 @@
#include <diagnostic/SkywardStack.h>
#include <miosix.h>
#include <atomic>
namespace Boardcore
{
......@@ -51,6 +53,8 @@ public:
/**
* @brief Start the thread associated with this active object.
*
* @warning The method is not thread safe.
*
* Call stop() to terminate execution of the thread.
* @return true if the thread has been started.
*/
......@@ -88,8 +92,8 @@ protected:
miosix::Thread* thread = nullptr; ///< Gives access to the thread object
bool stopFlag = false;
bool running = false;
std::atomic<bool> stopFlag{false};
std::atomic<bool> running{false};
private:
/**
......@@ -114,15 +118,18 @@ inline bool ActiveObject::start()
if (!running)
{
stopFlag = false;
running = true;
thread = miosix::Thread::create(threadLauncher, stackSize, priority,
reinterpret_cast<void*>(this),
miosix::Thread::JOINABLE);
if (thread != nullptr)
if (thread == nullptr)
{
running = true;
return true;
running = false;
}
return running;
}
return false;
......
......@@ -103,9 +103,9 @@ float Servo::getPosition()
float Servo::getPosition90Deg() { return getPosition() * 90; }
float Servo::getPosition180Deg() { return getPosition() * 1800; }
float Servo::getPosition180Deg() { return getPosition() * 180; }
float Servo::getPosition360Deg() { return getPosition() * 3600; }
float Servo::getPosition360Deg() { return getPosition() * 360; }
ServoData Servo::getState()
{
......
......@@ -53,7 +53,7 @@ namespace Boardcore
* Note that the peripheral clock of the undelying timer used to generate the
* PWM signal, is enabled when the object is created and disabled when
* destructed. When using the same timer for two or more sensors keep in mind
* that you could encouter issues.
* that you could encounter issues.
*/
class Servo
{
......
......@@ -21,6 +21,7 @@
*/
#pragma once
#include <atomic>
namespace Boardcore
{
......@@ -53,8 +54,10 @@ public:
void update()
{
if (running)
{
step();
}
}
bool isRunning() { return running; }
......@@ -64,7 +67,7 @@ protected:
*/
virtual void step() = 0;
bool running = false;
std::atomic<bool> running{false};
};
} // namespace Boardcore
......@@ -118,7 +118,12 @@ CanbusDriver::BitTiming CanbusDriver::calcBitTiming(AutoBitTiming autoBt)
BitTiming cfgIter;
cfgIter.SJW = 0;
uint32_t apbclk = ClockUtils::getAPBFrequency(ClockUtils::APB::APB1);
/*
* TODO: This is modified only for compatibility with the past, MUST check
* the clock settings in order to use the right method
* 'getAPBPeripheralsClock()'
*/
uint32_t apbclk = ClockUtils::getAPBTimersClock(ClockUtils::APB::APB1);
// Iterate over the possible number of quanta in a bit to find the best
// settings
......
/* Copyright (c) 2022 Skyward Experimental Rocketry
* Author: Emilio Corigliano
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "I2C.h"
namespace Boardcore
{
I2C::I2C(I2C_TypeDef *i2c, miosix::GpioPin scl, miosix::GpioPin sda)
: i2c(i2c, scl, sda)
{
}
bool I2C::read(const I2CDriver::I2CSlaveConfig &slaveConfig, void *buffer,
size_t nBytes)
{
i2c.flushBus();
return i2c.read(slaveConfig, buffer, nBytes);
}
bool I2C::write(const I2CDriver::I2CSlaveConfig &slaveConfig,
const void *buffer, size_t nBytes)
{
i2c.flushBus();
return i2c.write(slaveConfig, buffer, nBytes);
}
bool I2C::readRegister(const I2CDriver::I2CSlaveConfig &slaveConfig,
const uint8_t registerAddress, uint8_t &registerContent)
{
i2c.flushBus();
return i2c.write(slaveConfig, &registerAddress, 1, false) &&
i2c.read(slaveConfig, &registerContent, 1);
}
bool I2C::probe(const I2CDriver::I2CSlaveConfig &slaveConfig)
{
i2c.flushBus();
return i2c.write(slaveConfig, nullptr, 0);
}
uint16_t I2C::getLastError() { return i2c.getLastError(); }
SyncedI2C::SyncedI2C(I2C_TypeDef *i2c, miosix::GpioPin scl, miosix::GpioPin sda)
: I2C(i2c, scl, sda)
{
}
bool SyncedI2C::read(const I2CDriver::I2CSlaveConfig &slaveConfig, void *buffer,
size_t nBytes)
{
miosix::Lock<miosix::FastMutex> lock(mutex);
return I2C::read(slaveConfig, buffer, nBytes);
}
bool SyncedI2C::write(const I2CDriver::I2CSlaveConfig &slaveConfig,
const void *buffer, size_t nBytes)
{
miosix::Lock<miosix::FastMutex> lock(mutex);
return I2C::write(slaveConfig, buffer, nBytes);
}
bool SyncedI2C::readRegister(const I2CDriver::I2CSlaveConfig &slaveConfig,
const uint8_t registerAddress,
uint8_t registerContent)
{
miosix::Lock<miosix::FastMutex> lock(mutex);
return I2C::readRegister(slaveConfig, registerAddress, registerContent);
}
bool SyncedI2C::probe(const I2CDriver::I2CSlaveConfig &slaveConfig)
{
miosix::Lock<miosix::FastMutex> lock(mutex);
return I2C::probe(slaveConfig);
}
uint16_t SyncedI2C::getLastError()
{
miosix::Lock<miosix::FastMutex> lock(mutex);
return i2c.getLastError();
}
} // namespace Boardcore
\ No newline at end of file