RTEMS 6.1-rc5
Loading...
Searching...
No Matches
fsl_lpadc.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016, Freescale Semiconductor, Inc.
3 * Copyright 2016-2022 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8#ifndef _FSL_LPADC_H_
9#define _FSL_LPADC_H_
10
11#include "fsl_common.h"
12
20/*******************************************************************************
21 * Definitions
22 ******************************************************************************/
23
27#define FSL_LPADC_DRIVER_VERSION (MAKE_VERSION(2, 6, 1))
35#define LPADC_GET_ACTIVE_COMMAND_STATUS(statusVal) ((statusVal & ADC_STAT_CMDACT_MASK) >> ADC_STAT_CMDACT_SHIFT)
36
42#define LPADC_GET_ACTIVE_TRIGGER_STATUE(statusVal) ((statusVal & ADC_STAT_TRGACT_MASK) >> ADC_STAT_TRGACT_SHIFT)
43
44#if (defined(FSL_FEATURE_LPADC_FIFO_COUNT) && (FSL_FEATURE_LPADC_FIFO_COUNT == 2))
49{
50 kLPADC_ResultFIFO0OverflowFlag = ADC_STAT_FOF0_MASK,
52 kLPADC_ResultFIFO0ReadyFlag = ADC_STAT_RDY0_MASK,
54 kLPADC_ResultFIFO1OverflowFlag = ADC_STAT_FOF1_MASK,
56 kLPADC_ResultFIFO1ReadyFlag = ADC_STAT_RDY1_MASK,
58};
59
64{
65 kLPADC_ResultFIFO0OverflowInterruptEnable = ADC_IE_FOFIE0_MASK,
67 kLPADC_FIFO0WatermarkInterruptEnable = ADC_IE_FWMIE0_MASK,
69 kLPADC_ResultFIFO1OverflowInterruptEnable = ADC_IE_FOFIE1_MASK,
71 kLPADC_FIFO1WatermarkInterruptEnable = ADC_IE_FWMIE1_MASK,
73#if (defined(FSL_FEATURE_LPADC_HAS_TSTAT) && FSL_FEATURE_LPADC_HAS_TSTAT)
74 kLPADC_TriggerExceptionInterruptEnable = ADC_IE_TEXC_IE_MASK,
76 kLPADC_Trigger0CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 0UL),
78 kLPADC_Trigger1CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 1UL),
80 kLPADC_Trigger2CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 2UL),
82 kLPADC_Trigger3CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 3UL),
84 kLPADC_Trigger4CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 4UL),
86 kLPADC_Trigger5CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 5UL),
88 kLPADC_Trigger6CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 6UL),
90 kLPADC_Trigger7CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 7UL),
92 kLPADC_Trigger8CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 8UL),
94 kLPADC_Trigger9CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 9UL),
96 kLPADC_Trigger10CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 10UL),
98 kLPADC_Trigger11CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 11UL),
100 kLPADC_Trigger12CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 12UL),
102 kLPADC_Trigger13CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 13UL),
104 kLPADC_Trigger14CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 14UL),
106 kLPADC_Trigger15CompletionInterruptEnable = ADC_IE_TCOMP_IE(1UL << 15UL),
108#endif /* FSL_FEATURE_LPADC_HAS_TSTAT */
109};
110#else
115{
116 kLPADC_ResultFIFOOverflowFlag = ADC_STAT_FOF_MASK,
118 kLPADC_ResultFIFOReadyFlag = ADC_STAT_RDY_MASK,
120};
121
126{
127 kLPADC_ResultFIFOOverflowInterruptEnable = ADC_IE_FOFIE_MASK,
129 kLPADC_FIFOWatermarkInterruptEnable = ADC_IE_FWMIE_MASK,
131};
132#endif /* FSL_FEATURE_LPADC_FIFO_COUNT */
133
134#if (defined(FSL_FEATURE_LPADC_HAS_TSTAT) && FSL_FEATURE_LPADC_HAS_TSTAT)
138enum _lpadc_trigger_status_flags
139{
140 kLPADC_Trigger0InterruptedFlag = 1UL << 0UL,
141 kLPADC_Trigger1InterruptedFlag = 1UL << 1UL,
142 kLPADC_Trigger2InterruptedFlag = 1UL << 2UL,
143 kLPADC_Trigger3InterruptedFlag = 1UL << 3UL,
144 kLPADC_Trigger4InterruptedFlag = 1UL << 4UL,
145 kLPADC_Trigger5InterruptedFlag = 1UL << 5UL,
146 kLPADC_Trigger6InterruptedFlag = 1UL << 6UL,
147 kLPADC_Trigger7InterruptedFlag = 1UL << 7UL,
148 kLPADC_Trigger8InterruptedFlag = 1UL << 8UL,
149 kLPADC_Trigger9InterruptedFlag = 1UL << 9UL,
150 kLPADC_Trigger10InterruptedFlag = 1UL << 10UL,
151 kLPADC_Trigger11InterruptedFlag = 1UL << 11UL,
152 kLPADC_Trigger12InterruptedFlag = 1UL << 12UL,
153 kLPADC_Trigger13InterruptedFlag = 1UL << 13UL,
154 kLPADC_Trigger14InterruptedFlag = 1UL << 14UL,
155 kLPADC_Trigger15InterruptedFlag = 1UL << 15UL,
157 kLPADC_Trigger0CompletedFlag = 1UL << 16UL,
159 kLPADC_Trigger1CompletedFlag = 1UL << 17UL,
161 kLPADC_Trigger2CompletedFlag = 1UL << 18UL,
163 kLPADC_Trigger3CompletedFlag = 1UL << 19UL,
165 kLPADC_Trigger4CompletedFlag = 1UL << 20UL,
167 kLPADC_Trigger5CompletedFlag = 1UL << 21UL,
169 kLPADC_Trigger6CompletedFlag = 1UL << 22UL,
171 kLPADC_Trigger7CompletedFlag = 1UL << 23UL,
173 kLPADC_Trigger8CompletedFlag = 1UL << 24UL,
175 kLPADC_Trigger9CompletedFlag = 1UL << 25UL,
177 kLPADC_Trigger10CompletedFlag = 1UL << 26UL,
179 kLPADC_Trigger11CompletedFlag = 1UL << 27UL,
181 kLPADC_Trigger12CompletedFlag = 1UL << 28UL,
183 kLPADC_Trigger13CompletedFlag = 1UL << 29UL,
185 kLPADC_Trigger14CompletedFlag = 1UL << 30UL,
187 kLPADC_Trigger15CompletedFlag = 1UL << 31UL,
189};
190#endif /* FSL_FEATURE_LPADC_HAS_TSTAT */
191
201{
203 0U,
206
213{
216#if defined(FSL_FEATURE_LPADC_HAS_CMDL_DIFF) && FSL_FEATURE_LPADC_HAS_CMDL_DIFF
217 kLPADC_SampleChannelDiffBothSideAB = 2U,
218 kLPADC_SampleChannelDiffBothSideBA = 3U,
219#elif defined(FSL_FEATURE_LPADC_HAS_CMDL_CTYPE) && FSL_FEATURE_LPADC_HAS_CMDL_CTYPE
220 kLPADC_SampleChannelDiffBothSide = 2U,
221 kLPADC_SampleChannelDualSingleEndBothSide =
222 3U,
223#endif
225
233{
242#if (defined(FSL_FEATURE_LPADC_CONVERSIONS_AVERAGED_BITFIELD_WIDTH) && \
243 (FSL_FEATURE_LPADC_CONVERSIONS_AVERAGED_BITFIELD_WIDTH == 4))
244 kLPADC_HardwareAverageCount256 = 8U,
245 kLPADC_HardwareAverageCount512 = 9U,
246 kLPADC_HardwareAverageCount1024 = 10U,
247#endif /* FSL_FEATURE_LPADC_CONVERSIONS_AVERAGED_BITFIELD_WIDTH */
249
258{
268
277{
282
283#if defined(FSL_FEATURE_LPADC_HAS_CMDL_MODE) && FSL_FEATURE_LPADC_HAS_CMDL_MODE
290typedef enum _lpadc_conversion_resolution_mode
291{
292 kLPADC_ConversionResolutionStandard = 0U,
294 kLPADC_ConversionResolutionHigh = 1U,
296} lpadc_conversion_resolution_mode_t;
297#endif /* FSL_FEATURE_LPADC_HAS_CMDL_MODE */
298
299#if defined(FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS) && FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS
305typedef enum _lpadc_conversion_average_mode
306{
307 kLPADC_ConversionAverage1 = 0U,
308 kLPADC_ConversionAverage2 = 1U,
309 kLPADC_ConversionAverage4 = 2U,
310 kLPADC_ConversionAverage8 = 3U,
311 kLPADC_ConversionAverage16 = 4U,
312 kLPADC_ConversionAverage32 = 5U,
313 kLPADC_ConversionAverage64 = 6U,
314 kLPADC_ConversionAverage128 = 7U,
315#if (defined(FSL_FEATURE_LPADC_CONVERSIONS_AVERAGED_BITFIELD_WIDTH) && \
316 (FSL_FEATURE_LPADC_CONVERSIONS_AVERAGED_BITFIELD_WIDTH == 4))
317 kLPADC_ConversionAverage256 = 8U,
318 kLPADC_ConversionAverage512 = 9U,
319 kLPADC_ConversionAverage1024 = 10U,
320#endif /* FSL_FEATURE_LPADC_CONVERSIONS_AVERAGED_BITFIELD_WIDTH */
321} lpadc_conversion_average_mode_t;
322#endif /* FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS */
323
330{
335
343{
349
350#if (defined(FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE) && FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE)
355typedef enum _lpadc_offset_calibration_mode
356{
357 kLPADC_OffsetCalibration12bitMode = 0U,
358 kLPADC_OffsetCalibration16bitMode = 1U,
359} lpadc_offset_calibration_mode_t;
360#endif /* FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE */
361
368{
376#if defined(FSL_FEATURE_LPADC_HAS_CFG_SUBSEQUENT_PRIORITY) && FSL_FEATURE_LPADC_HAS_CFG_SUBSEQUENT_PRIORITY
377 kLPADC_TriggerPriorityPreemptSubsequently = 2U,
380#endif /* FSL_FEATURE_LPADC_HAS_CFG_SUBSEQUENT_PRIORITY */
382
388typedef struct
389{
390#if defined(FSL_FEATURE_LPADC_HAS_CFG_ADCKEN) && FSL_FEATURE_LPADC_HAS_CFG_ADCKEN
391 bool enableInternalClock;
393#endif /* FSL_FEATURE_LPADC_HAS_CFG_ADCKEN */
394#if defined(FSL_FEATURE_LPADC_HAS_CFG_VREF1RNG) && FSL_FEATURE_LPADC_HAS_CFG_VREF1RNG
395 bool enableVref1LowVoltage;
397#endif /* FSL_FEATURE_LPADC_HAS_CFG_VREF1RNG */
402#if defined(FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS) && FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS
403 lpadc_conversion_average_mode_t conversionAverageMode;
404#endif /* FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS */
407 uint32_t powerUpDelay;
415#if !(defined(FSL_FEATURE_LPADC_HAS_CFG_PWRSEL) && (FSL_FEATURE_LPADC_HAS_CFG_PWRSEL == 0))
417#endif /* FSL_FEATURE_LPADC_HAS_CFG_PWRSEL */
423 uint32_t convPauseDelay;
426#if (defined(FSL_FEATURE_LPADC_FIFO_COUNT) && (FSL_FEATURE_LPADC_FIFO_COUNT == 2))
427 /* for FIFO0. */
428 uint32_t FIFO0Watermark;
431 /* for FIFO1. */
432 uint32_t FIFO1Watermark;
435#else
436 /* for FIFO. */
437 uint32_t FIFOWatermark;
440#endif /* FSL_FEATURE_LPADC_FIFO_COUNT */
442
446typedef struct
447{
448#if defined(FSL_FEATURE_LPADC_HAS_CMDL_CSCALE) && FSL_FEATURE_LPADC_HAS_CMDL_CSCALE
449 lpadc_sample_scale_mode_t sampleScaleMode;
450#endif /* FSL_FEATURE_LPADC_HAS_CMDL_CSCALE */
451#if defined(FSL_FEATURE_LPADC_HAS_CMDL_ALTB_CSCALE) && FSL_FEATURE_LPADC_HAS_CMDL_ALTB_CSCALE
452 lpadc_sample_scale_mode_t channelBScaleMode;
453#endif /* FSL_FEATURE_LPADC_HAS_CMDL_ALTB_CSCALE */
455 uint32_t channelNumber;
456#if defined(FSL_FEATURE_LPADC_HAS_CMDL_ALTB_ADCH) && FSL_FEATURE_LPADC_HAS_CMDL_ALTB_ADCH
457 uint32_t channelBNumber;
458#endif
465 uint32_t loopCount;
473#if defined(FSL_FEATURE_LPADC_HAS_CMDL_MODE) && FSL_FEATURE_LPADC_HAS_CMDL_MODE
474 lpadc_conversion_resolution_mode_t conversionResolutionMode;
475#endif /* FSL_FEATURE_LPADC_HAS_CMDL_MODE */
476#if defined(FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG) && FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG
477 bool enableWaitTrigger;
480#endif /* FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG */
481#if defined(FSL_FEATURE_LPADC_HAS_CMDL_ALTBEN) && FSL_FEATURE_LPADC_HAS_CMDL_ALTBEN
482 bool enableChannelB;
483#endif /* FSL_FEATURE_LPADC_HAS_CMDL_ALTBEN */
485
489typedef struct
490{
493 uint32_t delayPower;
497 uint32_t priority;
500#if (defined(FSL_FEATURE_LPADC_FIFO_COUNT) && (FSL_FEATURE_LPADC_FIFO_COUNT == 2))
501 uint8_t channelAFIFOSelect; /* SAR Result Destination For Channel A. */
502 uint8_t channelBFIFOSelect; /* SAR Result Destination For Channel B. */
503#endif /* FSL_FEATURE_LPADC_FIFO_COUNT */
507
511typedef struct
512{
514 uint32_t loopCountIndex;
516 uint16_t convValue;
518
519#if defined(__cplusplus)
520extern "C" {
521#endif
522
523/*******************************************************************************
524 * API
525 ******************************************************************************/
537void LPADC_Init(ADC_Type *base, const lpadc_config_t *config);
538
557
563void LPADC_Deinit(ADC_Type *base);
564
571static inline void LPADC_Enable(ADC_Type *base, bool enable)
572{
573 if (enable)
574 {
575 base->CTRL |= ADC_CTRL_ADCEN_MASK;
576 }
577 else
578 {
579 base->CTRL &= ~ADC_CTRL_ADCEN_MASK;
580 }
581}
582
583#if (defined(FSL_FEATURE_LPADC_FIFO_COUNT) && (FSL_FEATURE_LPADC_FIFO_COUNT == 2))
589static inline void LPADC_DoResetFIFO0(ADC_Type *base)
590{
591 base->CTRL |= ADC_CTRL_RSTFIFO0_MASK;
592}
593
599static inline void LPADC_DoResetFIFO1(ADC_Type *base)
600{
601 base->CTRL |= ADC_CTRL_RSTFIFO1_MASK;
602}
603#else
609static inline void LPADC_DoResetFIFO(ADC_Type *base)
610{
611 base->CTRL |= ADC_CTRL_RSTFIFO_MASK;
612}
613#endif /* FSL_FEATURE_LPADC_FIFO_COUNT */
614
622static inline void LPADC_DoResetConfig(ADC_Type *base)
623{
624 base->CTRL |= ADC_CTRL_RST_MASK;
625 base->CTRL &= ~ADC_CTRL_RST_MASK;
626}
627
628/* @} */
629
641static inline uint32_t LPADC_GetStatusFlags(ADC_Type *base)
642{
643 return base->STAT;
644}
645
654static inline void LPADC_ClearStatusFlags(ADC_Type *base, uint32_t mask)
655{
656 base->STAT = mask;
657}
658
659#if (defined(FSL_FEATURE_LPADC_HAS_TSTAT) && FSL_FEATURE_LPADC_HAS_TSTAT)
667static inline uint32_t LPADC_GetTriggerStatusFlags(ADC_Type *base)
668{
669 return base->TSTAT;
670}
671
679static inline void LPADC_ClearTriggerStatusFlags(ADC_Type *base, uint32_t mask)
680{
681 base->TSTAT = mask;
682}
683#endif /* FSL_FEATURE_LPADC_HAS_TSTAT */
684
685/* @} */
686
698static inline void LPADC_EnableInterrupts(ADC_Type *base, uint32_t mask)
699{
700 base->IE |= mask;
701}
702
709static inline void LPADC_DisableInterrupts(ADC_Type *base, uint32_t mask)
710{
711 base->IE &= ~mask;
712}
713
719#if (defined(FSL_FEATURE_LPADC_FIFO_COUNT) && (FSL_FEATURE_LPADC_FIFO_COUNT == 2))
726static inline void LPADC_EnableFIFO0WatermarkDMA(ADC_Type *base, bool enable)
727{
728 if (enable)
729 {
730 base->DE |= ADC_DE_FWMDE0_MASK;
731 }
732 else
733 {
734 base->DE &= ~ADC_DE_FWMDE0_MASK;
735 }
736}
737
744static inline void LPADC_EnableFIFO1WatermarkDMA(ADC_Type *base, bool enable)
745{
746 if (enable)
747 {
748 base->DE |= ADC_DE_FWMDE1_MASK;
749 }
750 else
751 {
752 base->DE &= ~ADC_DE_FWMDE1_MASK;
753 }
754}
755#else
762static inline void LPADC_EnableFIFOWatermarkDMA(ADC_Type *base, bool enable)
763{
764 if (enable)
765 {
766 base->DE |= ADC_DE_FWMDE_MASK;
767 }
768 else
769 {
770 base->DE &= ~ADC_DE_FWMDE_MASK;
771 }
772}
773#endif /* FSL_FEATURE_LPADC_FIFO_COUNT */
774 /* @} */
775
781#if (defined(FSL_FEATURE_LPADC_FIFO_COUNT) && (FSL_FEATURE_LPADC_FIFO_COUNT == 2))
789static inline uint32_t LPADC_GetConvResultCount(ADC_Type *base, uint8_t index)
790{
791 return (ADC_FCTRL_FCOUNT_MASK & base->FCTRL[index]) >> ADC_FCTRL_FCOUNT_SHIFT;
792}
793
803bool LPADC_GetConvResult(ADC_Type *base, lpadc_conv_result_t *result, uint8_t index);
804#else
811static inline uint32_t LPADC_GetConvResultCount(ADC_Type *base)
812{
813 return (ADC_FCTRL_FCOUNT_MASK & base->FCTRL) >> ADC_FCTRL_FCOUNT_SHIFT;
814}
815
825#endif /* FSL_FEATURE_LPADC_FIFO_COUNT */
826
836void LPADC_SetConvTriggerConfig(ADC_Type *base, uint32_t triggerId, const lpadc_conv_trigger_config_t *config);
837
851
858static inline void LPADC_DoSoftwareTrigger(ADC_Type *base, uint32_t triggerIdMask)
859{
860 /* Writes to ADCx_SWTRIG register are ignored while ADCx_CTRL[ADCEN] is clear. */
861 base->SWTRIG = triggerIdMask;
862}
863
864#if defined(FSL_FEATURE_LPADC_HAS_TCTRL_CMD_SEL) && FSL_FEATURE_LPADC_HAS_TCTRL_CMD_SEL
875static inline void LPADC_EnableHardwareTriggerCommandSelection(ADC_Type *base, uint32_t triggerId, bool enable)
876{
877 if (enable)
878 {
879 base->TCTRL[triggerId] |= ADC_TCTRL_CMD_SEL_MASK;
880 }
881 else
882 {
883 base->TCTRL[triggerId] &= ~ADC_TCTRL_CMD_SEL_MASK;
884 }
885}
886#endif /* FSL_FEATURE_LPADC_HAS_TCTRL_CMD_SEL*/
887
895void LPADC_SetConvCommandConfig(ADC_Type *base, uint32_t commandId, const lpadc_conv_command_config_t *config);
896
922
923#if defined(FSL_FEATURE_LPADC_HAS_CFG_CALOFS) && FSL_FEATURE_LPADC_HAS_CFG_CALOFS
936void LPADC_EnableCalibration(ADC_Type *base, bool enable);
937#if defined(FSL_FEATURE_LPADC_HAS_OFSTRIM) && FSL_FEATURE_LPADC_HAS_OFSTRIM
947static inline void LPADC_SetOffsetValue(ADC_Type *base, uint32_t value)
948{
949 base->OFSTRIM = (value & ADC_OFSTRIM_OFSTRIM_MASK) >> ADC_OFSTRIM_OFSTRIM_SHIFT;
950}
951
962void LPADC_DoAutoCalibration(ADC_Type *base);
963#endif /* FSL_FEATURE_LPADC_HAS_OFSTRIM */
964#endif /* FSL_FEATURE_LPADC_HAS_CFG_CALOFS */
965
966#if defined(FSL_FEATURE_LPADC_HAS_CTRL_CALOFS) && FSL_FEATURE_LPADC_HAS_CTRL_CALOFS
967#if defined(FSL_FEATURE_LPADC_HAS_OFSTRIM) && FSL_FEATURE_LPADC_HAS_OFSTRIM
978static inline void LPADC_SetOffsetValue(ADC_Type *base, uint32_t valueA, uint32_t valueB)
979{
980 base->OFSTRIM = ADC_OFSTRIM_OFSTRIM_A(valueA) | ADC_OFSTRIM_OFSTRIM_B(valueB);
981}
982#else
993static inline void LPADC_SetOffset12BitValue(ADC_Type *base, uint32_t valueA, uint32_t valueB)
994{
995 base->OFSTRIM12 = ADC_OFSTRIM12_OFSTRIM_A(valueA) | ADC_OFSTRIM12_OFSTRIM_A(valueB);
996}
997
1008static inline void LPADC_SetOffset16BitValue(ADC_Type *base, uint32_t valueA, uint32_t valueB)
1009{
1010 base->OFSTRIM16 = ADC_OFSTRIM16_OFSTRIM_A(valueA) | ADC_OFSTRIM16_OFSTRIM_B(valueB);
1011}
1012#endif /* FSL_FEATURE_LPADC_HAS_OFSTRIM */
1013
1020static inline void LPADC_EnableOffsetCalibration(ADC_Type *base, bool enable)
1021{
1022 if (enable)
1023 {
1024 base->CTRL |= ADC_CTRL_CALOFS_MASK;
1025 }
1026 else
1027 {
1028 base->CTRL &= ~ADC_CTRL_CALOFS_MASK;
1029 }
1030}
1031#if defined(FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE) && FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE
1038static inline void LPADC_SetOffsetCalibrationMode(ADC_Type *base, lpadc_offset_calibration_mode_t mode)
1039{
1040 base->CTRL = (base->CTRL & ~ADC_CTRL_CALOFSMODE_MASK) | ADC_CTRL_CALOFSMODE(mode);
1041}
1042
1043#endif /* FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE */
1044
1050void LPADC_DoOffsetCalibration(ADC_Type *base);
1051
1052#if defined(FSL_FEATURE_LPADC_HAS_CTRL_CAL_REQ) && FSL_FEATURE_LPADC_HAS_CTRL_CAL_REQ
1058void LPADC_DoAutoCalibration(ADC_Type *base);
1059#endif /* FSL_FEATURE_LPADC_HAS_CTRL_CAL_REQ */
1060#endif /* FSL_FEATURE_LPADC_HAS_CTRL_CALOFS */
1061
1062/* @} */
1063
1064#if defined(__cplusplus)
1065}
1066#endif
1070#endif /* _FSL_LPADC_H_ */
uint32_t powerUpDelay
Definition: fsl_lpadc.h:407
bool LPADC_GetConvResult(ADC_Type *base, lpadc_conv_result_t *result)
Get the result in conversion FIFO.
Definition: fsl_lpadc.c:299
lpadc_hardware_average_mode_t hardwareAverageMode
Definition: fsl_lpadc.h:467
_lpadc_sample_scale_mode
Define enumeration of sample scale mode.
Definition: fsl_lpadc.h:201
_lpadc_sample_time_mode
Define enumeration of sample time selection.
Definition: fsl_lpadc.h:258
enum _lpadc_hardware_average_mode lpadc_hardware_average_mode_t
Define enumeration of hardware average selection.
lpadc_sample_time_mode_t sampleTimeMode
Definition: fsl_lpadc.h:468
uint32_t priority
Definition: fsl_lpadc.h:497
bool enableHardwareTrigger
Definition: fsl_lpadc.h:504
uint32_t delayPower
Definition: fsl_lpadc.h:493
uint32_t channelNumber
Definition: fsl_lpadc.h:455
void LPADC_GetDefaultConvTriggerConfig(lpadc_conv_trigger_config_t *config)
Gets an available pre-defined settings for trigger's configuration.
Definition: fsl_lpadc.c:369
uint16_t convValue
Definition: fsl_lpadc.h:516
uint32_t hardwareCompareValueHigh
Definition: fsl_lpadc.h:471
void LPADC_SetConvCommandConfig(ADC_Type *base, uint32_t commandId, const lpadc_conv_command_config_t *config)
Configure conversion command.
Definition: fsl_lpadc.c:393
bool enableConvPause
Definition: fsl_lpadc.h:420
lpadc_hardware_compare_mode_t hardwareCompareMode
Definition: fsl_lpadc.h:470
bool enableAutoChannelIncrement
Definition: fsl_lpadc.h:461
lpadc_trigger_priority_policy_t triggerPriorityPolicy
Definition: fsl_lpadc.h:418
void LPADC_SetConvTriggerConfig(ADC_Type *base, uint32_t triggerId, const lpadc_conv_trigger_config_t *config)
Configure the conversion trigger source.
Definition: fsl_lpadc.c:330
_lpadc_sample_channel_mode
Define enumeration of channel sample mode.
Definition: fsl_lpadc.h:213
uint32_t loopCount
Definition: fsl_lpadc.h:465
uint32_t commandIdSource
Definition: fsl_lpadc.h:513
uint32_t loopCountIndex
Definition: fsl_lpadc.h:514
void LPADC_GetDefaultConfig(lpadc_config_t *config)
Gets an available pre-defined settings for initial configuration.
Definition: fsl_lpadc.c:211
uint32_t convPauseDelay
Definition: fsl_lpadc.h:423
void LPADC_GetDefaultConvCommandConfig(lpadc_conv_command_config_t *config)
Gets an available pre-defined settings for conversion command's configuration.
Definition: fsl_lpadc.c:506
lpadc_power_level_mode_t powerLevelMode
Definition: fsl_lpadc.h:416
enum _lpadc_reference_voltage_mode lpadc_reference_voltage_source_t
Define enumeration of reference voltage source.
bool enableAnalogPreliminary
Definition: fsl_lpadc.h:405
enum _lpadc_sample_time_mode lpadc_sample_time_mode_t
Define enumeration of sample time selection.
enum _lpadc_hardware_compare_mode lpadc_hardware_compare_mode_t
Define enumeration of hardware compare mode.
void LPADC_Deinit(ADC_Type *base)
De-initializes the LPADC module.
Definition: fsl_lpadc.c:249
bool enableInDozeMode
Definition: fsl_lpadc.h:398
enum _lpadc_sample_scale_mode lpadc_sample_scale_mode_t
Define enumeration of sample scale mode.
enum _lpadc_power_level_mode lpadc_power_level_mode_t
Define enumeration of power configuration.
_lpadc_hardware_average_mode
Define enumeration of hardware average selection.
Definition: fsl_lpadc.h:233
uint32_t triggerIdSource
Definition: fsl_lpadc.h:515
lpadc_sample_channel_mode_t sampleChannelMode
Definition: fsl_lpadc.h:454
_lpadc_trigger_priority_policy
Define enumeration of trigger priority policy.
Definition: fsl_lpadc.h:368
enum _lpadc_trigger_priority_policy lpadc_trigger_priority_policy_t
Define enumeration of trigger priority policy.
uint32_t chainedNextCommandNumber
Definition: fsl_lpadc.h:459
uint32_t hardwareCompareValueLow
Definition: fsl_lpadc.h:472
uint32_t targetCommandId
Definition: fsl_lpadc.h:491
_lpadc_power_level_mode
Define enumeration of power configuration.
Definition: fsl_lpadc.h:343
uint32_t FIFOWatermark
Definition: fsl_lpadc.h:437
_lpadc_interrupt_enable
Define interrupt switchers of the module.
Definition: fsl_lpadc.h:126
enum _lpadc_sample_channel_mode lpadc_sample_channel_mode_t
Define enumeration of channel sample mode.
_lpadc_hardware_compare_mode
Define enumeration of hardware compare mode.
Definition: fsl_lpadc.h:277
void LPADC_Init(ADC_Type *base, const lpadc_config_t *config)
Initializes the LPADC module.
Definition: fsl_lpadc.c:102
lpadc_reference_voltage_source_t referenceVoltageSource
Definition: fsl_lpadc.h:412
_lpadc_status_flags
Define hardware flags of the module.
Definition: fsl_lpadc.h:115
_lpadc_reference_voltage_mode
Define enumeration of reference voltage source.
Definition: fsl_lpadc.h:330
@ kLPADC_SamplePartScale
Definition: fsl_lpadc.h:202
@ kLPADC_SampleFullScale
Definition: fsl_lpadc.h:204
@ kLPADC_SampleTimeADCK5
Definition: fsl_lpadc.h:260
@ kLPADC_SampleTimeADCK11
Definition: fsl_lpadc.h:262
@ kLPADC_SampleTimeADCK67
Definition: fsl_lpadc.h:265
@ kLPADC_SampleTimeADCK19
Definition: fsl_lpadc.h:263
@ kLPADC_SampleTimeADCK35
Definition: fsl_lpadc.h:264
@ kLPADC_SampleTimeADCK7
Definition: fsl_lpadc.h:261
@ kLPADC_SampleTimeADCK3
Definition: fsl_lpadc.h:259
@ kLPADC_SampleTimeADCK131
Definition: fsl_lpadc.h:266
@ kLPADC_SampleChannelSingleEndSideB
Definition: fsl_lpadc.h:215
@ kLPADC_SampleChannelSingleEndSideA
Definition: fsl_lpadc.h:214
@ kLPADC_HardwareAverageCount2
Definition: fsl_lpadc.h:235
@ kLPADC_HardwareAverageCount64
Definition: fsl_lpadc.h:240
@ kLPADC_HardwareAverageCount4
Definition: fsl_lpadc.h:236
@ kLPADC_HardwareAverageCount8
Definition: fsl_lpadc.h:237
@ kLPADC_HardwareAverageCount32
Definition: fsl_lpadc.h:239
@ kLPADC_HardwareAverageCount128
Definition: fsl_lpadc.h:241
@ kLPADC_HardwareAverageCount16
Definition: fsl_lpadc.h:238
@ kLPADC_HardwareAverageCount1
Definition: fsl_lpadc.h:234
@ kLPADC_TriggerPriorityPreemptImmediately
Definition: fsl_lpadc.h:369
@ kLPADC_TriggerPriorityPreemptSoftly
Definition: fsl_lpadc.h:372
@ kLPADC_PowerLevelAlt4
Definition: fsl_lpadc.h:347
@ kLPADC_PowerLevelAlt1
Definition: fsl_lpadc.h:344
@ kLPADC_PowerLevelAlt2
Definition: fsl_lpadc.h:345
@ kLPADC_PowerLevelAlt3
Definition: fsl_lpadc.h:346
@ kLPADC_ResultFIFOOverflowInterruptEnable
Definition: fsl_lpadc.h:127
@ kLPADC_FIFOWatermarkInterruptEnable
Definition: fsl_lpadc.h:129
@ kLPADC_HardwareCompareStoreOnTrue
Definition: fsl_lpadc.h:279
@ kLPADC_HardwareCompareRepeatUntilTrue
Definition: fsl_lpadc.h:280
@ kLPADC_HardwareCompareDisabled
Definition: fsl_lpadc.h:278
@ kLPADC_ResultFIFOReadyFlag
Definition: fsl_lpadc.h:118
@ kLPADC_ResultFIFOOverflowFlag
Definition: fsl_lpadc.h:116
@ kLPADC_ReferenceVoltageAlt2
Definition: fsl_lpadc.h:332
@ kLPADC_ReferenceVoltageAlt3
Definition: fsl_lpadc.h:333
@ kLPADC_ReferenceVoltageAlt1
Definition: fsl_lpadc.h:331
Definition: MIMXRT1052.h:1298
Definition: deflate.c:114
LPADC global configuration.
Definition: fsl_lpadc.h:389
Define structure to keep the configuration for conversion command.
Definition: fsl_lpadc.h:447
Define the structure to keep the conversion result.
Definition: fsl_lpadc.h:512
Define structure to keep the configuration for conversion trigger.
Definition: fsl_lpadc.h:490