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

Use PINx to toggle pins. #27

Open
timower opened this issue Apr 11, 2020 · 1 comment
Open

Use PINx to toggle pins. #27

timower opened this issue Apr 11, 2020 · 1 comment

Comments

@timower
Copy link

timower commented Apr 11, 2020

Currently DirectIO uses a read, flip, write sequence to toggle output pins.
This can be done faster by using the PINx registers (on some targets?).
See section 14.2.2 of the ATMega328 manual:

14.2.2 Toggling the Pin
Writing a logic one to PINxn toggles the value of PORTxn, independent on the value of DDRxn. Note that the SBI instruction can be used to toggle one single bit in a port.

@WestfW
Copy link

WestfW commented Oct 26, 2022

Toggle capability is also present in SAM and SAMD

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