adafruit / adafruit/Pro_Trinket_USB_Keyboard_Library

Feature Request: ISR-driven Example

Open
#2 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22
Forks
4
PR merge metrics
No merged PRs in 30d

Description

I'm trying to use this library but I want the keypress handler to be ISR-driven, rather than by polling.

I have adapted the example code, and added a call to attachInterrupt(..) in the setup function. This causes a compile error:

WInterrupts.c.o (symbol from plugin): In function `attachInterrupt':

(.text+0x0): multiple definition of `__vector_1'
/var/folders/st/18vtghg95f7g8wmtqcdsj3x00000gn/T/arduino_build_207015/libraries/Pro_Trinket_USB_Keyboard_Library/usbdrvasm_includer.S.o:/Users/j/Documents/Arduino/libraries/Pro_Trinket_USB_Keyboard_Library/usbdrv/usbdrvasm16.inc:35: first defined here

The code triggering this, added to my setup function looks like:
`attachInterrupt(digitalPinToInterrupt(PIN_BUTTON_STRING), keyPressISR, FALLING);`

My implementation attempt aside, I would quite appreciate an example of using this excellent library, with the key presses being handled by an ISR. That'd be most excellent to offer.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the adapted example's setup function and the attachInterrupt call, then inspect the compile-error references to WInterrupts.c.o and usbdrv/usbdrvasm16.inc. Determine the interaction between the requested keypress ISR and the library's existing interrupt handling. Done means a documented ISR-driven example that builds without the multiple-definition error.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.