BMP280: Avoid runtime memory allocation.

This commit is contained in:
Phil Howard 2023-03-13 13:35:23 +00:00
parent 1f0302bd66
commit a0ab44067f
2 changed files with 6 additions and 1 deletions

View File

@ -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 = BMP280_I2C_INTF;
device.read = (bmp280_com_fptr_t)&read_bytes;
device.write = (bmp280_com_fptr_t)&write_bytes;

View File

@ -25,6 +25,8 @@ namespace pimoroni {
bool status;
};
i2c_intf_ptr i2c_interface;
bool debug = false;
bool init();