VSF Documented
Data Structures | Macros | Typedefs | Enumerations | Functions
vsf_template_adc.h File Reference
#include "./vsf_template_hal_driver.h"
#include "hal/arch/vsf_arch.h"

Go to the source code of this file.

Data Structures

struct  vsf_adc_channel_cfg_t
 adc channel configuration More...
 
struct  vsf_adc_isr_t
 adc isr for api More...
 
struct  vsf_adc_cfg_t
 Configuration structure for ADC. More...
 
struct  vsf_adc_status_t
 Predefined VSF ADC status that can be reimplemented in specific HAL drivers. More...
 
struct  vsf_adc_capability_t
 Predefined VSF ADC capability that can be reimplemented in specific HAL drivers. More...
 
struct  vsf_adc_op_t
 
struct  vsf_adc_t
 

Macros

#define VSF_ADC_CFG_MULTI_CLASS   ENABLED
 Enable multi-class support by default for maximum availability.
 
#define VSF_ADC_CFG_PREFIX   vsf
 Define ADC hardware mask if count is defined.
 
#define VSF_ADC_CFG_FUNCTION_RENAME   ENABLED
 Disable VSF_ADC_CFG_FUNCTION_RENAME to use the original function names (e.g., vsf_adc_init()).
 
#define VSF_ADC_CFG_REIMPLEMENT_TYPE_MODE   DISABLED
 Enable VSF_ADC_CFG_REIMPLEMENT_TYPE_MODE to reimplement mode type vsf_adc_mode_t in specific hardware drivers.
 
#define VSF_ADC_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE   DISABLED
 Enable VSF_ADC_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE to reimplement channel mode type vsf_adc_channel_mode_t in specific hardware drivers.
 
#define VSF_ADC_CFG_REIMPLEMENT_TYPE_IRQ_MASK   DISABLED
 Enable VSF_ADC_CFG_REIMPLEMENT_TYPE_IRQ_MASK to reimplement interrupt mask type vsf_adc_irq_mask_t in specific hardware drivers.
 
#define VSF_ADC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG   DISABLED
 Enable VSF_ADC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG to reimplement channel configuration type vsf_adc_channel_cfg_t in specific hardware drivers For compatibility, do not delete members when redefining vsf_adc_channel_cfg_t.
 
#define VSF_ADC_CFG_REIMPLEMENT_TYPE_CFG   DISABLED
 Enable VSF_ADC_CFG_REIMPLEMENT_TYPE_CFG to reimplement ADC configuration type vsf_adc_cfg_t in specific hardware drivers For compatibility, do not delete members when redefining vsf_adc_cfg_t The vsf_adc_isr_handler_t type also needs to be redefined.
 
#define VSF_ADC_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED
 Enable the option to reimplement capability type. For compatibility, do not delete members when redefining vsf_adc_capability_t.
 
#define VSF_ADC_CFG_INHERIT_HAL_CAPABILITY   ENABLED
 In specific hardware driver, we can enable macro VSF_ADC_CFG_INHERIT_HAL_CAPABILITY to inherit structure vsf_peripheral_capability_t.
 
#define VSF_ADC_APIS(__PREFIX_NAME)
 ADC API template, used to generate ADC type, specific prefix function declarations, etc.
 

Typedefs

typedef enum vsf_adc_mode_t vsf_adc_mode_t
 Predefined VSF ADC modes that can be reimplemented in specific HAL drivers.
 
typedef enum vsf_adc_channel_mode_t vsf_adc_channel_mode_t
 Predefined VSF ADC channel modes that can be reimplemented in specific HAL drivers.
 
typedef enum vsf_adc_irq_mask_t vsf_adc_irq_mask_t
 Predefined VSF ADC interrupt that can be reimplemented in specific HAL drivers.
 
typedef struct vsf_adc_channel_cfg_t vsf_adc_channel_cfg_t
 adc channel configuration
 
typedef struct vsf_adc_t vsf_adc_t
 
typedef void vsf_adc_isr_handler_t(void *target_ptr, vsf_adc_t *adc_ptr, vsf_adc_irq_mask_t irq_mask)
 
typedef struct vsf_adc_isr_t vsf_adc_isr_t
 adc isr for api
 
typedef struct vsf_adc_cfg_t vsf_adc_cfg_t
 Configuration structure for ADC.
 
typedef struct vsf_adc_status_t vsf_adc_status_t
 Predefined VSF ADC status that can be reimplemented in specific HAL drivers.
 
typedef struct vsf_adc_capability_t vsf_adc_capability_t
 Predefined VSF ADC capability that can be reimplemented in specific HAL drivers.
 
typedef struct vsf_adc_op_t vsf_adc_op_t
 

Enumerations

enum  vsf_adc_mode_t {
  VSF_ADC_REF_VDD_1 = (0 << 0) ,
  VSF_ADC_REF_VDD_1_2 = (1 << 0) ,
  VSF_ADC_REF_VDD_1_3 = (2 << 0) ,
  VSF_ADC_REF_VDD_1_4 = (3 << 0) ,
  VSF_ADC_DATA_ALIGN_RIGHT = (0 << 2) ,
  VSF_ADC_DATA_ALIGN_LEFT = (1 << 2) ,
  VSF_ADC_SCAN_CONV_SINGLE_MODE = (0 << 3) ,
  VSF_ADC_SCAN_CONV_SEQUENCE_MODE = (1 << 3) ,
  VSF_ADC_EXTERN_TRIGGER_0 = (0 << 4) ,
  VSF_ADC_EXTERN_TRIGGER_1 = (1 << 4) ,
  VSF_ADC_EXTERN_TRIGGER_2 = (2 << 4)
}
 Predefined VSF ADC modes that can be reimplemented in specific HAL drivers. More...
 
enum  {
  VSF_ADC_REF_VDD_COUNT = 4 ,
  VSF_ADC_REF_VDD_MASK ,
  VSF_ADC_DATA_ALIGN_COUNT = 2 ,
  VSF_ADC_DATA_ALIGN_MASK ,
  VSF_ADC_SCAN_CONV_COUNT = 2 ,
  VSF_ADC_SCAN_CONV_MASK ,
  VSF_ADC_EXTERN_TRIGGER_COUNT = 3 ,
  VSF_ADC_EXTERN_TRIGGER_MASK ,
  VSF_ADC_MODE_MASK_COUNT = 4 ,
  VSF_ADC_MODE_ALL_BITS_MASK
}
 
enum  vsf_adc_channel_mode_t {
  VSF_ADC_CHANNEL_GAIN_1_6 = (0 << 0) ,
  VSF_ADC_CHANNEL_GAIN_1_5 = (1 << 0) ,
  VSF_ADC_CHANNEL_GAIN_1_4 = (2 << 0) ,
  VSF_ADC_CHANNEL_GAIN_1_3 = (3 << 0) ,
  VSF_ADC_CHANNEL_GAIN_1_2 = (4 << 0) ,
  VSF_ADC_CHANNEL_GAIN_1 = (5 << 0) ,
  VSF_ADC_CHANNEL_REF_VDD_1 = (0 << 4) ,
  VSF_ADC_CHANNEL_REF_VDD_1_2 = (1 << 4) ,
  VSF_ADC_CHANNEL_REF_VDD_1_3 = (2 << 4) ,
  VSF_ADC_CHANNEL_REF_VDD_1_4 = (3 << 4)
}
 Predefined VSF ADC channel modes that can be reimplemented in specific HAL drivers. More...
 
enum  {
  VSF_ADC_CHANNEL_GAIN_COUNT = 6 ,
  VSF_ADC_CHANNEL_GAIN_MASK ,
  VSF_ADC_CHANNEL_REF_VDD_COUNT = 4 ,
  VSF_ADC_CHANNEL_REF_VDD_MASK ,
  VSF_ADC_CHANNEL_MODE_MASK_COUNT = 2 ,
  VSF_ADC_CHANNEL_MODE_ALL_BITS_MASK
}
 
enum  vsf_adc_irq_mask_t { VSF_ADC_IRQ_MASK_CPL = (0x1ul << 0) }
 Predefined VSF ADC interrupt that can be reimplemented in specific HAL drivers. More...
 
enum  {
  VSF_ADC_IRQ_COUNT = 1 ,
  VSF_ADC_IRQ_ALL_BITS_MASK = VSF_ADC_IRQ_MASK_CPL
}
 

Functions

vsf_err_t vsf_adc_init (vsf_adc_t *adc_ptr, vsf_adc_cfg_t *cfg_ptr)
 Initialize an ADC instance.
 
void vsf_adc_fini (vsf_adc_t *adc_ptr)
 Finalize an ADC instance.
 
fsm_rt_t vsf_adc_enable (vsf_adc_t *adc_ptr)
 Enable an ADC instance.
 
fsm_rt_t vsf_adc_disable (vsf_adc_t *adc_ptr)
 Disable an ADC instance.
 
void vsf_adc_irq_enable (vsf_adc_t *adc_ptr, vsf_adc_irq_mask_t irq_mask)
 Enable interrupt masks of ADC instance.
 
void vsf_adc_irq_disable (vsf_adc_t *adc_ptr, vsf_adc_irq_mask_t irq_mask)
 Disable interrupt masks of ADC instance.
 
vsf_adc_status_t vsf_adc_status (vsf_adc_t *adc_ptr)
 Get the status of ADC instance.
 
vsf_adc_capability_t vsf_adc_capability (vsf_adc_t *adc_ptr)
 Get the capability of ADC instance.
 
vsf_err_t vsf_adc_channel_request_once (vsf_adc_t *adc_ptr, vsf_adc_channel_cfg_t *channel_cfg, void *buffer_ptr)
 ADC request sampling once.
 
vsf_err_t vsf_adc_channel_config (vsf_adc_t *adc_ptr, vsf_adc_channel_cfg_t *cfgs_ptr, uint32_t cnt)
 ADC channel configuration.
 
vsf_err_t vsf_adc_channel_request (vsf_adc_t *adc_ptr, void *buffer_ptr, uint_fast32_t count)
 ADC channel request.
 

Macro Definition Documentation

◆ VSF_ADC_CFG_MULTI_CLASS

#define VSF_ADC_CFG_MULTI_CLASS   ENABLED

Enable multi-class support by default for maximum availability.

◆ VSF_ADC_CFG_PREFIX

#define VSF_ADC_CFG_PREFIX   vsf

Define ADC hardware mask if count is defined.

Define ADC hardware count if mask is defined

We can redefine macro VSF_ADC_CFG_PREFIX to specify a prefix to call a specific driver directly in the application code.

◆ VSF_ADC_CFG_FUNCTION_RENAME

#define VSF_ADC_CFG_FUNCTION_RENAME   ENABLED

Disable VSF_ADC_CFG_FUNCTION_RENAME to use the original function names (e.g., vsf_adc_init()).

◆ VSF_ADC_CFG_REIMPLEMENT_TYPE_MODE

#define VSF_ADC_CFG_REIMPLEMENT_TYPE_MODE   DISABLED

Enable VSF_ADC_CFG_REIMPLEMENT_TYPE_MODE to reimplement mode type vsf_adc_mode_t in specific hardware drivers.

◆ VSF_ADC_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE

#define VSF_ADC_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE   DISABLED

Enable VSF_ADC_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE to reimplement channel mode type vsf_adc_channel_mode_t in specific hardware drivers.

◆ VSF_ADC_CFG_REIMPLEMENT_TYPE_IRQ_MASK

#define VSF_ADC_CFG_REIMPLEMENT_TYPE_IRQ_MASK   DISABLED

Enable VSF_ADC_CFG_REIMPLEMENT_TYPE_IRQ_MASK to reimplement interrupt mask type vsf_adc_irq_mask_t in specific hardware drivers.

◆ VSF_ADC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG

#define VSF_ADC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG   DISABLED

Enable VSF_ADC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG to reimplement channel configuration type vsf_adc_channel_cfg_t in specific hardware drivers For compatibility, do not delete members when redefining vsf_adc_channel_cfg_t.

◆ VSF_ADC_CFG_REIMPLEMENT_TYPE_CFG

#define VSF_ADC_CFG_REIMPLEMENT_TYPE_CFG   DISABLED

Enable VSF_ADC_CFG_REIMPLEMENT_TYPE_CFG to reimplement ADC configuration type vsf_adc_cfg_t in specific hardware drivers For compatibility, do not delete members when redefining vsf_adc_cfg_t The vsf_adc_isr_handler_t type also needs to be redefined.

◆ VSF_ADC_CFG_REIMPLEMENT_TYPE_CAPABILITY

#define VSF_ADC_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED

Enable the option to reimplement capability type. For compatibility, do not delete members when redefining vsf_adc_capability_t.

◆ VSF_ADC_CFG_INHERIT_HAL_CAPABILITY

#define VSF_ADC_CFG_INHERIT_HAL_CAPABILITY   ENABLED

In specific hardware driver, we can enable macro VSF_ADC_CFG_INHERIT_HAL_CAPABILITY to inherit structure vsf_peripheral_capability_t.

◆ VSF_ADC_APIS

#define VSF_ADC_APIS (   __PREFIX_NAME)
Value:
__VSF_HAL_TEMPLATE_API(__PREFIX_NAME, vsf_err_t, adc, init, VSF_MCONNECT(__PREFIX_NAME, _adc_t) *adc_ptr, vsf_adc_cfg_t *cfg_ptr) \
__VSF_HAL_TEMPLATE_API(__PREFIX_NAME, void, adc, fini, VSF_MCONNECT(__PREFIX_NAME, _adc_t) *adc_ptr) \
__VSF_HAL_TEMPLATE_API(__PREFIX_NAME, fsm_rt_t, adc, enable, VSF_MCONNECT(__PREFIX_NAME, _adc_t) *adc_ptr) \
__VSF_HAL_TEMPLATE_API(__PREFIX_NAME, fsm_rt_t, adc, disable, VSF_MCONNECT(__PREFIX_NAME, _adc_t) *adc_ptr) \
__VSF_HAL_TEMPLATE_API(__PREFIX_NAME, vsf_adc_status_t, adc, status, VSF_MCONNECT(__PREFIX_NAME, _adc_t) *adc_ptr) \
__VSF_HAL_TEMPLATE_API(__PREFIX_NAME, vsf_adc_capability_t, adc, capability, VSF_MCONNECT(__PREFIX_NAME, _adc_t) *adc_ptr) \
__VSF_HAL_TEMPLATE_API(__PREFIX_NAME, void, adc, irq_enable, VSF_MCONNECT(__PREFIX_NAME, _adc_t) *adc_ptr, vsf_adc_irq_mask_t irq_mask) \
__VSF_HAL_TEMPLATE_API(__PREFIX_NAME, void, adc, irq_disable, VSF_MCONNECT(__PREFIX_NAME, _adc_t) *adc_ptr, vsf_adc_irq_mask_t irq_mask) \
__VSF_HAL_TEMPLATE_API(__PREFIX_NAME, vsf_err_t, adc, channel_request_once, VSF_MCONNECT(__PREFIX_NAME, _adc_t) *adc_ptr, vsf_adc_channel_cfg_t *channel_cfg, void *buffer_ptr) \
__VSF_HAL_TEMPLATE_API(__PREFIX_NAME, vsf_err_t, adc, channel_config, VSF_MCONNECT(__PREFIX_NAME, _adc_t) *adc_ptr, vsf_adc_channel_cfg_t *channel_cfgs_ptr, uint32_t channel_cfgs_cnt) \
__VSF_HAL_TEMPLATE_API(__PREFIX_NAME, vsf_err_t, adc, channel_request, VSF_MCONNECT(__PREFIX_NAME, _adc_t) *adc_ptr, void *buffer_ptr, uint_fast32_t count)
vsf_err_t
Definition __type.h:42
struct VSF_MCONNECT(VSF_FLASH_CFG_IMP_PREFIX, _flash_t)
Definition flash.c:53
__le16 capability
Definition ieee80211.h:134
const i_spi_t vsf_spi_irq_mask_t irq_mask
Definition spi_interface.h:38
unsigned uint32_t
Definition stdint.h:9
unsigned int uint_fast32_t
Definition stdint.h:27
Predefined VSF ADC capability that can be reimplemented in specific HAL drivers.
Definition vsf_template_adc.h:688
Configuration structure for ADC.
Definition vsf_template_adc.h:638
adc channel configuration
Definition vsf_template_adc.h:612
Predefined VSF ADC status that can be reimplemented in specific HAL drivers.
Definition vsf_template_adc.h:660
fsm_rt_t
Definition vsf_fsm.h:315
vsf_adc_irq_mask_t
Predefined VSF ADC interrupt that can be reimplemented in specific HAL drivers.
Definition vsf_template_adc.h:593
#define __VSF_HAL_TEMPLATE_API
Definition vsf_template_instance_declaration.h:57
uint8_t status
Definition vsf_tgui.h:144

ADC API template, used to generate ADC type, specific prefix function declarations, etc.

Parameters
[in]__PREFIX_NAMEThe prefix used for generating ADC functions.

Typedef Documentation

◆ vsf_adc_mode_t

Predefined VSF ADC modes that can be reimplemented in specific HAL drivers.

Even if the hardware doesn't support these modes, the following modes must be kept, If the hardware supports more modes, e.g. more reference voltage, more data alignment, we can implement it in the hardware driver:

If more new modes are added to the driver, then the corresponding MASK macros need to be defined to include the values of the new modes. For example, Adding the new reference voltage option requires that the macro VSF_ADC_REF_VDD_MASK be defined.

Optional mode require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can switch to different modes at compile-time.

◆ vsf_adc_channel_mode_t

Predefined VSF ADC channel modes that can be reimplemented in specific HAL drivers.

Even if the hardware doesn't support these modes, the following modes must be kept, If the hardware supports more modes, e.g. more gain, more reference voltage, we can implement it in the hardware driver:

If more new modes are added to the driver, then the corresponding MASK macros need to be defined to include the values of the new modes. For example, Adding the new gain option requires that the macro VSF_ADC_CHANNEL_GAIN_MASK be defined.

Optional mode require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can switch to different modes at compile-time.

◆ vsf_adc_irq_mask_t

Predefined VSF ADC interrupt that can be reimplemented in specific HAL drivers.

Even if the hardware doesn't support these features, these interrupt must be kept.

Optional interrupt require one or more enumeration options and a macro with the same, so that the user can check if the interrupt is supported at compile-time.

◆ vsf_adc_channel_cfg_t

adc channel configuration

Configuration structure for ADC channel.

◆ vsf_adc_t

typedef struct vsf_adc_t vsf_adc_t

◆ vsf_adc_isr_handler_t

typedef void vsf_adc_isr_handler_t(void *target_ptr, vsf_adc_t *adc_ptr, vsf_adc_irq_mask_t irq_mask)

◆ vsf_adc_isr_t

typedef struct vsf_adc_isr_t vsf_adc_isr_t

adc isr for api

◆ vsf_adc_cfg_t

typedef struct vsf_adc_cfg_t vsf_adc_cfg_t

Configuration structure for ADC.

◆ vsf_adc_status_t

Predefined VSF ADC status that can be reimplemented in specific HAL drivers.

Even if the hardware doesn't support these features, these status must be kept.

◆ vsf_adc_capability_t

Predefined VSF ADC capability that can be reimplemented in specific HAL drivers.

Even if the hardware doesn't support these features, these capabilities must be kept.

◆ vsf_adc_op_t

typedef struct vsf_adc_op_t vsf_adc_op_t

Enumeration Type Documentation

◆ vsf_adc_mode_t

Predefined VSF ADC modes that can be reimplemented in specific HAL drivers.

Even if the hardware doesn't support these modes, the following modes must be kept, If the hardware supports more modes, e.g. more reference voltage, more data alignment, we can implement it in the hardware driver:

If more new modes are added to the driver, then the corresponding MASK macros need to be defined to include the values of the new modes. For example, Adding the new reference voltage option requires that the macro VSF_ADC_REF_VDD_MASK be defined.

Optional mode require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can switch to different modes at compile-time.

Enumerator
VSF_ADC_REF_VDD_1 

Reference voltage set to VDD. Uses the full supply voltage as reference for ADC conversion.

VSF_ADC_REF_VDD_1_2 

Reference voltage set to VDD/2. Uses half of the supply voltage as reference for ADC conversion.

VSF_ADC_REF_VDD_1_3 

Reference voltage set to VDD/3. Uses one-third of the supply voltage as reference for ADC conversion.

VSF_ADC_REF_VDD_1_4 

Reference voltage set to VDD/4. Uses one-fourth of the supply voltage as reference for ADC conversion.

VSF_ADC_DATA_ALIGN_RIGHT 

Data alignment set to right. The converted data is right-aligned in the data register.

VSF_ADC_DATA_ALIGN_LEFT 

Data alignment set to left. The converted data is left-aligned in the data register.

VSF_ADC_SCAN_CONV_SINGLE_MODE 

Single conversion mode. Conversion is performed once for a single channel.

VSF_ADC_SCAN_CONV_SEQUENCE_MODE 

Sequence conversion mode. Conversions are performed in sequence for multiple channels.

VSF_ADC_EXTERN_TRIGGER_0 

External trigger source 0. Selects the first external event source to trigger conversion.

VSF_ADC_EXTERN_TRIGGER_1 

External trigger source 1. Selects the second external event source to trigger conversion.

VSF_ADC_EXTERN_TRIGGER_2 

External trigger source 2. Selects the third external event source to trigger conversion.

◆ anonymous enum

anonymous enum
Enumerator
VSF_ADC_REF_VDD_COUNT 
VSF_ADC_REF_VDD_MASK 
VSF_ADC_DATA_ALIGN_COUNT 
VSF_ADC_DATA_ALIGN_MASK 
VSF_ADC_SCAN_CONV_COUNT 
VSF_ADC_SCAN_CONV_MASK 
VSF_ADC_EXTERN_TRIGGER_COUNT 
VSF_ADC_EXTERN_TRIGGER_MASK 
VSF_ADC_MODE_MASK_COUNT 
VSF_ADC_MODE_ALL_BITS_MASK 

◆ vsf_adc_channel_mode_t

Predefined VSF ADC channel modes that can be reimplemented in specific HAL drivers.

Even if the hardware doesn't support these modes, the following modes must be kept, If the hardware supports more modes, e.g. more gain, more reference voltage, we can implement it in the hardware driver:

If more new modes are added to the driver, then the corresponding MASK macros need to be defined to include the values of the new modes. For example, Adding the new gain option requires that the macro VSF_ADC_CHANNEL_GAIN_MASK be defined.

Optional mode require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can switch to different modes at compile-time.

Enumerator
VSF_ADC_CHANNEL_GAIN_1_6 

Channel gain set to 1/6. Input signal is attenuated to 1/6 of its original value.

VSF_ADC_CHANNEL_GAIN_1_5 

Channel gain set to 1/5. Input signal is attenuated to 1/5 of its original value.

VSF_ADC_CHANNEL_GAIN_1_4 

Channel gain set to 1/4. Input signal is attenuated to 1/4 of its original value.

VSF_ADC_CHANNEL_GAIN_1_3 

Channel gain set to 1/3. Input signal is attenuated to 1/3 of its original value.

VSF_ADC_CHANNEL_GAIN_1_2 

Channel gain set to 1/2. Input signal is attenuated to 1/2 of its original value.

VSF_ADC_CHANNEL_GAIN_1 

Channel gain set to 1. Input signal remains at its original value (no amplification or attenuation).

VSF_ADC_CHANNEL_REF_VDD_1 

Channel reference voltage set to VDD/1. Uses the full supply voltage as reference for this channel.

VSF_ADC_CHANNEL_REF_VDD_1_2 

Channel reference voltage set to VDD/1.2. Uses VDD/1.2 as reference voltage for this channel.

VSF_ADC_CHANNEL_REF_VDD_1_3 

Channel reference voltage set to VDD/1.3. Uses VDD/1.3 as reference voltage for this channel.

VSF_ADC_CHANNEL_REF_VDD_1_4 

Channel reference voltage set to VDD/1.4. Uses VDD/1.4 as reference voltage for this channel.

◆ anonymous enum

anonymous enum
Enumerator
VSF_ADC_CHANNEL_GAIN_COUNT 
VSF_ADC_CHANNEL_GAIN_MASK 
VSF_ADC_CHANNEL_REF_VDD_COUNT 
VSF_ADC_CHANNEL_REF_VDD_MASK 
VSF_ADC_CHANNEL_MODE_MASK_COUNT 
VSF_ADC_CHANNEL_MODE_ALL_BITS_MASK 

◆ vsf_adc_irq_mask_t

Predefined VSF ADC interrupt that can be reimplemented in specific HAL drivers.

Even if the hardware doesn't support these features, these interrupt must be kept.

Optional interrupt require one or more enumeration options and a macro with the same, so that the user can check if the interrupt is supported at compile-time.

Enumerator
VSF_ADC_IRQ_MASK_CPL 

Conversion complete interrupt.

◆ anonymous enum

anonymous enum
Enumerator
VSF_ADC_IRQ_COUNT 
VSF_ADC_IRQ_ALL_BITS_MASK 

Function Documentation

◆ vsf_adc_init()

vsf_err_t vsf_adc_init ( vsf_adc_t adc_ptr,
vsf_adc_cfg_t cfg_ptr 
)
extern

Initialize an ADC instance.

Parameters
[in]adc_ptra pointer to structure vsf_adc_t
[in]cfg_ptra pointer to structure vsf_adc_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if initialization successful, otherwise returns error code
Note
It is not necessary to call vsf_adc_fini() to deinitialize.
vsf_adc_init() should be called before any other ADC API except vsf_adc_capability().

◆ vsf_adc_fini()

void vsf_adc_fini ( vsf_adc_t adc_ptr)
extern

Finalize an ADC instance.

Parameters
[in]adc_ptra pointer to structure vsf_adc_t
Returns
none

◆ vsf_adc_enable()

fsm_rt_t vsf_adc_enable ( vsf_adc_t adc_ptr)
extern

Enable an ADC instance.

Parameters
[in]adc_ptra pointer to structure vsf_adc_t
Returns
fsm_rt_t: FSM_RT_CPL if ADC was enabled, FSM_RT_ON_GOING if ADC is still enabling

◆ vsf_adc_disable()

fsm_rt_t vsf_adc_disable ( vsf_adc_t adc_ptr)
extern

Disable an ADC instance.

Parameters
[in]adc_ptra pointer to structure vsf_adc_t
Returns
fsm_rt_t: FSM_RT_CPL if ADC was disabled, FSM_RT_ON_GOING if ADC is still disabling

◆ vsf_adc_irq_enable()

void vsf_adc_irq_enable ( vsf_adc_t adc_ptr,
vsf_adc_irq_mask_t  irq_mask 
)
extern

Enable interrupt masks of ADC instance.

Parameters
[in]adc_ptra pointer to structure vsf_adc_t
[in]irq_maskone or more values of enum vsf_adc_irq_mask_t
Returns
none
Note
All pending interrupts should be cleared before interrupts are enabled.

◆ vsf_adc_irq_disable()

void vsf_adc_irq_disable ( vsf_adc_t adc_ptr,
vsf_adc_irq_mask_t  irq_mask 
)
extern

Disable interrupt masks of ADC instance.

Parameters
[in]adc_ptra pointer to structure vsf_adc_t
[in]irq_maskone or more values of enum vsf_adc_irq_mask_t
Returns
none

◆ vsf_adc_status()

vsf_adc_status_t vsf_adc_status ( vsf_adc_t adc_ptr)
extern

Get the status of ADC instance.

Parameters
[in]adc_ptra pointer to structure vsf_adc_t
Returns
vsf_adc_status_t: All status of current ADC

◆ vsf_adc_capability()

vsf_adc_capability_t vsf_adc_capability ( vsf_adc_t adc_ptr)
extern

Get the capability of ADC instance.

Parameters
[in]adc_ptra pointer to structure vsf_adc_t
Returns
vsf_adc_capability_t: All capabilities of current ADC vsf_adc_capability_t

◆ vsf_adc_channel_request_once()

vsf_err_t vsf_adc_channel_request_once ( vsf_adc_t adc_ptr,
vsf_adc_channel_cfg_t channel_cfg,
void *  buffer_ptr 
)
extern

ADC request sampling once.

Parameters
[in]adc_ptra pointer to structure vsf_adc_t
[in]channel_cfga pointer to convert channel configuration
[in]buffer_ptrvalue to be converted
Returns
vsf_err_t: VSF_ERR_NONE if the request was successful, otherwise returns error code

◆ vsf_adc_channel_config()

vsf_err_t vsf_adc_channel_config ( vsf_adc_t adc_ptr,
vsf_adc_channel_cfg_t cfgs_ptr,
uint32_t  cnt 
)
extern

ADC channel configuration.

Parameters
[in]adc_ptra pointer to structure vsf_adc_t
[in]cfgs_ptrconvert channel configuration array
[in]cntthe length of convert channel configuration array
Returns
vsf_err_t: VSF_ERR_NONE if the configuration was successful, otherwise returns error code

◆ vsf_adc_channel_request()

vsf_err_t vsf_adc_channel_request ( vsf_adc_t adc_ptr,
void *  buffer_ptr,
uint_fast32_t  count 
)
extern

ADC channel request.

Parameters
[in]adc_ptra pointer to structure vsf_adc_t
[out]buffer_ptrconvert channel data array
[in]countthe length of convert channel configuration data array
Returns
vsf_err_t: VSF_ERR_NONE if the request was successful, otherwise returns error code
Generated from commit: vsfteam/vsf@2b286be