drivers: adc: Add support for gain 2/7 in nRF devices
Extend current adc gains with new entry 2/7. Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
This commit is contained in:
parent
d503f60c70
commit
057de458e2
4 changed files with 9 additions and 0 deletions
|
@ -17,6 +17,7 @@ int adc_gain_invert(enum adc_gain gain,
|
|||
[ADC_GAIN_1_6] = {.mul = 6, .div = 1},
|
||||
[ADC_GAIN_1_5] = {.mul = 5, .div = 1},
|
||||
[ADC_GAIN_1_4] = {.mul = 4, .div = 1},
|
||||
[ADC_GAIN_2_7] = {.mul = 7, .div = 2},
|
||||
[ADC_GAIN_1_3] = {.mul = 3, .div = 1},
|
||||
[ADC_GAIN_2_5] = {.mul = 5, .div = 2},
|
||||
[ADC_GAIN_1_2] = {.mul = 2, .div = 1},
|
||||
|
|
|
@ -202,6 +202,11 @@ static int adc_nrfx_channel_setup(const struct device *dev,
|
|||
config.gain = NRF_SAADC_GAIN1_4;
|
||||
break;
|
||||
#endif
|
||||
#if defined(SAADC_CH_CONFIG_GAIN_Gain2_7)
|
||||
case ADC_GAIN_2_7:
|
||||
config.gain = NRF_SAADC_GAIN2_7;
|
||||
break;
|
||||
#endif
|
||||
#if defined(SAADC_CH_CONFIG_GAIN_Gain1_3) || defined(SAADC_CH_CONFIG_GAIN_Gain2_6)
|
||||
case ADC_GAIN_1_3:
|
||||
config.gain = NRF_SAADC_GAIN1_3;
|
||||
|
|
|
@ -41,6 +41,7 @@ child-binding:
|
|||
- ADC_GAIN_1_6: x 1/6
|
||||
- ADC_GAIN_1_5: x 1/5
|
||||
- ADC_GAIN_1_4: x 1/4
|
||||
- ADC_GAIN_2_7: x 2/7
|
||||
- ADC_GAIN_1_3: x 1/3
|
||||
- ADC_GAIN_2_5: x 2/5
|
||||
- ADC_GAIN_1_2: x 1/2
|
||||
|
@ -62,6 +63,7 @@ child-binding:
|
|||
- "ADC_GAIN_1_6"
|
||||
- "ADC_GAIN_1_5"
|
||||
- "ADC_GAIN_1_4"
|
||||
- "ADC_GAIN_2_7"
|
||||
- "ADC_GAIN_1_3"
|
||||
- "ADC_GAIN_2_5"
|
||||
- "ADC_GAIN_1_2"
|
||||
|
|
|
@ -35,6 +35,7 @@ enum adc_gain {
|
|||
ADC_GAIN_1_6, /**< x 1/6. */
|
||||
ADC_GAIN_1_5, /**< x 1/5. */
|
||||
ADC_GAIN_1_4, /**< x 1/4. */
|
||||
ADC_GAIN_2_7, /**< x 2/7. */
|
||||
ADC_GAIN_1_3, /**< x 1/3. */
|
||||
ADC_GAIN_2_5, /**< x 2/5. */
|
||||
ADC_GAIN_1_2, /**< x 1/2. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue