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

Rework communication, flash and FRAM code #236

Merged
merged 21 commits into from
Dec 24, 2023
Merged

Rework communication, flash and FRAM code #236

merged 21 commits into from
Dec 24, 2023

Conversation

PatrickKa
Copy link
Contributor

@PatrickKa PatrickKa commented Dec 22, 2023

Description

This is a complete rework of the low-level communication functions for UART and SPI. Following that, the flash and FRAM code are updated, reworked and refactored as well. Of course, all effected tests are updated too. I guess the biggest changes are:

  • Use std::span in all interfaces
  • Add Span() to easily convert everything to std::span
  • Split Communication.hpp/.ipp/.cpp into separate files for UART and SPI
  • Add UART functions with timeouts which suspend the thread while writing or reading

Fixes #38
Fixes #196
Fixes #238

@PatrickKa PatrickKa marked this pull request as draft December 22, 2023 15:34
@codecov-commenter
Copy link

codecov-commenter commented Dec 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a1a764f) 86.73% compared to head (e4ef2c7) 87.35%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #236      +/-   ##
==========================================
+ Coverage   86.73%   87.35%   +0.61%     
==========================================
  Files          17       18       +1     
  Lines         490      514      +24     
==========================================
+ Hits          425      449      +24     
  Misses         65       65              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

The new interface is like the one in Communication.hpp and intended to
be used with Span().
@PatrickKa PatrickKa changed the title Rework low-level code for serial interfaces Rework communication, flash and FRAM code Dec 22, 2023
Also, split the communication functions for UART and SPI into separate
files.
I tried to test the non-blocking functions with the UCI UART but that
did not work. We have to use the EDU UART. I guess that has to do with
PRINTF().
The SPI interface only allowed to read byte spans while the UART one
allowd spans of all types. I decided to go for the more generic one in
both cases because it is more convenient.
This hopefully reduce binary sizes.
This reverts commit bfe7c24.

By adding the UART functions without "extent" the size of CobcSw.bin
built in release mode actually increased by 16 bytes instead of
decreasing. Therefore, I reverted the commit.
@PatrickKa PatrickKa marked this pull request as ready for review December 24, 2023 15:28
@PatrickKa PatrickKa merged commit d8c2773 into master Dec 24, 2023
6 checks passed
@PatrickKa PatrickKa deleted the span branch December 24, 2023 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants