File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ #menu "Driver configurations"
2+
3+ menu "ADC configuration"
4+
5+ config ADC_FORCE_XPD_FSM
6+ bool "Use the FSM to control ADC power"
7+ default n
8+ help
9+ ADC power can be controlled by the FSM instead of software. This allows the ADC to
10+ be shut off when it is not working leading to lower power consumption. However
11+ using the FSM control ADC power will increase the noise of ADC.
12+
13+ endmenu # ADC Configuration
14+
15+ #endmenu # Driver configurations
16+
Original file line number Diff line number Diff line change @@ -1046,11 +1046,18 @@ void adc_power_always_on()
10461046void adc_power_on ()
10471047{
10481048 portENTER_CRITICAL (& rtc_spinlock );
1049+ //The power FSM controlled mode saves more power, while the ADC noise may get increased.
1050+ #ifndef CONFIG_ADC_FORCE_XPD_FSM
1051+ //Set the power always on to increase precision.
1052+ SENS .sar_meas_wait2 .force_xpd_sar = SENS_FORCE_XPD_SAR_PU ;
1053+ #else
1054+ //Use the FSM to turn off the power while not used to save power.
10491055 if (SENS .sar_meas_wait2 .force_xpd_sar & SENS_FORCE_XPD_SAR_SW_M ) {
10501056 SENS .sar_meas_wait2 .force_xpd_sar = SENS_FORCE_XPD_SAR_PU ;
10511057 } else {
10521058 SENS .sar_meas_wait2 .force_xpd_sar = SENS_FORCE_XPD_SAR_FSM ;
10531059 }
1060+ #endif
10541061 portEXIT_CRITICAL (& rtc_spinlock );
10551062}
10561063
@@ -1466,6 +1473,8 @@ static inline void adc2_config_width(adc_bits_width_t width_bit)
14661473 portENTER_CRITICAL (& rtc_spinlock );
14671474 //sar_start_force shared with ADC1
14681475 SENS .sar_start_force .sar2_bit_width = width_bit ;
1476+ //cct set to the same value with PHY
1477+ SENS .sar_start_force .sar2_pwdet_cct = 4 ;
14691478 portEXIT_CRITICAL (& rtc_spinlock );
14701479
14711480 //Invert the adc value,the Output value is invert
You can’t perform that action at this time.
0 commit comments