Lines Matching full:adc
9 #include <zephyr/drivers/adc.h>
25 "Configure ADC channel\n" \
44 "Read adc value\n" \
117 /* This will never happen because ADC was prompted by shell */ in get_adc()
124 /* -2: index of ADC label name */ in cmd_adc_ch_id()
125 struct adc_hdl *adc = get_adc(argv[-2]); in cmd_adc_ch_id() local
128 if (!device_is_ready(adc->dev)) { in cmd_adc_ch_id()
129 shell_error(sh, "ADC device not ready"); in cmd_adc_ch_id()
138 adc->channel_config.channel_id = (uint8_t)strtol(argv[1], NULL, 10); in cmd_adc_ch_id()
139 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_ch_id()
147 /* -2: index of ADC label name */ in cmd_adc_ch_diff()
148 struct adc_hdl *adc = get_adc(argv[-2]); in cmd_adc_ch_diff() local
153 if (!device_is_ready(adc->dev)) { in cmd_adc_ch_diff()
154 shell_error(sh, "ADC device not ready"); in cmd_adc_ch_diff()
165 adc->channel_config.differential = (uint8_t)diff; in cmd_adc_ch_diff()
166 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_ch_diff()
175 /* -2: index of ADC label name */ in cmd_adc_ch_neg()
176 struct adc_hdl *adc = get_adc(argv[-2]); in cmd_adc_ch_neg() local
179 if (!device_is_ready(adc->dev)) { in cmd_adc_ch_neg()
180 shell_error(sh, "ADC device not ready"); in cmd_adc_ch_neg()
189 adc->channel_config.input_negative = (uint8_t)strtol(argv[1], NULL, 10); in cmd_adc_ch_neg()
190 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_ch_neg()
202 /* -2: index of ADC label name */ in cmd_adc_ch_pos()
203 struct adc_hdl *adc = get_adc(argv[-2]); in cmd_adc_ch_pos() local
206 if (!device_is_ready(adc->dev)) { in cmd_adc_ch_pos()
207 shell_error(sh, "ADC device not ready"); in cmd_adc_ch_pos()
216 adc->channel_config.input_positive = (uint8_t)strtol(argv[1], NULL, 10); in cmd_adc_ch_pos()
217 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_ch_pos()
229 /* -2: index of ADC label name */ in cmd_adc_gain()
230 struct adc_hdl *adc = get_adc(argv[-2]); in cmd_adc_gain() local
234 if (!device_is_ready(adc->dev)) { in cmd_adc_gain()
235 shell_error(sh, "ADC device not ready"); in cmd_adc_gain()
239 adc->channel_config.gain = gain; in cmd_adc_gain()
244 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_gain()
252 /* -1 index of ADC label name */ in cmd_adc_acq()
253 struct adc_hdl *adc = get_adc(argv[-1]); in cmd_adc_acq() local
257 if (!device_is_ready(adc->dev)) { in cmd_adc_acq()
258 shell_error(sh, "ADC device not ready"); in cmd_adc_acq()
269 adc->channel_config.acquisition_time = in cmd_adc_acq()
272 adc->channel_config.acquisition_time = in cmd_adc_acq()
275 adc->channel_config.acquisition_time = in cmd_adc_acq()
278 adc->channel_config.acquisition_time = in cmd_adc_acq()
281 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_acq()
288 /* -1 index of ADC label name */ in cmd_adc_reso()
289 struct adc_hdl *adc = get_adc(argv[-1]); in cmd_adc_reso() local
292 if (!device_is_ready(adc->dev)) { in cmd_adc_reso()
293 shell_error(sh, "ADC device not ready"); in cmd_adc_reso()
302 adc->resolution = (uint8_t)strtol(argv[1], NULL, 10); in cmd_adc_reso()
303 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_reso()
311 /* -2 index of ADC label name */ in cmd_adc_ref()
312 struct adc_hdl *adc = get_adc(argv[-2]); in cmd_adc_ref() local
316 if (!device_is_ready(adc->dev)) { in cmd_adc_ref()
317 shell_error(sh, "ADC device not ready"); in cmd_adc_ref()
326 adc->channel_config.reference = reference; in cmd_adc_ref()
327 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_ref()
337 /* -1 index of adc label name */ in cmd_adc_read()
338 struct adc_hdl *adc = get_adc(argv[-1]); in cmd_adc_read() local
342 if (!device_is_ready(adc->dev)) { in cmd_adc_read()
343 shell_error(sh, "ADC device not ready"); in cmd_adc_read()
347 adc->channel_config.channel_id = adc_channel_id; in cmd_adc_read()
349 .channels = BIT(adc->channel_config.channel_id), in cmd_adc_read()
352 .resolution = adc->resolution, in cmd_adc_read()
355 retval = adc_read(adc->dev, &sequence); in cmd_adc_read()
365 /* -1 index of ADC label name */ in cmd_adc_print()
366 struct adc_hdl *adc = get_adc(argv[-1]); in cmd_adc_print() local
375 adc->dev->name, in cmd_adc_print()
378 adc->channel_config.acquisition_time, in cmd_adc_print()
379 adc->channel_config.channel_id, in cmd_adc_print()
380 adc->channel_config.differential, in cmd_adc_print()
381 adc->resolution); in cmd_adc_print()
384 adc->channel_config.input_positive); in cmd_adc_print()
385 if (adc->channel_config.differential != 0) { in cmd_adc_print()
387 adc->channel_config.input_negative); in cmd_adc_print()
448 entry->help = "Select subcommand for ADC property label."; in cmd_adc_dev_get()
455 SHELL_CMD_REGISTER(adc, &sub_adc_dev, "ADC commands", NULL);