Skip to content

The UIRBcore Library is an Arduino library designed for managing the Universal Infrared Blaster (UIRB) board.

License

Notifications You must be signed in to change notification settings

DjordjeMandic/UIRBcorelib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UIRBcore Library

UIRBcore is an Arduino library tailored for managing the Universal Infrared Blaster (UIRB) board. This library provides core functionalities like power management and system initialization, while relying on external IR libraries for signal transmission and reception.

Note: This library is a proof of concept and is not optimized for performance or low-power applications. It is intended as an example and should be avoided in performance-critical scenarios.

This library is designed with PlatformIO in mind and requires the uirb-v02-atmega328p custom board definition or the -DUIRB_BOARD_V02 flag supplied during compilation.


Features

  • Power Management: Built-in support for monitoring battery voltage and charging states.
  • Fixed Pin Assignments: Predefined pin assignments managed directly within the library.
  • EEPROM Management: Efficient storage and retrieval of configuration data.
  • PlatformIO Support: Optimized for PlatformIO projects, ensuring robust build and dependency management.

Prerequisites

To use UIRBcore, ensure you have the following:

  1. PlatformIO installed.
  2. The custom board definition for uirb-v02-atmega328p installed. You will need to provide a path to the definition during project setup. Visit the UIRB PlatformIO Example Project Repository for more information.

Installation

Using PlatformIO Library Manager

Add UIRBcore to your platformio.ini file using one of the following approaches:

Tip: Learn more about semantic versioning at devhints.io/semver and semver.org.

lib_deps =
    djordjemandic/UIRBcorelib @ ^1.2.3  ; Depend on the latest 1.x stable version

Tip: Discover more about specifying packages in PlatformIO by visiting the official documentation on package specifications.

lib_deps =
    https://github.com/DjordjeMandic/UIRBcorelib.git#release  ; Depend on the release Git branch
lib_deps =
    https://github.com/DjordjeMandic/UIRBcorelib.git#v1.2.3  ; Depend on the v1.2.3 Git tag

Manually

  1. Download the latest release from the UIRBcore GitHub repository.
  2. Place the library folder in your project’s lib directory.

Usage

Here’s a quick example of how to initialize the UIRBcore library:

Important: The ATMEGA328P EEPROM must store a valid hardware version for the UIRB constructor to initialize correctly. If the EEPROM does not contain valid data, the constructor will cause the system to hang and reboot.

Note: For IR signal transmission and reception, use compatible external libraries.

#include <Arduino.h>
#include <UIRBcore.hpp>

using namespace uirbcore;

UIRB& uirb = UIRB::getInstance();

void setup()
{
    Serial.begin(1000000);

    if (!uirb.begin())
    {
        Serial.println(F("UIRBcore Initialization Failed!"));
        // Ensure uirb.begin() returns `uirbcore::CoreResult::SUCCESS` before proceeding to avoid hardware damage.
        while (1);
    }

    Serial.println("UIRBcore initialized successfully.");

    // Additional setup code here
}

void loop()
{
    // Main application logic
}

Examples

Explore the provided example sketches:

  • Basic: A basic implementation of the UIRBcore library.
  • Calibration: Demonstrates how to calibrate and configure the system.
  • BypassEEPROM: Shows how to bypass EEPROM validation using #define UIRB_EEPROM_BYPASS_DEBUG.

These examples are located within the examples folder of the library.


Configuration

Limitation: Simulation using simavr in PlatformIO is not supported because there is currently no method to pre-load EEPROM data before the simulation. However, this limitation can be mitigated using #define UIRB_EEPROM_BYPASS_DEBUG and #define UIRB_EEPROM_RPROG_DEBUG.

The library uses fixed pin assignments predefined for the UIRB V0.2 board. Refer to the source code for exact pin mappings.


Doxygen Documentation and Scripts

Note: All scripts should be executed from the root of the repository.

Version Management

Update version information in UIRBcore_Version.h using the script update_version.py:

python ./scripts/update_version.py

Documentation

This project uses Doxygen for documentation. Use the script doxygen_generate.ps1 to generate the documentation:

Details:

  • UpdateVersion: Updates the UIRBcore_Version.h file using update_version.py.
  • OpenHTML: Opens the index.html file in the docs/html directory after successful generation.
  • Ensure the script and its dependencies (git_info.ps1, update_version.py) are properly configured and placed in the scripts directory.
  • Requires Git, Python, and Doxygen installed and accessible via the command line.
pwsh ./scripts/doxygen_generate.ps1 Doxyfile -OpenHTML
pwsh ./scripts/doxygen_generate.ps1 Doxyfile -UpdateVersion -OpenHTML

Contribution

Contributions are welcome! If you have ideas for improvements or encounter issues, please open an issue or submit a pull request on the GitHub repository.


License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgments


For more information about the custom board definition, visit the UIRBpio GitHub repository.