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

digitalRead/WriteFast to sio_hw->gpio #1077

Merged
merged 1 commit into from
Dec 30, 2022
Merged

digitalRead/WriteFast to sio_hw->gpio #1077

merged 1 commit into from
Dec 30, 2022

Conversation

neilger
Copy link
Contributor

@neilger neilger commented Dec 30, 2022

Per #1067:

#define digitalWriteFast(pin,val) (val ? gpio_set_mask(1 << pin) : gpio_clr_mask(1 << pin))
#define digitalReadFast(pin) gpio_get(pin)

gives an 8.76 MHz ring (at 250 MHz clock);

#define digitalWriteFast(pin,val) (val ? sio_hw->gpio_set = (1 << pin) : sio_hw->gpio_clr = (1 << pin))
#define digitalReadFast(pin) ((1 << pin) & sio_hw->gpio_in)

gives a12.9 MHz ring.

@neilger neilger mentioned this pull request Dec 30, 2022
Copy link
Owner

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

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

Thanks!

@earlephilhower earlephilhower merged commit b8906e0 into earlephilhower:master Dec 30, 2022
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