Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Refactor IWDG driver and add initialize function for prescaler with downcounter#1127

Merged

Conversation

salkinium
Copy link
Member

@salkiniumsalkinium commentedFeb 3, 2024
edited
Loading

Re-opening this since I prematurely merged the previous PR#1122 due to pushing the wrong branch (PEBCAK). Addresses the last review. Original description:

Ok, this escalated a little. I was just looking through the code and saw that the Iwdg class was not inlined, so I quickly refactored it and then noticed that the prescaler was manually computed and then I had to program a constexpr algorithm for it.

  • Inline IWDG functions
  • Move intomodm::platform namespace.
  • Add prescaler + downcounter algorithm.
  • Add unittest for prescaler + downcounter algorithm.
  • AddRcc::Lsi andRcc::Hsi clock.
  • Addmodm.digsep filter for nicely formatting long integers.
  • AddSystemClock::Iwdg to every board.
  • Add a genericassertBaudrateInTolerance implementation.
  • Add documentation for prescaler calculators.
  • Simplify tolerance assertion functions.
  • Addedseconds_t,milliseconds_t,microseconds_t for template parameters.
  • percent_t can be float since C++20.
  • Fix minimum prescaler value for STM32 UART (8 or 16).
  • Renamefrom_range tofrom_linear.
  • Renamefrom_iterator tofrom_range and implement it to be compatible withstd::ranges::forward_range.

@salkiniumsalkinium added this to the2024q1 milestoneFeb 3, 2024
@salkiniumsalkiniumforce-pushed thefeature/init_iwdg_by_time branch from8abf5f9 to5a4a9bbCompareFebruary 3, 2024 19:36
@salkiniumsalkinium added the ci:halTriggers the exhaustive HAL compile CI jobs labelFeb 4, 2024
Copy link
Member

@chris-durandchris-durand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks!

out_index = idx;
}
};
for (uint32_t idx{0}; const auto prescaler : prescalers)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Maybe

Suggested change
for (uint32_t idx{0};constauto prescaler : prescalers)
for (constauto[idx,prescaler] :enumerate(prescalers))

?

Copy link
MemberAuthor

@salkiniumsalkiniumFeb 5, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

oh,std::ranges::enumerate_view exists, so we can alias this tomodm::enumerate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

👍, but that requires gcc 13. Mac OS hosted and AVR currently have 12. Let's upgrade the compilers for the next release and do it afterwards.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We need to find a workaround for the Protothread macro issue to upgrade to GCC13…

chris-durand reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't think this is fixable. The whole construct relies on jumping into a statement expression with a case label. According to the gcc documentation this was never valid but is now properly diagnosed since gcc 13. It just happened to work often enough ...

The only acceptable solution I see is abandoning resumable functions.

salkinium reacted with thumbs up emoji
Copy link
MemberAuthor

@salkiniumsalkiniumFeb 5, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This doesn't seem to work due to an (for me) incomprehensible compiler error aboutunsigned int& lvalue vsunsigned int rvalue… help (see CI for issue)

chris-durand reacted with eyes emoji
Copy link
Member

@chris-durandchris-durandFeb 6, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's a limitation inmodm::enumerate. The iterator types you have defined (linear_range, etc.) return r-values, here plain integers, not l-value references when you dereference them and the implementation can't deal with that. I'll push a fix tonight.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's fixed now. I've also pushed a fixup for a typo in the Nucleo G070module.lb file.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you!

@salkiniumsalkiniumforce-pushed thefeature/init_iwdg_by_time branch 3 times, most recently from3ec43f7 to893a7f3CompareFebruary 6, 2024 20:56
@salkiniumsalkiniumforce-pushed thefeature/init_iwdg_by_time branch from893a7f3 to23036e3CompareFebruary 6, 2024 20:57
@salkiniumsalkinium merged commit23036e3 intomodm-io:developFeb 6, 2024
@salkiniumsalkinium deleted the feature/init_iwdg_by_time branchFebruary 6, 2024 22:58
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@chris-durandchris-durandchris-durand approved these changes

Assignees
No one assigned
Labels
advanced 🤯ci:halTriggers the exhaustive HAL compile CI jobsenhancement 🌈feature 🚧testing 🧪
Milestone
2024q1
Development

Successfully merging this pull request may close these issues.

2 participants
@salkinium@chris-durand

[8]ページ先頭

©2009-2025 Movatter.jp