/dev/ttyACMx
, Windoze COMx
). No need to bother with baud rates, handshaking, parity and other awkward things.
emit? ( -- Flag ) Ready to send a character? key? ( -- Flag ) Checks if a key is waiting key ( -- Char ) Waits for and fetches the pressed key emit ( Char -- ) Emits a character hook-emit? ( -- a-addr ) Hooks for redirecting terminal IO on the fly hook-key? hook-key hook-emit uart ( -- ) redirect console to serial interface (UART) cdc ( -- ) redirect console to USB-CDC crs ( -- ) redirect console to BLE CRS
: ascii ( -- ) 127 32 do i emit loop ; : crs-ascii ( -- ) 127 32 do i crs-emit loop 10 crs-emit / LF ;
/dev/ttyACMx
, Windoze COMx
). No need to bother with baud rates, handshaking, parity and other awkward things.
cdc-emit ( c -- ) Emits one character to the USB-CDC interface. Blocking if the Buffer is full. cdc-key ( -- c ) Waits and gets one character from the USB-CDC interface. Blocking if the buffer is empty. cdc-emit? ( -- ? ) Ready to send a character. Buffer is not full. cdc-key? ( -- ? ) Checks if a character is in the buffer.
serial-emit ( c -- ) Emits one character to the UART interface. Blocking if the Buffer is full. serial-key ( -- c ) Waits and gets one character from the UART interface. Blocking if the buffer is empty. serial-emit? ( -- ? ) Ready to send a character. Buffer is not full. serial-key? ( -- ? ) Checks if a character is in the buffer. baudrate! ( u -- ) sets baud rate (e.g. 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200) paritybit! ( u -- ) sets parity bit 0 none, 1 odd, 2 even wordlength! ( u -- ) sets word length 7, 8, 9 (including parity) stopbits! ( u -- ) sets stop bits 0 1 bit, 1 1.5 bit, 2 2 bit
crs-emit ( c -- ) Emits one character to the UART interface. Blocking if the Buffer is full. crs-key ( -- c ) Waits and gets one character from the UART interface. Blocking if the buffer is empty. crs-emit? ( -- ? ) Ready to send a character. Buffer is not full. crs-key? ( -- ? ) Checks if a character is in the buffer.