Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adc-pin reports "invalid ADC" with default-adc #101

Closed
twillis-prog opened this issue May 14, 2024 · 2 comments
Closed

adc-pin reports "invalid ADC" with default-adc #101

twillis-prog opened this issue May 14, 2024 · 2 comments

Comments

@twillis-prog
Copy link

Found ads.fs adc-pin ( adc pin -- ) still had the pin on TOS when validate-adc executed.
Made to work by adding a 'drop" prior to validate-adc. When swap was tried, left pin on TOS.

\ Set a pin to be an ADC pin ( Modified )
: adc-pin ( adc pin -- )
dup pin-internal::validate-pin
dup 26 >= swap 29 <= and averts x-pin-has-no-adc-chan
drop \ <<<<<<<<<<<<<< added because the pin was on TOS, causing validate-adc to fail.
validate-adc
;

@tabemann
Copy link
Owner

Yeah that is a bug. Actually, if you are targeting the RP2040, don't even use adc-pin because it is completely unnecessary. It is there only for compatibility with the STM32 API's sake, and I didn't catch the bug in my testing because I never used adc-pin on the RP2040.

@twillis-prog
Copy link
Author

My error! All is OK with adc.fs

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

No branches or pull requests

2 participants