chore: initial commit
This commit is contained in:
29
.gitignore
vendored
Normal file
29
.gitignore
vendored
Normal file
@@ -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
|
||||||
15
.vscode/settings.json
vendored
Normal file
15
.vscode/settings.json
vendored
Normal file
@@ -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"
|
||||||
|
}
|
||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -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.
|
||||||
26
README.md
Normal file
26
README.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<h1 align="center">PicoPedal</h1>
|
||||||
|
<p align="center"><i>Made with <3 by <a href="https://git.brettb.xyz/apollo">@apollo</a></i></p>
|
||||||
|
|
||||||
|
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)
|
||||||
BIN
lib/adafruit_debouncer.mpy
Normal file
BIN
lib/adafruit_debouncer.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_hid/__init__.mpy
Normal file
BIN
lib/adafruit_hid/__init__.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_hid/consumer_control.mpy
Normal file
BIN
lib/adafruit_hid/consumer_control.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_hid/consumer_control_code.mpy
Normal file
BIN
lib/adafruit_hid/consumer_control_code.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_hid/keyboard.mpy
Normal file
BIN
lib/adafruit_hid/keyboard.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_hid/keyboard_layout_base.mpy
Normal file
BIN
lib/adafruit_hid/keyboard_layout_base.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_hid/keyboard_layout_us.mpy
Normal file
BIN
lib/adafruit_hid/keyboard_layout_us.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_hid/keycode.mpy
Normal file
BIN
lib/adafruit_hid/keycode.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_hid/mouse.mpy
Normal file
BIN
lib/adafruit_hid/mouse.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_ticks.mpy
Normal file
BIN
lib/adafruit_ticks.mpy
Normal file
Binary file not shown.
47
main.py
Normal file
47
main.py
Normal file
@@ -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)
|
||||||
Reference in New Issue
Block a user