Functions
Basic Configuration
Peripheral Driver » LL Driver » ADC » Functions

## Functions
__STATIC_INLINE void | ll_adc_enable (void)
| Enable ADC module. More...
__STATIC_INLINE void | ll_adc_disable (void)
| Disable ADC module. More...
__STATIC_INLINE uint32_t | ll_adc_is_enabled (void)
| Check if ADC module is enabled. More...
__STATIC_INLINE void | ll_adc_enable_clock (void)
| Enable ADC clock. More...
__STATIC_INLINE void | ll_adc_disable_clock (void)
| Disable ADC clock. More...
__STATIC_INLINE uint32_t | ll_adc_is_enabled_clock (void)
| Check if ADC clock is enabled. More...
__STATIC_INLINE void | ll_adc_set_clock (uint32_t clk)
| Set ADC clock source. More...
__STATIC_INLINE uint32_t | ll_adc_get_clock (void)
| Return source for ADC clock. More...
__STATIC_INLINE void | ll_adc_set_ref_value (uint32_t value)
| Set ADC bias reference. More...
__STATIC_INLINE uint32_t | ll_adc_get_ref_value (void)
| Return ADC bias reference. More...
__STATIC_INLINE void | ll_adc_enable_temp (void)
| Enable temperature sensor. More...
__STATIC_INLINE void | ll_adc_disable_temp (void)
| Disable temperature sensor. More...
__STATIC_INLINE uint32_t | ll_adc_is_enabled_temp (void)
| Check if temperature sensor is enabled. More...
__STATIC_INLINE void | ll_adc_enable_vbat (void)
| Enable Vbattery sensor. More...
__STATIC_INLINE void | ll_adc_disable_vbat (void)
| Disable Vbattery sensor. More...
__STATIC_INLINE uint32_t | ll_adc_is_enabled_vbat (void)
| Check if Vbattery sensor is enabled. More...
__STATIC_INLINE void | ll_adc_set_input_mode (uint32_t mode)
| Set ADC input mode. More...
__STATIC_INLINE uint32_t | ll_adc_get_input_mode (void)
| Return ADC input mode. More...
__STATIC_INLINE void | ll_adc_enable_ofs_cal (void)
| Enable offset calibration. More...
__STATIC_INLINE void | ll_adc_disable_ofs_cal (void)
| Disable offset calibration. More...
__STATIC_INLINE uint32_t | ll_adc_is_enabled_ofs_cal (void)
| Check if offset calibration is enabled. More...
__STATIC_INLINE void | ll_adc_set_dynamic_rang (uint32_t rang)
| Set dynamic rang of ADC. More...
__STATIC_INLINE uint32_t | ll_adc_get_dynamic_rang (void)
| Return ADC dynamic rang. More...
__STATIC_INLINE void | ll_adc_set_channelp (uint32_t source)
| Set source of ADC input channelP. More...
__STATIC_INLINE uint32_t | ll_adc_get_channelp (void)
| Return source of ADC input channelP. More...
__STATIC_INLINE void | ll_adc_set_channeln (uint32_t source)
| Set source of ADC input channelN. More...
__STATIC_INLINE uint32_t | ll_adc_get_channeln (void)
| Return source of ADC input channelN. More...
__STATIC_INLINE void | ll_adc_enable_mas_rst (void)
| Enable ADC MAS_RST. More...
__STATIC_INLINE void | ll_adc_disable_mas_rst (void)
| Disable ADC MAS_RST. More...
__STATIC_INLINE uint32_t | ll_adc_is_enabled_mas_rst (void)
| Check if ADC MAS_RST is enabled. More...
__STATIC_INLINE void | ll_adc_set_ref (uint32_t source)
| Set source of ADC reference. More...
__STATIC_INLINE uint32_t | ll_adc_get_ref (void)
| Return source of ADC reference. More...
__STATIC_INLINE void | ll_adc_set_ref_current (uint32_t source)
| Set current of ADC reference circuit. More...
__STATIC_INLINE uint32_t | ll_adc_get_ref_current (void)
| Return current of ADC reference circuit. More...

## Detailed Description

## Function Documentation

## ◆ ll_adc_disable()

__STATIC_INLINE void ll_adc_disable | ( | void |  | ) |

Disable ADC module.

Register | BitsName
--- | ---
SNSADC_CFG | REG4

Return values

  None |

## ◆ ll_adc_disable_clock()

__STATIC_INLINE void ll_adc_disable_clock | ( | void |  | ) |

Disable ADC clock.

Register | BitsName
--- | ---
MSIO_PAD_CFG_1 | ADC_CLK_EN

Return values

  None |

## ◆ ll_adc_disable_mas_rst()

__STATIC_INLINE void ll_adc_disable_mas_rst | ( | void |  | ) |

Disable ADC MAS_RST.

Register | BitsName
--- | ---
SNSADC_CFG | REG4

Return values

  None |

## ◆ ll_adc_disable_ofs_cal()

__STATIC_INLINE void ll_adc_disable_ofs_cal | ( | void |  | ) |

Disable offset calibration.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Return values

  None |

## ◆ ll_adc_disable_temp()

__STATIC_INLINE void ll_adc_disable_temp | ( | void |  | ) |

Disable temperature sensor.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Return values

  None |

## ◆ ll_adc_disable_vbat()

__STATIC_INLINE void ll_adc_disable_vbat | ( | void |  | ) |

Disable Vbattery sensor.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Return values

  None |

## ◆ ll_adc_enable()

__STATIC_INLINE void ll_adc_enable | ( | void |  | ) |

Enable ADC module.

Register | BitsName
--- | ---
SNSADC_CFG | REG4

Return values

  None |

## ◆ ll_adc_enable_clock()

__STATIC_INLINE void ll_adc_enable_clock | ( | void |  | ) |

Enable ADC clock.

Register | BitsName
--- | ---
MSIO_PAD_CFG_1 | ADC_CLK_EN

Return values

  None |

## ◆ ll_adc_enable_mas_rst()

__STATIC_INLINE void ll_adc_enable_mas_rst | ( | void |  | ) |

Enable ADC MAS_RST.

Register | BitsName
--- | ---
SNSADC_CFG | REG4

Return values

  None |

## ◆ ll_adc_enable_ofs_cal()

__STATIC_INLINE void ll_adc_enable_ofs_cal | ( | void |  | ) |

Enable offset calibration.

Note
  Enable offset calibration, used to swap inputs of comparator for offset calibration.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Return values

  None |

## ◆ ll_adc_enable_temp()

__STATIC_INLINE void ll_adc_enable_temp | ( | void |  | ) |

Enable temperature sensor.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Return values

  None |

## ◆ ll_adc_enable_vbat()

__STATIC_INLINE void ll_adc_enable_vbat | ( | void |  | ) |

Enable Vbattery sensor.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Return values

  None |

## ◆ ll_adc_get_channeln()

__STATIC_INLINE uint32_t ll_adc_get_channeln | ( | void |  | ) |

Return source of ADC input channelN.

Register | BitsName
--- | ---
SNSADC_CFG | REG3

Return values

  Returned | value can be one of the following values: LL_ADC_INPUT_SRC_IO0 LL_ADC_INPUT_SRC_IO1 LL_ADC_INPUT_SRC_IO2 LL_ADC_INPUT_SRC_IO3 LL_ADC_INPUT_SRC_IO4 LL_ADC_INPUT_SRC_TMP LL_ADC_INPUT_SRC_BAT

## ◆ ll_adc_get_channelp()

__STATIC_INLINE uint32_t ll_adc_get_channelp | ( | void |  | ) |

Return source of ADC input channelP.

Register | BitsName
--- | ---
SNSADC_CFG | REG3

Return values

  Returned | value can be one of the following values: LL_ADC_INPUT_SRC_IO0 LL_ADC_INPUT_SRC_IO1 LL_ADC_INPUT_SRC_IO2 LL_ADC_INPUT_SRC_IO3 LL_ADC_INPUT_SRC_IO4 LL_ADC_INPUT_SRC_TMP LL_ADC_INPUT_SRC_BAT

## ◆ ll_adc_get_clock()

__STATIC_INLINE uint32_t ll_adc_get_clock | ( | void |  | ) |

Return source for ADC clock.

Register | BitsName
--- | ---
MSIO_PAD_CFG_1 | ADC_CLK_SEL

Return values

  Returned | value can be one of the following values: LL_ADC_CLK_16 LL_ADC_CLK_8 LL_ADC_CLK_4 LL_ADC_CLK_2 LL_ADC_CLK_1P6 LL_ADC_CLK_1

## ◆ ll_adc_get_dynamic_rang()

__STATIC_INLINE uint32_t ll_adc_get_dynamic_rang | ( | void |  | ) |

Return ADC dynamic rang.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Return values

  Returned | value can be a value between: 1 ~ 7

## ◆ ll_adc_get_input_mode()

__STATIC_INLINE uint32_t ll_adc_get_input_mode | ( | void |  | ) |

Return ADC input mode.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Return values

  Returned | value can be one of the following values: LL_ADC_INPUT_SINGLE LL_ADC_INPUT_DIFFERENTIAL

## ◆ ll_adc_get_ref()

__STATIC_INLINE uint32_t ll_adc_get_ref | ( | void |  | ) |

Return source of ADC reference.

Register | BitsName
--- | ---
SNSADC_CFG | REG4

Return values

  Returned | value can be one of the following values: LL_ADC_REF_SRC_BUF_INT LL_ADC_REF_SRC_IO0 LL_ADC_REF_SRC_IO1 LL_ADC_REF_SRC_IO2 LL_ADC_REF_SRC_IO3

## ◆ ll_adc_get_ref_current()

__STATIC_INLINE uint32_t ll_adc_get_ref_current | ( | void |  | ) |

Return current of ADC reference circuit.

Register | BitsName
--- | ---
SNSADC_CFG | REG4

Return values

  Returned | value can be a value between: 0 ~ 7

## ◆ ll_adc_get_ref_value()

__STATIC_INLINE uint32_t ll_adc_get_ref_value | ( | void |  | ) |

Return ADC bias reference.

Register | BitsName
--- | ---
SNSADC_CFG | REG1

Return values

  Returned | value can be one of the following values: LL_ADC_REF_VALUE_0P8 LL_ADC_REF_VALUE_1P2 LL_ADC_REF_VALUE_1P6

## ◆ ll_adc_is_enabled()

__STATIC_INLINE uint32_t ll_adc_is_enabled | ( | void |  | ) |

Check if ADC module is enabled.

Register | BitsName
--- | ---
SNSADC_CFG | REG4

Return values

  State | of bit (1 or 0).

## ◆ ll_adc_is_enabled_clock()

__STATIC_INLINE uint32_t ll_adc_is_enabled_clock | ( | void |  | ) |

Check if ADC clock is enabled.

Register | BitsName
--- | ---
MSIO_PAD_CFG_1 | ADC_CLK_EN

Return values

  State | of bit (1 or 0).

## ◆ ll_adc_is_enabled_mas_rst()

__STATIC_INLINE uint32_t ll_adc_is_enabled_mas_rst | ( | void |  | ) |

Check if ADC MAS_RST is enabled.

Register | BitsName
--- | ---
SNSADC_CFG | REG4

Return values

  State | of bit (1 or 0).

## ◆ ll_adc_is_enabled_ofs_cal()

__STATIC_INLINE uint32_t ll_adc_is_enabled_ofs_cal | ( | void |  | ) |

Check if offset calibration is enabled.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Return values

  State | of bit (1 or 0).

## ◆ ll_adc_is_enabled_temp()

__STATIC_INLINE uint32_t ll_adc_is_enabled_temp | ( | void |  | ) |

Check if temperature sensor is enabled.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Return values

  State | of bit (1 or 0).

## ◆ ll_adc_is_enabled_vbat()

__STATIC_INLINE uint32_t ll_adc_is_enabled_vbat | ( | void |  | ) |

Check if Vbattery sensor is enabled.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Return values

  State | of bit (1 or 0).

## ◆ ll_adc_set_channeln()

__STATIC_INLINE void ll_adc_set_channeln | ( | uint32_t | source | ) |

Set source of ADC input channelN.

Register | BitsName
--- | ---
SNSADC_CFG | REG3

Parameters

  source | This parameter can be one of the following values: LL_ADC_INPUT_SRC_IO0 LL_ADC_INPUT_SRC_IO1 LL_ADC_INPUT_SRC_IO2 LL_ADC_INPUT_SRC_IO3 LL_ADC_INPUT_SRC_IO4 LL_ADC_INPUT_SRC_TMP LL_ADC_INPUT_SRC_BAT

Return values

  None |

## ◆ ll_adc_set_channelp()

__STATIC_INLINE void ll_adc_set_channelp | ( | uint32_t | source | ) |

Set source of ADC input channelP.

Register | BitsName
--- | ---
SNSADC_CFG | REG3

Parameters

  source | This parameter can be one of the following values: LL_ADC_INPUT_SRC_IO0 LL_ADC_INPUT_SRC_IO1 LL_ADC_INPUT_SRC_IO2 LL_ADC_INPUT_SRC_IO3 LL_ADC_INPUT_SRC_IO4 LL_ADC_INPUT_SRC_TMP LL_ADC_INPUT_SRC_BAT

Return values

  None |

## ◆ ll_adc_set_clock()

__STATIC_INLINE void ll_adc_set_clock | ( | uint32_t | clk | ) |

Set ADC clock source.

Register | BitsName
--- | ---
MSIO_PAD_CFG_1 | ADC_CLK_SEL

Parameters

  clk | This parameter can be one of the following values: LL_ADC_CLK_16 LL_ADC_CLK_8 LL_ADC_CLK_4 LL_ADC_CLK_2 LL_ADC_CLK_1P6 LL_ADC_CLK_1

Return values

  None |

## ◆ ll_adc_set_dynamic_rang()

__STATIC_INLINE void ll_adc_set_dynamic_rang | ( | uint32_t | rang | ) |

Set dynamic rang of ADC.

Note
  When higher input signal frequencies close to Nyquist rate, you should set 1.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Parameters

  rang | This parameter can be a value between: 1 ~ 7

Return values

  None |

## ◆ ll_adc_set_input_mode()

__STATIC_INLINE void ll_adc_set_input_mode | ( | uint32_t | mode | ) |

Set ADC input mode.

Register | BitsName
--- | ---
SNSADC_CFG | REG2

Parameters

  mode | This parameter can be one of the following values: LL_ADC_INPUT_SINGLE LL_ADC_INPUT_DIFFERENTIAL

Return values

  None |

## ◆ ll_adc_set_ref()

__STATIC_INLINE void ll_adc_set_ref | ( | uint32_t | source | ) |

Set source of ADC reference.

Register | BitsName
--- | ---
SNSADC_CFG | REG4

Parameters

  source | This parameter can be one of the following values: LL_ADC_REF_SRC_BUF_INT LL_ADC_REF_SRC_IO0 LL_ADC_REF_SRC_IO1 LL_ADC_REF_SRC_IO2 LL_ADC_REF_SRC_IO3

Return values

  None |

## ◆ ll_adc_set_ref_current()

__STATIC_INLINE void ll_adc_set_ref_current | ( | uint32_t | source | ) |

Set current of ADC reference circuit.

Note
  When samples at 100kbps, you should set 0. When samples at 1mbps, you should set 7.

Register | BitsName
--- | ---
SNSADC_CFG | REG4

Parameters

  source | This parameter can be a value between: 0 ~ 7

Return values

  None |

## ◆ ll_adc_set_ref_value()

__STATIC_INLINE void ll_adc_set_ref_value | ( | uint32_t | value | ) |

Set ADC bias reference.

Register | BitsName
--- | ---
SNSADC_CFG | REG1

Parameters

  value | This parameter can be one of the following values: LL_ADC_REF_VALUE_0P8 LL_ADC_REF_VALUE_1P2 LL_ADC_REF_VALUE_1P6

Return values

  None |