From e622f95a4d1c34b03f202b5dc25d3128f1e0e535 Mon Sep 17 00:00:00 2001 From: Khalil Estell Date: Mon, 13 May 2024 11:44:42 -0700 Subject: [PATCH] :bug: Fix div_t vs ldiv_t in can.hpp --- .github/workflows/5.0.1.yml | 11 +++++++++++ README.md | 6 ------ include/libhal-util/can.hpp | 5 ++++- 3 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/5.0.1.yml diff --git a/.github/workflows/5.0.1.yml b/.github/workflows/5.0.1.yml new file mode 100644 index 0000000..77eb237 --- /dev/null +++ b/.github/workflows/5.0.1.yml @@ -0,0 +1,11 @@ +name: 🚀 5.0.1 + +on: + workflow_dispatch: + +jobs: + deploy: + uses: libhal/ci/.github/workflows/deploy_all.yml@5.x.y + with: + version: 5.0.1 + secrets: inherit diff --git a/README.md b/README.md index 19549bf..cadbc82 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,3 @@ See [`CONTRIBUTING.md`](CONTRIBUTING.md) for details. ## License Apache 2.0; see [`LICENSE`](LICENSE) for details. - -## Disclaimer - -This project is not an official Google project. It is not supported by -Google and Google specifically disclaims all warranties as to its quality, -merchantability, or fitness for a particular purpose. diff --git a/include/libhal-util/can.hpp b/include/libhal-util/can.hpp index 71a865e..30968f6 100644 --- a/include/libhal-util/can.hpp +++ b/include/libhal-util/can.hpp @@ -179,10 +179,13 @@ struct can_bus_divider_t std::int32_t operating_frequency = p_operating_frequency; std::int32_t desired_baud_rate = p_target_baud_rate; - std::div_t division{}; + using inner_div_t = + decltype(std::div(operating_frequency, desired_baud_rate)); + inner_div_t division{}; for (std::uint32_t total_tq = 25; total_tq >= 8; total_tq--) { division = std::div(operating_frequency, (desired_baud_rate * total_tq)); + if (division.rem == 0) { timing.total_tq = total_tq; break;