{"slice":{"locale":"en","from":20000,"to":27317,"total_chars":27317,"html":"<h2 id=\"keymap\">Keymap!</h2>\n<p>#<br>\n# You will need to customize this for your own needs.  The sample<br>\n# below will give you a good idea of what you can do.<br>\n#<br>\n# Holding the D0 key will cycle between layer 0-5 and then go<br>\n# back to layer 0.<br>\n#<br>\n# To cycle between layers, we use KC.TG to go to higher level<br>\n# layers and then KC.TO to go back to the lowest (first) layer when<br>\n# we reach the last layer. I initially used KC.TO everywhere<br>\n# which resulted in the current layer being the only active layer<br>\n# and transparent keys not working as expected.  A big thumbs up<br>\n# to &quot;regicidal plutophage&quot; for helping me understand that on the<br>\n# zulip support chat <a href=\"https://kmkfw.zulipchat.com/\" rel=\"nofollow ugc noopener\" target=\"_blank\">https://kmkfw.zulipchat.com/</a><br>\n#<br>\n# Cycle between layers:<br>\n# Layer 0 (Blue LED)   - Active layers [0]<br>\n# Layer 1 (White LED)  - Active layers [1,0]<br>\n# Layer 2 (Red LED)    - Active layers [2,1,0]<br>\n# Layer 3 (Green LED)  - Active layers [3,2,1,0]<br>\n# Layer 4 (Pink LED)   - Active layers [4,3,2,1,0]<br>\n# Layer 5 (Yellow LED) - Active layers [5,4,3,2,1,0]<br>\n#</p>\n<p>GO_WHITE  = KC.TG(LYR_WHITE)<br>\nGO_RED    = KC.TG(LYR_RED)<br>\nGO_GREEN  = KC.TG(LYR_GREEN)<br>\nGO_PINK   = KC.TG(LYR_PINK)<br>\nGO_YELLOW = KC.TG(LYR_YELLOW)<br>\nGO_FIRST  = KC.TO(0)</p>\n<p>keyboard.keymap = [<br>\n# LYR_BLUE<br>\n[<br>\n#   D0<br>\nKC.MT(GOOGLE, GO_WHITE),<br>\n],<br>\n# LYR_WHITE<br>\n[<br>\n#   D0<br>\nKC.MT(WHITE, GO_RED),<br>\n],<br>\n# LYR_RED<br>\n[<br>\n#   D0<br>\nKC.MT(RED, GO_GREEN),<br>\n],<br>\n# LYR_GREEN<br>\n[<br>\n#   D0<br>\nKC.MT(GREEN, GO_PINK),<br>\n],<br>\n# LYR_PINK<br>\n[<br>\n#   D0<br>\nKC.MT(PINK, GO_YELLOW),<br>\n],<br>\n# LYR_YELLOW<br>\n[<br>\n#   D0<br>\nKC.MT(YELLOW, GO_FIRST),<br>\n],<br>\n]</p>\n<p>if <strong>name</strong> == &quot;<strong>main</strong>&quot;:<br>\nkeyboard.go()</p>\n<h4>boot.py (optional) contains the code to hide the CIRCUITPY USB drive and serial COM port (REPL) unless you press and hold a specific key while booting, in this case this is the key connected to D10.  For me, it is underneath the LED window:</h4>\n<p># &lt;boot.py&gt;<br>\n# Include this file at the root of the CIRCUITPY drive if<br>\n# you want to disable the USB drive and serial interface<br>\n# unless you press and hold key 10 while booting<br>\nimport board<br>\nimport digitalio<br>\nimport storage<br>\nimport usb_cdc</p>\n<p># Need this to make the keyboard visible in the BIOS<br>\n# This is a macropad so unlikely that we'll need it<br>\n# import usb_hid<br>\n# usb_hid.enable(boot_device=1)</p>\n<p># The USB drive (CIRCUITPY), and serial interface (REPL)<br>\n# are enabled by default<br>\n#<br>\n# If the key on pin D10 is not held during boot,<br>\n# execute the code to disable the USB drive and serial interface.<br>\n# (Hold the key to mount the drive and serial interface)<br>\n#<br>\n# <a href=\"https://learn.adafruit.com/customizing-usb-devices-in-circuitpython/circuitpy-midi-serial\" rel=\"nofollow ugc noopener\" target=\"_blank\">https://learn.adafruit.com/customizing-usb-devices-in-circuitpython/circuitpy-midi-serial</a></p>\n<p>bypass_key = digitalio.DigitalInOut(board.D0)<br>\nbypass_key.pull = digitalio.Pull.UP</p>\n<p>if bypass_key.value:<br>\n# Disable the CIRCUITPY USB drive<br>\nstorage.disable_usb_drive()</p>\n<p># Disable both serial devices<br>\n# Equivalent to usb_cdc.enable(console=False, data=False)<br>\nusb_cdc.disable()</p>\n<p>bypass_key.deinit()</p>\n<h4>Installation steps</h4>\n<p><strong>Install CircuitPython</strong></p>\n<p>There is a detailed tutorial available for Mac OSX <a href=\"https://wiki.seeedstudio.com/XIAO-RP2040-with-CircuitPython/\" rel=\"nofollow ugc noopener\" target=\"_blank\">here</a>, beware the download link provided is for an outdated version of CircuitPython; I suggest getting the latest stable version from the CircuitPython <a href=\"https://circuitpython.org/board/seeeduino_xiao_rp2040/\" rel=\"nofollow ugc noopener\" target=\"_blank\">download page</a>.</p>\n<p><strong>Start the RP2040 in bootloader mode:</strong> </p>\n<p>Press and hold the “BOOT” button (see diagram in the overview section for reference) on the RP2040 board and then connect it to USB or hit and release the “reset” button (while still holding “BOOT”) if the board is already connected to USB.</p>\n<p>Release the “BOOT” button after the board has started and you see the <em>RP1-RPI2</em> USB drive.</p>\n<p><strong>Download and copy CircuitPython for the Seeed Xiao RP2040 board:</strong></p>\n<p>I downloaded the current stable version (8.0.3) from <a href=\"https://downloads.circuitpython.org/bin/seeeduino_xiao_rp2040/fr/adafruit-circuitpython-seeeduino_xiao_rp2040-fr-8.0.3.uf2\" rel=\"nofollow ugc noopener\" target=\"_blank\">here</a>.</p>\n<p>Copy the UF2 file to the root of <em>RP1-RPI2</em> USB drive.</p>\n<p>The board will restart and you will see a <em>CIRCUITPY</em> USB drive instead of <em>RP1-RPI2</em>.</p>\n<p>Congrats, you just installed CircuitPython!</p>\n<p><strong>Install KMK and the neopixel library</strong></p>\n<p>Download KMK from <a href=\"https://github.com/KMKfw/kmk_firmware/archive/refs/heads/master.zip\" rel=\"nofollow ugc noopener\" target=\"_blank\">here</a>.</p>\n<p>Open the zip file and copy the <em>KMK</em> folder and its content to the root of the <em>CIRCUITPY</em> drive.</p>\n<p>Download the neopixel library from <a href=\"https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/archive/refs/heads/main.zip\" rel=\"nofollow ugc noopener\" target=\"_blank\">here</a>.</p>\n<p>Open the zip file and copy the neopixel.py file to the root of the <em>CIRCUITPY</em> drive.</p>\n<p><strong>Setup KMK</strong> </p>\n<p>Create a code.py file at the root of the <em>CIRCUITPY</em> drive.  The file can contain your own code or the sample that I have provided.</p>\n<p>Optionally, create a boot.py file at the root of the <em>CIRCUITPY</em> drive.  This file is only needed if you prefer to hide the USB drive and serial port.  You need to unplug and reconnect the USB cable to apply changes to the boot.py file (a simple reset is not sufficient).</p>\n<h4>Print Settings:</h4>\n<p>If you are willing to sacrifice the LED window, you can print with a single color but I recommend printing the top layer with transparent filament.</p>\n<p>Color changes instructions: <a href=\"https://help.prusa3d.com/article/color-change_1687\" rel=\"nofollow ugc noopener\" target=\"_blank\">https://help.prusa3d.com/article/color-change_1687</a></p>\n<p><strong>Recommended settings</strong></p>\n<p><strong>Layer Height</strong></p>\n<p>0.2 mm</p>\n<p>0.15 mm</p>\n<p>0.1 mm</p>\n<p><strong>Material</strong></p>\n<p>PETG</p>\n<p><strong>Infill - Bottom fill pattern</strong></p>\n<p>Hilbert Curve</p>\n<p><strong>Layers and perimeters - Solid Layers - Bottom</strong></p>\n<p>15</p>\n<p>20</p>\n<p>29</p>\n<p><strong>Color changes</strong></p>\n<p>Color change <a href=\"https://help.prusa3d.com/article/color-change_1687\" rel=\"nofollow ugc noopener\" target=\"_blank\">instructions</a> for Prusa slicer.</p>\n<p>1.8 mm</p>\n<p>3.2 mm</p>\n<p>1.7 mm</p>\n<p>3.2 mm</p>\n<p>1.6 mm</p>\n<p>3.1 mm</p>\n<p>I printed the top with a 0.6 nozzle because that's what I had installed / 0.2 mm layer height but I would probably print with a 0.4 nozzle. </p>\n<p>All color changes are optional if you are willing to sacrifice the LED window.  The first layer should be printed with transparent filament with a change of color at the height specified in the table above.  The first color change is highly recommended.  The second  is optional but the color change gives a nice look.</p>\n<p>Hilbert Curve gives a wonderful finish on the transparent layer (much better than diagonal lines!).</p>\n<p>PLA will probably work but I am not sure how the RP2040 pegs will handle being bent when inserting the microcontroller (PLA is more brittle than PETG).  I also don’t remember ever seeing transparent PLA so you would need to sacrifice the LED window.  If you print it with PLA, please let me know how it worked for you!</p>\n<p>If you want to learn more about CircuitPython you can check this <a href=\"https://learn.adafruit.com/welcome-to-circuitpython\" rel=\"nofollow ugc noopener\" target=\"_blank\">tutorial</a> on the Adafruit website.</p>\n<p>The KMK github page is <a href=\"https://github.com/KMKfw/kmk_firmware\" rel=\"nofollow ugc noopener\" target=\"_blank\">here</a>.</p>\n<p>The KMK web site is <a href=\"http://kmkfw.io/\" rel=\"nofollow ugc noopener\" target=\"_blank\">here</a>.</p>","has_more":false},"deferred":false}
