From cbaf995e330667a62be1278adc8af517e38469dd Mon Sep 17 00:00:00 2001 From: zyxwars <zyxwars221@gmail.com> Date: Fri, 11 Mar 2022 23:10:39 +0100 Subject: [PATCH] Add boot.py docs --- docs/boot.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 docs/boot.md diff --git a/docs/boot.md b/docs/boot.md new file mode 100644 index 0000000..7b40bed --- /dev/null +++ b/docs/boot.md @@ -0,0 +1,48 @@ +## There is a more detailed explanation in the [circuit python docs](https://docs.circuitpython.org/en/latest/README.html), however there are some common use cases for your keyboard listed here + +### You can hide your device from showing up as a usb storage + +```python +storage.disable_usb_drive() +``` + +### Make your keyboard work in bios + +```python +usb_hid.enable(boot_device=1) +``` + +### Disable serial comms + +```python +# Equivalent to usb_cdc.enable(console=False, data=False) +usb_cdc.disable() +``` + +### A fully working example, with a + +```python +import supervisor +import board +import digitalio +import storage +import usb_cdc +import usb_hid + +supervisor.set_next_stack_limit(4096 + 4096) + +# If this key is held during boot, don't run the code which hides the storage and disables serial +col = digitalio.DigitalInOut(board.GP2) +row = digitalio.DigitalInOut(board.GP13) +col.switch_to_output(value=True) +row.switch_to_input(pull=digitalio.Pull.DOWN) + +if not row.value: + storage.disable_usb_drive() + # Equivalent to usb_cdc.enable(console=False, data=False) + usb_cdc.disable() + usb_hid.enable(boot_device=1) + +row.deinit() +col.deinit() +```