Skip to content

drivers: adc: shell: fix acquisition time printing#5

Draft
Surya-Tumma wants to merge 1 commit into
mainfrom
ADC_Shell_Fix
Draft

drivers: adc: shell: fix acquisition time printing#5
Surya-Tumma wants to merge 1 commit into
mainfrom
ADC_Shell_Fix

Conversation

@Surya-Tumma

Copy link
Copy Markdown
Collaborator

Fix cmd_adc_print to decode the raw packed acquisition_time bitfield into a human-readable value with units (us, ns, ticks) instead of printing a raw composite integer.

Comment thread drivers/adc/adc_shell.c Outdated
adc->resolution);

if (acq_time == ADC_ACQ_TIME_DEFAULT) {
shell_print(sh, "Acquisition Time: default");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does default mean here? It is supposed to tell the unit. correct?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ADC_ACQ_TIME_DEFAULT is nothing but zero default it will be zero.

@Surya-Tumma

Copy link
Copy Markdown
Collaborator Author

Before and after Fix resullt:

uart:~$ adc adc@40007000 acq_time 10 us                                         
uart:~$ adc adc@40007000 print                                                  
adc@40007000:                                                                   
Gain: 1                                                                         
Reference: INTERNAL                                                             
Acquisition Time: 16394                                                         
Channel ID: 0                                                                   
Differential: 0                                                                 
Resolution: 0                                                                   
Input positive: 0                                                               
uart:~$ 
uart:~$ adc adc@40007000 acq_time 10 us 
uart:~$ adc adc@40007000 print
adc@40007000:
Gain: 1
Reference: INTERNAL
Acquisition Time: 10 us                                                         
Channel ID: 0                                                                   
Differential: 0                                                                 
Resolution: 0                                                                   
Input positive: 0   

Fix cmd_adc_print to decode the raw packed acquisition_time bitfield
into a human-readable value with units (us, ns, ticks) instead of
printing a raw composite integer.

Signed-off-by: Surya Prakash T <suryat@aerlync.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants