StratifyAPI Documentation

This is the Stratify Application Programming Interface (API) documentation. This documentation is for building applications for Stratify OS. If you are creating board support packages, you will want to take a look at the Stratify OS documentation.


StratifyAPI is a library for Stratify OS applications that makes it easy to access hardware and other system functions (you can also use standard POSIX and C Standard Library functions if that is your style).

If you are new, it would be highly beneficial to quickly read through the naming conventions: Once you are familiar with those, you can check out these useful namespaces to get started.

  • hal - Hardware Abstraction Layer
  • calc - Useful software algorithms
  • draw - Drawing on an LCD
  • fmt - Common file formats
  • sys - Access to timers and files and such
  • var - Variable storage in data and strings

The following examples will give you an idea about how things work. These are the objects used in the examples.

#include <sapi/hal.hpp> //this will include all namespace classes and add the namespace i.e. "using namespace hal;"
#include <sapi/sys.hpp> //includes all sys classes plus "using namespace sys;"
#include <sapi/chrono.hpp> //includes all sys classes plus "using namespace sys;"
int main(int argc, char * argv[]){
Pin p(2, 10);
Pin button(2,9);
p.init(Pin::FLAG_SET_OUTPUT); //open the port and configure pin 10 as an output
button.init(Pin::FLAG_SET_INPUT | Pin::FLAG_IS_PULLUP); //pin 9 is an input (pulled high)
//toggle p until the button is pressed
while( button.get_value() != 0 ){
p = false;
p = true;
return 0;

Here is an example of a UART echo routine.

#include <sapi/hal.hpp>
#include <sapi/var.hpp>
int main(int argc, char * argv[]){
Uart uart(0);
int ret;
String exit_command = "exit\n";
bool done = false;
char buffer[64];
uart.init(); //initializes the UART with default settings
//echo UART until exit is entered
while( done == false ){
if( (ret =,64)) > 0 ){
if( exit_command == buffer ){
done = true;
uart.write(buffer, ret);
return 0;

The best way to learn is to get started: