Skip to content

Commit 6784398

Browse files
committed
Bump release to 1.2.0, fixes compile errors, updates examples, adds new options
1 parent d3b2009 commit 6784398

File tree

19 files changed

+4228
-166
lines changed

19 files changed

+4228
-166
lines changed

.github/workflows/publish.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
name: Publish Library to PlatformIO
22

33
on:
4-
push:
5-
tags:
6-
- 'v[0-9]*.[0-9]*.[0-9]*' # Match tags in the vMAJOR.MINOR.PATCH format (e.g., v1.0.0)
4+
release:
5+
types:
6+
- published # Trigger only when a release is published
77

88
jobs:
99
publish:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13+
- name: Validate Tag Format
14+
run: |
15+
echo "Validating tag format: ${{ github.event.release.tag_name }}"
16+
if [[ ! "${{ github.event.release.tag_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
17+
echo "Error: Tag format is invalid. Must be in vMAJOR.MINOR.PATCH format (e.g., v1.0.0)."
18+
exit 1
19+
fi
20+
1321
- name: Checkout Code
1422
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.event.release.tag_name }} # Check out the tag associated with the release
1525

1626
- name: Publish to PlatformIO
1727
uses: bojit/platformio-publish@v1.0.0

README.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This library is designed with PlatformIO in mind and requires the **uirb-v02-atm
2222
To use UIRBcore, ensure you have the following:
2323

2424
1. [PlatformIO](https://platformio.org/) installed.
25-
2. The custom board definition for **uirb-v02-atmega328p** installed. You will need to provide a path to the definition during project setup. (A repository link with more information will be added here in the future.)
25+
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](https://github.com/DjordjeMandic/UIRBpio) for more information.
2626

2727
---
2828

@@ -32,12 +32,14 @@ To use UIRBcore, ensure you have the following:
3232

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

35+
> **Tip:** Learn more about semantic versioning at [devhints.io/semver](https://devhints.io/semver) and [semver.org](https://semver.org/).
36+
3537
```ini
3638
lib_deps =
37-
djordjemandic/UIRBcorelib @ ^1.1.1 ; Depend on the latest 1.x stable version
39+
djordjemandic/UIRBcorelib @ ^1.2.0 ; Depend on the latest 1.x stable version
3840
```
3941

40-
> **Tip:** Learn more about semantic versioning at [devhints.io/semver](https://devhints.io/semver) and [semver.org](https://semver.org/).
42+
> **Tip:** Discover more about specifying packages in PlatformIO by visiting the [official documentation on package specifications](https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_install.html#package-specifications).
4143
4244
```ini
4345
lib_deps =
@@ -46,11 +48,9 @@ lib_deps =
4648

4749
```ini
4850
lib_deps =
49-
https://github.com/DjordjeMandic/UIRBcorelib.git#v1.1.1 ; Depend on the v1.1.1 Git tag
51+
https://github.com/DjordjeMandic/UIRBcorelib.git#v1.2.0 ; Depend on the v1.2.0 Git tag
5052
```
5153

52-
> **Tip:** Discover more about specifying packages in PlatformIO by visiting the [official documentation on package specifications](https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_install.html#package-specifications).
53-
5454
### Manually
5555

5656
1. Download the latest release from the [UIRBcore GitHub repository](https://github.com/DjordjeMandic/UIRBcorelib).
@@ -62,6 +62,10 @@ lib_deps =
6262

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

65+
> **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.
66+
67+
> **Note:** For IR signal transmission and reception, use compatible external libraries.
68+
6569
```cpp
6670
#include <Arduino.h>
6771
#include <UIRBcore.hpp>
@@ -92,10 +96,6 @@ void loop()
9296
}
9397
```
9498

95-
> **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.
96-
97-
> **Note:** For IR signal transmission and reception, use compatible external libraries.
98-
9999
---
100100

101101
## Examples
@@ -112,12 +112,16 @@ These examples are located within the [`examples`](./examples) folder of the lib
112112

113113
## Configuration
114114

115+
> **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`.
116+
115117
The library uses fixed pin assignments predefined for the UIRB V0.2 board. Refer to the source code for exact pin mappings.
116118

117119
---
118120

119121
## Doxygen Documentation and Scripts
120122

123+
> **Note:** All scripts should be executed from the root of the repository.
124+
121125
### Version Management
122126

123127
Update version information in [`UIRBcore_Version.h`](./include/UIRBcore_Version.h) using the script [`update_version.py`](./scripts/update_version.py):
@@ -130,23 +134,19 @@ python ./scripts/update_version.py
130134

131135
This project uses Doxygen for documentation. Use the script [`doxygen_generate.ps1`](./scripts/doxygen_generate.ps1) to generate the documentation:
132136

133-
```powershell
134-
pwsh ./scripts/doxygen_generate.ps1 Doxyfile -OpenHTML
135-
```
136-
137-
```powershell
138-
pwsh ./scripts/doxygen_generate.ps1 Doxyfile -UpdateVersion -OpenHTML
139-
```
140-
141137
> **Details:**
142138
> - **UpdateVersion**: Updates the `UIRBcore_Version.h` file using `update_version.py`.
143139
> - **OpenHTML**: Opens the `index.html` file in the `docs/html` directory after successful generation.
144140
> - Ensure the script and its dependencies (`git_info.ps1`, `update_version.py`) are properly configured and placed in the `scripts` directory.
145141
> - Requires Git, Python, and Doxygen installed and accessible via the command line.
146142
147-
> **Note:** All scripts should be executed from the root of the repository.
143+
```powershell
144+
pwsh ./scripts/doxygen_generate.ps1 Doxyfile -OpenHTML
145+
```
148146

149-
> **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`.
147+
```powershell
148+
pwsh ./scripts/doxygen_generate.ps1 Doxyfile -UpdateVersion -OpenHTML
149+
```
150150

151151
---
152152

@@ -169,4 +169,5 @@ This project is licensed under the MIT License. See the [LICENSE](./LICENSE) fil
169169

170170
---
171171

172-
_For more information about the custom board definition and the hardware design, a dedicated repository link will be added here soon._
172+
_For more information about the custom board definition, visit the [UIRBpio GitHub repository](https://github.com/DjordjeMandic/UIRBpio)._
173+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"build": {
3+
"core": "MiniCore",
4+
"extra_flags": [
5+
"-DARDUINO_AVR_ATmega328P",
6+
"-DAVR8_USER_BAUDRATE=1000000",
7+
"-DAVR8_SWINT_SOURCE=1",
8+
"-DUIRB_BOARD_V02"
9+
],
10+
"hwids": [
11+
["0x10C4", "0xEA60"],
12+
["0x10C4", "0xEA63"]
13+
],
14+
"f_cpu": "8000000L",
15+
"mcu": "atmega328p",
16+
"variant": "standard"
17+
},
18+
"hardware": {
19+
"oscillator": "external",
20+
"uart": "uart0",
21+
"bod": "2.7v",
22+
"eesave": "yes",
23+
"ckout": "no"
24+
},
25+
"bootloader": {
26+
"type": "urboot",
27+
"led_pin": "B5",
28+
"uart0_pins": "uart0_rxd0_txd1",
29+
"speed": 1000000
30+
},
31+
"debug": {
32+
"simavr_target": "atmega328p",
33+
"avr-stub": {
34+
"speed": 1000000
35+
}
36+
},
37+
"frameworks": [ "arduino" ],
38+
"platforms": [ "atmelavr" ],
39+
"name": "Universal IR Blaster V0.2",
40+
"upload": {
41+
"maximum_ram_size": 2048,
42+
"maximum_size": 32768,
43+
"protocol": "urclock",
44+
"require_upload_port": true,
45+
"speed": 1000000
46+
},
47+
"url": "https://www.github.com/DjordjeMandic/Universal-IR-Blaster/Hardware/v02",
48+
"vendor": "Djordje Mandic"
49+
}

examples/Basic/platformio.ini

Lines changed: 102 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,106 @@
1-
; PlatformIO Project Configuration File for UIRB V0.2 Basic Example
1+
; PlatformIO Project Configuration File for UIRB Basic Example
22
;
3-
; **Requirements:**
4-
; - Ensure the custom UIRB V0.2 board definition is installed in PlatformIO.
3+
; **Overview:**
4+
; This configuration file sets up build and environment settings for the Universal Infrared Blaster (UIRB)
5+
; project using the UIRBcore library. It supports a custom UIRB V0.2 board along with other Arduino-compatible
6+
; boards. Key features include customizable pin configurations, high-speed serial communication, and support
7+
; for debugging.
58
;
6-
; **Features:**
7-
; - Target Platform: Atmel AVR
8-
; - Framework: Arduino
9-
; - Dependencies: UIRBcore library
10-
; - Upload and Serial Monitor speed set to 1000000 baud for fast communication.
11-
; - Includes a time filter for the serial monitor to display timestamps alongside output.
9+
; **Project Details:**
10+
; - Targets Atmel AVR microcontrollers using the Arduino framework.
11+
; - Focuses on the UIRB V0.2 board with expansion capabilities and a custom pin layout.
12+
; - Provides examples for Uno, Nano, and Pro series boards with reusable configurations.
13+
; - Ensures consistency across environments using shared `custom_pin_config`.
1214
;
13-
; **Documentation:**
14-
; - PlatformIO Options: https://docs.platformio.org/page/projectconf.html
15-
; - UIRB Library and Examples: https://github.com/DjordjeMandic/UIRBcorelib
16-
[env:uirb-v02-atmega328p]
17-
platform = atmelavr
18-
board = uirb-v02-atmega328p ; Custom UIRB-v02 board definition must be installed
19-
framework = arduino
15+
; **Usage Notes:**
16+
; - Ensure the UIRBcore library is installed (https://github.com/DjordjeMandic/UIRBcorelib).
17+
; - For UIRB V0.2, confirm the board definition (`uirb-v02-atmega328p`) is installed.
18+
; - Review and modify the `custom_pin_config` section for specific hardware setups.
19+
;
20+
; **References:**
21+
; - UIRBcore Library Documentation: https://github.com/DjordjeMandic/UIRBcorelib
22+
; - PlatformIO Documentation: https://docs.platformio.org/
23+
; - UIRB PlatformIO Project Example Details: https://github.com/DjordjeMandic/UIRBpio
24+
;
25+
; **Supported Environments:**
26+
; - [env:uirb-v02]: Default environment for UIRB V0.2 hardware.
27+
; - [env:uirb-v02-usbasp]: Uses USBasp for firmware uploads on the UIRB V0.2.
28+
; - [env:uno], [env:nano], [env:pro-16mhz-328], [env:pro-8mhz-328p]: Arduino-compatible boards.
29+
30+
; General PlatformIO settings
31+
[platformio]
32+
name = UIRB Basic Example
33+
description = Basic example demonstrating the use of the UIRBcore library.
34+
default_envs = uirb-v02 ; Default environment to use for builds (specified below)
35+
36+
; Common settings for all environments
37+
[env]
38+
platform = atmelavr ; Specifies the Atmel AVR platform (used for ATmega microcontrollers)
39+
framework = arduino ; Utilizes the Arduino framework for development
2040
lib_deps =
21-
djordjemandic/UIRBcorelib @ ^1.1.1 ; Depend on the latest 1.x stable version
22-
upload_speed = 1000000 ; High upload speed for faster programming
23-
monitor_speed = 1000000 ; Serial monitor baud rate
24-
monitor_filters = time ; Adds timestamps to serial monitor output
41+
djordjemandic/UIRBcorelib @ ^1.2.0 ; UIRBcore library for Universal IR Blaster (GitHub: https://github.com/DjordjeMandic/UIRBcorelib)
42+
monitor_speed = 1000000 ; Serial monitor baud rate (1M)
43+
monitor_filters = default, time, colorize ; Serial monitor: default output, timestamps, and colorized text
44+
build_src_flags =
45+
-DMONITOR_SPEED=${env.monitor_speed} ; Define monitor speed as a preprocessor macro
46+
47+
; Default environment for the UIRB V0.2 board with urboot bootloader
48+
[env:uirb-v02]
49+
board = uirb-v02-atmega328p ; Board configuration for UIRB V0.2 hardware (ATmega328P).
50+
; For details, see https://github.com/DjordjeMandic/UIRBpio
51+
build_type = release ; Specifies release build type
52+
; upload_speed = 57600 ; Uncomment if bootloader has issues with the default upload speed
53+
; upload_port = COM6 ; Uncomment and set this to specify a fixed upload port.
54+
; Ports are automatically detected using hardware IDs (hwids).
55+
56+
; Environment for the UIRB V0.2 board using USBasp as the programmer
57+
[env:uirb-v02-usbasp]
58+
extends = env:uirb-v02 ; Inherit settings from the default UIRB V0.2 environment
59+
upload_protocol = usbasp ; Use USBasp for uploading firmware
60+
upload_flags = ; Additional configuration for USBasp:
61+
-PUSB ; Specify USB as the upload port
62+
-B8 ; Set SPI clock speed (divide by 8) for stable uploads
63+
64+
; Custom pin configuration section
65+
[custom_pin_config]
66+
build_flags =
67+
-DPIN_USB_IO3=4 ; Define USB I/O pin
68+
-DPIN_BUTTON_WAKEUP=2 ; Define button wakeup pin
69+
-DPIN_BUTTON_OPTION_1=A1 ; Define first option button pin
70+
-DPIN_BUTTON_OPTION_2=A2 ; Define second option button pin
71+
-DPIN_BUTTON_OPTION_3=A3 ; Define third option button pin
72+
-DPIN_PULLDOWN_RESISTOR=5 ; Define pulldown resistor pin
73+
-DPIN_TX=1 ; Define UART TX pin
74+
-DPIN_RX=0 ; Define UART RX pin
75+
-DBUTTON_PIN_ACTIVE_STATE=0 ; Define active state for buttons (0 = LOW)
76+
-DPIN_STAT_LED=LED_BUILTIN ; Define status LED pin (shared with SPI SCK)
77+
-DPIN_IR_LED=3 ; Define IR LED pin for IR transmission
78+
-DPIN_IR_CAPTURE=8 ; Define input capture pin for IR raw signal
79+
-DIR_CAPTURE_PIN_PULLUP=0 ; Disable pull-up resistor for IR capture pin
80+
-DPIN_IR_RECEIVE=12 ; Define demodulating IR receiver pin
81+
-DIR_RECEIVE_PIN_PULLUP=1 ; Enable pull-up resistor for IR receive pin
82+
-DPIN_PROG=A0 ; Define pin for the PROG line (TP4057 charger monitoring and control)
83+
84+
; Arduino Uno environment
85+
[env:uno]
86+
board = uno ; Board definition for Arduino Uno
87+
build_flags =
88+
${custom_pin_config.build_flags} ; Reuse custom pin configuration
89+
90+
; Arduino Nano environment
91+
[env:nano]
92+
board = nano ; Board definition for Arduino Nano
93+
build_flags =
94+
${custom_pin_config.build_flags} ; Reuse custom pin configuration
95+
96+
; Arduino Pro 16MHz environment with ATmega328
97+
[env:pro-16mhz-328]
98+
board = pro16MHzatmega328 ; Board definition for Arduino Pro 16MHz
99+
build_flags =
100+
${custom_pin_config.build_flags} ; Reuse custom pin configuration
101+
102+
; Arduino Pro 8MHz environment with ATmega328P
103+
[env:pro-8mhz-328p]
104+
board = pro8MHzatmega328 ; Board definition for Arduino Pro 8MHz
105+
build_flags =
106+
${custom_pin_config.build_flags} ; Reuse custom pin configuration
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@
5353
#include <Arduino.h>
5454
#include <UIRBcore.hpp>
5555

56+
#if defined(PLATFORMIO)
57+
#warning "This is a PlatformIO project. Please visit https://github.com/DjordjeMandic/UIRBpio for more details and latest boards definitions."
58+
#endif
59+
60+
/* Define the baud rate for serial communication */
61+
#if defined(MONITOR_SPEED)
62+
static constexpr unsigned long BAUD_RATE = MONITOR_SPEED; // Use user-defined monitor speed if available
63+
#else
64+
static constexpr unsigned long BAUD_RATE = 1000000; // Default baud rate: 1M BAUD
65+
#endif // !defined(MONITOR_SPEED)
66+
5667
/* Use namespace to prevent typing uirbcore:: before each member. */
5768
using namespace uirbcore;
5869

@@ -102,7 +113,7 @@ void io3WakeupCallback()
102113
*/
103114
void setup()
104115
{
105-
Serial.begin(1000000);
116+
Serial.begin(BAUD_RATE);
106117
Serial.println(F("UIRBcore basic example"));
107118

108119

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"build": {
3+
"core": "MiniCore",
4+
"extra_flags": [
5+
"-DARDUINO_AVR_ATmega328P",
6+
"-DAVR8_USER_BAUDRATE=1000000",
7+
"-DAVR8_SWINT_SOURCE=1",
8+
"-DUIRB_BOARD_V02"
9+
],
10+
"hwids": [
11+
["0x10C4", "0xEA60"],
12+
["0x10C4", "0xEA63"]
13+
],
14+
"f_cpu": "8000000L",
15+
"mcu": "atmega328p",
16+
"variant": "standard"
17+
},
18+
"hardware": {
19+
"oscillator": "external",
20+
"uart": "uart0",
21+
"bod": "2.7v",
22+
"eesave": "yes",
23+
"ckout": "no"
24+
},
25+
"bootloader": {
26+
"type": "urboot",
27+
"led_pin": "B5",
28+
"uart0_pins": "uart0_rxd0_txd1",
29+
"speed": 1000000
30+
},
31+
"debug": {
32+
"simavr_target": "atmega328p",
33+
"avr-stub": {
34+
"speed": 1000000
35+
}
36+
},
37+
"frameworks": [ "arduino" ],
38+
"platforms": [ "atmelavr" ],
39+
"name": "Universal IR Blaster V0.2",
40+
"upload": {
41+
"maximum_ram_size": 2048,
42+
"maximum_size": 32768,
43+
"protocol": "urclock",
44+
"require_upload_port": true,
45+
"speed": 1000000
46+
},
47+
"url": "https://www.github.com/DjordjeMandic/Universal-IR-Blaster/Hardware/v02",
48+
"vendor": "Djordje Mandic"
49+
}

0 commit comments

Comments
 (0)