RX Family
ADC Module Using Firmware Integration Technology
R01AN1666EJ0220 Rev. 2.20
Page 29 of 74
Dec 01, 2016
#define
ADC_MASK_CH22 (1<<22)
#define
ADC_MASK_CH23 (1<<23)
#define
ADC_MASK_CH24 (1<<24)
#define
ADC_MASK_CH25 (1<<25)
#define
ADC_MASK_CH26 (1<<26)
#define
ADC_MASK_CH27 (1<<27)
#define
ADC_MASK_CH28 (1<<28)
#define
ADC_MASK_CH29 (1<<29)
#define
ADC_MASK_CH30 (1<<30)
#define
ADC_MASK_CH31 (1<<31)
#define
ADC_MASK_TEMP (1<<8)
// temperature sensor
#define
ADC_MASK_VOLT (1<<9)
// internal reference voltage sensor
#define
ADC_MASK_SENSORS (ADC_MASK_TEMP | ADC_MASK_VOLT)
#define
ADC_MASK_GROUPB_OFF (0)
#define
ADC_MASK_ADD_OFF (0)
#define
ADC_MASK_SAMPLE_HOLD_OFF (0)
typedef
enum
e_adc_grpa
// action when groupa interrupts groupb
// scan
{
ADC_GRPA_PRIORITY_OFF = 0,
// groupa ignored and does not interrupt
// groupb
ADC_GRPA_GRPB_WAIT_TRIG = 1,
// groupb restarts at next trigger
ADC_GRPA_GRPB_RESTART_SCAN = 3,
// groupb restarts immediately
ADC_GRPA_GRPB_CONT_SCAN= 0x8001,
// groupb restarts immediately and scans
// continuously
} adc_grpa_t;
typedef
enum
e_adc_diag
// Self-Diagnosis Channel
{
ADC_DIAG_OFF = 0x00,
ADC_DIAG_0_VOLT = 0x01,
ADC_DIAG_HALF_VREFH0 = 0x02,
ADC_DIAG_VREFH0 = 0x03,
ADC_DIAG_ROTATE_VOLTS = 0x04
} adc_diag_t;
typedef
enum
e_adc_elc
{
ADC_ELC_SCAN_DONE = 0,
// normal scan or Group A scan complete
ADC_ELC_GROUPB_SCAN_DONE,
ADC_ELC_ALL_SCANS_DONE
} adc_elc_t;
typedef
struct
st_adc_ch_cfg
{
uint32_t chan_mask;
// channels/bits 0-7, 16-31
uint32_t chan_mask_groupb;
// valid for group modes
adc_grpa_t priority_groupa;
// valid for group modes
uint32_t add_mask;
// valid if add enabled in Open()
adc_diag_t diag_method;
// self-diagnosis virtual channel
adc_elc_t signal_elc;
//
} adc_ch_cfg_t;
/* for ADC_CMD_EN_COMPARATOR_LEVEL and ADC_CMD_EN_COMPARATOR_WINDOW */
typedef
struct
st_adc_cmpwin_cfg
// bit-OR ADC_MASK_xxx to
{
// indicate channels/sensor
s
uint32_t compare_mask;
// channels/sensors to compare