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

See PR #6889 for a better solution (AT90USB - use only Teensy pin numbers in pins_XXX.h files) #6896

Closed
wants to merge 2 commits into from
Closed

See PR #6889 for a better solution (AT90USB - use only Teensy pin numbers in pins_XXX.h files) #6896

wants to merge 2 commits into from

Conversation

Bob-the-Kuhn
Copy link
Contributor

pins_XXX.h files can now use only the Teensyduino pin numbering.

This was done by by re-defining the FASTIO second level macros to translate pin numbers from Teensy to FASTIO. Now READ(X_MIN_PIN) and digitalRead(X_MIN_PIN) will use the same port.

I've verified that the stepper motors respond correctly.

pinsDebug.h needs more work

More testing needed.

So far I've translated Teensylu and both Printrboards.

pins_XXX.h files can now use only the Teensyduino pin numbering.

This was done by by re-defining the FASTIO second level macros to
translate pin numbers from Teensy to FASTIO.

I've verified that the stepper motors respond correctly.

pinsDebug.h needs more work

more testing needed
* supported by the Teensy type IDEs the digitalRead and digitalWrite commands will
* not work for these pins. They can only be used with the FASTIO commands. That's
* OK since 46 is not used by any AT90USB board and pin 47 is only used as an endstop
* input.
Copy link
Member

Choose a reason for hiding this comment

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

Excellent. Based on recent discussions and the improved notes in the code, I think we will be able to make a pretty decent article for the site explaining pins and boards.

#define E0_ENABLE_PIN 19
#define E0_STEP_PIN 34
#define E0_DIR_PIN 35
#define E0_ENABLE_PIN 13
Copy link
Member

@thinkyhead thinkyhead May 30, 2017

Choose a reason for hiding this comment

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

If these pins are now matching the ones from my PR #6889, we should try to use the pins from my PR instead, because I labeled them all with their port/pin numbers and did some other helpful formatting. Let's do a comparison and bring them into conjunction.

@thinkyhead
Copy link
Member

thinkyhead commented May 30, 2017

Wouldn't it be the same (only better) to simply assign the DIO macros according to the Teensy mapping? We just want to get rid of the "Marlin" mapping completely. In other words, get rid of this:

#define DIO0_PIN    PINA0
#define DIO0_RPORT  PINA
#define DIO0_WPORT  PORTA
#define DIO0_PWM    NULL
#define DIO0_DDR    DDRA
. . .

…and use the "Teensy" numbers in the first place, as they seem to already correspond to the digital pin number and the numbering that this PR translates…

#define DIO0_PIN    PIND0
#define DIO0_RPORT  PIND
#define DIO0_WPORT  PORTD
#define DIO0_PWM    NULL
#define DIO0_DDR    DDRD
. . .

The TEENSY_TO_FASTIO macro is just a roundabout way of doing the same thing. And, it perpetuates the idea that there is a "FastIO mapping" — which there is not. FastIO is just a tool to map pins however we want. In this case, we want to map them Teensy-style and drop the old port/pin ordering that has been associated with "Marlin mapping" or "FastIO mapping" but which might as well be "random mapping," as we are seeing.

@Bob-the-Kuhn
Copy link
Contributor Author

Closing this PR because @thinkyhead has a superior solution in PR #6889

@Bob-the-Kuhn Bob-the-Kuhn changed the title AT90USB - use only Teensy pin numbers in pins_XXX.h files See PR #6889 ~AT90USB - use only Teensy pin numbers in pins_XXX.h files~ May 31, 2017
@Bob-the-Kuhn Bob-the-Kuhn changed the title See PR #6889 ~AT90USB - use only Teensy pin numbers in pins_XXX.h files~ See PR #6889 for a better solution (AT90USB - use only Teensy pin numbers in pins_XXX.h files) May 31, 2017
@Bob-the-Kuhn Bob-the-Kuhn deleted the AT90USB---Teensy-&-FASTIO-convergence branch July 29, 2017 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants