kbaskett248 / adafruit_macropad

45 stars 21 forks source link

App Pad

A derivative of the Macropad Hotkeys example from the Adafruit Learning System Guide.

Why use this version

I wanted to define more complex configurations than what was easily possible with the original Adafruit Macropad Hotkeys code. This project has several advanced features beyond the original project.

Using

Just like with the original Macropad Hotkeys code, copy all the files over to your Circuitpy drive.

The existing layout has a Home App with the following features:

Customizing

There are two methods to tailor the macropad to your specific use case. The preferred method avoids modifying any versioned files, so you can continue to pull in updates from this project. The second method may be easier for those without as much git or python experience.

Preferred

The preferred way to customize your apps and hotkeys is by creating a user module or package. If that module or package defines DEFAULT_APP, then that app will be loaded when the macropad starts.

  1. Clone this repo.
  2. In the base of the repo, create either user.py or create a directory called user with a file called __init__.py.
  3. In whichever file you created, define a callable called DEFAULT_APP. The callable should accept an AppPad instance. For example, the default configuration assumes the host OS is windows. If you wanted to set the default host OS to MacOS instead, you could define user.py as follows.

    # user.py
    from apps.home import HomeApp
    from utils.constants import OS_SETTING, OS_MAC, PREVIOUS_APP_SETTING
    
    app_settings = {
       OS_SETTING: OS_MAC,
       PREVIOUS_APP_SETTING: [],
    }
    
    DEFAULT_APP = lambda app_pad: HomeApp(app_pad, app_settings)

That's all there is to it.

Method 2

If you aren't interested in pulling down future updates, then feel free to make any tweaks you'd like to make in the apps folder or any other code.

Contributors

Thanks for your interest in contributing!

This project uses black and isort to maintain code style. Both of these tools are configured to run via pre-commit. After installing pre-commit using your preferred method, install the git hooks for this repository.

pre-commit install

The first commit may take some time while pre-commit installs the hooks. Subsequent commits will be faster.

In addition, there is a Github action which will run these checks on any pull request.