Skip to content

Pass in devices #43

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

Merged
merged 2 commits into from
Jan 7, 2020
Merged

Pass in devices #43

merged 2 commits into from
Jan 7, 2020

Conversation

tannewt
Copy link
Member

@tannewt tannewt commented Dec 18, 2019

This will be a new major version because the constructor signature changes.

hid_simpletest.py and hid_keyboard_shortcuts.py tested and work.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of breaking upward compatibility, how about making devices be an optional arg devices=None, and if it is None, conditionally importing usb_hid and then passing usb.hid_devices to find_device()? That will save having to change a lot of existing code, and will simplify the use in the USB case, which is the most common case.

@tannewt
Copy link
Member Author

tannewt commented Dec 18, 2019

I'd rather not have the USB be auto-magic. It's more readable to have it passed in. (Taking a USB example and porting to BLE would be much clearer for example.) Furthermore, it removes a dependency on usb_hid.

@dhalbert
Copy link
Collaborator

The issue I see is that there are many existing examples including in Learn Guides (I counted at least 17 Learn Guides, and there may be more), and we'll break a lot of existing code if the bundles start including an incompatible library. We'd also probably want to update the frozen lib again on 4.x.

Suppose we made it upward compatible for 5.0, and then gradually changed the examples and cut over for 6.0 (like we are doing for stop for I2C)?

@tannewt
Copy link
Member Author

tannewt commented Dec 20, 2019

I'd rather figure out how to update everything as needed than stretch out the update over a period of time where more examples may be created. It's important for us to have the flexibility to update our APIs over time.

I can prep a PR for updating these examples:

 /V/G/Adafruit_Learning_System_Guides   master 
 ag -Ql "from adafruit_hid" .                                                             Thu Dec 19 16:08:22 2019
Introducing_Gemma_M0/Gemma_HIDkeyboard.py
Foul_Fowl/main.py
Make_It_Log/time-light-temp.py
GemmaM0_Radio_Tuning_Knob/main.py
Arcade_Button_Control_Box/Arcade_Button_Control_Box.py
Make_It_A-Mouse/cpx-mouse-buttons.py
Make_It_A-Mouse/mouse-cursor.py
Launch_Deck_Trellis_M4/launch_deck_trellis_m4.py
Make_It_A_Keyboard/keyboard-multimedia.py
Make_It_A_Keyboard/keycodes.py
Make_It_A_Keyboard/strings.py
Minecraft_Gesture_Controller/main.py
Introducing_CircuitPlaygroundExpress/CircuitPlaygroundExpress_HIDKeyboard.py
GemmaM0_Password_Vault/main.py
CPX_GBoard/touch_hid.py
CPX_GBoard/arcade_hid.py
CPX_GBoard/universal.py
Giant_Mechanical_Keyboard/code.py
CircuitPython_Essentials/CircuitPython_HID_Mouse.py
CircuitPython_Essentials/CircuitPython_HID_Keyboard.py
Rotary_Encoder/rotary_encoder_volume.py
Crank_USB_HID/code.py
Adafruit_pIRKey/NEC_keyboard_example.py
Adafruit_pIRKey/raw_code_keyboard/main.py

@dhalbert
Copy link
Collaborator

I'll approve, but won't merge, so we can merge a corresponding Learn Guides PR immediately after the bundle is published

@tannewt
Copy link
Member Author

tannewt commented Jan 7, 2020

Merging now. Will follow up with Learn code updates and updating frozen in CP master.

@tannewt tannewt merged commit 2d1dce6 into adafruit:master Jan 7, 2020
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jan 8, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display to 3.8.4 from 3.8.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#59 from makermelissa/master
  > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#58 from makermelissa/master
  > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#57 from makermelissa/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_HID to 4.0.0 from 3.3.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_HID#43 from tannewt/pass_in_devices
  > Merge pull request adafruit/Adafruit_CircuitPython_HID#44 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_LIS2MDL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants