Difference: TerminalIO (21 vs. 22)

Revision 222021-05-10 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
%DASHBOARD{ section="banner"
Line: 21 to 21
 
Changed:
<
<
>
>
 

Terminal-IO

emit and key can block the calling thread, if the buffer is full (emit) or empty (key). The other threads are not affected (no busy-wait). The incoming characters (Rx) are buffered in a RTOS message queue, outgoing characters are also buffered.

Default console is USB-CDC, but if you press button SW2 on reset, the console is redirected to the UART RS-232 serial device (for details see mecrisp.s). If you press button SW1 on reset, the console is redirected to the Bluetooth LE Cable Replacement Service.

Changed:
<
<
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

>
>
emit         ( char -- )        Emits a character
key          ( -- char )        Waits for and fetches the pressed key
emit?        ( -- flag )        Ready to send a character?
key?         ( -- flag )        Checks if a key is waiting

hook-emit?   ( -- addr )        Hooks for redirecting terminal IO on the fly
hook-key?    ( -- addr ) 
hook-key     ( -- addr ) 
hook-emit    ( -- addr ) 
  uart ( -- ) redirect console to serial interface (UART)
Added:
>
>
>uart ( -- addr1 addr2 )
<uart ( -- addr1 addr2 )
 cdc ( -- ) redirect console to USB-CDC
Added:
>
>
>cdc ( -- addr1 addr2 )
<cdc ( -- addr1 addr2 )
 crs ( -- ) redirect console to BLE CRS
Changed:
<
<
>
>
>crs ( -- addr1 addr2 )
<crs ( -- addr1 addr2 )

>term ( addr1 addr2 -- )
<term ( addr1 addr2 -- )

 
: ascii ( -- ) 

Line: 68 to 77
 USB_USER CN1 Micro USB connector on the MB1355 Nucleo Board.
USB_USER CN3 USB A plug on the MB1293 dongle.

Changed:
<
<
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.
>
>
cdc-emit ( char -- ) Emits one character to the USB-CDC interface. Blocking if the Buffer is full. cdc-key ( -- char ) Waits and gets one character from the USB-CDC interface. Blocking if the buffer is empty. cdc-emit? ( -- flag ) Ready to send a character. Buffer is not full. cdc-key? ( -- flag ) Checks if a character is in the buffer.
 

Line: 81 to 90
  USB-CDC on the ST-LINK Micro USB connector on the MB1355 Nucleo Board. Serial port UART1 on PB6/PB7 (remove jumper SB2, close jumper SB6) on the MB1293 dongle. Do not forget to set the baud rate. The default baud rate for the MecrispCube is 115200 baud, e.g. microcom -D /dev/ttyACM1 -s 115200 .

Changed:
<
<
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.
>
>
serial-emit ( char -- ) Emits one character to the UART interface. Blocking if the Buffer is full. serial-key ( -- char ) Waits and gets one character from the UART interface. Blocking if the buffer is empty. serial-emit? ( -- flag ) Ready to send a character. Buffer is not full. serial-key? ( -- flag ) 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
Line: 113 to 122
 Serial Bluetooth Terminal works great. You have to configure the the STM CRS to Custom, choose the default UUIDs (Service 0000fe60-cc7a-482a-984a-7f2ed5b3e58f, Read Characteristic 0000fe62-8e22-4541-9d4c-21edae82ed19, Write Characteristic 0000fe61-8e22-4541-9d4c-21edae82ed19).


Changed:
<
<
crs-emit ( c -- ) Emits one character to the BLE Cable Replacement Service. Blocking if the Buffer is full. crs-key ( -- c ) Waits and gets one character from the BLE Cable Replacement Service. 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.
>
>
crs-emit ( char -- ) Emits one character to the BLE Cable Replacement Service. Blocking if the Buffer is full. crs-key ( -- char ) Waits and gets one character from the BLE Cable Replacement Service. Blocking if the buffer is empty. crs-emit? ( -- flag ) Ready to send a character. Buffer is not full. crs-key? ( -- flag ) Checks if a character is in the buffer.
 

The blue LED indicates a connection to a central device.

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback