RX Family ADC Module Using Firmware Integration Technology
R01AN1666EJ0220 Rev. 2.20 Page 39 of 74
Dec 01, 2016
typedef struct st_adc_data
{
uint16_t chan[ADC_REG_ARRAY_MAX];
uint16_t temp;
uint16_t volt;
} adc_data_t;
2.10.10 RX64M, RX71M Interface Types ( r_s12ad_rx64m_if.h, r_s12ad_rx71m_if.h )
/* ADC_OPEN() ARGUMENT DEFINITIONS */
typedef enum e_adc_mode
{
ADC_MODE_SS_ONE_CH, // single scan one channel
ADC_MODE_SS_MULTI_CH, // 1 trigger source, scan multiple channels
ADC_MODE_CONT_ONE_CH, // continuous scan one channel
ADC_MODE_CONT_MULTI_CH, // continuous scan multiple channels
ADC_MODE_SS_ONE_CH_DBLTRIG, // on even triggers save to ADDBLDR & int
ADC_MODE_SS_MULTI_CH_GROUPED, // 2 trigger sources, scan multiple channels
ADC_MODE_SS_MULTI_CH_GROUPED_DBLTRIG_A,
ADC_MODE_MAX // This definition DO NOT USE for R_ADC_Open() argument
} adc_mode_t;
typedef enum e_adc_res
{
ADC_RESOLUTION_12_BIT = 0, // 13 ADCLKs conversion (15 self diagnosis)
ADC_RESOLUTION_10_BIT = 1, // 11 ADCLKs conversion (13 self diagnosis)
ADC_RESOLUTION_8_BIT = 2 // 9 ADCLKs conversion (11 self diagnosis)
} adc_res_t ;
typedef enum e_adc_align
{
ADC_ALIGN_RIGHT = 0x0000,
ADC_ALIGN_LEFT = 0x8000
} adc_align_t;
typedef enum e_adc_add
{
ADC_ADD_OFF = 0, // addition is turned off for chans/sensors
ADC_ADD_TWO_SAMPLES = 1,
ADC_ADD_THREE_SAMPLES = 2,
ADC_ADD_FOUR_SAMPLES = 3,
ADC_ADD_AVG_2_SAMPLES = 0x81, // average 2 samples
ADC_ADD_AVG_4_SAMPLES = 0x83, // average 4 samples
} adc_add_t;
typedef enum e_adc_clear
{
ADC_CLEAR_AFTER_READ_OFF = 0x0000,
ADC_CLEAR_AFTER_READ_ON = 0x0020
} adc_clear_t;
typedef enum e_adc_trig // trigger sources (set to TRSA bit or TRSB
bit)
{
ADC_TRIG_ASYNC_ADTRG = 0, // ext asynchronous trigger; not for Group
// modes nor double trigger modes
ADC_TRIG_SYNC_TRG0AN = 1, // MTU0 TRGA
ADC_TRIG_SYNC_TRG1AN = 2, // MTU1 TRGA
ADC_TRIG_SYNC_TRG2AN = 3, // MTU2 TRGA
ADC_TRIG_SYNC_TRG3AN = 4, // MTU3 TRGA