This project includes a sample for creating a LampArray deivce on the Adafruit Macropad, which allows it to be controlled using Windows Lighting. This is done using the Raspberry Pi Pico C/C++ SDK and TinyUSB.
In this sample, there are two layers which are controlled by the rotary encoder. The default layer is a simple numpad layout, and the second layer is all blanks ready to be filed with any Macro command. The current design only allows one key combination to be sent at a time, and each combination is limited to two modifier keys (control, alt, shift, etc.) and 6 keys at a time, which is a limitation of the HID standard.
This sample implements the LampArray HID standard, so when connected to any LampArry HID controller, this device should be able to be controlled. Additionally, a developer can control the RGB device effects from the Windows LampArray API. See the AutoRGB sample here: https://github.com/microsoft/Dynamic-Lighting-AutoRGB.
This can be used as a template for other RP2040 devices which are connected to NeoPixels, or the Lighting folder can be used as a starting point for any project that uses TinyUSB.
Note, this project was built off of the Hid Composite sample in the Pico-Examples repository. Additionally, this project uses the PIO example in the Pico C/C++ SDK documentation, section 3.2.2: A Real Example: WS2812 LEDs.
Note, that this project was built and tested using the latest Ubuntu WSL. Other distributions and the Windows version of the Pico SDK should work, but those options have not been verified.
- Install WSL onto Windows Machine
git clone
this project into WSL distribtion. This directory will now be the project directory.- Install build dependencies.
$ sudo apt install build-essential
-
Follow Pico SDK setup instructions from https://github.com/raspberrypi/pico-sdk up through step 2c. (For step 2, this project was set up by cloning the SDK)
-
cd to the SDK directory and run
git submodule update --init
-
Update TinyUSB hid header to include LampArray. Navigate to fork of TinyUSB. Copy headers hid.h and hid_device.h to TinyUSB library in Pico SDK path, i.e.
<PicoSdkRoot>/lib/tinyusb/src/class/hid/
. TODO: Once PR in TinyUSB goes in, remove this step -
cd to
<ProjectDirectory>/src
and setup CMake build directory:
mkdir build
cd build
cmake -DPICO_BOARD=adafruit_macropad_rp2040 ..
Note, if PICO_SDK_PATH environment variable has not been set up in step 3, -DPICO_SDK_PATH=
will need to be specified as well.
- Make your target from the project build directory.
make
- On the Macropad, while holding down the rotary encoder button, press the reset button on the left side of the board, right under the OLED screen. Macropad device should show up as a removable device
RPI-RP2 (DriveLetter:)
- Open an Explorer window to the build directory, and copy macropad.uf2 to the Macropad removeable device. Device should automatically remove itself and reboot.
- Open Settings > Personalization > Dynamic Lighting, and see the device come up.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.