From 3f826267b4cf6843dedddac6fffbb6634dfda890 Mon Sep 17 00:00:00 2001 From: xs5871 Date: Thu, 14 Jul 2022 13:55:05 +0000 Subject: [PATCH] remove adafruit_pioasm dependency --- docs/split_keyboards.md | 5 +---- kmk/transports/pio_uart.py | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/docs/split_keyboards.md b/docs/split_keyboards.md index a02bc49..fec0f66 100644 --- a/docs/split_keyboards.md +++ b/docs/split_keyboards.md @@ -108,10 +108,7 @@ If you're using an RP2040 based board and want the split communication to use ot In order to enable it, you must: - Install Circuitpython version > 7.2, -- add the `adafruit_pioasm.mpy` library to the lib or root folder of the boards, -- and pass `use_pio=True` into the `Split()` constructor. - -The file is available [on the library release page](https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/releases). From the `adafruit-circuitpython-pioasm-x.y-mpy-0.x.y.zip`, copy the `lib` folder (or its content) to the root of your circuitpython drives. Make sure to get the zip corresponding to your circuitpython version as the mpy format can evolve! +- pass `use_pio=True` into the `Split()` constructor. ### `data_pin`/`data_pin2` diff --git a/kmk/transports/pio_uart.py b/kmk/transports/pio_uart.py index ac9eadc..0b30df6 100644 --- a/kmk/transports/pio_uart.py +++ b/kmk/transports/pio_uart.py @@ -2,11 +2,10 @@ Circuit Python wrapper around PIO implementation of UART Original source of these examples: https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/tree/main/examples (MIT) ''' -import adafruit_pioasm import rp2pio +from array import array -tx_code = adafruit_pioasm.assemble( - ''' +''' .program uart_tx .side_set 1 opt ; An 8n1 UART transmit program. @@ -16,11 +15,13 @@ tx_code = adafruit_pioasm.assemble( bitloop: ; This loop will run 8 times (8n1 UART) out pins, 1 ; Shift 1 bit from OSR to the first OUT pin jmp x-- bitloop [6] ; Each loop iteration is 8 cycles. -''' -) -rx_code = adafruit_pioasm.assemble( - ''' +; compiles to: +''' +tx_code = array('H', [40864, 63271, 24577, 1602]) + + +''' .program uart_rx_mini ; Minimum viable 8n1 UART receiver. Wait for the start bit, then sample 8 bits @@ -34,8 +35,9 @@ bitloop: ; Loop 8 times in pins, 1 ; Sample data jmp x-- bitloop [6] ; Each iteration is 8 cycles +; compiles to: ''' -) +rx_code = array('H', [8224, 59943, 16385, 1602]) class PIO_UART: