Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MicroPython: Avoid heap allocations in all C++ modules. #711

Merged
merged 23 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b74b371
JPEGDEC: Don't pass filename through std::string.
Gadgetoid Mar 10, 2023
375df60
PicoGraphics: Switch to string_view.
Gadgetoid Mar 10, 2023
73f50e4
Hershey Fonts: Replace map lookup to avoid std::string.
Gadgetoid Mar 10, 2023
59ae107
BME280: Avoid runtime memory allocation.
Gadgetoid Mar 13, 2023
bcebccc
BME68X: Avoid runtime memory allocation.
Gadgetoid Mar 13, 2023
1f0302b
BME280: Check read status and throw error on fail.
Gadgetoid Mar 13, 2023
a0ab440
BMP280: Avoid runtime memory allocation.
Gadgetoid Mar 13, 2023
157841f
MicroPython: Add tracked alloc/free class helpers.
Gadgetoid Mar 13, 2023
e4cb7ce
Pico RGB Keypad: Use tracked alloc.
Gadgetoid Mar 13, 2023
dd7ea6f
Pico Scroll: Use tracked alloc.
Gadgetoid Mar 13, 2023
aa91450
Pico Unicorn: Use tracked alloc.
Gadgetoid Mar 13, 2023
a45eeb1
Pico Wireless: Use tracked alloc.
Gadgetoid Mar 13, 2023
af2b74d
Servo/Motor/PWM: Avoid runtime memory alloc.
Gadgetoid Mar 13, 2023
9964ed7
Servo/Motor: Use m_new instead of new.
Gadgetoid Mar 13, 2023
bd3651d
Pico RGB Keypad: Refactor to class.
Gadgetoid Mar 13, 2023
0443135
Pico Scroll: Refactor to class.
Gadgetoid Mar 13, 2023
3eb4233
Pico Unicorn: Refactor into class.
Gadgetoid Jul 25, 2022
f2751ba
Pico Unicorn: Add support for PicoGraphics.
Gadgetoid Mar 16, 2023
b83bdbf
MicroPython: Pico W parity with Pico build.
Gadgetoid Mar 16, 2023
1b0b783
Pico Scroll: Add support for PicoGraphics.
Gadgetoid Mar 16, 2023
f9b46ba
Pico Scroll: PicoGraphics scrolling text example.
Gadgetoid Mar 16, 2023
bb004e0
Badger: Deprecate firmware builds.
Gadgetoid Mar 17, 2023
587588d
CI: Bump MicroPython to 05bb260.
Gadgetoid Mar 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 0 additions & 172 deletions .github/workflows/micropython-badger2040.yml

This file was deleted.

164 changes: 0 additions & 164 deletions .github/workflows/micropython-badger2040w.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/micropython-picow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
types: [created]

env:
MICROPYTHON_VERSION: 294098d28e2bad0ac0aad0d72595d11a82798096
MICROPYTHON_VERSION: 05bb26010e4a466a82cfed179f8d8d0b406a78ca

jobs:
deps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/micropython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
types: [created]

env:
MICROPYTHON_VERSION: 294098d28e2bad0ac0aad0d72595d11a82798096
MICROPYTHON_VERSION: 05bb26010e4a466a82cfed179f8d8d0b406a78ca

jobs:
deps:
Expand Down
5 changes: 4 additions & 1 deletion drivers/bme280/bme280.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ namespace pimoroni {
gpio_pull_up(interrupt);
}

device.intf_ptr = new i2c_intf_ptr{.i2c = i2c, .address = address};
i2c_interface.i2c = i2c;
i2c_interface.address = address;

device.intf_ptr = &i2c_interface;
device.intf = bme280_intf::BME280_I2C_INTF;
device.read = (bme280_read_fptr_t)&read_bytes;
device.write = (bme280_write_fptr_t)&write_bytes;
Expand Down
2 changes: 2 additions & 0 deletions drivers/bme280/bme280.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace pimoroni {
bool status;
};

i2c_intf_ptr i2c_interface;

bool debug = false;

bool init();
Expand Down
4 changes: 3 additions & 1 deletion drivers/bme68x/bme68x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ namespace pimoroni {
gpio_pull_up(interrupt);
}

device.intf_ptr = new i2c_intf_ptr{.i2c = i2c, .address = address};
i2c_interface.i2c = i2c;
i2c_interface.address = address;

device.intf_ptr = &i2c_interface;
device.intf = bme68x_intf::BME68X_I2C_INTF;
device.read = (bme68x_read_fptr_t)&read_bytes;
device.write = (bme68x_write_fptr_t)&write_bytes;
Expand Down
2 changes: 2 additions & 0 deletions drivers/bme68x/bme68x.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace pimoroni {
int8_t address;
};

i2c_intf_ptr i2c_interface;

bool debug = true;

bool init();
Expand Down
Loading