commit 1fd62394665934e69129d6e3cc582a8ac066e004 Author: Brett Bender Date: Thu Feb 9 20:50:05 2023 -0600 chore: initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d6cb94 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,circuitpython +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,circuitpython + +### CircuitPython ### +.Trashes +.metadata_never_index +.fseventsd/ +boot_out.txt + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,circuitpython \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c2014f0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "python.languageServer": "Pylance", + "python.linting.pylintEnabled": false, + "python.analysis.diagnosticSeverityOverrides": { + "reportMissingModuleSource": "none" + }, + "python.analysis.extraPaths": [ + "/Users/brett/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.19-darwin-arm64/boards/0x239A/0x80F4", + "/Users/brett/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.19-darwin-arm64/stubs", + "/Users/brett/Library/Application Support/Code/User/globalStorage/joedevivo.vscode-circuitpython/bundle/20230209/adafruit-circuitpython-bundle-py-20230209/lib" + ], + "circuitpython.board.version": null, + "circuitpython.board.vid": "0x239A", + "circuitpython.board.pid": "0x80F4" +} \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0f55269 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Brett Bender + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3b03245 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +

PicoPedal

+

Made with <3 by @apollo

+ +A simple script that turns a pin into a keypress + +## Built With +- Circuit Python +- Adafruit HID +- Adafruit Debouncer +- Adafruit Ticks + +## Usage +### Wiring +| Pico Pin | Audio Jack | +| ---- | ---- | +| GP1 | LEFT/RIGHT | +| GND | GROUND | + + +## Licensing + +This project is licensed under the [MIT License](https://choosealicense.com/licenses/mit/) + +## Authors + +* [Brett Bender](https://git.brettb.xyz/apollo) \ No newline at end of file diff --git a/lib/adafruit_debouncer.mpy b/lib/adafruit_debouncer.mpy new file mode 100644 index 0000000..f5933a2 Binary files /dev/null and b/lib/adafruit_debouncer.mpy differ diff --git a/lib/adafruit_hid/__init__.mpy b/lib/adafruit_hid/__init__.mpy new file mode 100644 index 0000000..8244b8c Binary files /dev/null and b/lib/adafruit_hid/__init__.mpy differ diff --git a/lib/adafruit_hid/consumer_control.mpy b/lib/adafruit_hid/consumer_control.mpy new file mode 100644 index 0000000..02cb9dc Binary files /dev/null and b/lib/adafruit_hid/consumer_control.mpy differ diff --git a/lib/adafruit_hid/consumer_control_code.mpy b/lib/adafruit_hid/consumer_control_code.mpy new file mode 100644 index 0000000..618edca Binary files /dev/null and b/lib/adafruit_hid/consumer_control_code.mpy differ diff --git a/lib/adafruit_hid/keyboard.mpy b/lib/adafruit_hid/keyboard.mpy new file mode 100644 index 0000000..1bc8e5d Binary files /dev/null and b/lib/adafruit_hid/keyboard.mpy differ diff --git a/lib/adafruit_hid/keyboard_layout_base.mpy b/lib/adafruit_hid/keyboard_layout_base.mpy new file mode 100644 index 0000000..7d759cf Binary files /dev/null and b/lib/adafruit_hid/keyboard_layout_base.mpy differ diff --git a/lib/adafruit_hid/keyboard_layout_us.mpy b/lib/adafruit_hid/keyboard_layout_us.mpy new file mode 100644 index 0000000..7b3398c Binary files /dev/null and b/lib/adafruit_hid/keyboard_layout_us.mpy differ diff --git a/lib/adafruit_hid/keycode.mpy b/lib/adafruit_hid/keycode.mpy new file mode 100644 index 0000000..8a5c631 Binary files /dev/null and b/lib/adafruit_hid/keycode.mpy differ diff --git a/lib/adafruit_hid/mouse.mpy b/lib/adafruit_hid/mouse.mpy new file mode 100644 index 0000000..9e09cc3 Binary files /dev/null and b/lib/adafruit_hid/mouse.mpy differ diff --git a/lib/adafruit_ticks.mpy b/lib/adafruit_ticks.mpy new file mode 100644 index 0000000..75c902d Binary files /dev/null and b/lib/adafruit_ticks.mpy differ diff --git a/main.py b/main.py new file mode 100644 index 0000000..250e986 --- /dev/null +++ b/main.py @@ -0,0 +1,47 @@ +from adafruit_hid.keycode import Keycode +from adafruit_hid.keyboard import Keyboard +from adafruit_debouncer import Debouncer +import usb_hid +import digitalio +import board + +############# WIRING ############# +# +# GND <-> Audio Jack Ground +# GP1 <-> Audio Jack Left/Right +# +########### END WIRING ########### + + +############# CONFIG ############# +keycodePress = Keycode.D +readPin = board.GP1 + +########### END CONFIG ########### + + +######## SYSTEM VARIABLES ######## +# Keyboard +kbd = Keyboard(usb_hid.devices) + +# Button/Switch +pin = digitalio.DigitalInOut(readPin) +pin.direction = digitalio.Direction.INPUT +pin.pull = digitalio.Pull.UP +switch = Debouncer(pin, interval=0.05) +###### END SYSTEM VARIABLES ###### + +### BEGIN PROGRAM ### +# Clean up any left over keypresses, sometimes they happen +kbd.release_all() + +print("Starting program") +print("Waiting for pedal input") +while True: + switch.update() + if switch.rose: + print("releasing button") + kbd.release(keycodePress) + if switch.fell: + print("pressing button") + kbd.press(keycodePress)