Lines Matching full:adc
9 #include <zephyr/drivers/adc.h>
25 "Configure ADC channel\n" \
44 "Read adc value\n" \
156 /* This will never happen because ADC was prompted by shell */ in get_adc()
163 /* -2: index of ADC label name */ in cmd_adc_ch_id()
164 struct adc_hdl *adc = get_adc(argv[-2]); in cmd_adc_ch_id() local
167 if (!device_is_ready(adc->dev)) { in cmd_adc_ch_id()
168 shell_error(sh, "ADC device not ready"); in cmd_adc_ch_id()
177 adc->channel_config.channel_id = (uint8_t)strtol(argv[1], NULL, 10); in cmd_adc_ch_id()
178 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_ch_id()
186 /* -2: index of ADC label name */ in cmd_adc_ch_diff()
187 struct adc_hdl *adc = get_adc(argv[-2]); in cmd_adc_ch_diff() local
192 if (!device_is_ready(adc->dev)) { in cmd_adc_ch_diff()
193 shell_error(sh, "ADC device not ready"); in cmd_adc_ch_diff()
204 adc->channel_config.differential = (uint8_t)diff; in cmd_adc_ch_diff()
205 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_ch_diff()
214 /* -2: index of ADC label name */ in cmd_adc_ch_neg()
215 struct adc_hdl *adc = get_adc(argv[-2]); in cmd_adc_ch_neg() local
218 if (!device_is_ready(adc->dev)) { in cmd_adc_ch_neg()
219 shell_error(sh, "ADC device not ready"); in cmd_adc_ch_neg()
228 adc->channel_config.input_negative = (uint8_t)strtol(argv[1], NULL, 10); in cmd_adc_ch_neg()
229 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_ch_neg()
241 /* -2: index of ADC label name */ in cmd_adc_ch_pos()
242 struct adc_hdl *adc = get_adc(argv[-2]); in cmd_adc_ch_pos() local
245 if (!device_is_ready(adc->dev)) { in cmd_adc_ch_pos()
246 shell_error(sh, "ADC device not ready"); in cmd_adc_ch_pos()
255 adc->channel_config.input_positive = (uint8_t)strtol(argv[1], NULL, 10); in cmd_adc_ch_pos()
256 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_ch_pos()
268 /* -2: index of ADC label name */ in cmd_adc_gain()
269 struct adc_hdl *adc = get_adc(argv[-2]); in cmd_adc_gain() local
273 if (!device_is_ready(adc->dev)) { in cmd_adc_gain()
274 shell_error(sh, "ADC device not ready"); in cmd_adc_gain()
278 adc->channel_config.gain = gain; in cmd_adc_gain()
283 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_gain()
291 /* -1 index of ADC label name */ in cmd_adc_acq()
292 struct adc_hdl *adc = get_adc(argv[-1]); in cmd_adc_acq() local
296 if (!device_is_ready(adc->dev)) { in cmd_adc_acq()
297 shell_error(sh, "ADC device not ready"); in cmd_adc_acq()
308 adc->channel_config.acquisition_time = in cmd_adc_acq()
311 adc->channel_config.acquisition_time = in cmd_adc_acq()
314 adc->channel_config.acquisition_time = in cmd_adc_acq()
317 adc->channel_config.acquisition_time = in cmd_adc_acq()
320 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_acq()
327 /* -1 index of ADC label name */ in cmd_adc_reso()
328 struct adc_hdl *adc = get_adc(argv[-1]); in cmd_adc_reso() local
331 if (!device_is_ready(adc->dev)) { in cmd_adc_reso()
332 shell_error(sh, "ADC device not ready"); in cmd_adc_reso()
341 adc->resolution = (uint8_t)strtol(argv[1], NULL, 10); in cmd_adc_reso()
342 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_reso()
350 /* -2 index of ADC label name */ in cmd_adc_ref()
351 struct adc_hdl *adc = get_adc(argv[-2]); in cmd_adc_ref() local
355 if (!device_is_ready(adc->dev)) { in cmd_adc_ref()
356 shell_error(sh, "ADC device not ready"); in cmd_adc_ref()
365 adc->channel_config.reference = reference; in cmd_adc_ref()
366 retval = adc_channel_setup(adc->dev, &adc->channel_config); in cmd_adc_ref()
376 /* -1 index of adc label name */ in cmd_adc_read()
377 struct adc_hdl *adc = get_adc(argv[-1]); in cmd_adc_read() local
381 if (!device_is_ready(adc->dev)) { in cmd_adc_read()
382 shell_error(sh, "ADC device not ready"); in cmd_adc_read()
386 adc->channel_config.channel_id = adc_channel_id; in cmd_adc_read()
388 .channels = BIT(adc->channel_config.channel_id), in cmd_adc_read()
391 .resolution = adc->resolution, in cmd_adc_read()
394 retval = adc_read(adc->dev, &sequence); in cmd_adc_read()
404 /* -1 index of ADC label name */ in cmd_adc_print()
405 struct adc_hdl *adc = get_adc(argv[-1]); in cmd_adc_print() local
414 adc->dev->name, in cmd_adc_print()
417 adc->channel_config.acquisition_time, in cmd_adc_print()
418 adc->channel_config.channel_id, in cmd_adc_print()
419 adc->channel_config.differential, in cmd_adc_print()
420 adc->resolution); in cmd_adc_print()
423 adc->channel_config.input_positive); in cmd_adc_print()
424 if (adc->channel_config.differential != 0) { in cmd_adc_print()
426 adc->channel_config.input_negative); in cmd_adc_print()
487 entry->help = "Select subcommand for ADC property label."; in cmd_adc_dev_get()
494 SHELL_CMD_REGISTER(adc, &sub_adc_dev, "ADC commands", NULL);