# As recommended by the Mecrisp-Stellaris unofficial docs
# @ https://mecrisp-stellaris-folkdoc.sourceforge.io/serial-terminals.html
+
+HW_FLOW_CONTROL ?= 1
+LINESPEED = ""
+
+ifeq ($(HW_FLOW_CONTROL), 0)
+ LINESPEED = "-l200"
+endif
+
connect:
picocom -b 115200 -f h /dev/ttyUSB0 \
--imap lfcrlf,crcrlf \
--omap delbs,crlf \
- --send-cmd "ascii-xfr -s"
+ --send-cmd "ascii-xfr -s $(LINESPEED)"
[Documentation](doc/README.md)
+## Connecting
+
+To connect to the system relying on hardware flow control:
+
+```shell
+make connect
+```
+
+Or, when hardware flow control may not be present:
+
+```shell
+HW_FLOW_CONTROL=0 make connect
+```
+
+This will add a 200ms end-of-line delay. Enabling hardware flow control comes
+highly recommended, as developer workflow improves tremendously.
## TODO
--- /dev/null
+\ Random number generation words
+\ Relies upon the rp2040 ring oscillator
+
+$40060000 constant ROSC_BASE
+ROSC_BASE $1c + constant RANDOMBIT
+
+\ Given a size in bits, return a random number
+: random ( bits -- n )
+ 0 SWAP 0 DO
+ RANDOMBIT @ I lshift OR
+ LOOP ;
: transmit-enabled? ( addr -- flag ) @ 1 8 lshift AND 0 > ;
\ Hardware Flow Control
+\ Given the address of a UART control register, check if rts or cts is enabled
+\ example: UART0 rts-enabled?
: rts-enabled? ( addr -- flag ) @ 1 14 lshift AND 0 > ;
: cts-enabled? ( addr -- flag ) @ 1 15 lshift AND 0 > ;
+\ Given the address of a UART control register, toggle rts or cts
+\ example: UART0 rts-toggle
: rts-toggle ( addr -- ) DUP @ 1 14 lshift XOR SWAP ! ;
: cts-toggle ( addr -- ) DUP @ 1 15 lshift XOR SWAP ! ;
+\ Given the address of a UART control register, enable rts or cts
+\ example: UART0 rts-enable
: rts-enable ( addr -- ) DUP @ 1 14 lshift OR SWAP ! ;
: cts-enable ( addr -- ) DUP @ 1 15 lshift OR SWAP ! ;
\ The hit game, Wordle
+\ requires rng.fs, terminal.fs
+
\ QOL words
: ? @ . ;
: R? R@ . ;
-\ Random number generator
-\ relies on the rp2040 Ring Oscillator
-$40060000 constant ROSC_BASE
-ROSC_BASE $1c + constant RANDOMBIT
-
-\ Given a size in bits, return a random number
-: random ( bits -- n )
- 0 SWAP 0 DO
- RANDOMBIT @ I lshift OR
- LOOP ;
-
\ Lexicon
5 constant WORDSIZE
20 WORDSIZE * constant SIZE