-
Notifications
You must be signed in to change notification settings - Fork 210
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
base: main
Are you sure you want to change the base?
Conversation
apps/uv-test/app.c
Outdated
|
||
watch_enable_leds(); | ||
|
||
watch_register_interrupt_callback(A2, cb_si1133_int, INTERRUPT_TRIGGER_FALLING); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
e415c44
to
6674c70
Compare
All the design files for the UV sensor board r1
SI1133 Working i2c version check
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?