94 void begin(uint8_t pin_reference);
99 void map(ControlParameter *target_parameter);
118 void set_floor(ControlParameter output_at_floor, uint16_t adc_lower_limit);
129 void set_ceiling(ControlParameter output_at_ceiling, uint16_t adc_upper_limit);
149 void map(DecimalPosition *target_parameter);
151 void set_averaging(int8_t averaging);
152 void set_resolution(int8_t resolution);
153 void set_clock(int8_t clock);
154 volatile uint16_t last_value_raw = 0;
155 void (*callback_function)() =
nullptr;
156 ControlParameter *target_control_param =
nullptr;
157 DecimalPosition *target_decimal_pos =
nullptr;
158 static AnalogInput *adc1_inputs[MAX_NUM_ADC_INPUTS];
159 static AnalogInput *adc2_inputs[MAX_NUM_ADC_INPUTS];
160 static uint8_t module_num_inputs[NUM_ADC_MODULES];
161 static volatile uint8_t module_current_input_index[NUM_ADC_MODULES];
162 void configure_adc();
163 void begin_conversion();
164 void set_deadband_here(ControlParameter output_at_deadband = 0, uint16_t adc_deadband_width = 4);
165 void set_deadband(ControlParameter output_at_deadband, uint16_t adc_deadband_center, uint16_t adc_deadband_width = 4);
166 float32_t full_scale_volts = VREF_3V3;
168 float32_t conversion_slope_1 = 1;
169 float32_t conversion_intercept_1 = 0;
170 float32_t conversion_slope_2 = 1;
171 float32_t conversion_intercept_2 = 0;
172 uint16_t adc_deadband_location = 0;
173 uint16_t adc_deadband_width = 0;
174 uint16_t adc_deadband_lower = 0;
175 uint16_t adc_deadband_upper = 0;
177 void enroll(
RPC *rpc,
const String &instance_name);
182 static const uint16_t max_adc_values[3];
183 static const struct analog_pin_info_struct analog_pin_info[];
184 static volatile uint8_t module_calibrating[NUM_ADC_MODULES];
185 static void adc1_on_interrupt();
186 static void adc2_on_interrupt();
187 void set_slope_intercept();
190 void initialize_adc();
195 int8_t averaging = ANALOG_AVERAGING_32;
196 int8_t resolution = ANALOG_RESOLUTION_10_BIT;
197 int8_t clock = ANALOG_CLOCK_75MHZ_DIV_16;
198 int8_t input_enabled = ANALOG_INPUT_ENABLED;
200 uint8_t adc_input_channel;
202 ControlParameter output_at_floor = 0;
203 ControlParameter output_at_deadband = 512;
204 ControlParameter output_at_ceiling = 1023;
205 uint16_t adc_lower_limit = 0;
206 uint16_t adc_upper_limit = 1023;
207 bool deadband_enabled =
false;
209 int8_t inversion_multiplier = 1;