Skip to content

Commit

Permalink
nrfx: hal: nrf_comp: patch main_mode and speed_mode set
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bjarki-andreasen committed Aug 19, 2024
1 parent 0b6040d commit 8c43440
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nrfx/hal/nrf_comp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
p_reg->MODE |= (main_mode << COMP_MODE_MAIN_Pos);
}

NRF_STATIC_INLINE void nrf_comp_speed_mode_set(NRF_COMP_Type * p_reg,
nrf_comp_sp_mode_t speed_mode)
{
p_reg->MODE &= ~(COMP_MODE_SP_Msk);
p_reg->MODE |= (speed_mode << COMP_MODE_SP_Pos);
}

Expand Down

0 comments on commit 8c43440

Please sign in to comment.