Skip to content

Latest commit

 

History

History
66 lines (59 loc) · 4.77 KB

README.md

File metadata and controls

66 lines (59 loc) · 4.77 KB

SafeString

This SafeString library is designed for beginners to be a safe, robust and debuggable replacement for string processing in Arduino and provides non-blocking text I/O and parsing and testing for Real World use.

This library includes:-

  • SafeString, a safe, robust and debuggable replacement for string processing in Arduino

  • SafeStringReader, a non-blocking tokenizing text reader replacement for Serial read()

  • BufferedOutput, non-blocking replacement for Serial print()

  • SafeStringStream, a stream to provide test inputs for repeated testing of I/O sketches

  • BufferedInput, extra buffering for text input

  • loopTimer, (loopTimerClass) to track of the maximum and average run times for the loop()

  • millisDelay, a non-blocking delay replacement, with single-shot, repeating, restart and stop facilities.

  • PinFlasher, a non-blocking flashing of an output pin.

  • SerialComs, to send messages between Arduinos via Serial

    To create SafeStrings use one of the four (4) macros createSafeString or cSF, createSafeStringFromCharArray or cSFA, createSafeStringFromCharPtr or cSFP, createSafeStringFromCharPtrWithSize or cSFPS
    For example sketches see SafeString_ConstructorAndDebugging.ino, SafeStringFromCharArray.ino, SafeStringFromCharPtr.ino and SafeStringFromCharPtrWithSize.ino
    and the SafeString Tutorial

How-To

See SafeString Documentation
See SafeString Tutorial
See Arduino to Arduino/PC via Serial
See Arduino Text I/O for the Real World
See Simple Multitasking Arduino
See How to code Timers and Delays in Arduino

Software License

See the top of each file for its license

Note

Note, this is NOT my work, I am simply hosting it for easy access. The original code belongs to Forward Computing and Control Pty. Ltd.

Revisions

V4.1.23 added readFrom(const char*)
V4.1.22 added link to docs in README.md
V4.1.21 minor change document correction
V4.1.20 fixed for ESP32 V2.0.3 dtostrf
V4.1.19 minor change to PinFlasher to support ESP32_WS2812Flasher extension
V4.1.18 changed firstToken() arguments now defaults to returning empty tokens
V4.1.17 restored firstToken() method
V4.1.16 minor text corrections, SafeStringReader.getDelimiter() now returns int, fix for SafeStringReader.flushInput()
V4.1.15 added support for ARDUINO_ARCH_NRF52 and ARDUINO_ARCH_NRF5
V4.1.14 minor fix PinFlasher
V4.1.13 minor change PinFlasher to simplify loop logic
V4.1.12 adds PinFlasher class
V4.1.11 adds support for Ardafruit M4 and Moteino M4
V4.1.10 fixed SafeStringStream to handle data >= 0x80
V4.1.9 added toUnsignedLong coversions, removed firstToken()
V4.1.7-8 added MegaTinyCore support V4.1.6 added Teensy2 to Teensy4.1 support (dtostrf)
V4.1.5 SerialComs timeout 5sec, added firstToken()
V4.1.4 fixed dtostrf support
V4.1.3 added Arduino Due support
V4.1.2 fixed SerialComs when msg times out without delimiter, fixed support for Adafruit Feather nRF52 (V0.21.0)
V4.1.1 fixed nullpointer, check for Out-Of-Memory on createSafeString, support for Earl Philhower's pi pico board package
V4.1.0 added SerialComs class for Arduino to Arduino/PC via Serial, added fixed width formatting, print(value,decPlaces,width) see example SafeString_Tests/SafeString_fixedWidthFormat.ino
V4.0.5 added returnEmptyTokens() option to SafeStringReader
V4.0.4 adds support for Raspberry Pi Pico using Arduino Mbed OS RP2040 V2.0.0 board package ,nextToken() now returns last un-terminated token by default (can be overridded by optional arg), option to return empty tokens
V4.0.3 allow createSafeString for small sizes, fixed bool for DUE (ARDUINO_ARCH_SAM)
V4.0.2 added flushInput() method to SafeStringReader
V4.0.1 fixed SafeStringReader timeout and NanoBLE F() macro
V4.0.0 changes method returns to better match Arduino String methods, main change is indexOf now returns int and returns -1 if not found
V3.1.0 adds hasError() method
V3.0.6 adds support for Arduino megaAVR boards
V3.0.5 adds support for SparkFun Redboard Turbo,but may interfer with other SAM ZERO based boards, also adds support for Due and STM32F1 and STM32F4