Skip to content

Repository files navigation

OneOutput logo OneOutput

HAPI output components — zero-overhead, composable output layers for embedded and desktop targets.

HAPI Compatibility: Updated for new Check/Apply/ApplyPack API (2026-Q2)

Part of the InternetOfPins project family.

Overview

OneOutput provides the base output API and device components used by higher-level IOP libraries (OneMenu, etc.). It defines OutDef — a HAPI chain wrapper that composes output layers into a single zero-cost type — along with position, area, and device abstractions.

Components

OutAPI<Cfg>

The base API for all output chains. Provides default no-op implementations of the output interface:

clear() // clear the display
nl() // newline
put(T) // write a value
flush() // flush the output buffer
resume() // re-sync device state
getPos() // current cursor position
setPos(Pos) // move cursor
free() // available area remaining
setColors(fg,bg) // set foreground/background colour

OutDef<OO...>

Closes a chain of output layers into a named, usable type:

using Out = OutDef<PrefixComp, ConsoleOut>;
Out o;
o << "hello"; // flows through PrefixComp → ConsoleOut

IOutDef<OO...>

Virtual-dispatch variant of OutDef — exposes the output interface through IOut for runtime polymorphism when the concrete chain type cannot be known at a call site.

OutputDevice<Out, out>

Tag component that injects a static reference to the underlying hardware or stream device into the chain. Used by upper layers to access the raw device.

Device layers

ComponentPlatformDescription
StreamOut<Out, out>non-ArduinoWraps any std::ostream; put() calls out <<, nl() calls std::endl
ConsoleOutnon-ArduinoAlias for StreamOut<decltype(std::cout), std::cout>
PrintOut<Out, out>ArduinoWraps any Print-derived object; put() calls out.print()

Usage

#include<oneOutput/oneOutput.h>usingnamespaceoneOutput;// Basic console output
OutDef<ConsoleOut> out;
out << "hello " << 42;
out.nl();
// Custom component layered above the devicestructPrefixComp : PrefixTag {
template<typename O>
structPart : O {
using Base = O;
string prefix{};
template<typename T>
voidput(const T& v) { Base::put(prefix); Base::put(v); }
};
};
OutDef<PrefixComp, ConsoleOut> out2;
auto& pc = hapi::find<TagIs<PrefixTag>>(out2);
pc.prefix = ">> ";
out2 << "msg"; // prints: >> msg

Spatial types

template<typename T> structXY { T x; T y; };
using Pos = XY<SizeT>; // cursor positionusing Area = XY<SizeT>; // width × height region

License

MIT — see LICENSE.

Author: Rui Azevedo (neu-rah) · Azores, Portugal

About

HAPI output API and some components

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages