Skip to content

ryanplusplus/tiny

Repository files navigation

tiny

Tests

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.

Design

Simple

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.

Event-Driven

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.

Flexible

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.

What's in the Box?

HAL

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.

Data Structures

tiny provides heapless, arbitrarily-sized (intrusive) list, queue, and ring buffer data structures. See:

Software Timers

Software timers allow applications to generate one-shot and periodic time-based events. See:

Events

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

Event queues allow work to be queued to another RTC or to move an between an interrupt context and a non-interrupt context. See:

Message Buses

tiny's message bus interface allows components to broadcast events within an application. See:

Key Value Stores

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:

State Machines

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:

Communication

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.

How Can I Use It?

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.

Examples

Bare Metal

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.

FreeRTOS

See ryanplusplus/stm32f051-freertos for an example of a tiny project that integrates with FreeRTOS.

Arduino

See ryanplusplus/pio-tiny-starter-kit for an example of a tiny project using the Arduino framework with PlatformIO.

Development

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •