Embedis
Embedded Dictionary Server
 All Modules Pages
Embedis

Introduction

Embedis is an open source library for creating simple embedded dictionary servers.
Embedis is used for embedding key-value dictionaries into the
SRAM, FLASH, FRAM, NVSRAM, EEPROM, or SDcard memory systems
of small, limited resource, embedded computing platforms,
such as the Arduino(AVR), Teensy(Cortex-M4),
ESP8266, and others.

Background

We needed to support several different persistant memory store types,
for a number of "Internet of Things", and small embedded system projects.
These types include the internal processor/SoC based SRAM, FLASH, EEPROM,
and Scratchpad SRAM memories, as well as externally attached FLASH, EEPROM,
FRAM, NVSRAM and SDCard memories.
Embedis was developed to provide a simple, consistant command line interface, and APIs
for storing and retrieving data from pins, sensors, interfaces, and other I/O devices,
across a number of different embedded platforms and IDEs.
Embedis is a simple, easily extensible framework for adding persistant, nonvolatile storage to your projects. It is designed to be be lightweight (using only a few kilobytes of program space), and to efficiently support very small storage devices, such as EEPROM or FRAM data storage only a few kilobytes. Embedis implements a Command Line Interface, similar to a subset of the Redis data structure server.

Embedis Command Line Interface

The Embedis command line interface (CLI) uses familiar SET/GET/DEL commands
for storing, retriving, and deleting key-value pairs in the persistant memory stores.
For example :

set mykey somevalue
+OK
get mykey
+somevalue
del mykey
:1

The different persistent memory stores are called "dictionaries",
and you can query what dictionary types are available on your system with the DICTIONARIES command, for example:

DICTIONARIES
*3
+FRAM
+FLASH
+EEPROM

Would indicate that EEPROM, FLASH, and FRAM are available on that system. New "dictionaries", or persistent memory stores, are easily added to the Embedis server by adding a handler with READ, WRITE, and COMMIT methods to your sketch.
The "select" command is used to switch between different storage devices Different memory types are selected using their device name, for example:

select EEPROM
+OK free = 8190

Would select an internal EEPROM for storage, and inform you that it has 8190 bytes of storage remaining. (The current version of Embedis supports a maximum of 64K Keys, and uses two bytes of the 8196 bytes of the EEPROM to indicate the key pointer (in this case, no or zero keys).

A list of keys can be retrieved using the KEYS command for the selected memory :

select EEPROM
+OK free = 8190
keys
*0

In this case, we show zero keys, or an empty dictionary.

Embedis starts writing from the high memory address of the device, and writes "down" in addressing, from high to low memory addresses. The reason for this is to be able to coexist with other uses of the same EEPROM, such as the DeviceTree information for the auto-configuration of Socks, Hats, Capes, and Shields.
Access to hardware resources are accomplished similarly using the READ and WRITE commands, for example:

HARDWARE
*4
+wifi
+vcc
+temp
+blte

READ VCC
+3.335

READ TEMP
+37.542

Several custom commands are shown in the Embedis examples for the Arduino, including pinMode, DigitalWrite, DigitalRead, and AnalogRead, allowing you to read sensors and toggle I/O pins directly from the Embedis Command Line Interface. For example, to toggle the LED on and OFF on an Arduino

pinMode 13 OUTPUT
+OK
digitalWrite 13 HIGH
+OK
digitalWrite 13 LOW
+OK

For more information, please see the Embedis Wiki at https://github.com/thingSoC/embedis/wiki