|
SAM4SD32 (SAM4S-EK2)
|
See Quickstart guide for SAM ADC driver. More...
Topics | |
| Legacy ADC group alias | |
Macros | |
| #define | ADC_WPMR_WPKEY_PASSWD ADC_WPMR_WPKEY(0x414443u) |
Functions | |
| void | adc_check (Adc *p_adc, const uint32_t ul_mck) |
| Check ADC configurations. | |
| void | adc_configure_power_save (Adc *p_adc, const uint8_t uc_sleep, const uint8_t uc_fwup) |
| Configures ADC power saving mode. | |
| void | adc_configure_sequence (Adc *p_adc, const enum adc_channel_num_t ch_list[], uint8_t uc_num) |
| Configure conversion sequence. | |
| void | adc_configure_timing (Adc *p_adc, const uint8_t uc_tracking, const enum adc_settling_time_t settling, const uint8_t uc_transfer) |
| Configure ADC timing. | |
| void | adc_configure_trigger (Adc *p_adc, const enum adc_trigger_t trigger, uint8_t uc_freerun) |
| Configure conversion trigger and free run mode. | |
| void | adc_disable_all_channel (Adc *p_adc) |
| Disable all ADC channel. | |
| void | adc_disable_anch (Adc *p_adc) |
| Disable analog change. | |
| void | adc_disable_channel (Adc *p_adc, const enum adc_channel_num_t adc_ch) |
| Disable the specified ADC channel. | |
| void | adc_disable_channel_differential_input (Adc *p_adc, const enum adc_channel_num_t channel) |
| Disable differential input for the specified channel. | |
| void | adc_disable_channel_input_offset (Adc *p_adc, const enum adc_channel_num_t channel) |
| Disable analog signal offset for the specified channel. | |
| void | adc_disable_interrupt (Adc *p_adc, const uint32_t ul_source) |
| Disable ADC interrupts. | |
| void | adc_disable_tag (Adc *p_adc) |
| Disable TAG option. | |
| void | adc_disable_ts (Adc *p_adc) |
| Turn off temperature sensor. | |
| void | adc_enable_all_channel (Adc *p_adc) |
| Enable all ADC channels. | |
| void | adc_enable_anch (Adc *p_adc) |
| Enable analog change. | |
| void | adc_enable_channel (Adc *p_adc, const enum adc_channel_num_t adc_ch) |
| Enable the specified ADC channel. | |
| void | adc_enable_channel_differential_input (Adc *p_adc, const enum adc_channel_num_t channel) |
| Enable differential input for the specified channel. | |
| void | adc_enable_channel_input_offset (Adc *p_adc, const enum adc_channel_num_t channel) |
| Enable analog signal offset for the specified channel. | |
| void | adc_enable_interrupt (Adc *p_adc, const uint32_t ul_source) |
| Enable ADC interrupts. | |
| void | adc_enable_tag (Adc *p_adc) |
| Enable TAG option so that the number of the last converted channel can be indicated. | |
| void | adc_enable_ts (Adc *p_adc) |
| Turn on temperature sensor. | |
| uint32_t | adc_get_actual_adc_clock (const Adc *p_adc, const uint32_t ul_mck) |
| Return the actual ADC clock. | |
| uint32_t | adc_get_channel_status (const Adc *p_adc, const enum adc_channel_num_t adc_ch) |
| Read the ADC channel status. | |
| uint32_t | adc_get_channel_value (const Adc *p_adc, const enum adc_channel_num_t adc_ch) |
| Read the ADC result data of the specified channel. | |
| uint32_t | adc_get_comparison_mode (const Adc *p_adc) |
| Get comparison mode. | |
| uint32_t | adc_get_interrupt_mask (const Adc *p_adc) |
| Read ADC interrupt mask. | |
| uint32_t | adc_get_latest_value (const Adc *p_adc) |
| Read the last ADC result data. | |
| uint32_t | adc_get_overrun_status (const Adc *p_adc) |
| Get ADC interrupt and overrun error status. | |
| Pdc * | adc_get_pdc_base (const Adc *p_adc) |
| Get PDC registers base address. | |
| uint32_t | adc_get_status (const Adc *p_adc) |
| Get ADC interrupt and overrun error status. | |
| enum adc_channel_num_t | adc_get_tag (const Adc *p_adc) |
| Indicate the last converted channel. | |
| uint32_t | adc_get_writeprotect_status (const Adc *p_adc) |
| Indicate write protect status. | |
| uint32_t | adc_init (Adc *p_adc, const uint32_t ul_mck, const uint32_t ul_adc_clock, const enum adc_startup_time startup) |
| Initialize the given ADC with the specified ADC clock and startup time. | |
| void | adc_reset (Adc *p_adc) |
| Reset ADC. | |
| void | adc_set_bias_current (Adc *p_adc, const uint8_t uc_ibctl) |
| Adapt performance versus power consumption. | |
| void | adc_set_calibmode (Adc *p_adc) |
| Set ADC auto calibration mode. | |
| void | adc_set_channel_input_gain (Adc *p_adc, const enum adc_channel_num_t channel, const enum adc_gainvalue_t gain) |
| Configure input gain for the specified channel. | |
| void | adc_set_comparison_channel (Adc *p_adc, const enum adc_channel_num_t channel) |
| Configure comparison selected channel. | |
| void | adc_set_comparison_mode (Adc *p_adc, const uint8_t uc_mode) |
| Configure comparison mode. | |
| void | adc_set_comparison_window (Adc *p_adc, const uint16_t us_low_threshold, const uint16_t us_high_threshold) |
| Configure ADC compare window. | |
| void | adc_set_resolution (Adc *p_adc, const enum adc_resolution_t resolution) |
| Configure the conversion resolution. | |
| void | adc_set_writeprotect (Adc *p_adc, const uint32_t ul_enable) |
| Enable or disable write protection of ADC registers. | |
| void | adc_start (Adc *p_adc) |
| Start analog-to-digital conversion. | |
| void | adc_start_sequencer (Adc *p_adc) |
| Enable conversion sequencer. | |
| void | adc_stop_sequencer (Adc *p_adc) |
| Disable conversion sequencer. | |
| static uint32_t | calcul_startup (const uint32_t ul_startup) |
| calcul_startup | |
See Quickstart guide for SAM ADC driver.
Driver for the Analog-to-digital Converter. This driver provides access to the main features of the ADC controller.
| #define ADC_WPMR_WPKEY_PASSWD ADC_WPMR_WPKEY(0x414443u) |
Definition at line 756 of file adc.c.
Referenced by adc_set_writeprotect().
| void adc_check | ( | Adc * | p_adc, |
| const uint32_t | ul_mck ) |
Check ADC configurations.
| p_adc | Pointer to an ADC instance. |
| ul_mck | Main clock of the device (in Hz). |
Definition at line 838 of file adc.c.
References ADC_FREQ_MAX, ADC_FREQ_MIN, Adc::ADC_MR, ADC_MR_FREERUN_ON, ADC_MR_FWUP_ON, ADC_MR_PRESCAL_Msk, ADC_MR_PRESCAL_Pos, ADC_MR_SLEEP_SLEEP, ADC_MR_STARTUP_Msk, ADC_MR_STARTUP_Pos, ADC_STARTUP_FAST, ADC_STARTUP_NORM, and calcul_startup().
| void adc_configure_power_save | ( | Adc * | p_adc, |
| const uint8_t | uc_sleep, | ||
| const uint8_t | uc_fwup ) |
Configures ADC power saving mode.
| p_adc | Pointer to an ADC instance. |
| uc_sleep | ADC_MR_SLEEP_NORMAL keeps the ADC Core and reference voltage circuitry ON between conversions. ADC_MR_SLEEP_SLEEP keeps the ADC Core and reference voltage circuitry OFF between conversions. |
| uc_fwup | ADC_MR_FWUP_OFF configures sleep mode as uc_sleep setting, ADC_MR_FWUP_ON keeps voltage reference ON and ADC Core OFF between conversions. |
Definition at line 198 of file adc.c.
References Adc::ADC_MR, ADC_MR_FWUP, and ADC_MR_SLEEP.
| void adc_configure_sequence | ( | Adc * | p_adc, |
| const enum adc_channel_num_t | ch_list[], | ||
| uint8_t | uc_num ) |
Configure conversion sequence.
| p_adc | Pointer to an ADC instance. |
| ch_list | Channel sequence list. |
| uc_num | Number of channels in the list. |
Definition at line 228 of file adc.c.
References Adc::ADC_SEQR1.
| void adc_configure_timing | ( | Adc * | p_adc, |
| const uint8_t | uc_tracking, | ||
| const enum adc_settling_time_t | settling, | ||
| const uint8_t | uc_transfer ) |
Configure ADC timing.
| p_adc | Pointer to an ADC instance. |
| uc_tracking | ADC tracking time = uc_tracking / ADC clock. |
| settling | Analog settling time = (settling + 1) / ADC clock. |
| uc_transfer | Data transfer time = (uc_transfer * 2 + 3) / ADC clock. |
Definition at line 261 of file adc.c.
References Adc::ADC_MR, ADC_MR_TRACKTIM, and ADC_MR_TRANSFER.
| void adc_configure_trigger | ( | Adc * | p_adc, |
| const enum adc_trigger_t | trigger, | ||
| uint8_t | uc_freerun ) |
Configure conversion trigger and free run mode.
| p_adc | Pointer to an ADC instance. |
| trigger | Conversion trigger. |
| uc_freerun | ADC_MR_FREERUN_ON enables freerun mode, ADC_MR_FREERUN_OFF disables freerun mode. |
Definition at line 168 of file adc.c.
References Adc::ADC_MR, and ADC_MR_FREERUN.
| void adc_disable_all_channel | ( | Adc * | p_adc | ) |
Disable all ADC channel.
| p_adc | Pointer to an ADC instance. |
Definition at line 382 of file adc.c.
References Adc::ADC_CHDR.
| void adc_disable_anch | ( | Adc * | p_adc | ) |
Disable analog change.
| p_adc | Pointer to an ADC instance. |
Definition at line 311 of file adc.c.
References Adc::ADC_MR, and ADC_MR_ANACH.
| void adc_disable_channel | ( | Adc * | p_adc, |
| const enum adc_channel_num_t | adc_ch ) |
Disable the specified ADC channel.
| p_adc | Pointer to an ADC instance. |
| adc_ch | ADC channel number. |
Definition at line 372 of file adc.c.
References Adc::ADC_CHDR.
| void adc_disable_channel_differential_input | ( | Adc * | p_adc, |
| const enum adc_channel_num_t | channel ) |
Disable differential input for the specified channel.
| p_adc | Pointer to an ADC instance. |
| channel | ADC channel number. |
Definition at line 568 of file adc.c.
References Adc::ADC_COR.
| void adc_disable_channel_input_offset | ( | Adc * | p_adc, |
| const enum adc_channel_num_t | channel ) |
Disable analog signal offset for the specified channel.
| p_adc | Pointer to an ADC instance. |
| channel | ADC channel number. |
Definition at line 593 of file adc.c.
References Adc::ADC_COR.
| void adc_disable_interrupt | ( | Adc * | p_adc, |
| const uint32_t | ul_source ) |
Disable ADC interrupts.
| p_adc | Pointer to an ADC instance. |
| ul_source | Interrupts to be disabled. |
Definition at line 663 of file adc.c.
References Adc::ADC_IDR.
| void adc_disable_tag | ( | Adc * | p_adc | ) |
Disable TAG option.
| p_adc | Pointer to an ADC instance. |
Definition at line 453 of file adc.c.
References Adc::ADC_EMR, and ADC_EMR_TAG.
| void adc_disable_ts | ( | Adc * | p_adc | ) |
Turn off temperature sensor.
| p_adc | Pointer to an ADC instance. |
Definition at line 748 of file adc.c.
References Adc::ADC_ACR, and ADC_ACR_TSON.
| void adc_enable_all_channel | ( | Adc * | p_adc | ) |
Enable all ADC channels.
| p_adc | Pointer to an ADC instance. |
Definition at line 357 of file adc.c.
References Adc::ADC_CHER.
| void adc_enable_anch | ( | Adc * | p_adc | ) |
Enable analog change.
| p_adc | Pointer to an ADC instance. |
Definition at line 299 of file adc.c.
References Adc::ADC_MR, and ADC_MR_ANACH.
| void adc_enable_channel | ( | Adc * | p_adc, |
| const enum adc_channel_num_t | adc_ch ) |
Enable the specified ADC channel.
| p_adc | Pointer to an ADC instance. |
| adc_ch | ADC channel number. |
Definition at line 347 of file adc.c.
References Adc::ADC_CHER.
| void adc_enable_channel_differential_input | ( | Adc * | p_adc, |
| const enum adc_channel_num_t | channel ) |
Enable differential input for the specified channel.
| p_adc | Pointer to an ADC instance. |
| channel | ADC channel number. |
Definition at line 557 of file adc.c.
References Adc::ADC_COR.
| void adc_enable_channel_input_offset | ( | Adc * | p_adc, |
| const enum adc_channel_num_t | channel ) |
Enable analog signal offset for the specified channel.
| p_adc | Pointer to an ADC instance. |
| channel | ADC channel number. |
Definition at line 582 of file adc.c.
References Adc::ADC_COR.
| void adc_enable_interrupt | ( | Adc * | p_adc, |
| const uint32_t | ul_source ) |
Enable ADC interrupts.
| p_adc | Pointer to an ADC instance. |
| ul_source | Interrupts to be enabled. |
Definition at line 652 of file adc.c.
References Adc::ADC_IER.
| void adc_enable_tag | ( | Adc * | p_adc | ) |
Enable TAG option so that the number of the last converted channel can be indicated.
| p_adc | Pointer to an ADC instance. |
Definition at line 443 of file adc.c.
References Adc::ADC_EMR, and ADC_EMR_TAG.
| void adc_enable_ts | ( | Adc * | p_adc | ) |
Turn on temperature sensor.
| p_adc | Pointer to an ADC instance. |
Definition at line 738 of file adc.c.
References Adc::ADC_ACR, and ADC_ACR_TSON.
| uint32_t adc_get_actual_adc_clock | ( | const Adc * | p_adc, |
| const uint32_t | ul_mck ) |
Return the actual ADC clock.
| p_adc | Pointer to an ADC instance. |
| ul_mck | Main clock of the device (in Hz). |
Definition at line 635 of file adc.c.
References Adc::ADC_MR, ADC_MR_PRESCAL_Msk, and ADC_MR_PRESCAL_Pos.
| uint32_t adc_get_channel_status | ( | const Adc * | p_adc, |
| const enum adc_channel_num_t | adc_ch ) |
Read the ADC channel status.
| p_adc | Pointer to an ADC instance. |
| adc_ch | ADC channel number. |
| 1 | if channel is enabled. |
| 0 | if channel is disabled. |
Definition at line 400 of file adc.c.
References Adc::ADC_CHSR.
| uint32_t adc_get_channel_value | ( | const Adc * | p_adc, |
| const enum adc_channel_num_t | adc_ch ) |
Read the ADC result data of the specified channel.
| p_adc | Pointer to an ADC instance. |
| adc_ch | ADC channel number. |
Definition at line 413 of file adc.c.
References Adc::ADC_CDR.
| uint32_t adc_get_comparison_mode | ( | const Adc * | p_adc | ) |
Get comparison mode.
| p_adc | Pointer to an ADC instance. |
| Compare | mode value. |
Definition at line 513 of file adc.c.
References Adc::ADC_EMR, and ADC_EMR_CMPMODE_Msk.
| uint32_t adc_get_interrupt_mask | ( | const Adc * | p_adc | ) |
Read ADC interrupt mask.
| p_adc | Pointer to an ADC instance. |
Definition at line 713 of file adc.c.
References Adc::ADC_IMR.
| uint32_t adc_get_latest_value | ( | const Adc * | p_adc | ) |
Read the last ADC result data.
| p_adc | Pointer to an ADC instance. |
Definition at line 431 of file adc.c.
References Adc::ADC_LCDR.
| uint32_t adc_get_overrun_status | ( | const Adc * | p_adc | ) |
Get ADC interrupt and overrun error status.
| p_adc | Pointer to an ADC instance. |
Definition at line 688 of file adc.c.
References Adc::ADC_OVER.
| Pdc * adc_get_pdc_base | ( | const Adc * | p_adc | ) |
| uint32_t adc_get_status | ( | const Adc * | p_adc | ) |
Get ADC interrupt and overrun error status.
| p_adc | Pointer to an ADC instance. |
Definition at line 676 of file adc.c.
References Adc::ADC_ISR.
| enum adc_channel_num_t adc_get_tag | ( | const Adc * | p_adc | ) |
Indicate the last converted channel.
| p_adc | Pointer to an ADC instance. |
Definition at line 468 of file adc.c.
References Adc::ADC_LCDR, ADC_LCDR_CHNB_Msk, and ADC_LCDR_CHNB_Pos.
| uint32_t adc_get_writeprotect_status | ( | const Adc * | p_adc | ) |
Indicate write protect status.
| p_adc | Pointer to an ADC instance. |
Definition at line 777 of file adc.c.
References Adc::ADC_WPSR, ADC_WPSR_WPVS, ADC_WPSR_WPVSRC_Msk, and ADC_WPSR_WPVSRC_Pos.
| uint32_t adc_init | ( | Adc * | p_adc, |
| const uint32_t | ul_mck, | ||
| const uint32_t | ul_adc_clock, | ||
| const enum adc_startup_time | startup ) |
Initialize the given ADC with the specified ADC clock and startup time.
| p_adc | Pointer to an ADC instance. |
| ul_mck | Main clock of the device (value in Hz). |
| ul_adc_clock | Analog-to-Digital conversion clock (value in Hz). |
| startup | ADC start up time. Please refer to the product datasheet for details. |
Definition at line 70 of file adc.c.
References Adc::ADC_CR, ADC_CR_SWRST, Adc::ADC_MR, ADC_MR_PRESCAL, Adc::ADC_PTCR, ADC_PTCR_RXTDIS, ADC_PTCR_TXTDIS, Adc::ADC_RCR, and Adc::ADC_RNCR.
| void adc_reset | ( | Adc * | p_adc | ) |
Reset ADC.
| p_adc | Pointer to an ADC instance. |
Definition at line 336 of file adc.c.
References Adc::ADC_CR, and ADC_CR_SWRST.
| void adc_set_bias_current | ( | Adc * | p_adc, |
| const uint8_t | uc_ibctl ) |
Adapt performance versus power consumption.
| p_adc | Pointer to an ADC instance. |
| uc_ibctl | ADC Bias current control. |
Definition at line 728 of file adc.c.
References Adc::ADC_ACR, and ADC_ACR_IBCTL.
| void adc_set_calibmode | ( | Adc * | p_adc | ) |
Set ADC auto calibration mode.
| p_adc | Pointer to an ADC instance. |
Definition at line 621 of file adc.c.
References Adc::ADC_CR, and ADC_CR_AUTOCAL.
| void adc_set_channel_input_gain | ( | Adc * | p_adc, |
| const enum adc_channel_num_t | channel, | ||
| const enum adc_gainvalue_t | gain ) |
Configure input gain for the specified channel.
| p_adc | Pointer to an ADC instance. |
| channel | ADC channel number. |
| gain | Gain value for the input. |
Definition at line 608 of file adc.c.
References Adc::ADC_CGR.
| void adc_set_comparison_channel | ( | Adc * | p_adc, |
| const enum adc_channel_num_t | channel ) |
Configure comparison selected channel.
| p_adc | Pointer to an ADC instance. |
| channel | ADC channel number. |
Definition at line 538 of file adc.c.
References Adc::ADC_EMR, ADC_EMR_CMPALL, ADC_EMR_CMPSEL_Msk, and ADC_EMR_CMPSEL_Pos.
| void adc_set_comparison_mode | ( | Adc * | p_adc, |
| const uint8_t | uc_mode ) |
Configure comparison mode.
| p_adc | Pointer to an ADC instance. |
| uc_mode | ADC comparison mode. |
Definition at line 500 of file adc.c.
References Adc::ADC_EMR, and ADC_EMR_CMPMODE_Msk.
| void adc_set_comparison_window | ( | Adc * | p_adc, |
| const uint16_t | us_low_threshold, | ||
| const uint16_t | us_high_threshold ) |
Configure ADC compare window.
| p_adc | Pointer to an ADC instance. |
| us_low_threshold | Low threshold of compare window. |
| us_high_threshold | High threshold of compare window. |
Definition at line 525 of file adc.c.
References Adc::ADC_CWR, ADC_CWR_HIGHTHRES, and ADC_CWR_LOWTHRES.
| void adc_set_resolution | ( | Adc * | p_adc, |
| const enum adc_resolution_t | resolution ) |
Configure the conversion resolution.
| p_adc | Pointer to an ADC instance. |
| resolution | ADC resolution. |
Definition at line 134 of file adc.c.
References ADC_10_BITS, ADC_12_BITS, Adc::ADC_EMR, Adc::ADC_MR, and ADC_MR_LOWRES.
| void adc_set_writeprotect | ( | Adc * | p_adc, |
| const uint32_t | ul_enable ) |
Enable or disable write protection of ADC registers.
| p_adc | Pointer to an ADC instance. |
| ul_enable | 1 to enable, 0 to disable. |
Definition at line 764 of file adc.c.
References Adc::ADC_WPMR, ADC_WPMR_WPEN, and ADC_WPMR_WPKEY_PASSWD.
| void adc_start | ( | Adc * | p_adc | ) |
Start analog-to-digital conversion.
| p_adc | Pointer to an ADC instance. |
Definition at line 326 of file adc.c.
References Adc::ADC_CR, and ADC_CR_START.
| void adc_start_sequencer | ( | Adc * | p_adc | ) |
Enable conversion sequencer.
| p_adc | Pointer to an ADC instance. |
Definition at line 479 of file adc.c.
References Adc::ADC_MR, and ADC_MR_USEQ.
| void adc_stop_sequencer | ( | Adc * | p_adc | ) |
Disable conversion sequencer.
| p_adc | Pointer to an ADC instance. |
Definition at line 489 of file adc.c.
References Adc::ADC_MR, and ADC_MR_USEQ.
|
static |
calcul_startup
Definition at line 792 of file adc.c.
Referenced by adc_check().