Driver API for AFEC (plib_afec0.h) More...
Data Structures | |
| struct | AFEC_CALLBACK_OBJECT |
| AFEC callback object structure (Harmony compatible). More... | |
Typedefs | |
| typedef uint32_t | AFEC_CHANNEL_NUM |
| AFEC channel number selection. | |
| typedef uint32_t | AFEC_CHANNEL_MASK |
| AFEC channel mask for enabling/disabling multiple channels. | |
| typedef uint32_t | AFEC_CHANNEL_GAIN |
| AFEC channel gain selection. | |
| typedef uint32_t | AFEC_INTERRUPT_MASK |
| AFEC interrupt mask for enabling/disabling interrupts. | |
| typedef uint32_t | AFEC_COMPARATOR_MODE |
| AFEC comparator mode selection. | |
| typedef uint32_t | AFEC_TRIGGER_SOURCE |
| AFEC trigger source selection. | |
| typedef uint32_t | AFEC_RESOLUTION |
| AFEC resolution selection. | |
| typedef uint32_t | AFEC_STARTUP_TIME |
| AFEC startup time selection. | |
| typedef uint32_t | AFEC_SIGN_MODE |
| AFEC sign mode selection. | |
| typedef uint32_t | AFEC_TEMP_CMP_MODE |
| AFEC temperature comparison mode selection. | |
| typedef void(* | AFEC_CALLBACK_HANDLER) (uint32_t status) |
| Simple AFEC interrupt callback handler type. | |
| typedef void(* | AFEC_CALLBACK) (uint32_t status, uintptr_t context) |
| AFEC interrupt callback type with context (Harmony compatible). | |
Functions | |
| void | AFEC0_SoftwareReset (void) |
| Software reset of AFEC0. | |
| void | AFEC0_SetPrescaler (uint8_t prescaler) |
| Sets the AFEC0 clock prescaler. | |
| void | AFEC0_SetStartupTime (AFEC_STARTUP_TIME startup) |
| Sets the AFEC0 startup time. | |
| void | AFEC0_SetTransferPeriod (uint8_t transfer) |
| Sets the AFEC0 transfer period. | |
| void | AFEC0_SetFreeRunMode (bool enable) |
| Enables or disables free run mode. | |
| void | AFEC0_SetSleepMode (bool enable) |
| Enables or disables sleep mode. | |
| void | AFEC0_SetFastWakeup (bool enable) |
| Enables or disables fast wakeup mode. | |
| void | AFEC0_SetTriggerEnable (bool enable) |
| Enables hardware trigger. | |
| void | AFEC0_SetTriggerSource (AFEC_TRIGGER_SOURCE trigger) |
| Sets the hardware trigger source. | |
| void | AFEC0_SetUserSequenceMode (bool enable) |
| Enables or disables user sequence mode. | |
| void | AFEC0_SetResolution (AFEC_RESOLUTION resolution) |
| Sets the AFEC0 resolution. | |
| void | AFEC0_SetSignMode (AFEC_SIGN_MODE signmode) |
| Sets the AFEC0 sign mode. | |
| void | AFEC0_SetTagMode (bool enable) |
| Enables or disables TAG mode. | |
| void | AFEC0_SetSingleTriggerMode (bool enable) |
| Enables or disables single trigger mode. | |
| void | AFEC0_ChannelsEnable (AFEC_CHANNEL_MASK channelsMask) |
| Enables AFEC0 channels. | |
| void | AFEC0_ChannelsDisable (AFEC_CHANNEL_MASK channelsMask) |
| Disables AFEC0 channels. | |
| void | AFEC0_ChannelsInterruptEnable (AFEC_INTERRUPT_MASK channelsInterruptMask) |
| Enables channel end of conversion interrupts. | |
| void | AFEC0_ChannelsInterruptDisable (AFEC_INTERRUPT_MASK channelsInterruptMask) |
| Disables channel end of conversion interrupts. | |
| uint32_t | AFEC0_ChannelsStatusGet (void) |
| Gets the channel status. | |
| void | AFEC0_ConversionStart (void) |
| Starts an AFEC0 conversion. | |
| bool | AFEC0_ChannelResultIsReady (AFEC_CHANNEL_NUM channel) |
| Checks if channel result is ready. | |
| uint16_t | AFEC0_ChannelResultGet (AFEC_CHANNEL_NUM channel) |
| Gets the conversion result for a channel. | |
| uint16_t | AFEC0_LastConvertedDataGet (void) |
| Gets the last converted data. | |
| uint8_t | AFEC0_LastConvertedChannelGet (void) |
| Gets the channel number from last converted data. | |
| void | AFEC0_ConversionSequenceSet (const AFEC_CHANNEL_NUM *channelList, uint8_t numChannel) |
| Configures the user-defined conversion sequence. | |
| void | AFEC0_ChannelGainSet (AFEC_CHANNEL_NUM channel, AFEC_CHANNEL_GAIN gain) |
| Sets the channel gain. | |
| void | AFEC0_ChannelOffsetSet (AFEC_CHANNEL_NUM channel, uint16_t offset) |
| Sets the channel offset. | |
| void | AFEC0_ChannelDifferentialModeSet (AFEC_CHANNEL_NUM channel, bool enable) |
| Sets a channel to differential mode. | |
| void | AFEC0_ChannelDualSampleHoldSet (AFEC_CHANNEL_NUM channel, bool enable) |
| Sets a channel to dual sample-and-hold mode. | |
| void | AFEC0_PGA0Enable (bool enable) |
| Enables PGA0. | |
| void | AFEC0_PGA1Enable (bool enable) |
| Enables PGA1. | |
| void | AFEC0_SetBiasCurrentControl (uint8_t ibctl) |
| Sets the AFE bias current control. | |
| void | AFEC0_ComparatorChannelSet (AFEC_CHANNEL_NUM channel) |
| Sets the comparator channel. | |
| void | AFEC0_CompareAllChannelsEnable (void) |
| Enables comparison on all channels. | |
| void | AFEC0_CompareAllChannelsDisable (void) |
| Disables comparison on all channels. | |
| void | AFEC0_ComparatorModeSet (AFEC_COMPARATOR_MODE cmpMode) |
| Sets the comparator mode. | |
| void | AFEC0_ComparatorFilterSet (uint8_t filter) |
| Sets the comparison filter. | |
| void | AFEC0_CompareWindowSet (uint16_t lowThreshold, uint16_t highThreshold) |
| Configures the comparison window. | |
| bool | AFEC0_ComparatorStatusGet (void) |
| Gets the comparator status. | |
| void | AFEC0_TemperatureRTCTriggerEnable (bool enable) |
| Enables temperature sensor RTC trigger. | |
| void | AFEC0_TemperatureComparisonModeSet (AFEC_TEMP_CMP_MODE cmpMode) |
| Sets the temperature comparison mode. | |
| void | AFEC0_TemperatureCompareWindowSet (uint16_t lowThreshold, uint16_t highThreshold) |
| Sets the temperature comparison window. | |
| void | AFEC0_ChannelErrorCorrectionEnable (AFEC_CHANNEL_NUM channel, bool enable) |
| Enables error correction for a channel. | |
| void | AFEC0_CorrectionSelectSet (uint8_t shUnit) |
| Selects the sample-and-hold unit for correction. | |
| void | AFEC0_CorrectionValuesSet (int16_t offsetCorr, uint16_t gainCorr) |
| Sets the correction values. | |
| void | AFEC0_InterruptsEnable (AFEC_INTERRUPT_MASK interruptMask) |
| Enables AFEC0 interrupts. | |
| void | AFEC0_InterruptsDisable (AFEC_INTERRUPT_MASK interruptMask) |
| Disables AFEC0 interrupts. | |
| uint32_t | AFEC0_InterruptsMaskGet (void) |
| Gets the interrupt mask. | |
| uint32_t | AFEC0_StatusGet (void) |
| Gets the interrupt status. | |
| uint32_t | AFEC0_OverrunStatusGet (void) |
| Gets the overrun status. | |
| void | AFEC0_WriteProtectionEnable (bool enable) |
| Enables write protection. | |
| uint32_t | AFEC0_WriteProtectionStatusGet (void) |
| Gets write protection violation status. | |
| void | AFEC0_SetCallbackHandler (AFEC_CALLBACK_HANDLER callback) |
| Registers a callback handler. | |
| void | AFEC0_CallbackRegister (AFEC_CALLBACK callback, uintptr_t context) |
| Registers a callback with context (Harmony compatible). | |
AFEC Channel Number Definitions | |
Channel number values for use with AFEC_CHANNEL_NUM type. | |
| #define | AFEC_CH0 (0U) |
| AFEC Channel 0. | |
| #define | AFEC_CH1 (1U) |
| AFEC Channel 1. | |
| #define | AFEC_CH2 (2U) |
| AFEC Channel 2. | |
| #define | AFEC_CH3 (3U) |
| AFEC Channel 3. | |
| #define | AFEC_CH4 (4U) |
| AFEC Channel 4. | |
| #define | AFEC_CH5 (5U) |
| AFEC Channel 5. | |
| #define | AFEC_CH6 (6U) |
| AFEC Channel 6. | |
| #define | AFEC_CH7 (7U) |
| AFEC Channel 7. | |
| #define | AFEC_CH8 (8U) |
| AFEC Channel 8. | |
| #define | AFEC_CH9 (9U) |
| AFEC Channel 9. | |
| #define | AFEC_CH10 (10U) |
| AFEC Channel 10. | |
| #define | AFEC_CH11 (11U) |
| AFEC Channel 11. | |
AFEC Channel Mask Definitions | |
Channel mask values for use with AFEC_CHANNEL_MASK type. | |
| #define | AFEC_CH0_MASK (1U << 0U) |
| AFEC Channel 0 mask. | |
| #define | AFEC_CH1_MASK (1U << 1U) |
| AFEC Channel 1 mask. | |
| #define | AFEC_CH2_MASK (1U << 2U) |
| AFEC Channel 2 mask. | |
| #define | AFEC_CH3_MASK (1U << 3U) |
| AFEC Channel 3 mask. | |
| #define | AFEC_CH4_MASK (1U << 4U) |
| AFEC Channel 4 mask. | |
| #define | AFEC_CH5_MASK (1U << 5U) |
| AFEC Channel 5 mask. | |
| #define | AFEC_CH6_MASK (1U << 6U) |
| AFEC Channel 6 mask. | |
| #define | AFEC_CH7_MASK (1U << 7U) |
| AFEC Channel 7 mask. | |
| #define | AFEC_CH8_MASK (1U << 8U) |
| AFEC Channel 8 mask. | |
| #define | AFEC_CH9_MASK (1U << 9U) |
| AFEC Channel 9 mask. | |
| #define | AFEC_CH10_MASK (1U << 10U) |
| AFEC Channel 10 mask. | |
| #define | AFEC_CH11_MASK (1U << 11U) |
| AFEC Channel 11 mask. | |
AFEC Gain Definitions | |
Gain values for use with AFEC_CHANNEL_GAIN type. | |
| #define | AFEC_GAIN_X1 (0U) |
| Gain x1 (no amplification) | |
| #define | AFEC_GAIN_X2 (1U) |
| Gain x2. | |
| #define | AFEC_GAIN_X4 (3U) |
| Gain x4. | |
AFEC Interrupt Mask Definitions | |
Interrupt mask values for use with AFEC_INTERRUPT_MASK type. | |
| #define | AFEC_INTERRUPT_EOC0_MASK (1U << 0U) |
| End of Conversion Channel 0 interrupt mask. | |
| #define | AFEC_INTERRUPT_EOC1_MASK (1U << 1U) |
| End of Conversion Channel 1 interrupt mask. | |
| #define | AFEC_INTERRUPT_EOC2_MASK (1U << 2U) |
| End of Conversion Channel 2 interrupt mask. | |
| #define | AFEC_INTERRUPT_EOC3_MASK (1U << 3U) |
| End of Conversion Channel 3 interrupt mask. | |
| #define | AFEC_INTERRUPT_EOC4_MASK (1U << 4U) |
| End of Conversion Channel 4 interrupt mask. | |
| #define | AFEC_INTERRUPT_EOC5_MASK (1U << 5U) |
| End of Conversion Channel 5 interrupt mask. | |
| #define | AFEC_INTERRUPT_EOC6_MASK (1U << 6U) |
| End of Conversion Channel 6 interrupt mask. | |
| #define | AFEC_INTERRUPT_EOC7_MASK (1U << 7U) |
| End of Conversion Channel 7 interrupt mask. | |
| #define | AFEC_INTERRUPT_EOC8_MASK (1U << 8U) |
| End of Conversion Channel 8 interrupt mask. | |
| #define | AFEC_INTERRUPT_EOC9_MASK (1U << 9U) |
| End of Conversion Channel 9 interrupt mask. | |
| #define | AFEC_INTERRUPT_EOC10_MASK (1U << 10U) |
| End of Conversion Channel 10 interrupt mask. | |
| #define | AFEC_INTERRUPT_EOC11_MASK (1U << 11U) |
| End of Conversion Channel 11 interrupt mask. | |
| #define | AFEC_INTERRUPT_DRDY_MASK (1U << 24U) |
| Data Ready interrupt mask. | |
| #define | AFEC_INTERRUPT_GOVRE_MASK (1U << 25U) |
| General Overrun Error interrupt mask. | |
| #define | AFEC_INTERRUPT_COMPE_MASK (1U << 26U) |
| Comparison Event interrupt mask. | |
| #define | AFEC_INTERRUPT_TEMPCHG_MASK (1U << 30U) |
| Temperature Change interrupt mask. | |
AFEC Comparator Mode Definitions | |
Comparator mode values for use with AFEC_COMPARATOR_MODE type. | |
| #define | AFEC_COMPARATOR_MODE_LOW (0U) |
| Event when conversion is lower than low threshold. | |
| #define | AFEC_COMPARATOR_MODE_HIGH (1U) |
| Event when conversion is higher than high threshold. | |
| #define | AFEC_COMPARATOR_MODE_IN (2U) |
| Event when conversion is within the comparison window. | |
| #define | AFEC_COMPARATOR_MODE_OUT (3U) |
| Event when conversion is outside the comparison window. | |
AFEC Trigger Source Definitions | |
Trigger source values for use with AFEC_TRIGGER_SOURCE type. | |
| #define | AFEC_TRIGGER_ADTRG (0U) |
| External trigger (ADTRG pin) | |
| #define | AFEC_TRIGGER_TIOA0 (1U) |
| Timer Counter Channel 0 Output A. | |
| #define | AFEC_TRIGGER_TIOA1 (2U) |
| Timer Counter Channel 1 Output A. | |
| #define | AFEC_TRIGGER_TIOA2 (3U) |
| Timer Counter Channel 2 Output A. | |
| #define | AFEC_TRIGGER_PWM_EVENT0 (4U) |
| PWM Event Line 0. | |
| #define | AFEC_TRIGGER_PWM_EVENT1 (5U) |
| PWM Event Line 1. | |
| #define | AFEC_TRIGGER_ANALOG_COMP (6U) |
| Analog Comparator. | |
AFEC Resolution Definitions | |
Resolution values for use with AFEC_RESOLUTION type. | |
| #define | AFEC_RESOLUTION_12BIT (0U) |
| 12-bit resolution, no averaging | |
| #define | AFEC_RESOLUTION_13BIT_OSR4 (2U) |
| 13-bit resolution with 4x oversampling | |
| #define | AFEC_RESOLUTION_14BIT_OSR16 (3U) |
| 14-bit resolution with 16x oversampling | |
| #define | AFEC_RESOLUTION_15BIT_OSR64 (4U) |
| 15-bit resolution with 64x oversampling | |
| #define | AFEC_RESOLUTION_16BIT_OSR256 (5U) |
| 16-bit resolution with 256x oversampling | |
AFEC Startup Time Definitions | |
Startup time values for use with AFEC_STARTUP_TIME type (in AFE clock periods). | |
| #define | AFEC_STARTUP_SUT0 (0U) |
| 0 AFE clock periods | |
| #define | AFEC_STARTUP_SUT8 (1U) |
| 8 AFE clock periods | |
| #define | AFEC_STARTUP_SUT16 (2U) |
| 16 AFE clock periods | |
| #define | AFEC_STARTUP_SUT24 (3U) |
| 24 AFE clock periods | |
| #define | AFEC_STARTUP_SUT64 (4U) |
| 64 AFE clock periods | |
| #define | AFEC_STARTUP_SUT80 (5U) |
| 80 AFE clock periods | |
| #define | AFEC_STARTUP_SUT96 (6U) |
| 96 AFE clock periods | |
| #define | AFEC_STARTUP_SUT112 (7U) |
| 112 AFE clock periods | |
| #define | AFEC_STARTUP_SUT512 (8U) |
| 512 AFE clock periods | |
| #define | AFEC_STARTUP_SUT576 (9U) |
| 576 AFE clock periods | |
| #define | AFEC_STARTUP_SUT640 (10U) |
| 640 AFE clock periods | |
| #define | AFEC_STARTUP_SUT704 (11U) |
| 704 AFE clock periods | |
| #define | AFEC_STARTUP_SUT768 (12U) |
| 768 AFE clock periods | |
| #define | AFEC_STARTUP_SUT832 (13U) |
| 832 AFE clock periods | |
| #define | AFEC_STARTUP_SUT896 (14U) |
| 896 AFE clock periods | |
| #define | AFEC_STARTUP_SUT960 (15U) |
| 960 AFE clock periods | |
AFEC Sign Mode Definitions | |
Sign mode values for use with AFEC_SIGN_MODE type. | |
| #define | AFEC_SIGNMODE_SE_UNSG_DF_SIGN (0U) |
| Single-ended unsigned, differential signed. | |
| #define | AFEC_SIGNMODE_SE_SIGN_DF_UNSG (1U) |
| Single-ended signed, differential unsigned. | |
| #define | AFEC_SIGNMODE_ALL_UNSIGNED (2U) |
| All channels unsigned. | |
| #define | AFEC_SIGNMODE_ALL_SIGNED (3U) |
| All channels signed. | |
AFEC Temperature Comparison Mode Definitions | |
Temperature comparison mode values for use with AFEC_TEMP_CMP_MODE type. | |
| #define | AFEC_TEMPCMPMODE_LOW (0U) |
| Event when temperature is below low threshold. | |
| #define | AFEC_TEMPCMPMODE_HIGH (1U) |
| Event when temperature is above high threshold. | |
| #define | AFEC_TEMPCMPMODE_IN (2U) |
| Event when temperature is within the comparison window. | |
| #define | AFEC_TEMPCMPMODE_OUT (3U) |
| Event when temperature is outside the comparison window. | |
Driver API for AFEC (plib_afec0.h)
| #define AFEC_CH0 (0U) |
AFEC Channel 0.
| #define AFEC_CH0_MASK (1U << 0U) |
AFEC Channel 0 mask.
| #define AFEC_CH1 (1U) |
AFEC Channel 1.
| #define AFEC_CH10 (10U) |
AFEC Channel 10.
| #define AFEC_CH10_MASK (1U << 10U) |
AFEC Channel 10 mask.
| #define AFEC_CH11 (11U) |
AFEC Channel 11.
| #define AFEC_CH11_MASK (1U << 11U) |
AFEC Channel 11 mask.
| #define AFEC_CH1_MASK (1U << 1U) |
AFEC Channel 1 mask.
| #define AFEC_CH2 (2U) |
AFEC Channel 2.
| #define AFEC_CH2_MASK (1U << 2U) |
AFEC Channel 2 mask.
| #define AFEC_CH3 (3U) |
AFEC Channel 3.
| #define AFEC_CH3_MASK (1U << 3U) |
AFEC Channel 3 mask.
| #define AFEC_CH4 (4U) |
AFEC Channel 4.
| #define AFEC_CH4_MASK (1U << 4U) |
AFEC Channel 4 mask.
| #define AFEC_CH5 (5U) |
AFEC Channel 5.
| #define AFEC_CH5_MASK (1U << 5U) |
AFEC Channel 5 mask.
| #define AFEC_CH6 (6U) |
AFEC Channel 6.
| #define AFEC_CH6_MASK (1U << 6U) |
AFEC Channel 6 mask.
| #define AFEC_CH7 (7U) |
AFEC Channel 7.
| #define AFEC_CH7_MASK (1U << 7U) |
AFEC Channel 7 mask.
| #define AFEC_CH8 (8U) |
AFEC Channel 8.
| #define AFEC_CH8_MASK (1U << 8U) |
AFEC Channel 8 mask.
| #define AFEC_CH9 (9U) |
AFEC Channel 9.
| #define AFEC_CH9_MASK (1U << 9U) |
AFEC Channel 9 mask.
| #define AFEC_COMPARATOR_MODE_HIGH (1U) |
Event when conversion is higher than high threshold.
| #define AFEC_COMPARATOR_MODE_IN (2U) |
Event when conversion is within the comparison window.
| #define AFEC_COMPARATOR_MODE_LOW (0U) |
Event when conversion is lower than low threshold.
| #define AFEC_COMPARATOR_MODE_OUT (3U) |
Event when conversion is outside the comparison window.
| #define AFEC_GAIN_X1 (0U) |
Gain x1 (no amplification)
| #define AFEC_GAIN_X2 (1U) |
Gain x2.
| #define AFEC_GAIN_X4 (3U) |
Gain x4.
| #define AFEC_INTERRUPT_COMPE_MASK (1U << 26U) |
Comparison Event interrupt mask.
| #define AFEC_INTERRUPT_DRDY_MASK (1U << 24U) |
Data Ready interrupt mask.
| #define AFEC_INTERRUPT_EOC0_MASK (1U << 0U) |
End of Conversion Channel 0 interrupt mask.
| #define AFEC_INTERRUPT_EOC10_MASK (1U << 10U) |
End of Conversion Channel 10 interrupt mask.
| #define AFEC_INTERRUPT_EOC11_MASK (1U << 11U) |
End of Conversion Channel 11 interrupt mask.
| #define AFEC_INTERRUPT_EOC1_MASK (1U << 1U) |
End of Conversion Channel 1 interrupt mask.
| #define AFEC_INTERRUPT_EOC2_MASK (1U << 2U) |
End of Conversion Channel 2 interrupt mask.
| #define AFEC_INTERRUPT_EOC3_MASK (1U << 3U) |
End of Conversion Channel 3 interrupt mask.
| #define AFEC_INTERRUPT_EOC4_MASK (1U << 4U) |
End of Conversion Channel 4 interrupt mask.
| #define AFEC_INTERRUPT_EOC5_MASK (1U << 5U) |
End of Conversion Channel 5 interrupt mask.
| #define AFEC_INTERRUPT_EOC6_MASK (1U << 6U) |
End of Conversion Channel 6 interrupt mask.
| #define AFEC_INTERRUPT_EOC7_MASK (1U << 7U) |
End of Conversion Channel 7 interrupt mask.
| #define AFEC_INTERRUPT_EOC8_MASK (1U << 8U) |
End of Conversion Channel 8 interrupt mask.
| #define AFEC_INTERRUPT_EOC9_MASK (1U << 9U) |
End of Conversion Channel 9 interrupt mask.
| #define AFEC_INTERRUPT_GOVRE_MASK (1U << 25U) |
General Overrun Error interrupt mask.
| #define AFEC_INTERRUPT_TEMPCHG_MASK (1U << 30U) |
Temperature Change interrupt mask.
| #define AFEC_RESOLUTION_12BIT (0U) |
12-bit resolution, no averaging
| #define AFEC_RESOLUTION_13BIT_OSR4 (2U) |
13-bit resolution with 4x oversampling
| #define AFEC_RESOLUTION_14BIT_OSR16 (3U) |
14-bit resolution with 16x oversampling
| #define AFEC_RESOLUTION_15BIT_OSR64 (4U) |
15-bit resolution with 64x oversampling
| #define AFEC_RESOLUTION_16BIT_OSR256 (5U) |
16-bit resolution with 256x oversampling
| #define AFEC_SIGNMODE_ALL_SIGNED (3U) |
All channels signed.
| #define AFEC_SIGNMODE_ALL_UNSIGNED (2U) |
All channels unsigned.
| #define AFEC_SIGNMODE_SE_SIGN_DF_UNSG (1U) |
Single-ended signed, differential unsigned.
| #define AFEC_SIGNMODE_SE_UNSG_DF_SIGN (0U) |
Single-ended unsigned, differential signed.
| #define AFEC_STARTUP_SUT0 (0U) |
0 AFE clock periods
| #define AFEC_STARTUP_SUT112 (7U) |
112 AFE clock periods
| #define AFEC_STARTUP_SUT16 (2U) |
16 AFE clock periods
| #define AFEC_STARTUP_SUT24 (3U) |
24 AFE clock periods
| #define AFEC_STARTUP_SUT512 (8U) |
512 AFE clock periods
| #define AFEC_STARTUP_SUT576 (9U) |
576 AFE clock periods
| #define AFEC_STARTUP_SUT64 (4U) |
64 AFE clock periods
| #define AFEC_STARTUP_SUT640 (10U) |
640 AFE clock periods
| #define AFEC_STARTUP_SUT704 (11U) |
704 AFE clock periods
| #define AFEC_STARTUP_SUT768 (12U) |
768 AFE clock periods
| #define AFEC_STARTUP_SUT8 (1U) |
8 AFE clock periods
| #define AFEC_STARTUP_SUT80 (5U) |
80 AFE clock periods
| #define AFEC_STARTUP_SUT832 (13U) |
832 AFE clock periods
| #define AFEC_STARTUP_SUT896 (14U) |
896 AFE clock periods
| #define AFEC_STARTUP_SUT96 (6U) |
96 AFE clock periods
| #define AFEC_STARTUP_SUT960 (15U) |
960 AFE clock periods
| #define AFEC_TEMPCMPMODE_HIGH (1U) |
Event when temperature is above high threshold.
| #define AFEC_TEMPCMPMODE_IN (2U) |
Event when temperature is within the comparison window.
| #define AFEC_TEMPCMPMODE_LOW (0U) |
Event when temperature is below low threshold.
| #define AFEC_TEMPCMPMODE_OUT (3U) |
Event when temperature is outside the comparison window.
| #define AFEC_TRIGGER_ADTRG (0U) |
External trigger (ADTRG pin)
| #define AFEC_TRIGGER_ANALOG_COMP (6U) |
Analog Comparator.
| #define AFEC_TRIGGER_PWM_EVENT0 (4U) |
PWM Event Line 0.
| #define AFEC_TRIGGER_PWM_EVENT1 (5U) |
PWM Event Line 1.
| #define AFEC_TRIGGER_TIOA0 (1U) |
Timer Counter Channel 0 Output A.
| #define AFEC_TRIGGER_TIOA1 (2U) |
Timer Counter Channel 1 Output A.
| #define AFEC_TRIGGER_TIOA2 (3U) |
Timer Counter Channel 2 Output A.
| AFEC_CALLBACK |
AFEC interrupt callback type with context (Harmony compatible).
Defines the prototype for AFEC interrupt callback functions with user context. Use this with AFECx_CallbackRegister() for applications that need to pass user-defined context (e.g., object pointers, state data) to the callback.
This is the recommended callback pattern for new designs as it provides better modularity and compatibility with MPLAB Harmony 3 style APIs.
| status | The interrupt status register value that triggered the callback. |
| context | User-defined context value passed during callback registration. |
| AFEC_CALLBACK_HANDLER |
Simple AFEC interrupt callback handler type.
Defines the prototype for simple AFEC interrupt callback functions. Use this with AFECx_SetCallbackHandler() for simple applications that don't need to pass user context to the callback.
| status | The interrupt status register value that triggered the callback. |
AFEC channel gain selection.
This type specifies the gain for the programmable gain amplifier.
AFEC channel mask for enabling/disabling multiple channels.
This type specifies a bitmask of channels.
AFEC channel number selection.
This type specifies the AFEC channel number (0-11).
AFEC comparator mode selection.
This type specifies the comparison mode for window monitoring.
AFEC interrupt mask for enabling/disabling interrupts.
This type specifies a bitmask of interrupt sources.
AFEC resolution selection.
This type specifies the resolution and averaging mode.
AFEC sign mode selection.
This type specifies the sign mode for conversion results.
AFEC startup time selection.
This type specifies the startup time in AFE clock periods.
AFEC temperature comparison mode selection.
This type specifies the temperature comparison mode.
AFEC trigger source selection.
This type specifies the hardware trigger source.
| void AFEC0_CallbackRegister | ( | AFEC_CALLBACK | callback, |
| uintptr_t | context ) |
Registers a callback with context (Harmony compatible).
Sets a user-defined callback function with context to be invoked when an AFEC0 interrupt occurs.
| callback | Pointer to the callback function. |
| context | User-defined context value passed to the callback. |
| void AFEC0_ChannelDifferentialModeSet | ( | AFEC_CHANNEL_NUM | channel, |
| bool | enable ) |
Sets a channel to differential mode.
Configures a channel for differential input operation.
| channel | Channel number (see AFEC_CHANNEL_NUM). |
| enable | True for differential mode, false for single-ended. |
| void AFEC0_ChannelDualSampleHoldSet | ( | AFEC_CHANNEL_NUM | channel, |
| bool | enable ) |
Sets a channel to dual sample-and-hold mode.
Configures a channel for dual sample-and-hold operation.
| channel | Channel number (see AFEC_CHANNEL_NUM). |
| enable | True for dual S&H mode, false for single S&H. |
| void AFEC0_ChannelErrorCorrectionEnable | ( | AFEC_CHANNEL_NUM | channel, |
| bool | enable ) |
Enables error correction for a channel.
Enables automatic error correction for the specified channel.
| channel | Channel number (see AFEC_CHANNEL_NUM). |
| enable | True to enable, false to disable. |
| void AFEC0_ChannelGainSet | ( | AFEC_CHANNEL_NUM | channel, |
| AFEC_CHANNEL_GAIN | gain ) |
Sets the channel gain.
Configures the programmable gain amplifier for a channel.
| channel | Channel number (see AFEC_CHANNEL_NUM). |
| gain | Gain selection (see AFEC_CHANNEL_GAIN). |
| void AFEC0_ChannelOffsetSet | ( | AFEC_CHANNEL_NUM | channel, |
| uint16_t | offset ) |
Sets the channel offset.
Configures the analog offset compensation for a channel.
| channel | Channel number (see AFEC_CHANNEL_NUM). |
| offset | Offset value (0-1023, 512 = no offset). |
| uint16_t AFEC0_ChannelResultGet | ( | AFEC_CHANNEL_NUM | channel | ) |
Gets the conversion result for a channel.
Returns the conversion result for the specified channel.
| channel | Channel number (see AFEC_CHANNEL_NUM). |
| bool AFEC0_ChannelResultIsReady | ( | AFEC_CHANNEL_NUM | channel | ) |
Checks if channel result is ready.
Returns true if conversion result is available for the specified channel.
| channel | Channel number (see AFEC_CHANNEL_NUM). |
| void AFEC0_ChannelsDisable | ( | AFEC_CHANNEL_MASK | channelsMask | ) |
Disables AFEC0 channels.
Disables the specified channels.
| channelsMask | Bitmask of channels to disable (see AFEC_CHANNEL_MASK). |
| void AFEC0_ChannelsEnable | ( | AFEC_CHANNEL_MASK | channelsMask | ) |
Enables AFEC0 channels.
Enables the specified channels for conversion.
| channelsMask | Bitmask of channels to enable (see AFEC_CHANNEL_MASK). |
| void AFEC0_ChannelsInterruptDisable | ( | AFEC_INTERRUPT_MASK | channelsInterruptMask | ) |
Disables channel end of conversion interrupts.
Disables the specified channel interrupt sources.
| channelsInterruptMask | Bitmask of channel interrupts to disable (see AFEC_INTERRUPT_MASK). |
| void AFEC0_ChannelsInterruptEnable | ( | AFEC_INTERRUPT_MASK | channelsInterruptMask | ) |
Enables channel end of conversion interrupts.
Enables the specified channel interrupt sources.
| channelsInterruptMask | Bitmask of channel interrupts to enable (see AFEC_INTERRUPT_MASK). |
| uint32_t AFEC0_ChannelsStatusGet | ( | void | ) |
Gets the channel status.
Returns the current channel enable status.
| None. |
| void AFEC0_ComparatorChannelSet | ( | AFEC_CHANNEL_NUM | channel | ) |
Sets the comparator channel.
Configures which channel is used for comparison.
| channel | Channel number (see AFEC_CHANNEL_NUM). |
| void AFEC0_ComparatorFilterSet | ( | uint8_t | filter | ) |
Sets the comparison filter.
Sets the number of consecutive comparison errors needed to raise flag.
| filter | Filter value (0-3, number of comparisons = filter + 1). |
| void AFEC0_ComparatorModeSet | ( | AFEC_COMPARATOR_MODE | cmpMode | ) |
Sets the comparator mode.
Configures the comparison mode (low, high, in, out).
| cmpMode | Comparator mode selection (see AFEC_COMPARATOR_MODE). |
| bool AFEC0_ComparatorStatusGet | ( | void | ) |
Gets the comparator status.
Returns true if a comparison event has occurred.
| None. |
| void AFEC0_CompareAllChannelsDisable | ( | void | ) |
Disables comparison on all channels.
When disabled, only the selected channel is compared.
| None. |
| void AFEC0_CompareAllChannelsEnable | ( | void | ) |
Enables comparison on all channels.
When enabled, all channels are compared against the window.
| None. |
| void AFEC0_CompareWindowSet | ( | uint16_t | lowThreshold, |
| uint16_t | highThreshold ) |
Configures the comparison window.
Sets the low and high thresholds for comparison.
| lowThreshold | Low threshold value (16-bit). |
| highThreshold | High threshold value (16-bit). |
| void AFEC0_ConversionSequenceSet | ( | const AFEC_CHANNEL_NUM * | channelList, |
| uint8_t | numChannel ) |
Configures the user-defined conversion sequence.
Sets the channel conversion sequence for user sequence mode.
| channelList | Pointer to array of channel numbers. |
| numChannel | Number of channels in the sequence (max 12). |
| void AFEC0_ConversionStart | ( | void | ) |
Starts an AFEC0 conversion.
Initiates a software-triggered conversion on enabled channels.
| None. |
| void AFEC0_CorrectionSelectSet | ( | uint8_t | shUnit | ) |
Selects the sample-and-hold unit for correction.
Selects which S&H unit's correction values are accessed.
| shUnit | Sample-and-hold unit (0 or 1). |
| void AFEC0_CorrectionValuesSet | ( | int16_t | offsetCorr, |
| uint16_t | gainCorr ) |
Sets the correction values.
Configures offset and gain correction values for the selected S&H unit.
| offsetCorr | Offset correction value (16-bit signed). |
| gainCorr | Gain correction value (16-bit). |
| void AFEC0_InterruptsDisable | ( | AFEC_INTERRUPT_MASK | interruptMask | ) |
Disables AFEC0 interrupts.
Disables the specified interrupt sources.
| interruptMask | Bitmask of interrupts to disable (see AFEC_INTERRUPT_MASK). |
| void AFEC0_InterruptsEnable | ( | AFEC_INTERRUPT_MASK | interruptMask | ) |
Enables AFEC0 interrupts.
Enables the specified interrupt sources.
| interruptMask | Bitmask of interrupts to enable (see AFEC_INTERRUPT_MASK). |
| uint32_t AFEC0_InterruptsMaskGet | ( | void | ) |
Gets the interrupt mask.
Returns the current interrupt enable mask.
| None. |
| uint8_t AFEC0_LastConvertedChannelGet | ( | void | ) |
Gets the channel number from last converted data.
Returns the channel number associated with last converted data (requires TAG mode).
| None. |
| uint16_t AFEC0_LastConvertedDataGet | ( | void | ) |
Gets the last converted data.
Returns the last converted data from LCDR register.
| None. |
| uint32_t AFEC0_OverrunStatusGet | ( | void | ) |
Gets the overrun status.
Returns the overrun status for all channels.
| None. |
| void AFEC0_PGA0Enable | ( | bool | enable | ) |
Enables PGA0.
Enables the Programmable Gain Amplifier 0.
| enable | True to enable, false to disable. |
| void AFEC0_PGA1Enable | ( | bool | enable | ) |
Enables PGA1.
Enables the Programmable Gain Amplifier 1.
| enable | True to enable, false to disable. |
| void AFEC0_SetBiasCurrentControl | ( | uint8_t | ibctl | ) |
Sets the AFE bias current control.
Configures the bias current for the analog front-end.
| ibctl | Bias current control value (0-3). |
| void AFEC0_SetCallbackHandler | ( | AFEC_CALLBACK_HANDLER | callback | ) |
Registers a callback handler.
Sets a user-defined callback function to be invoked when an AFEC0 interrupt occurs.
| callback | Pointer to the callback function. |
| void AFEC0_SetFastWakeup | ( | bool | enable | ) |
Enables or disables fast wakeup mode.
In fast wakeup mode, voltage reference stays ON between conversions.
| enable | True to enable fast wakeup, false for normal sleep. |
| void AFEC0_SetFreeRunMode | ( | bool | enable | ) |
Enables or disables free run mode.
In free run mode, AFEC0 continuously converts without waiting for triggers.
| enable | True to enable, false to disable. |
| void AFEC0_SetPrescaler | ( | uint8_t | prescaler | ) |
Sets the AFEC0 clock prescaler.
Configures the AFEC0 clock division factor relative to the peripheral clock. AFE Clock = Peripheral Clock / (PRESCAL + 1) This function also sets the ONE bit (bit 23) in the Mode Register as required by the datasheet. Call this function during AFEC initialization.
| prescaler | Prescaler value (0-255). |
| void AFEC0_SetResolution | ( | AFEC_RESOLUTION | resolution | ) |
Sets the AFEC0 resolution.
Configures the resolution and averaging/oversampling mode.
| resolution | Resolution selection (see AFEC_RESOLUTION). |
| void AFEC0_SetSignMode | ( | AFEC_SIGN_MODE | signmode | ) |
Sets the AFEC0 sign mode.
Configures whether conversion results are signed or unsigned.
| signmode | Sign mode selection (see AFEC_SIGN_MODE). |
| void AFEC0_SetSingleTriggerMode | ( | bool | enable | ) |
Enables or disables single trigger mode.
When enabled, only a single trigger is required to get an averaged value.
| enable | True to enable single trigger mode, false for multiple triggers. |
| void AFEC0_SetSleepMode | ( | bool | enable | ) |
Enables or disables sleep mode.
In sleep mode, AFE and reference voltage are OFF between conversions.
| enable | True to enable sleep mode, false for normal mode. |
| void AFEC0_SetStartupTime | ( | AFEC_STARTUP_TIME | startup | ) |
Sets the AFEC0 startup time.
Configures the startup time in AFE clock periods.
| startup | Startup time selection (see AFEC_STARTUP_TIME). |
| void AFEC0_SetTagMode | ( | bool | enable | ) |
Enables or disables TAG mode.
When enabled, channel number is appended to LCDR.
| enable | True to enable TAG mode, false to disable. |
| void AFEC0_SetTransferPeriod | ( | uint8_t | transfer | ) |
Sets the AFEC0 transfer period.
Configures the period between start command and channel selection.
| transfer | Transfer period value (0-3, recommended: 2). |
| void AFEC0_SetTriggerEnable | ( | bool | enable | ) |
Enables hardware trigger.
Enables the hardware trigger selected by SetTriggerSource.
| enable | True to enable hardware trigger, false for software trigger only. |
| void AFEC0_SetTriggerSource | ( | AFEC_TRIGGER_SOURCE | trigger | ) |
Sets the hardware trigger source.
Configures which hardware trigger source is used.
| trigger | Trigger source selection (see AFEC_TRIGGER_SOURCE). |
| void AFEC0_SetUserSequenceMode | ( | bool | enable | ) |
Enables or disables user sequence mode.
In user sequence mode, the conversion sequence is defined by SEQ1R/SEQ2R.
| enable | True to enable user sequence, false for numeric order. |
| void AFEC0_SoftwareReset | ( | void | ) |
Software reset of AFEC0.
Resets the AFEC0 module to its default state.
| None. |
| uint32_t AFEC0_StatusGet | ( | void | ) |
Gets the interrupt status.
Returns the current interrupt status register (AFEC_ISR). Note: Reading AFEC_ISR clears only GOVRE, COMPE, and TEMPCHG flags. EOCx flags are cleared by reading AFEC_CDRx (via ChannelResultGet). DRDY flag is cleared by reading AFEC_LCDR (via LastConvertedDataGet).
| None. |
| void AFEC0_TemperatureCompareWindowSet | ( | uint16_t | lowThreshold, |
| uint16_t | highThreshold ) |
Sets the temperature comparison window.
Configures the low and high thresholds for temperature comparison.
| lowThreshold | Low threshold value (16-bit). |
| highThreshold | High threshold value (16-bit). |
| void AFEC0_TemperatureComparisonModeSet | ( | AFEC_TEMP_CMP_MODE | cmpMode | ) |
Sets the temperature comparison mode.
Configures the temperature comparison mode.
| cmpMode | Temperature comparison mode (see AFEC_TEMP_CMP_MODE). |
| void AFEC0_TemperatureRTCTriggerEnable | ( | bool | enable | ) |
Enables temperature sensor RTC trigger.
When enabled, temperature sensor is triggered by RTC every second.
| enable | True to enable RTC trigger, false to disable. |
| void AFEC0_WriteProtectionEnable | ( | bool | enable | ) |
Enables write protection.
Enables write protection for AFEC0 registers.
| enable | True to enable write protection, false to disable. |
| uint32_t AFEC0_WriteProtectionStatusGet | ( | void | ) |
Gets write protection violation status.
Returns information about write protection violations.
| None. |