yauclib - yet another microcontroller library. This library is an attempt to write device drivers and an abstraction layer for different microcontroller families in C++.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Moritz Strohm e292fc16db added Microcontroller::analog_input_max_value const 3 months ago
doc@b2efee97a5 updated doc 1 year ago
drivers EONE1602: do not wait until the display is ready when writing each character 3 months ago
tests added Microcontroller::analog_input_max_value const 3 months ago
.gitignore gitignore file: added output.bin.ihex 4 months ago
.gitmodules Driver interface: removed protected microcontroller attribute 1 year ago
InterruptHandler.h added Microcontroller::addTimerInterruptHandler method, added InterruptHandler interface 1 year ago
LICENSE initial commit 1 year ago
Microcontroller.h added Microcontroller::analog_input_max_value const 3 months ago
Microcontroller_AVR.cpp added Microcontroller::analog_input_max_value const 3 months ago
README.md updated README.md 1 year ago
SystemInterrupt.h initial commit 1 year ago
definitions.h EONE1602: added printShort method, AVR: began implementation of analog pin reading 3 months ago
ucmf.config made UC_PACKAGE config parameter mandatory, fixes #1 1 year ago


yauclib - yet another microcontroller library

This library is an attempt to write device drivers and an abstraction layer for different microcontroller families in C++.

How it works

The microcontroller is represented using the Microcontroller class which provides fundamental methods like writing and reading pin values. The class acts as an abstraction layer so that programs do not need to include mircocontroller-specific code.

Pin numbers represent the physical pins on the microcontrollers package instead of using the microcontroller-specific port names. This code snippet illustrates how microcontroller programs can be written using yauclib:

//Setting Pin 5 high:
Microcontroller::writePin(5, true);
//Read from Pin 4:
bool enabled = Microcontroller::readPin(4);

Here is an example, how you would make an LED blink using yauclib:

//blink the LED: turn it on and off every 500 miliseconds:
while (true) {
    //Set pin 3 high:
    Microcontroller::writePin(3, true);
    //Wait 500 ms:
    //Set pin 3 low:
    Microcontroller::writePin(3, false);
    //Wait 500 ms:

In a similar way, you would access timer and PWM hardware of your microcontroller.


Each driver is placed in the "drivers" folder. They are only added to your program if you include them using #include in your C++ program source file and add the driver source file in the compilation process.

Each driver is derived from the "Driver" base class so that they have a common interface for basic methods like mapping pins. Drivers may also include special methods if they are needed to use the device they are driving in a certain manner.

To faciliate the mapping between device and microcontroller pins, each driver has a set of named so-called "application pins". These are then mapped to physical microcontroller pin numbers using the "applyPinMapping" method. With this mapping, you can simply write which application pin is connected to which microcontroller pin. A code snippet for a serial device:

//The clock pin of the device is connected to pin 3:
serial.applyPinMapping(APIN::SCK, 3);
//The data pin is connected to pin 2:
serial.applyPinMapping(APIN::SDA, 2);


The library itself is just a library, so it doesn't come with a compilation framework. However, it relies on certain definitions to be present that are set when compiling using the ucmf tool (see https://codeberg.org/ncc1988/ucmf). The microcontroller family and model should be set using the UC_FAMILY_... and UC_MODEL_... definitions:

//for ATtiny45:

//for 8051:


The "tests" folder contains test programs for the drivers that can be compiled using either the ucmf tool and make, by writing a hand-crafted shell script or some other fancy compilation process. They are written independent of any particular microcontroller architecture.


The documentation is available on Codeberg.org:


It is also available as git submodule of this repository. To download the documentation, use the following git commands:

git submodule init
git submodule update

The documentation can then be found in the "doc" folder.