RZV Flexible Software Package Documentation  Release v3.0.0

 
Analog to Digital Converter (r_adc_c)

Functions

fsp_err_t R_ADC_C_Open (adc_ctrl_t *p_ctrl, adc_cfg_t const *const p_cfg)
 
fsp_err_t R_ADC_C_ScanCfg (adc_ctrl_t *p_ctrl, void const *const p_channel_cfg)
 
fsp_err_t R_ADC_C_InfoGet (adc_ctrl_t *p_ctrl, adc_info_t *p_adc_info)
 
fsp_err_t R_ADC_C_ScanStart (adc_ctrl_t *p_ctrl)
 
fsp_err_t R_ADC_C_ScanGroupStart (adc_ctrl_t *p_ctrl, adc_group_mask_t group_id)
 
fsp_err_t R_ADC_C_ScanStop (adc_ctrl_t *p_ctrl)
 
fsp_err_t R_ADC_C_StatusGet (adc_ctrl_t *p_ctrl, adc_status_t *p_status)
 
fsp_err_t R_ADC_C_Read (adc_ctrl_t *p_ctrl, adc_channel_t const reg_id, uint16_t *const p_data)
 
fsp_err_t R_ADC_C_Read32 (adc_ctrl_t *p_ctrl, adc_channel_t const reg_id, uint32_t *const p_data)
 
fsp_err_t R_ADC_C_SampleStateCountSet (adc_ctrl_t *p_ctrl, uint16_t num_states)
 
fsp_err_t R_ADC_C_Close (adc_ctrl_t *p_ctrl)
 
fsp_err_t R_ADC_C_OffsetSet (adc_ctrl_t *const p_ctrl, adc_channel_t const reg_id, int32_t offset)
 
fsp_err_t R_ADC_C_Calibrate (adc_ctrl_t *const p_ctrl, void const *p_extend)
 
fsp_err_t R_ADC_C_CallbackSet (adc_ctrl_t *const p_api_ctrl, void(*p_callback)(adc_callback_args_t *), void const *const p_context, adc_callback_args_t *const p_callback_memory)
 

Detailed Description

Driver for the ADC peripheral on RZ MPUs. This module implements the ADC Interface.

Overview

Features

The ADC_C module supports the following features:

*1 The channel configuration of module is shown below.

RZ/V2L
Channels 0 to 7

*2 Repeat mode is valid only in hardware trigger mode and step mode.

Configuration

Build Time Configurations for r_adc_c

The following build time configurations are defined in fsp_cfg/r_adc_c_cfg.h:

ConfigurationOptionsDefaultDescription
Parameter Checking
  • Default (BSP)
  • Enabled
  • Disabled
Default (BSP) If selected code for parameter checking is included in the build.

Configurations for Analog > ADC (r_adc_c)

This module can be added to the Stacks tab via New Stack > Analog > ADC (r_adc_c).

ConfigurationOptionsDefaultDescription
General > NameName must be a valid C symbolg_adc0 Module name
General > Trigger mode
  • Software trigger mode
  • Hardware trigger mode
Software trigger mode Select trigger mode.
General > Operating mode
  • Scan mode
  • Select mode
Scan mode Select the operating mode.
General > Conversion mode
  • Single mode
  • Repeat mode
Single mode Select the conversion mode.
General > Buffer mode
  • 1-buffer mode
  • 4-buffer mode
1-buffer mode Select the buffer mode.4-buffer mode is prohibited in scan mode.
General > Analog input channelMCU Specific OptionsSpecify the analog input channel.Multiple selection is prohibited in select mode.
General > Sampling timeManual Entry100 Set the sampling time.(unit:ADIVCLK cycle)
General > Number of stages of the AD external trigger pin filter
  • Disabled
  • 4 stages
  • 8 stages
  • 12 stages
  • 16 stages
Disabled Select the number of stages of the AD external trigger pin filter.The signal to be filtered is ADC_ADCLK(TSUϕ) (80 MHz).
Hardware trigger mode > Hardware trigger sourceMCU Specific OptionsSelect hardware trigger source.
Hardware trigger mode > Valid edge of the trigger source (Only when ADC_TRG is selected)
  • Falling edge
  • Rising edge
  • Both edges
Falling edge Select the valid edge of the trigger.
Hardware trigger mode > Trigger input mode
  • Auto mode
  • Step mode
Auto mode Selects the trigger input mode.
Interrupts > CallbackName must be a valid C symbolNULL A user callback function can be provided here. If this callback function is provided, it is called from the interrupt service routine (ISR)
Interrupts > Conversion end interrupt Enable
  • Disabled
  • Enabled
Disabled Enable or disable the conversion end interrupt.
Interrupts > Conversion end Interrupt PriorityValue must be between 0 and 25512 Select the interrupt priority for Conversion end.

Clock Configuration

The ADC_C peripheral uses the clocks(ADC_ADCLK) shown in the table below as its clock sources.

RZ/V2L
Clock Source 80MHz

Pin Configuration

The ADC_CHx pins are analog input channels that can be used with the ADC.

ADC_TRG can be used to start scans with an external trigger. When external triggers are used, ADC scans begin on the falling edge of the ADTRG pin.

Usage Notes

ADC Conversion Modes

Single mode and repeat mode are available.

Single-scan Mode

In single scan mode, one or more specified channels are scanned once per trigger.

Repeat-scan Mode

In repeat scan mode, a single trigger is required to start the scan. Scans continue until R_ADC_C_ScanStop() is called.

Note
To help ensure a responsive system, developers should consider system clock speed, ADCLK speed, and callback processing time. In particular, using a scan-end callback with a high scan rate relative to core clocks (for example, in continuous scan mode) result in constant or high-frequency interrupts and cannot recommended. Therefore, repeat mode is valid only in hardware trigger mode and step mode. For the hardware trigger source, set a timer with a cycle that takes the above into consideration.

ADC Trigger Modes

Software trigger mode and hardware trigger mode are the two types of trigger modes in which the trigger is the timing for starting the A/D conversion processing.

Software-trigger Mode

In software trigger mode, A/D conversion is started for the input of the analog input pins. The hardware trigger is invalid when software trigger mode is set.

Hardware-trigger Mode

There are two triggers in hardware trigger mode: asynchronous trigger using the ADC_TRG pin as the activation source and synchronous trigger using the multi-function timer pulse unit 3 (MTU3a) or general purpose PWM timer (GPT) as the activation source. In hardware trigger mode, the available trigger input modes are auto mode and step mode. In auto mode, when a hardware trigger is input once, A/D conversion is repeated automatically for the conversion count in accordance with the specified conversion settings. In step mode, A/D conversion proceeds every time a hardware trigger is input. For example, if select mode, single mode, and 4- buffer mode are selected, conversion finishes when a hardware trigger has been input four times.

ADC Operating Modes

There are two operating modes: select mode and scan mode. The select mode has 1-buffer mode and 4-buffer mode as sub-modes.

Select Mode

A/D conversion proceeds for the analog input specified. The A/D conversion results are stored in the A/D conversion result registers corresponding to the analog inputs. In select mode, 1-buffer mode or 4-buffer mode can be used as the method for storing the A/D conversion results. Only one channel is selectable for A/D conversion in select mode.

In 1-buffer mode, A/D conversion proceeds only once for the analog input specified. This mode is usable for reading the result of a single conversion.

In 4-buffer mode, A/D conversion proceeds four times for the analog input specified and the conversion results are stored A/D conversion result registers. For the correspondence between the analog inputs and A/D conversion result registers in 4-Buffer mode, refer to the reference section "Table Correspondence between Analog Inputs and A/D Conversion Result Registers in 4-Buffer Mode" of the user's manual. This mode is usable for obtaining the average of the A/D conversion results.

Scan Mode

A/D conversion proceeds for the analog inputs of channels selected, in ascending order of channel number. The A/D conversion results are stored in the A/D conversion result registers corresponding to the analog inputs. This mode is usable for constantly monitoring multiple analog signals. In scan mode, only 1-buffer mode can be specified.

When Interrupts Are Not Enabled

If interrupts are not enabled, the R_ADC_C_StatusGet API can be used to poll the ADC to determine when the scan has completed. The read API function is used to access the converted ADC result.

Sample-State Count Setting

The application program can modify the setting of the sample-state count for analog channels by calling the R_ADC_C_SampleStateCountSet() API function. To modify the sample-state count, set the number of states when calling the R_ADC_C_SampleStateCountSet() API function. The valid sample states for module are shown below.

RZ/V2L
Sample State 6 to 2800

Examples

Basic Example

This is a basic example of minimal use of the ADC in an application.

/* A channel configuration is generated by the Configuration editor based on the options selected. If additional
* configurations are desired additional adc_c_channel_cfg_t elements can be defined and passed to R_ADC_C_ScanCfg. */
const adc_c_channel_cfg_t g_adc0_channel_cfg =
{
};
void adc_basic_example (void)
{
fsp_err_t err = FSP_SUCCESS;
/* Initializes the module. */
err = R_ADC_C_Open(&g_adc0_ctrl, &g_adc0_cfg);
/* Handle any errors. This function should be defined by the user. */
assert(FSP_SUCCESS == err);
/* Enable channels. */
err = R_ADC_C_ScanCfg(&g_adc0_ctrl, &g_adc0_channel_cfg);
assert(FSP_SUCCESS == err);
/* In software trigger mode, start a scan by calling R_ADC_C_ScanStart(). In other modes, enable external
* triggers by calling R_ADC_C_ScanStart(). */
(void) R_ADC_C_ScanStart(&g_adc0_ctrl);
/* Wait for conversion to complete. */
adc_status_t status;
{
(void) R_ADC_C_StatusGet(&g_adc0_ctrl, &status);
}
/* Read converted data. */
uint16_t channel1_conversion_result;
err = R_ADC_C_Read(&g_adc0_ctrl, ADC_CHANNEL_1, &channel1_conversion_result);
assert(FSP_SUCCESS == err);
}

Repeat Mode Example

This example shows how to perform repeated AD conversions using GPT.

const adc_c_extended_cfg_t g_adc0_repeat_cfg_extend =
{
.trigger_source = ADC_C_ACTIVE_TRIGGER_ADTRGA0,
.trigger_edge = ADC_C_TRIGGER_EDGE_FALLING,
.input_mode = ADC_C_INPUT_MODE_STEP,
.operating_mode = ADC_C_OPERATING_MODE_SELECT,
.buffer_mode = ADC_C_BUFFER_MODE_1,
.sampling_time = 100,
.external_trigger_filter = ADC_C_FILTER_STAGE_SETTING_DISABLE,
};
const adc_cfg_t g_adc0_repeat_cfg =
{
.p_callback = adc_callback,
.p_context = NULL,
.p_extend = &g_adc0_repeat_cfg_extend,
.scan_end_irq = ADC_INTAD_IRQn,
.scan_end_ipl = 12,
};
const adc_c_channel_cfg_t g_adc0_repeat_channel_cfg =
{
};
void adc_callback (adc_callback_args_t * const p_unused)
{
(void) p_unused;
uint16_t channel1_conversion_result;
/* Read converted data. */
(void) R_ADC_C_Read(&g_adc0_ctrl, ADC_CHANNEL_1, &channel1_conversion_result);
}
void adc_repeatmode_example (void)
{
fsp_err_t err = FSP_SUCCESS;
/* Initializes the module. */
err = R_ADC_C_Open(&g_adc0_ctrl, &g_adc0_repeat_cfg);
/* Handle any errors. This function should be defined by the user. */
assert(FSP_SUCCESS == err);
/* Enable channels. */
err = R_ADC_C_ScanCfg(&g_adc0_ctrl, &g_adc0_repeat_channel_cfg);
assert(FSP_SUCCESS == err);
/* Set the user callback. */
err = R_ADC_C_CallbackSet(&g_adc0_ctrl, adc_callback, NULL, NULL);
assert(FSP_SUCCESS == err);
/* Open GPT timer with following configurations
* (1) Set the mode to "Periodic".
* (2) Determine the period of the timer considering the system clock speed, ADCLK speed, and callback processing time.
* (3) Enable A/D Converter Start Request A during up-counting.
* (4) Set the compare match value that generates a A/D Converter Start Request A.
* (5) Enable extra features.
*/
err = R_GPT_Open(&g_timer0_ctrl, &g_timer0_cfg);
assert(FSP_SUCCESS == err);
err = R_GPT_Start(&g_timer0_ctrl);
assert(FSP_SUCCESS == err);
/* Scan the data with ADC channels*/
err = R_ADC_C_ScanStart(&g_adc0_ctrl);
assert(FSP_SUCCESS == err);
}

Data Structures

struct  adc_c_extended_cfg_t
 
struct  adc_c_channel_cfg_t
 
struct  adc_c_instance_ctrl_t
 

Enumerations

enum  adc_c_mask_t
 
enum  adc_c_trigger_mode_t
 
enum  adc_c_active_trigger_t
 
enum  adc_c_trigger_edge_t
 
enum  adc_c_input_mode_t
 
enum  adc_c_operating_mode_t
 
enum  adc_c_buffer_mode_t
 
enum  adc_c_filter_stage_setting_t
 
enum  adc_c_interrupt_channel_setting_t
 

Data Structure Documentation

◆ adc_c_extended_cfg_t

struct adc_c_extended_cfg_t

Extended configuration structure for ADC.

Data Fields
adc_c_trigger_mode_t trigger_mode Trigger mode.
adc_c_active_trigger_t trigger_source Hardware trigger source.
adc_c_trigger_edge_t trigger_edge Valid edge of the trigger source.
adc_c_input_mode_t input_mode Trigger input mode.
adc_c_operating_mode_t operating_mode Operating mode.
adc_c_buffer_mode_t buffer_mode Buffer mode.
uint16_t sampling_time Sampling period. (6~2800)
adc_c_filter_stage_setting_t external_trigger_filter AD external trigger pin filter.

◆ adc_c_channel_cfg_t

struct adc_c_channel_cfg_t

ADC channel(s) configuration

Data Fields
uint32_t scan_mask Channels/bits: bit 0 is ch0; bit 1 is ch1.
adc_c_interrupt_channel_setting_t interrupt_setting Interrupt setting.

◆ adc_c_instance_ctrl_t

struct adc_c_instance_ctrl_t

ADC instance control block. DO NOT INITIALIZE. Initialized in adc_api_t::open().

Enumeration Type Documentation

◆ adc_c_mask_t

For ADC Scan configuration adc_channel_cfg_t::scan_mask. Use bitwise OR to combine these masks for desired channels.

Enumerator
ADC_C_MASK_OFF 

No channels selected.

ADC_C_MASK_CHANNEL_0 

Channel 0 mask.

ADC_C_MASK_CHANNEL_1 

Channel 1 mask.

ADC_C_MASK_CHANNEL_2 

Channel 2 mask.

ADC_C_MASK_CHANNEL_3 

Channel 3 mask.

ADC_C_MASK_CHANNEL_4 

Channel 4 mask.

ADC_C_MASK_CHANNEL_5 

Channel 5 mask.

ADC_C_MASK_CHANNEL_6 

Channel 6 mask.

ADC_C_MASK_CHANNEL_7 

Channel 7 mask.

ADC_C_MASK_CHANNEL_8 

Channel 8 mask (Temperature sensor channel mask)

◆ adc_c_trigger_mode_t

ADC trigger mode select

Enumerator
ADC_C_TRIGGER_MODE_SOFTWARE 

Software trigger mode.

ADC_C_TRIGGER_MODE_HARDWARE 

Hardware trigger mode.

◆ adc_c_active_trigger_t

ADC hardware trigger source select

Enumerator
ADC_C_ACTIVE_TRIGGER_EXTERNAL 

External trigger input.

ADC_C_ACTIVE_TRIGGER_TRGA0N 

Compare match with or input capture to MTU0.TGRA.

ADC_C_ACTIVE_TRIGGER_TRGA1N 

Compare match with or input capture to MTU1.TGRA.

ADC_C_ACTIVE_TRIGGER_TRGA2N 

Compare match with or input capture to MTU2.TGRA.

ADC_C_ACTIVE_TRIGGER_TRGA3N 

Compare match with or input capture to MTU3.TGRA.

ADC_C_ACTIVE_TRIGGER_TRGA4N 

Compare match with or input capture to MTU4.TGRA.

ADC_C_ACTIVE_TRIGGER_TRGA6N 

Compare match with or input capture to MTU6.TGRA.

ADC_C_ACTIVE_TRIGGER_TRGA7N 

Compare match with or input capture to MTU7.TGRA.

ADC_C_ACTIVE_TRIGGER_TRG0N 

Compare match with MTU0.TGRE.

ADC_C_ACTIVE_TRIGGER_TRG4AN 

Compare match between MTU4.TADCORA and MTU4.TCNT.

ADC_C_ACTIVE_TRIGGER_TRG4BN 

Compare match between MTU4.TADCORB and MTU4.TCNT.

ADC_C_ACTIVE_TRIGGER_TRG4AN_BN 

Compare match between MTU4.TADCORA and MTU4.TCNT, or between MTU4.TADCORB and MTU4.TCNT.

ADC_C_ACTIVE_TRIGGER_TRG4ABN 

Compare match between MTU4.TADCORA and MTU4.TCNT, and between MTU4.TADCORB and MTU4.TCNT (when interrupt skipping function 2 is in use)

ADC_C_ACTIVE_TRIGGER_TRG7AN 

Compare match between MTU7.TADCORA and MTU7.TCNT.

ADC_C_ACTIVE_TRIGGER_TRG7BN 

Compare match between MTU7.TADCORB and MTU7.TCNT.

ADC_C_ACTIVE_TRIGGER_TRG7AN_BN 

Compare match between MTU7.TADCORA and MTU7.TCNT, or between MTU7.TADCORB and MTU7.TCNT.

ADC_C_ACTIVE_TRIGGER_TRG7ABN 

Compare match between MTU7.TADCORA and MTU7.TCNT, and between MTU7.TADCORB and MTU7.TCNT.

ADC_C_ACTIVE_TRIGGER_ADTRGA0 

Compare match with GPT0.GTADTRA.

ADC_C_ACTIVE_TRIGGER_ADTRGB0 

Compare match with GPT0.GTADTRB.

ADC_C_ACTIVE_TRIGGER_ADTRGA1 

Compare match with GPT1.GTADTRA.

ADC_C_ACTIVE_TRIGGER_ADTRGB1 

Compare match with GPT1.GTADTRB.

ADC_C_ACTIVE_TRIGGER_ADTRGA2 

Compare match with GPT2.GTADTRA.

ADC_C_ACTIVE_TRIGGER_ADTRGB2 

Compare match with GPT2.GTADTRB.

ADC_C_ACTIVE_TRIGGER_ADTRGA3 

Compare match with GPT3.GTADTRA.

ADC_C_ACTIVE_TRIGGER_ADTRGB3 

Compare match with GPT3.GTADTRB.

ADC_C_ACTIVE_TRIGGER_ADTRGA0_B0 

Compare match with GPT0.GTADTRA or GPT0.GTADTRB.

ADC_C_ACTIVE_TRIGGER_ADTRGA1_B1 

Compare match with GPT1.GTADTRA or GPT1.GTADTRB.

ADC_C_ACTIVE_TRIGGER_ADTRGA2_B2 

Compare match with GPT2.GTADTRA or GPT2.GTADTRB.

ADC_C_ACTIVE_TRIGGER_ADTRGA3_B3 

Compare match with GPT3.GTADTRA or GPT3.GTADTRB.

◆ adc_c_trigger_edge_t

valid edge of the trigger select

Enumerator
ADC_C_TRIGGER_EDGE_FALLING 

Falling edge.

ADC_C_TRIGGER_EDGE_RISING 

Rising edge.

ADC_C_TRIGGER_EDGE_BOTH 

Both edges.

◆ adc_c_input_mode_t

ADC trigger input mode select

Enumerator
ADC_C_INPUT_MODE_AUTO 

Auto mode.

ADC_C_INPUT_MODE_STEP 

Step mode.

◆ adc_c_operating_mode_t

ADC operating mode select

Enumerator
ADC_C_OPERATING_MODE_SCAN 

Scan mode.

ADC_C_OPERATING_MODE_SELECT 

Select mode.

◆ adc_c_buffer_mode_t

ADC buffer mode select

Enumerator
ADC_C_BUFFER_MODE_1 

1-buffer mode

ADC_C_BUFFER_MODE_4 

4-buffer mode

◆ adc_c_filter_stage_setting_t

Select the number of stages of the AD external trigger pin filter.

Enumerator
ADC_C_FILTER_STAGE_SETTING_DISABLE 

Filter is disabled.

ADC_C_FILTER_STAGE_SETTING_4 

12.5 ns (80 MHz) x 4 stages

ADC_C_FILTER_STAGE_SETTING_8 

12.5 ns (80 MHz) x 8 stages

ADC_C_FILTER_STAGE_SETTING_12 

12.5 ns (80 MHz) x 12 stages

ADC_C_FILTER_STAGE_SETTING_16 

12.5 ns (80 MHz) x 16 stages

◆ adc_c_interrupt_channel_setting_t

Enable or disable the conversion end interrupt of channel

Enumerator
ADC_C_INTERRUPT_CHANNEL_SETTING_DISABLE 

Interrupt output is disabled.

ADC_C_INTERRUPT_CHANNEL_SETTING_ENABLE 

Interrupt output is enabled.

Function Documentation

◆ R_ADC_C_Open()

fsp_err_t R_ADC_C_Open ( adc_ctrl_t p_ctrl,
adc_cfg_t const *const  p_cfg 
)

Initializes the ADC module and applies configurations.

Return values
FSP_SUCCESSModule is ready for use.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_ALREADY_OPENThe instance control structure has already been opened.
FSP_ERR_IRQ_BSP_DISABLEDA callback is provided, but the interrupt is not enabled.

◆ R_ADC_C_ScanCfg()

fsp_err_t R_ADC_C_ScanCfg ( adc_ctrl_t p_ctrl,
void const *const  p_channel_cfg 
)

Configures the ADC_C scan parameters. Channel specific settings are set in this function. Pass a pointer to adc_c_channel_cfg_t to p_channel_cfg.

Return values
FSP_SUCCESSChannel specific settings applied.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_NOT_OPENUnit is not open.

◆ R_ADC_C_InfoGet()

fsp_err_t R_ADC_C_InfoGet ( adc_ctrl_t p_ctrl,
adc_info_t p_adc_info 
)

Returns the address of the lowest number configured channel and the total number of bytes to be read in order to read the results of the configured channels. If no channels are configured, then a length of 0 is returned.

Return values
FSP_SUCCESSInformation stored in p_adc_info.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_NOT_OPENUnit is not open.

◆ R_ADC_C_ScanStart()

fsp_err_t R_ADC_C_ScanStart ( adc_ctrl_t p_ctrl)

Start A/D conversion.

Precondition
Call R_ADC_C_ScanCfg after R_ADC_C_Open before starting a scan.
Return values
FSP_SUCCESSScan started (software trigger) or hardware triggers enabled.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_NOT_OPENUnit is not open.
FSP_ERR_NOT_INITIALIZEDUnit is not initialized.
FSP_ERR_IN_USEAnother scan is still in progress (software trigger).

◆ R_ADC_C_ScanGroupStart()

fsp_err_t R_ADC_C_ScanGroupStart ( adc_ctrl_t p_ctrl,
adc_group_mask_t  group_id 
)

adc_api_t::scanGroupStart is not supported. Use scanStart instead.

Return values
FSP_ERR_UNSUPPORTEDFunction not supported in this implementation.

◆ R_ADC_C_ScanStop()

fsp_err_t R_ADC_C_ScanStop ( adc_ctrl_t p_ctrl)

Stop A/D conversion.

Return values
FSP_SUCCESSScan stopped (software trigger) or hardware triggers disabled.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_NOT_OPENUnit is not open.
FSP_ERR_NOT_INITIALIZEDUnit is not initialized.

◆ R_ADC_C_StatusGet()

fsp_err_t R_ADC_C_StatusGet ( adc_ctrl_t p_ctrl,
adc_status_t p_status 
)

Get current ADC_C status and store it in provided pointer p_status.

Return values
FSP_SUCCESSModule status stored in the provided pointer p_status
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_NOT_OPENUnit is not open.

◆ R_ADC_C_Read()

fsp_err_t R_ADC_C_Read ( adc_ctrl_t p_ctrl,
adc_channel_t const  reg_id,
uint16_t *const  p_data 
)

Reads conversion results from a single channel or sensor.

Return values
FSP_SUCCESSData read into provided p_data.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_NOT_OPENUnit is not open.
FSP_ERR_NOT_INITIALIZEDUnit is not initialized.

◆ R_ADC_C_Read32()

fsp_err_t R_ADC_C_Read32 ( adc_ctrl_t p_ctrl,
adc_channel_t const  reg_id,
uint32_t *const  p_data 
)

Reads conversion results from a single channel or sensor register into a 32-bit result.

Return values
FSP_SUCCESSData read into provided p_data.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_NOT_OPENUnit is not open.
FSP_ERR_NOT_INITIALIZEDUnit is not initialized.

◆ R_ADC_C_SampleStateCountSet()

fsp_err_t R_ADC_C_SampleStateCountSet ( adc_ctrl_t p_ctrl,
uint16_t  num_states 
)

Sets the sample state count for individual channels. This only needs to be set for special use cases. Normally, use the default values out of reset.

Note
The sample states for the temperature and voltage sensor are set in R_ADC_C_ScanCfg.
Return values
FSP_SUCCESSSample state count updated.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_NOT_INITIALIZEDUnit is not initialized.
FSP_ERR_NOT_OPENUnit is not open.
FSP_ERR_IN_USEA/D conversion ongoing.

◆ R_ADC_C_Close()

fsp_err_t R_ADC_C_Close ( adc_ctrl_t p_ctrl)

This function ends any scan in progress, disables interrupts, and removes power to the A/D peripheral.

Return values
FSP_SUCCESSModule closed.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_NOT_OPENUnit is not open.

◆ R_ADC_C_OffsetSet()

fsp_err_t R_ADC_C_OffsetSet ( adc_ctrl_t *const  p_ctrl,
adc_channel_t const  reg_id,
int32_t  offset 
)

adc_api_t::offsetSet is not supported.

Return values
FSP_ERR_UNSUPPORTEDFunction not supported in this implementation.

◆ R_ADC_C_Calibrate()

fsp_err_t R_ADC_C_Calibrate ( adc_ctrl_t *const  p_ctrl,
void const *  p_extend 
)

adc_api_t::calibrate is not supported.

Return values
FSP_ERR_UNSUPPORTEDCalibration not supported on this MCU.

◆ R_ADC_C_CallbackSet()

fsp_err_t R_ADC_C_CallbackSet ( adc_ctrl_t *const  p_api_ctrl,
void(*)(adc_callback_args_t *)  p_callback,
void const *const  p_context,
adc_callback_args_t *const  p_callback_memory 
)

Updates the user callback and has option of providing memory for callback structure. Implements adc_api_t::callbackSet

Return values
FSP_SUCCESSCallback updated successfully.
FSP_ERR_ASSERTIONA required pointer is NULL.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_NO_CALLBACK_MEMORYp_callback is non-secure and p_callback_memory is either secure or NULL.