Browse Source

chore: initial commit

master
Brett Bender 3 years ago
commit
1fd6239466
15 changed files with 138 additions and 0 deletions
  1. +29
    -0
      .gitignore
  2. +15
    -0
      .vscode/settings.json
  3. +21
    -0
      LICENSE
  4. +26
    -0
      README.md
  5. BIN
      lib/adafruit_debouncer.mpy
  6. BIN
      lib/adafruit_hid/__init__.mpy
  7. BIN
      lib/adafruit_hid/consumer_control.mpy
  8. BIN
      lib/adafruit_hid/consumer_control_code.mpy
  9. BIN
      lib/adafruit_hid/keyboard.mpy
  10. BIN
      lib/adafruit_hid/keyboard_layout_base.mpy
  11. BIN
      lib/adafruit_hid/keyboard_layout_us.mpy
  12. BIN
      lib/adafruit_hid/keycode.mpy
  13. BIN
      lib/adafruit_hid/mouse.mpy
  14. BIN
      lib/adafruit_ticks.mpy
  15. +47
    -0
      main.py

+ 29
- 0
.gitignore View 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
- 0
.vscode/settings.json View 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
- 0
LICENSE View 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
- 0
README.md View File

@ -0,0 +1,26 @@
<h1 align="center">PicoPedal</h1>
<p align="center"><i>Made with &lt;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 View File


BIN
lib/adafruit_hid/__init__.mpy View File


BIN
lib/adafruit_hid/consumer_control.mpy View File


BIN
lib/adafruit_hid/consumer_control_code.mpy View File


BIN
lib/adafruit_hid/keyboard.mpy View File


BIN
lib/adafruit_hid/keyboard_layout_base.mpy View File


BIN
lib/adafruit_hid/keyboard_layout_us.mpy View File


BIN
lib/adafruit_hid/keycode.mpy View File


BIN
lib/adafruit_hid/mouse.mpy View File


BIN
lib/adafruit_ticks.mpy View File


+ 47
- 0
main.py View 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)

Loading…
Cancel
Save