Remove unnecessary reference to CircuitPython binding#44
Conversation
dhalbert
left a comment
There was a problem hiding this comment.
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__.happears 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_expressandtrinket_m0- there were no errors.