tinygo
tinygo copied to clipboard
avr: adding pin change interrupt handling to atmega328p
This is what I've come up with for AVR pin change interrupts.
I created a ticket for this work too: https://github.com/tinygo-org/tinygo/issues/3145 Not sure what the official ticket/git tagging mechanism is...
So @mrbell321 has this been tested on real hardware?
I’m on macOS not Linux and I’ve been through the process a couple times. Not the only one having the issue either. There’s a slack thread.
On Thu, Sep 29, 2022 at 3:46 AM Ron Evans @.***> wrote:
@.**** commented on this pull request.
In src/machine/machine_atmega328p.go https://github.com/tinygo-org/tinygo/pull/3139#discussion_r983253188:
PCMSK_REG = avr.PCMSK0
PCIE = avr.PCICR_PCIE0PIN0 = PD0PCINT = 1 << (pin - PIN0)IRQ = avr.IRQ_PCINT0Please see https://tinygo.org/getting-started/install/linux/#avr-eg-arduino-uno for the install requirements for AVR on Linux.
— Reply to this email directly, view it on GitHub https://github.com/tinygo-org/tinygo/pull/3139#discussion_r983253188, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH52U5JQDUWPUVU5NHFUELWAVJOPANCNFSM6AAAAAAQHFEHMI . You are receiving this because you authored the thread.Message ID: @.***>
The early version, yes, but there have been changes I cannot test yet due to the above toolchain issues.
On Thu, Sep 29, 2022 at 4:42 AM Ron Evans @.***> wrote:
So @mrbell321 https://github.com/mrbell321 has this been tested on real hardware?
— Reply to this email directly, view it on GitHub https://github.com/tinygo-org/tinygo/pull/3139#issuecomment-1262032197, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH52UYQXYYNG5NF5676IHTWAVQALANCNFSM6AAAAAAQHFEHMI . You are receiving this because you were mentioned.Message ID: @.***>
I've tried this change on a custom board with atmega328p chip.
Interrupt fires. Can't use irremote driver directly though, since this change misses PinRising and PinFalling states.
I'm not exactly sure how, but handling of the state shall be possible to add, see for example https://www.avrfreaks.net/s/topic/a5C3l000000URmcEAG/t120592
This can be closed now, @deadprogram ?
@ysoldak yes.
@mrbell321 thank you for pointing the way on the implementation. Now closing this PR.