RX Family
ADC Module Using Firmware Integration Technology
R01AN1666EJ0220 Rev. 2.20
Page 18 of 74
Dec 01, 2016
ADC_TRIG_SYNC_TRG0EN
= 4,
// MTU0 TRGE
ADC_TRIG_SYNC_TRG0FN
= 5,
// MTU0 TRGF
ADC_TRIG_SYNC_TRG4AN
= 6,
// MTU4 TADCORA
ADC_TRIG_SYNC_TRG4BN
= 7,
// MTU4 TADCORB
ADC_TRIG_SYNC_TRG4AN_AND_TRG4BN
= 8,
// MTU4 TADCORA and MTU4 TADCORB
ADC_TRIG_SYNC_ELC
= 9,
// ELC
ADC_TRIG_SOFTWARE
= 10,
// software trigger; not for Group modes
// nor double trigger modes
// This is not set to TRSA or TRSB
ADC_TRIG_NONE = 0x3F
}
adc_trig_t
;
typedef
enum
e_adc_speed
{
ADC_CONVERT_SPEED_DEFAULT
= 0,
ADC_CONVERT_SPEED_HIGH
= 0,
ADC_CONVERT_CURRENT_LOW
= 1
}
adc_speed_t
;
typedef
struct
st_adc_cfg
{
adc_speed_t
conv_speed
;
// ADCSR.ADHSC, rx130 has two conversion
speeds
adc_align_t
alignment
;
// ADCER.ADRFMT, Left or Right
alignment,ignored if addition used
adc_add_t
add_cnt
;
// ADADC.ADC, Addition/average count
select.
adc_clear_t
clearing
;
// ADCER.ACE, Automatic clearing
enable/disable after read
adc_trig_t
trigger
;
// ADSTRGR.TRSA, 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
;
// S12GBADI interrupt priority; 0-15
}
adc_cfg_t
;
/***** ADC_CONTROL() ARGUMENT DEFINITIONS *****/
typedef
enum
e_adc_cmd
{
// Commands for special hardware configurations
ADC_CMD_USE_VREFL0
,
// Low reference. Default is to use AVSS0.
ADC_CMD_USE_VREFH0
,
// High reference. Default is to use AVCC0.
ADC_CMD_SET_DDA_STATE_CNT
,
// For Disconnect Detection Assist
ADC_CMD_SET_SAMPLE_STATE_CNT
,
// Set the conversion time
// Command to configure channels, sensors, and comparator
ADC_CMD_ENABLE_CHANS
,
// Configure channels to scan
ADC_CMD_ENABLE_TEMP_SENSOR
,
// "configure" temperature sensor
ADC_CMD_ENABLE_VOLT_SENSOR
,
// "configure" internal ref voltage sensor
ADC_CMD_EN_COMPARATOR_LEVEL
,
// Enable comparator for threshold compare
ADC_CMD_EN_COMPARATOR_WINDOW
,
// Enable comparator for range compare
// Commands to enable hardware triggers or cause software trigger
ADC_CMD_ENABLE_TRIG
,
// ADCSR.TRGE=1 for sync/asynchronous
triggers
ADC_CMD_SCAN_NOW
,
// Software trigger start scan
// Commands to poll for scan completion and comparator results