GetString() function that supports input character filtering. Includes menu-driven commands.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

This project is designed to provide a GetString() function for user serial communication.   The GetString() function includes input character filtering for:

  • unsigned or signed decimal (eg .  34953 or -4510)
  • unsigned or signed decimal fixed point (eg  3.1415 or -46.789)
  • unsigned hexidecimal  (eg. 401EA)
  • floating point (eq. 834.5, 510.45454e-9, -0.6343e45)
  • string (eg. The Lion Sleeps Tonight!)
  • Filesystem string [used for SD card valid Volume, directory and file names] (eq. Volume:\directory\dir2\filename.ext)

The input filtering will discard characters that don't match the filtering type.

Note: The BACKSPACE character ('\b') is supported if support by the serial terminal program being used.

Menu commands:

?=> display FULL help list

h=> display minimized help list

b=> display Build info

G=> GetString Test commands

    d=> unsigned Decimal

    D=> signed Decimal

    .=> unsigned Fixed Decimal

    >=> signed Fixed Decimal

    x=> Hex

    s=> ANY String

    S=> FileSystem String

    f=> Float

The above feature is not CPU specific and can be ported to virtually any CPU.

Additionally, I've include a menu-driven one-character command structure to operate the GetString() test commands for each of the filtering types.

This menu structure is capable of being modified/added/deleted/adapted by other programs if desired.

The above feature is not CPU specific and can be ported to virtually any CPU.

The last feature of this project is the ability to optionally use the CY8CKIT-059 target on-board USB port instead of the USB UART of the KitProg PCB.  This frees up the KitProg to be detected if desired or to be used exclusively for debugging the target PCB.

The above feature is mostly CPU specific to the PSoC5.

Target CPU: Any.

Project CPU: PSoC

Compiler: GCC.

Message was edited by: Leonard Poma Found bug: Oops. Please use new "fixed" code (v1.1.0). Len

Len
"Engineering is an Art. The Art of Compromise."
1 Reply
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

To all,

I've updated this code share in a new component library.

Terminal Support Component Library

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes