27#ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX78002_ADC_H_
28#define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX78002_ADC_H_
47#define MAX_ADC_SLOT_NUM 20
48#define MAX_ADC_FIFO_LEN 16
49#define MAX_ADC_RES_DIV_CH 8
213typedef void (*mxc_adc_complete_cb_t)(
void *req,
int error);
327 void (*callback)(
int,
int));
Registers, Bit Masks and Bit Positions for the ADC Peripheral Module.
#define MXC_S_ADC_CTRL1_AVG_AVG8
Definition: adc_regs.h:196
#define MXC_S_ADC_CTRL1_AVG_AVG32
Definition: adc_regs.h:200
#define MXC_S_ADC_CTRL1_AVG_AVG4
Definition: adc_regs.h:194
#define MXC_S_ADC_CTRL1_AVG_AVG1
Definition: adc_regs.h:190
#define MXC_S_ADC_CTRL1_AVG_AVG16
Definition: adc_regs.h:198
#define MXC_S_ADC_CTRL1_AVG_AVG2
Definition: adc_regs.h:192
#define MXC_V_MCR_ADCCFG2_CH0_DIV2_5K
Definition: mcr_regs.h:299
#define MXC_V_MCR_ADCCFG2_CH0_DIV2_50K
Definition: mcr_regs.h:301
#define MXC_V_MCR_ADCCFG2_CH0_DIV1
Definition: mcr_regs.h:297
mxc_adc_div_lpmode_t lpmode_divder
Divide by 2 control in lpmode.
Definition: adc.h:246
mxc_adc_trig_sel_t hwTrig
HW Trigger Source.
Definition: adc.h:242
uint8_t fifo_threshold
FIFO Threshold Configuration.
Definition: adc.h:244
mxc_adc_chsel_t channel
channel select
Definition: adc.h:231
mxc_adc_divsel_t div
Analog input divider.
Definition: adc.h:232
uint32_t trackCount
Sample Clock High time.
Definition: adc.h:223
mxc_adc_clock_t clock
clock to use
Definition: adc.h:219
mxc_adc_avg_t avg_number
no of samples to average
Definition: adc.h:245
mxc_adc_trig_mode_t trig
trigger mode
Definition: adc.h:241
mxc_adc_dynamic_pullup_t pullup_dyn
Dynamic Pullup.
Definition: adc.h:233
uint32_t idleCount
Sample Clock Low time.
Definition: adc.h:224
mxc_adc_refsel_t ref
ADC reference voltage.
Definition: adc.h:222
mxc_adc_calibration_t cal
skip calibration
Definition: adc.h:221
mxc_adc_clkdiv_t clkdiv
clock divider
Definition: adc.h:220
int8_t dma_channel
The channel to use for DMA-enabled transactions.
Definition: adc.h:248
mxc_adc_conversion_mode_t mode
conversion mode
Definition: adc.h:240
mxc_adc_fifodataformat_t fifo_format
FIFO Data Format.
Definition: adc.h:243
uint8_t num_slots
num of slots in the sequence
Definition: adc.h:247
int MXC_ADC_Configuration(mxc_adc_conversion_req_t *req)
Configures the ADC.
int MXC_ADC_DynamicModeEn(mxc_adc_chsel_t ch)
Enables the ADC Dynamic Power-Up Mode.
mxc_adc_avg_t
Enumeration type for the number of samples to average.
Definition: adc.h:84
mxc_adc_calibration_t
Calibration settings.
Definition: adc.h:129
int MXC_ADC_StartConversion(void)
Initiate configured ADC conversion.
void MXC_ADC_ClearFlags(uint32_t flags)
Performs the ADC startup procedure.
int MXC_ADC_InputDividerSelect(mxc_adc_chsel_t ch, mxc_adc_divsel_t div, mxc_adc_dynamic_pullup_t lpEn)
Selects the analog input divider.
mxc_adc_dynamic_pullup_t
Dynamic Divider pullup control.
Definition: adc.h:207
mxc_adc_trig_sel_t
Hardware trigger select options.
Definition: adc.h:145
int MXC_ConvertTemperature_ToK(uint16_t tempSensor_Readout, mxc_adc_refsel_t ref, float ext_ref, float *temp_k)
Calculates temperature (in K) from ADC readout.
int MXC_ADC_FIFO_Threshold_Config(uint32_t fifo_threshold)
Configures the ADC FIFO threshold register.
mxc_adc_trig_mode_t
trigger mode settings
Definition: adc.h:137
int MXC_ADC_ComparatorHysteresisDis(mxc_adc_comp_t comp)
Disable comparator hysteresis.
int MXC_ADC_AverageConfig(mxc_adc_avg_t avg_number)
Configures number of sample average in the sequence for each channel.
int MXC_ADC_GetData(int *outdata)
Gets the ADC readout after the ADC conversion.
void MXC_ADC_Clear_ChannelSelect(void)
Clear all channel select registers.
mxc_adc_clkdiv_t
Enumeration type for ADC clock divider.
Definition: adc.h:108
int MXC_ADC_DynamicModeDis(mxc_adc_chsel_t ch)
Disables the ADC Dynamic Power-Up Mode.
void MXC_ADC_EnableConversion(void)
Enables the ADC converter.
int MXC_ConvertTemperature_ToC(uint16_t tempSensor_Readout, mxc_adc_refsel_t ref, float ext_ref, float *temp)
Calculates temperature (in C) from ADC readout.
int MXC_ADC_ReferenceSelect(mxc_adc_refsel_t ref)
Selects the desired reference voltage for the ADC.
void MAX_ADC_Flush_FIFO(void)
Flushes the ADC FIFO.
void MXC_ADC_SetConversionDelay(int delay)
Set Sample Delay before Continuous Mode Conversion Restart.
int MXC_ADC_SlotConfiguration(mxc_adc_slot_req_t *req, uint32_t slot_length)
Configures ADC slot and channel registers.
int MXC_ADC_StartConversionAsync(mxc_adc_complete_cb_t callback)
Perform a conversion on a specific channel.
mxc_adc_chsel_t
Enumeration type for the ADC Input Channels.
Definition: adc.h:59
int MXC_ADC_Init(mxc_adc_req_t *req)
Performs the ADC startup procedure.
mxc_adc_div_lpmode_t
Divide by 2 control in low power mode.
Definition: adc.h:188
void MXC_ADC_EnableInt(uint32_t flags)
Enable specific ADC interrupts.
uint16_t MXC_ADC_FIFO_Level(void)
Provides the ADC FIFO level.
mxc_adc_conversion_mode_t
trigger mode settings
Definition: adc.h:159
mxc_adc_refsel_t
Reference voltage select type.
Definition: adc.h:178
mxc_adc_comp_t
Definition: adc.h:96
int MXC_ADC_SlotsConfig(mxc_adc_conversion_req_t *req)
Configures number of slots for ADC sequence.
void MXC_ADC_TS_SelectEnable(void)
Enables the temperature sensor.
int MXC_ADC_GetFlags(void)
Performs the ADC startup procedure.
int MXC_ADC_StartConversionDMA(mxc_adc_conversion_req_t *req, int *data, void(*callback)(int, int))
Perform a conversion on a specific channel using a DMA transfer. DMA channel must be acquired using M...
void MXC_ADC_TS_SelectDisable(void)
Disables the temperature sensor.
mxc_adc_divsel_t
Analog input divider select.
Definition: adc.h:167
void MXC_ADC_TriggerConfig(mxc_adc_conversion_req_t *req)
Configures ADC Trigger to initiate ADC conversion.
int MXC_ConvertTemperature_ToF(uint16_t tempSensor_Readout, mxc_adc_refsel_t ref, float ext_ref, float *temp)
Calculates temperature (in F) from ADC readout.
int MXC_ADC_ComparatorHysteresisEn(mxc_adc_comp_t comp)
Enable comparator hysteresis.
void MXC_ADC_DisableConversion(void)
Disables the ADC converter.
mxc_adc_clock_t
Clock settings.
Definition: adc.h:119
int MXC_ADC_LowPowerModeDividerSelect(mxc_adc_div_lpmode_t div_lpmode)
Configures Divider (0-12 channel) in the low power mode.
int MXC_ADC_Handler(void)
Call this function from the ADC ISR when using Async API functions.
void MXC_ADC_DisableInt(uint32_t flags)
Disable specific ADC interrupts.
int MXC_ADC_Shutdown(void)
Shuts down the ADC.
mxc_adc_fifodataformat_t
Data FIFO data format.
Definition: adc.h:198
void MXC_ADC_ConversionModeConfig(mxc_adc_conversion_req_t *req)
Configures ADC Conversion Mode: Single vs Continuous Conversion.
@ MXC_ADC_AVG_32
Select Channel 5.
Definition: adc.h:90
@ MXC_ADC_AVG_1
Select Channel 0.
Definition: adc.h:85
@ MXC_ADC_AVG_8
Select Channel 3.
Definition: adc.h:88
@ MXC_ADC_AVG_16
Select Channel 4.
Definition: adc.h:89
@ MXC_ADC_AVG_2
Select Channel 1.
Definition: adc.h:86
@ MXC_ADC_AVG_4
Select Channel 2.
Definition: adc.h:87
@ MXC_ADC_SKIP_CAL
Skip calibration on power-up.
Definition: adc.h:130
@ MXC_ADC_EN_CAL
Calibrate on power-up.
Definition: adc.h:131
@ MXC_ADC_PY_DN_DISABLE
Disable Dynamic Divider Pullup.
Definition: adc.h:208
@ MXC_ADC_PY_DN_ENABLE
Enable Dynamic Divider Pullup.
Definition: adc.h:209
@ MXC_ADC_TRIG_SEL_P1_13
GPIO Port 1, Pin 13.
Definition: adc.h:151
@ MXC_ADC_TRIG_SEL_TMR2
Timer 2 Out Rising Edge.
Definition: adc.h:148
@ MXC_ADC_TRIG_SEL_TEMP_SENS
Temperature Sensor Ready.
Definition: adc.h:153
@ MXC_ADC_TRIG_SEL_TMR1
Timer 1 Out Rising Edge.
Definition: adc.h:147
@ MXC_ADC_TRIG_SEL_P1_14
GPIO Port 1, Pin 14.
Definition: adc.h:152
@ MXC_ADC_TRIG_SEL_TMR3
Timer 3 Out Rising Edge.
Definition: adc.h:149
@ MXC_ADC_TRIG_SEL_P1_12
GPIO Port 1, Pin 12.
Definition: adc.h:150
@ MXC_ADC_TRIG_SEL_TMR0
Timer 0 Out Rising edge.
Definition: adc.h:146
@ MXC_ADC_TRIG_SOFTWARE
Software Trigger.
Definition: adc.h:138
@ MXC_ADC_TRIG_HARDWARE
Hardware Trigger.
Definition: adc.h:139
@ MXC_ADC_CLKDIV_16
ADC Scale by 1/16.
Definition: adc.h:112
@ MXC_ADC_CLKDIV_8
ADC Scale by 1/8.
Definition: adc.h:111
@ MXC_ADC_CLKDIV_4
ADC Scale by 1/4.
Definition: adc.h:110
@ MXC_ADC_CLKDIV_2
ADC Scale by 1/2.
Definition: adc.h:109
@ MXC_ADC_CLKDIV_1
ADC Scale by 1x (no scaling)
Definition: adc.h:113
@ MXC_ADC_CH_VLDO_2P5_DIV4
Select Channel 10, VLDO_2P5DIV4.
Definition: adc.h:70
@ MXC_ADC_CH_VCOREA
Select Channel 8, VCOREA.
Definition: adc.h:68
@ MXC_ADC_CH_6
Select Channel 6.
Definition: adc.h:66
@ MXC_ADC_CH_3
Select Channel 3.
Definition: adc.h:63
@ MXC_ADC_CH_0
Select Channel 0.
Definition: adc.h:60
@ MXC_ADC_CH_VDDA_DIV2
Select Channel 12, VDDA_DIV2.
Definition: adc.h:72
@ MXC_ADC_CH_VCOREB
Select Channel 9, VCOREB.
Definition: adc.h:69
@ MXC_ADC_CH_1
Select Channel 1.
Definition: adc.h:61
@ MXC_ADC_CH_7
Select Channel 7.
Definition: adc.h:67
@ MXC_ADC_CH_VBB_DIV4
Select Channel 14, VBB_DIV4.
Definition: adc.h:74
@ MXC_ADC_CH_5
Select Channel 5.
Definition: adc.h:65
@ MXC_ADC_CH_2
Select Channel 2.
Definition: adc.h:62
@ MXC_ADC_CH_VDDB_DIV4
Select Channel 14, VDDB_DIV4.
Definition: adc.h:75
@ MXC_ADC_CH_VSS
Select Channel 16, VSS.
Definition: adc.h:76
@ MXC_ADC_CH_VLDO_0P9
Select Channel 11, VLDO_0P9.
Definition: adc.h:71
@ MXC_ADC_CH_4
Select Channel 4.
Definition: adc.h:64
@ MXC_ADC_CH_TEMP_SENSOR
Select Channel 13, VDDA_DIV2.
Definition: adc.h:73
@ MXC_ADC_DIV_2_5K_50K_ENABLE
2.5K and 50K divide by 2 enable in lpmode
Definition: adc.h:189
@ MXC_ADC_DIV_2_5K_50K_DISABLE
2.5K and 50K divide by 2 disable in lpmode
Definition: adc.h:192
@ MXC_ADC_DIV_2_5K_DISABLE
2.5K disable and 50K divide by 2 enable in lpmode
Definition: adc.h:190
@ MXC_ADC_DIV_50K_DISABLE
2.5K enable and 50K divide by 2 disable in lpmode
Definition: adc.h:191
@ MXC_ADC_CONTINUOUS_CONV
Hardware Trigger.
Definition: adc.h:161
@ MXC_ADC_ATOMIC_CONV
Software Trigger.
Definition: adc.h:160
@ MXC_ADC_REF_EXT
Use external reference voltage source.
Definition: adc.h:179
@ MXC_ADC_REF_INT_1V25
Use internal 1.25V source.
Definition: adc.h:180
@ MXC_ADC_REF_INT_2V048
Use internal 2.048V souce.
Definition: adc.h:181
@ MXC_ADC_DIV1
No input divider.
Definition: adc.h:168
@ MXC_ADC_DIV2_5K
Divide analog input by two with 5K resistor.
Definition: adc.h:169
@ MXC_ADC_DIV2_50K
Divide analog input by two with 50K resistor.
Definition: adc.h:171
@ MXC_ADC_CLK_HCLK
HCLK CLock.
Definition: adc.h:120
@ MXC_ADC_CLK_IBRO
IBRO Clock.
Definition: adc.h:122
@ MXC_ADC_CLK_EXT
External Clock.
Definition: adc.h:121
@ MXC_ADC_CLK_ERFO
ERFO Clock.
Definition: adc.h:123
@ MXC_ADC_DATA_STATUS
Data(12-bit) plus Status.
Definition: adc.h:199
@ MXC_ADC_DATA
Data(12-bit) only.
Definition: adc.h:200
@ MXC_ADC_RAW_DATA
18-bit raw data
Definition: adc.h:201
ADC Conversion Settings.
Definition: adc.h:239
ADC Settings.
Definition: adc.h:218
ADC Slot Settings.
Definition: adc.h:230
Registers, Bit Masks and Bit Positions for the MCR Peripheral Module.