Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Scd40 driver libhal 2.0 #108
Scd40 driver libhal 2.0 #108
Changes from 40 commits
9bdda38
563d818
84381b4
3abde90
f826011
a54c388
7dd31ab
6b795ce
0506bc2
031a924
a2c75f7
75b7bd0
3da5489
7f820a7
72fe910
fde9a57
09f67c9
9bc5c49
76bfda0
260d290
2f10cd0
102f8d4
cc42592
775a6c2
4107ad0
b7bf426
7d32f70
3c06eea
9dba9f6
737eef4
ffa698e
68e8bbb
32ef530
312d262
ff6590d
8f55fe7
f36f904
30eddd2
7494a44
846f0e7
d9f7fa4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give these magic numbers names. 175 isn't some power of two so it must mean something. Fine the term in the datasheet and make a constexpr variables for it. Something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work using an enum for all of the addresses. Makes it easier to understand whats what. But its favorable to use an
enum class
as they get promoted to a type. You canstatic_cast<>
them back to whatever integral repersation you need provided that representation does not truncate the enum value. You can also usehal::value()
in<libhal-util/enum.hpp>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I talked to Corey and Gene to understand what you were saying. While on the topic they recommended using constants (likely in a separate file) for this use case. What are your thoughts on switching the values in the enum to static constants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static constants are great! Sometimes the constructs of an enum work fine too just depends on what you are doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do these magic numbers mean? Maybe make some constants or add some comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These APIs should be documented in order to understand how they should be used.