diff --git a/components/hal/esp32/include/hal/dac_ll.h b/components/hal/esp32/include/hal/dac_ll.h index 010e754b59..3bf220c8e2 100644 --- a/components/hal/esp32/include/hal/dac_ll.h +++ b/components/hal/esp32/include/hal/dac_ll.h @@ -166,12 +166,12 @@ static inline void dac_ll_cw_set_dc_offset(dac_channel_t channel, int8_t offset) if (SENS.sar_dac_ctrl2.dac_inv1 == DAC_CW_PHASE_180) { offset = 0 - offset; } - HAL_FORCE_MODIFY_U32_REG_FIELD(SENS.sar_dac_ctrl2, dac_dc1, -128 - offset); + HAL_FORCE_MODIFY_U32_REG_FIELD(SENS.sar_dac_ctrl2, dac_dc1, offset); } else if (channel == DAC_CHANNEL_2) { if (SENS.sar_dac_ctrl2.dac_inv2 == DAC_CW_PHASE_180) { offset = 0 - offset; } - HAL_FORCE_MODIFY_U32_REG_FIELD(SENS.sar_dac_ctrl2, dac_dc2, -128 - offset); + HAL_FORCE_MODIFY_U32_REG_FIELD(SENS.sar_dac_ctrl2, dac_dc2, offset); } }