RX Family
ADC Module Using Firmware Integration Technology
R01AN1666EJ0220 Rev. 2.20
Page 23 of 74
Dec 01, 2016
typedef
struct
st_adc_cfg
{
adc_add_t add_cnt;
adc_align_t alignment; // ignored if addition used
adc_clear_t clearing;
adc_trig_t trigger; // default and Group A trigger source
adc_trig_t trigger_groupb; // valid only for group modes
uint8_t priority; // for S12ADIO int; 1=lo 15=hi 0=off/polled
uint8_t priority_groupb; // GBADI interrupt priority; 0-15
}
adc_cfg_t;
/* ADC_CONTROL() ARGUMENT DEFINITIONS */
typedef
enum
e_adc_cmd
{
// Commands for special hardware configurations
ADC_CMD_SET_DDA_STATE_CNT, // for Disconnect Detection Assist
ADC_CMD_SET_SAMPLE_STATE_CNT,
// Commands to enable channels or sensors
ADC_CMD_ENABLE_CHANS, // enables chans and A & B INT if pri != 0
ADC_CMD_ENABLE_TEMP_SENSOR, // enables sensor and INT if priority != 0
ADC_CMD_ENABLE_VOLT_SENSOR, // enables sensor and INT if priority != 0
// Commands to enable hardware triggers or cause software trigger
ADC_CMD_ENABLE_TRIG, // ADCSR.TRGE=1 for sync/async triggers
ADC_CMD_SCAN_NOW, // software trigger start scan
// Commands to poll for scan completion
ADC_CMD_CHECK_SCAN_DONE, // for Normal or GroupA scan
ADC_CMD_CHECK_SCAN_DONE_GROUPA,
ADC_CMD_CHECK_SCAN_DONE_GROUPB,
// Advanced control commands
ADC_CMD_DISABLE_TRIG, // ADCSR.TRGE=0 for sync/async trigs
ADC_CMD_DISABLE_INT, // interrupt disable; ADCSR.ADIE=0
ADC_CMD_ENABLE_INT, // interrupt enable; ADCSR.ADIE=1
ADC_CMD_DISABLE_INT_GROUPB, // interrupt disable; ADCSR.GBADIE=0
ADC_CMD_ENABLE_INT_GROUPB, // interrupt enable; ADCSR.GBADIE=1
}
adc_cmd_t;
/* for ADC_CMD_SET_DDA_STATE_CNT */
typedef
enum
e_adc_charge // Disconnection Detection Assist (DDA)
{
ADC_DDA_DISCHARGE =
0x00
,
ADC_DDA_PRECHARGE =
0x01
,
ADC_DDA_OFF =
0x02
,
}
adc_charge_t;
#define
ADC_DDA_STATE_CNT_MIN (
1
)
#define
ADC_DDA_STATE_CNT_MAX (
15
)
typedef
struct
st_adc_dda
{
adc_charge_t method;
uint8_t num_states; // 1-15
}
adc_dda_t;
/* for ADC_CMD_SET_SAMPLE_STATE_CNT */