Skip to content

Commit a72e21b

Browse files
committed
first commit
0 parents  commit a72e21b

17 files changed

Lines changed: 801 additions & 0 deletions
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/pull_request_template.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## Summary
2+
3+
- Briefly describe the change and its motivation.
4+
- Link related issues (e.g., closes #123).
5+
6+
## Type of Change
7+
8+
- [ ] Bug fix (non-breaking change that fixes an issue)
9+
- [ ] New feature (non-breaking change that adds functionality)
10+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
11+
- [ ] Refactor (code change that neither fixes a bug nor adds a feature)
12+
- [ ] Documentation update
13+
- [ ] Build/CI
14+
15+
## Details
16+
17+
- What does this PR change? Why?
18+
- Any context for reviewers to understand decisions and tradeoffs.
19+
20+
## Testing
21+
22+
- [ ] Builds locally
23+
- [ ] Unit tests added/updated
24+
- [ ] Tested on target hardware/device (if applicable)
25+
26+
Describe how you tested the changes. Include commands, logs, or screenshots if helpful.
27+
28+
## Compatibility / Breaking Changes
29+
30+
- Describe any API, ABI, or behavior changes.
31+
- Migration steps for users (if any).
32+
33+
## Risks and Mitigations
34+
35+
- Potential risks introduced by this change and how they’re mitigated.
36+
37+
## Checklist
38+
39+
- [ ] Code follows project style and conventions
40+
- [ ] All tests pass locally
41+
- [ ] Documentation updated (README, examples, comments)
42+
- [ ] No secrets, credentials, or sensitive data committed
43+
- [ ] Linked issue(s) and relevant context provided
44+
45+
## Environment
46+
47+
- Toolchain/SDK versions: (e.g., ESP-IDF/PlatformIO/GCC)
48+
- OS and version:
49+
- Other relevant environment details:
50+

.github/workflows/ci.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint-metadata:
15+
name: Arduino Lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Arduino Lint
22+
uses: arduino/arduino-lint-action@v1
23+
with:
24+
library-manager: false
25+
project-type: library
26+
27+
build-examples:
28+
runs-on: ubuntu-latest
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
board: [esp32dev, esp32-s3-devkitc-1, esp32-c3-devkitm-1, esp32-p4-evboard]
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: '3.13'
41+
42+
- name: Cache PlatformIO
43+
uses: actions/cache@v4
44+
with:
45+
path: ~/.platformio
46+
key: ${{ runner.os }}-platformio-${{ hashFiles('**/library.json') }}
47+
restore-keys: |
48+
${{ runner.os }}-platformio-
49+
50+
- name: Install PIOArduino Core
51+
run: python -m pip install --upgrade https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip
52+
53+
- name: Install PIOArduino ESP32 Platform
54+
run: pio platform install https://github.com/pioarduino/platform-espressif32.git
55+
56+
- name: Build library examples (ESP32 Arduino)
57+
run: |
58+
set -e
59+
for d in examples/*; do
60+
if [ -d "$d" ]; then
61+
echo "Building $d on ${{ matrix.board }} via PlatformIO CI"
62+
pio ci "$d" \
63+
--board ${{ matrix.board }} \
64+
--lib="." \
65+
--project-option "platform=https://github.com/pioarduino/platform-espressif32.git" \
66+
--project-option "build_unflags=-std=gnu++11" \
67+
--project-option "build_flags=-std=gnu++17" \
68+
--project-option $'lib_deps=\nArduinoJson@>=7.0.0'
69+
fi
70+
done
71+
72+
arduino-cli:
73+
runs-on: ubuntu-latest
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
board:
78+
- fqbn: esp32:esp32:esp32
79+
name: esp32dev
80+
- fqbn: esp32:esp32:esp32s3
81+
name: esp32-s3-devkitc-1
82+
- fqbn: esp32:esp32:esp32c3
83+
name: esp32-c3-devkitm-1
84+
- fqbn: esp32:esp32:esp32p4
85+
name: esp32-p4-evboard
86+
steps:
87+
- name: Checkout
88+
uses: actions/checkout@v4
89+
90+
- name: Set up Arduino CLI
91+
uses: arduino/setup-arduino-cli@v1
92+
93+
- name: Install ESP32 core
94+
run: |
95+
arduino-cli core update-index
96+
arduino-cli core install esp32:esp32
97+
98+
- name: Install libraries
99+
run: |
100+
arduino-cli lib update-index
101+
arduino-cli lib install "ArduinoJson"
102+
103+
- name: Add local library to sketchbook
104+
run: |
105+
set -e
106+
SKETCHBOOK_DIR="${HOME}/Arduino"
107+
mkdir -p "$SKETCHBOOK_DIR/libraries/ESPBufferManager"
108+
rsync -a --delete --exclude ".git" ./ "$SKETCHBOOK_DIR/libraries/ESPBufferManager/"
109+
110+
- name: Build examples (${{ matrix.board.name }})
111+
env:
112+
FQBN: ${{ matrix.board.fqbn }}
113+
run: |
114+
set -e
115+
for d in examples/*; do
116+
if [ -d "$d" ]; then
117+
echo "Compiling $d"
118+
arduino-cli compile --fqbn "$FQBN" "$d"
119+
fi
120+
done
121+
122+
package-library:
123+
runs-on: ubuntu-latest
124+
needs:
125+
- build-examples
126+
- arduino-cli
127+
steps:
128+
- name: Checkout
129+
uses: actions/checkout@v4
130+
131+
- name: Set up Python
132+
uses: actions/setup-python@v5
133+
with:
134+
python-version: '3.13'
135+
136+
- name: Install PIOArduino Core
137+
run: python -m pip install --upgrade https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip
138+
139+
- name: Pack library (PlatformIO)
140+
run: |
141+
mkdir -p dist
142+
pio pkg pack --output dist
143+
144+
- name: Upload package artifact
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: espbuffermanager-${{ github.sha }}
148+
path: dist/*

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
create-release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Extract changelog entry
18+
id: changelog
19+
uses: actions/github-script@v7
20+
with:
21+
result-encoding: string
22+
script: |
23+
const tag = process.env.GITHUB_REF_NAME || '';
24+
const version = tag.startsWith('v') ? tag.slice(1) : tag;
25+
const fs = require('node:fs');
26+
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
27+
const heading = `## [${version}]`;
28+
const start = changelog.indexOf(heading);
29+
let entry;
30+
if (start === -1) {
31+
entry = `No changelog entry found for version ${version}.`;
32+
} else {
33+
const afterHeading = start + heading.length;
34+
const nextHeader = changelog.indexOf('\n## [', afterHeading);
35+
const sliceEnd = nextHeader === -1 ? changelog.length : nextHeader;
36+
entry = changelog.slice(start, sliceEnd).trim();
37+
}
38+
return entry;
39+
40+
- name: Create GitHub Release
41+
uses: softprops/action-gh-release@v2
42+
with:
43+
draft: false
44+
prerelease: false
45+
generate_release_notes: false
46+
body: ${{ steps.changelog.outputs.result }}
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.venv
2+
build/
3+
build_prev_runner/
4+
.vscode

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [Unreleased]
6+
7+
### Added
8+
- Initial ESPBufferManager implementation with PSRAM-aware `allocate`, `reallocate`, and `deallocate` helpers.
9+
- Added `isPSRAMAvailable()` and `shouldUsePSRAM()` runtime helpers.
10+
- Added Arduino example (`examples/basic_usage`) demonstrating safe fallback behavior.
11+
12+
## [0.1.0] - 2026-02-20
13+
14+
### Added
15+
- First release scaffold for ESPBufferManager.
16+
- Shared, non-throwing memory management API for ESPToolKit libraries.
17+
- Arduino/ESP-IDF compatible platform guards.
18+
- CI, release workflow, issue templates, and PR template.

CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# ESPBufferManager - https://github.com/ESPToolKit/esp-buffer-manager
2+
# Copyright ESPToolKit
3+
# MIT License
4+
5+
cmake_minimum_required(VERSION 3.12)
6+
project(ESPBufferManager)
7+
8+
include(CTest)
9+
10+
set(CMAKE_CXX_STANDARD 17)
11+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
12+
13+
if(${COVERAGE})
14+
set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage -g -O0")
15+
endif()
16+
17+
include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
18+
19+
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/test/CMakeLists.txt")
20+
add_subdirectory(test)
21+
endif()

0 commit comments

Comments
 (0)