-
Notifications
You must be signed in to change notification settings - Fork 17
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
Remove unnecessary reference to CircuitPython binding #44
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks!
common_hal_mcu_disable_interrupts()
and common_hal_mcu_enable_interupts()
are called in samd/samd21/dma.c
and samd/external_interrupts.c
.
This is noted in #28, with a possible solution. Another refactoring would be to move the body of those routines back to here as new routines, and call them from common_hal/microcontroller/__init__.c
.
The |
Thanks; just tried |
Just for background: I'm adding cap touch support to MicroPython, particularly SAMD. I used the Adafruit_Freetouch library to add the majority of the functionality (for SAMD21 at least, 51 is going to take further effort). However, looking at the TouchIn implementation, samd-peripherals was required - just to configure a GCLK appropriately. Even that needs a little work since - if I understand correctly, it currently only works for 48MHz |
Apologies, that was a long-winded way of saying that I'm currently focussed on getting cap touch working for MicroPython and this change is all that's required for that. Once I sort out touch I'll come back and take a look at |
It turns out this only works because the interrupt routines are also declared here: // These critical-section macros are used only a few places in MicroPython, but
// we need to provide actual implementations.
extern void common_hal_mcu_disable_interrupts(void);
extern void common_hal_mcu_enable_interrupts(void);
#define MICROPY_BEGIN_ATOMIC_SECTION() (common_hal_mcu_disable_interrupts(), 0)
#define MICROPY_END_ATOMIC_SECTION(state) ((void)state, common_hal_mcu_enable_interrupts()) Ideally we would like to remove both MicroPython and CircuitPython dependencies from this library. Aside re SAMD51 touch: we tried reverse-engineering it and failed, and instead reused the implementation we originally developed for nRF, which requires a 1M pull-down. It works quite well. |
The include to
shared-bindings/microcontroller/__init__.h
appears to be unused but makes it difficult to build without CircuitPython.To be certain, I removed the include and tested building the CircuitPython atmel-samd boards
feather_m4_express
andtrinket_m0
- there were no errors.