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

nrfx: hal: nrf_comp: patch main_mode and speed_mode set #203

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bjarki-andreasen
Copy link
Contributor

The functions for setting the main and speed modes don't clear their fields before setting the desired value. This results in not being able to set the main mode to single-ended (0) after having set the mode to differential (1), similarly, the speed mode can not be set to low (0) after being set to medium (1) or high (2), and it can be set to the reserved value 3.

@@ -481,12 +481,14 @@ NRF_STATIC_INLINE void nrf_comp_th_set(NRF_COMP_Type * p_reg, nrf_comp_th_t thre
NRF_STATIC_INLINE void nrf_comp_main_mode_set(NRF_COMP_Type * p_reg,
nrf_comp_main_mode_t main_mode)
{
p_reg->MODE &= ~(COMP_MODE_MAIN_Msk);
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend to make it similar to for example spim:
https://github.com/zephyrproject-rtos/hal_nordic/blob/master/nrfx/hal/nrf_spim.h#L1524
or
https://github.com/zephyrproject-rtos/hal_nordic/blob/master/nrfx/hal/nrf_glitchdet.h#L103
p_reg->MODE = (p_reg->MODE & ~(COMP_MODE_MAIN_Msk)) | (main_mode << COMP_MODE_MAIN_Pos);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done :)

The functions for setting the main and speed modes don't clear their
fields before setting the desired value. This results in not being
able to set the main mode to single-ended (0) after having set the
mode to differential (1), similarly, the speed mode can not be set
to low (0) after being set to medium (1) or high (2), and it can be
set to the reserved value 3.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
@bjarki-andreasen
Copy link
Contributor Author

ping @kl-cruz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants