I'm proud to present my some commonly used libraries (tribool, units, compact optional) for Arduino.
"my Arduino Libraries" library is distributed under Boost Software License 1.0 (BSL-1.0).
| library | short | download | documentation |
|---|---|---|---|
| tribool | true/false/unknown logic | src/tribool.h | doc/tribool.md |
- Just copy requested file from my GitHub into your project
- it is located in
srcdirectory
- it is located in
- Review
examplesdirectory.- find example ending with
01.- Like
tribool01. It is simplest example fortriboollibrary
- Like
- There is example sketch (for example:
tribool01.ino) - Look at the beginning of the file
- Copy lines
#include ...andusing ...into your sketch
- find example ending with
- Voila
Probably there is nothing interesting below. Feel free to skip the rest.
Motivation
- "My Arduino Libraries" contains reusable code selected from my projects.
Platform, language
- "My Arduino Libraries" are designed using C++11.
- Code is as portable as possible. That means, that it should work on any platform.
Arduino specific
- If reasonable I'm using Arduino specific features and exclusions
- Important flags, features and exclusions
-std=gnu++11: "My Arduino Libraries" are designed using C++11-Os: optimize for size - sometimes it matters-fno-exceptions: not usingtry/catchnornoexcept-fno-threadsafe-statics: Arduino executor is single threaded, compiler does not care on thread safety, my library does not care about thread safetyint24_t: can be used as base type for specific enumerationsPROGMEM: used if it is reasonable (to store largeconststructures or strings)- C++ Standard Library : Arduino does not implement C++ Standard Library, so many features are not available and not used (for example:
type_traitsare not implemented)
Headers only
- Most of "My Arduino Libraries" are in the designed as "single header" and "headers only".
- Yes, it increases compile time.
Namespaces
- "My Arduino Libraries" avoids namespace pollution
- Most of functionality is located within
namespace jbor within anonymous namespace.
Refer to cloning.md