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

UV Sensor PCB + Code #76

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft

UV Sensor PCB + Code #76

wants to merge 17 commits into from

Conversation

tahnok
Copy link
Collaborator

@tahnok tahnok commented Jul 3, 2022

Opening this up now so I have a place to push my work in progress in case anyone wants to follow along

@joeycastillo I designed the PCB for the sensor in KiCAD, had to add some new .gitignore stuff and I wasn't sure how to name it to follow the conventions you have... What do you think about a kicad folder?


watch_enable_leds();

watch_register_interrupt_callback(A2, cb_si1133_int, INTERRUPT_TRIGGER_FALLING);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@joeycastillo can you spot a mistake here somewhere? I can't get the interrupt to fire, even though the pin does go low

Copy link
Owner

Choose a reason for hiding this comment

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

This is a subtle but annoying issue with the ASF external interrupt framework; there's a warning about it in the docs. The gist is that pin A2 uses the same interrupt channel as the Alarm button, and the ASF framework only wants one pin associated with each channel. You could change that association deep in the EIC config file, but it would mean the Alarm button no longer works with the EIC.

My suggestion: instead of using watch_register_interrupt_callback, use watch_register_extwake_callback (documented here). This has the added benefit that the interrupt on A2 will be able to wake the watch from deep sleep.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess revision 2 of the UV sensor board should use a different pin 😅 , thanks for the clarification, I didn't think to read the docs...

Copy link
Owner

@joeycastillo joeycastillo Jul 25, 2022

Choose a reason for hiding this comment

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

TBH I think pins A2 and A4 are the best option for an external interrupt, since they can wake the watch from deep sleep (the EIC doesn't run in deep sleep, but the external wake on those two pins does). Unless you need to trigger on both rising and falling edges, the extwake callback on A2 should do everything the interrupt callback would do for you.

Having said that if you do want to use the EIC for whatever reason, I'd recommend pin A4 since it also gives you the option of waking from deep sleep on an interrupt signal.

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

2 participants