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

Isr vectors #40

Merged
merged 6 commits into from
Sep 20, 2020
Merged

Isr vectors #40

merged 6 commits into from
Sep 20, 2020

Conversation

jayzakk
Copy link
Collaborator

@jayzakk jayzakk commented Aug 12, 2020

For issue #39

  • Add missing ISR vectors and definitions.
  • Fix helper functions to get correct PCINT registers and masks.

(I accidently added the patch branch from some other branch. Hopefully reverting the older patch in the new patch branch is the correct way to handle that)

@jayzakk
Copy link
Collaborator Author

jayzakk commented Aug 12, 2020

If ANYONE has a better approach for getting the bit# from bitvalue in digitalPinToPCMSKbit(), please tell me... It looks awful.

@dwillmore
Copy link
Collaborator

@jayzakk
Copy link
Collaborator Author

jayzakk commented Aug 12, 2020

I was looking for some builtin, always available function I could use in the define.
Maybe have to put some simple rotate-carry-out loop somewhere in the base libs.

@jayzakk
Copy link
Collaborator Author

jayzakk commented Aug 13, 2020

Found the builtin:
__builtin_ctz() -> "count trailing zeroes"

Looks much better now ;)

@dbuezas dbuezas force-pushed the master branch 2 times, most recently from 0dd93f9 to 26248ad Compare September 20, 2020 13:32
@dbuezas
Copy link
Owner

dbuezas commented Sep 20, 2020

Really nice jayzakk! I actually needed to use the timer 3 interrupt some time ago and gave up, thanks for this!

@dbuezas dbuezas merged commit a0c187d into dbuezas:master Sep 20, 2020
@dbuezas
Copy link
Owner

dbuezas commented Sep 20, 2020

Did you test the Analog Comparator (page 224 of datasheet v1.0.4) ?

@jayzakk
Copy link
Collaborator Author

jayzakk commented Sep 20, 2020

Nope, didn't have a setup or example for it.

@dbuezas
Copy link
Owner

dbuezas commented Sep 22, 2020

This was marked as "todo" in the original core on which this one is based, (in the readme). This part in your PR should have covered it, right?

#define ANALOG_COMP_0_vect      _VECTOR(23)
#define ANALOG_COMP_1_vect_num  25
#define ANALOG_COMP_1_vect      _VECTOR(25)

@LaZsolt
Copy link
Collaborator

LaZsolt commented Feb 14, 2021

When I try to compile my skech I get these error:

c:\ ... variants\standard\pins_arduino.h:392:47: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
const uint8_t PROGMEM port_to_PCMSK_PGM[] = { (uint8_t *)0, (uint8_t *)0, &PCMSK0, &PCMSK1, &PCMSK2, &PCMSK3, &PCMSK4 };

Maybe in line 404, need some conversion about &PCMSKx
I don't know what, but I'm tired now, Perhaps tomorrow I can figure out.

Edit: My mistake: pins_arduino.h was not the newest one. When I use the correct version of this file, I get another error.
redefined: digitalPinToPCMSK, digitalPinToPCICRbit, digitalPinToPCMSKbit and digitalPinToPCICR

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.

None yet

4 participants