MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
Analog To Digital Converter (ADC)

Modules

 ADC_Registers
 Registers, Bit Masks and Bit Positions for the ADC Peripheral Module.
 

Enumerations

enum  mxc_adc_chsel_t {
  ADC_CH_0 = MXC_V_ADC_CTRL_CH_SEL_AIN0,
  ADC_CH_1 = MXC_V_ADC_CTRL_CH_SEL_AIN1,
  ADC_CH_2 = MXC_V_ADC_CTRL_CH_SEL_AIN2,
  ADC_CH_3 = MXC_V_ADC_CTRL_CH_SEL_AIN3,
  ADC_CH_4 = MXC_V_ADC_CTRL_CH_SEL_AIN4,
  ADC_CH_5 = MXC_V_ADC_CTRL_CH_SEL_AIN5,
  ADC_CH_6 = MXC_V_ADC_CTRL_CH_SEL_AIN6,
  ADC_CH_7 = MXC_V_ADC_CTRL_CH_SEL_AIN7,
  ADC_CH_VCOREA = MXC_V_ADC_CTRL_CH_SEL_VCOREA,
  ADC_CH_VCOREB = MXC_V_ADC_CTRL_CH_SEL_VCOREB,
  ADC_CH_VRXOUT = MXC_V_ADC_CTRL_CH_SEL_VRXOUT,
  ADC_CH_VTXOUT = MXC_V_ADC_CTRL_CH_SEL_VTXOUT,
  ADC_CH_VDDA = MXC_V_ADC_CTRL_CH_SEL_VDDA,
  ADC_CH_VDDB = MXC_V_ADC_CTRL_CH_SEL_VDDB,
  ADC_CH_VDDIO = MXC_V_ADC_CTRL_CH_SEL_VDDIO,
  ADC_CH_VDDIOH = MXC_V_ADC_CTRL_CH_SEL_VDDIOH,
  ADC_CH_VREGI = MXC_V_ADC_CTRL_CH_SEL_VREGI
}
 Enumeration type for the ADC Input Channels.
 
enum  mxc_adc_limitsel_t {
  ADC_LIMIT_0,
  ADC_LIMIT_1,
  ADC_LIMIT_2,
  ADC_LIMIT_3,
  ADC_LIMIT_MAX
}
 Enumeration type for the ADC limit register to set.
 

Functions

int ADC_Init (unsigned divisor, const sys_cfg_adc_t *sys_cfg)
 Initialize the ADC hardware. More...
 
void ADC_StartConvert (mxc_adc_chsel_t channel, unsigned int adc_scale, unsigned int ref_scale)
 Start ADC conversion on the selected channel. More...
 
int ADC_GetData (uint16_t *outdata)
 Gets the result from the previous ADC conversion. More...
 
int ADC_SetLimit (mxc_adc_limitsel_t unit, mxc_adc_chsel_t channel, unsigned int low_enable, unsigned int low_limit, unsigned int high_enable, unsigned int high_limit)
 Set the data limits for an ADC channel monitor. More...
 
uint32_t ADC_GetFlags (void)
 Get interrupt flags. More...
 
void ADC_ClearFlags (uint32_t mask)
 Clear interrupt flag(s) using the mask parameter. More...
 
uint32_t ADC_GetStatus (void)
 Get the Status of the ADC. More...
 
void ADC_EnableINT (uint32_t mask)
 Enables the ADC interrupts specified by the mask parameter. More...
 
void ADC_DisableINT (uint32_t mask)
 Disable ADC interrupts based on mask. More...
 

Detailed Description

Function Documentation

◆ ADC_Init()

int ADC_Init ( unsigned  divisor,
const sys_cfg_adc_t *  sys_cfg 
)
Parameters
divisorThe divisor
sys_cfgSystem Configuration Object
Returns
E_NO_ERROR If successful

◆ ADC_StartConvert()

void ADC_StartConvert ( mxc_adc_chsel_t  channel,
unsigned int  adc_scale,
unsigned int  ref_scale 
)
Parameters
channelChannel select from mxc_adc_chsel_t
adc_scaleEnable the ADC input scaling mode if non-zero
ref_scaleThe reference scale

◆ ADC_GetData()

int ADC_GetData ( uint16_t *  outdata)
Parameters
outdataPointer to store the ADC data conversion result
Returns
E_OVERFLOW ADC overflow error
E_NO_ERROR Data returned in outdata parameter

◆ ADC_SetLimit()

int ADC_SetLimit ( mxc_adc_limitsel_t  unit,
mxc_adc_chsel_t  channel,
unsigned int  low_enable,
unsigned int  low_limit,
unsigned int  high_enable,
unsigned int  high_limit 
)
Parameters
unitWhich data limit unit to configure
channelChannel select from mxc_adc_chsel_t
low_enableEnable the lower limit on this monitor
low_limitValue for lower limit monitor
high_enableEnable the upper limit on this monitor
high_limitValue for upper limit monitor
Returns
E_BAD_PARAM ADC limit or channel greater than supported
E_NO_ERROR ADC limit set successfully.

◆ ADC_GetFlags()

uint32_t ADC_GetFlags ( void  )
Returns
ADC Interrupt flags bit mask. See the ADC_INTR Register for the interrupt flag masks.

◆ ADC_ClearFlags()

void ADC_ClearFlags ( uint32_t  mask)

All bits set in the parameter will be cleared

Parameters
maskInterrupt flags to clear. See the ADC_INTR Register for the interrupt flag masks

◆ ADC_GetStatus()

uint32_t ADC_GetStatus ( void  )
Returns
ADC status register. See ADC_STATUS Register" for details.

◆ ADC_EnableINT()

void ADC_EnableINT ( uint32_t  mask)
Parameters
maskADC interrupts to enable. See ADC_INTR Register for the interrupt enable bit masks.

◆ ADC_DisableINT()

void ADC_DisableINT ( uint32_t  mask)
Parameters
maskADC interrupts to disable. See ADC_INTR Register for the interrupt enable bit masks.