tiny
is an embedded development library designed to be enjoyable to use, even in a heapless environment. Its components are designed to be flexible, reusable, and have RAM and ROM usage. tiny
can be used bare metal, with an RTOS, or integrated into an existing framework like Arduino or Mbed and can be used on all but the smallest microcontrollers.
tiny
favors simplicity over providing every possible feature. This makes it easier to learn, keeps code size and compile times down, and helps to ensure that the features that are included are high impact.
tiny
is designed for event-driven applications. It relies upon short RTCs (Run-To-Complete steps) and synchronous event propagation to enable "multi-tasking" without threading. This is roughly analogous to the JavaScript programming model.
tiny
relies upon run-time polymorphism provided by low-cost interfaces. This allows for a roughly object-oriented style without inheritance. Interfaces make tiny
flexible, portable, and testable.
tiny
provides a basic HAL (Hardware Abstraction Layer) that includes interfaces for interacting with hardware like digital I/O, analog inputs, PWM channels, and serial communication protocols. Most of the core tiny
components are hardware independent, but those that aren't use the HAL to be portable.
See include/hal for a list of all interfaces.
tiny
provides heapless, arbitrarily-sized (intrusive) list, queue, and ring buffer data structures. See:
Software timers allow applications to generate one-shot and periodic time-based events. See:
tiny
defines an abstract event type as well as some concrete event implementations. Events are basically fancy callbacks that event handlers to be registered dynamically. See:
Event queues allow work to be queued to another RTC or to move an between an interrupt context and a non-interrupt context. See:
tiny
's message bus interface allows components to broadcast events within an application. See:
tiny
's key value store allows for data to be shared within a component in a structured way. Changes to values within a key value store generate data events that enable components to "watch" shared data. See:
tiny
provides lightweight FSM (Finite State Machine) and HSM (Hierarchical State Machine) libraries. These model states as functions that are invoked when the state machine is signaled. State machines allow event-driven programs to be written without spaghetti code. See:
tiny
provides a simple library for point-to-point communication. It allows payloads to be sent between nodes in a network with data integrity protected by a CRC16.
Integrating tiny
is simple: just put include/
on the include path and build everything in src/
.
To include tiny
in a test build, add test/include
to the include path and build the contents of test/src
. This brings useful test doubles into your tests.
See ryanplusplus/samd21-tiny
for an example of a bare metal tiny
project using the Microchip SAMD21. This is a simple project that sets up a blinking LED and includes several hardware drivers that use the tiny
HAL.
See ryanplusplus/w1209
for an example of a bare metal tiny
project that is a more complete application built around a tiny
key value store.
See ryanplusplus/stm32f051-freertos
for an example of a tiny
project that integrates with FreeRTOS.
See ryanplusplus/pio-tiny-starter-kit
for an example of a tiny
project using the Arduino framework with PlatformIO.
Building and running tests requires MacOS or Linux and:
Build and run tests with:
$ make
Or use rerun
to automatically build and run tests when source files change with:
$ rerun make