Merge pull request #625 from pimoroni/patch/bme68x-configure-fix

Fix BME68x configure function
gadgetoid-patch-readme-ci-status v1.19.12
Philip Howard 2023-01-16 15:01:11 +00:00 zatwierdzone przez GitHub
commit 63fc338ca6
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -11,12 +11,12 @@ PINS_PICO_EXPLORER = {"sda": 20, "scl": 21}
i2c = PimoroniI2C(**PINS_BREAKOUT_GARDEN)
bmp = BreakoutBME68X(i2c)
bme = BreakoutBME68X(i2c)
# If this gives an error, try the alternative address
# bmp = BreakoutBME68X(i2c, 0x77)
# bme = BreakoutBME68X(i2c, 0x77)
while True:
temperature, pressure, humidity, gas, status, _, _ = bmp.read()
temperature, pressure, humidity, gas, status, _, _ = bme.read()
heater = "Stable" if status & STATUS_HEATER_STABLE else "Unstable"
print("{:0.2f}c, {:0.2f}Pa, {:0.2f}%, {:0.2f} Ohms, Heater: {}".format(
temperature, pressure, humidity, gas, heater))

Wyświetl plik

@ -11,6 +11,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutBME68X_configure_obj, 1, BreakoutBME68X_confi
/***** Binding of Methods *****/
STATIC const mp_rom_map_elem_t BreakoutBME68X_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&BreakoutBME68X_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_configure), MP_ROM_PTR(&BreakoutBME68X_configure_obj) },
};
STATIC MP_DEFINE_CONST_DICT(BreakoutBME68X_locals_dict, BreakoutBME68X_locals_dict_table);
@ -95,4 +96,4 @@ MP_REGISTER_MODULE(MP_QSTR_breakout_bme68x, breakout_bme68x_user_cmodule, MODULE
MP_REGISTER_MODULE(MP_QSTR_breakout_bme68x, breakout_bme68x_user_cmodule);
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////