Skip to content

Library to store C++ objects directly in flash memory for Sming 4.0

License

Notifications You must be signed in to change notification settings

mikee47/FlashString

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
mikee47
Apr 6, 2024
62212fc · Apr 6, 2024
Nov 20, 2019
Apr 6, 2024
Apr 6, 2024
Jan 1, 2020
Oct 26, 2020
Nov 20, 2019
Nov 21, 2019
Nov 12, 2019
Dec 21, 2021
Nov 21, 2019
Dec 21, 2021
Feb 2, 2020
Nov 21, 2019
Nov 26, 2019
Feb 2, 2020
Dec 21, 2021
Dec 21, 2021
Feb 2, 2020
Feb 2, 2020
Nov 19, 2019
Jan 1, 2020
Nov 21, 2019
Jan 4, 2020
Feb 2, 2020

Repository files navigation

FlashString

Introduction

This is a C++ library to simplify the definition and use of data structures stored in program (flash) memory in an embedded microcontroller.

It was developed for use with Sming and the ESP8266 but could be ported to other platforms relatively easily.

Perhaps the most common use for PROGMEM data is passing strings around, usually as a pointer to a 'C' NUL-terminated char array. There are a couple of problems with this:

  1. If we need to know how long the string is, we need to call :c:func:`strlen_P`, which is really expensive computationally.
  2. We can't include NUL characters in the string.

Both of these are easily solved by passing the length along with the string, like this:

char myString[] PROGMEM = "hello, this is a string";
Serial.println(FPSTR(myString), sizeof(myString) - 1);

Of course, passing two parameters instead of one gets tiresome and is not very C++, is it?

This library implements C++ objects stored in flash memory, using macros to create the data structures. The object interfaces are implemented using class templates for performance and flexibility.

The classes are all in the FSTR namespace.

.. toctree::
   :maxdepth: 1

   object
   string
   array
   table
   vector
   map
   streams
   utility

Sming Integration

Sming provides several aliases to provide compatibility with existing code:

Other pages

.. toctree::
   :maxdepth: 1

   upgrade
   changelog
   technical
   todo
   about

About

Library to store C++ objects directly in flash memory for Sming 4.0

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages