stm32l4: enable comparator support #662
Open
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.
The bits for
COMP1
exactly match those in the existing definition ofcomp_v3
.COMP2
has an extra bitWINMODE
, used to connect the positive inputs of both comparators. This is not described at the moment. I was not sure how this should be described, and don't need it at the moment.The used register definition is lacking the description for the
INxSEL
andINMESEL
registers. These also have variations between the different comparator units, as they select the GPIO pins used. There also appears to be an error in the reference manual (RM0394 on page 538), as forCOMP1
the description ofINMSEL
states that0b110
usesINMESEL
for selection, whereas the description in theINMESEL
register states that0b111
should be used. The later would be in line withCOMP2
. I currently don't have an easy way to check which one is correct. It also doesn't affect this change, as the enums are not described.EDIT: The later also matches the values in the tables on page 527, so
0b111
is the correct setting to use theINMESEL
register