The BME68X library is *linked* against the MicroPython bindings, rather than compiled directly in.
This saves specifing the list of target files twice.
Add a pimoroni.py module which includes Python code equivilents of the RGBLED and Button C++ drivers.
This is simpler than binding these drivers into MicroPython and much easier to maintain/extend.
As discussed on https://forums.pimoroni.com/t/pico-wireless-pack-fetching-data-from-web/17215/ the cheerlights.py example was stalling on the first HTTP request.
I have added a timeout in this case, so the code will stop waiting and retry after the 60second polling wait period. Users report this does the trick!
This change appends the list dir and project root dir to CMAKE_MODULE_PATH so that it doesn't need prepended to each "include" directive.
All .mk files have been deleted, since these are completely redundant.
This is the final piece of the puzzle.
Prior to this rather considerable change, Pimoroni breakouts were not de-init'ing I2C when they failed to init()
This change adds a __del__ method which cleans up the I2C instance attached to a MicroPython object.
Under the hood this calls i2c_deinit() and resets the associated pins to their default state.
This means that I2C is now cleaned up during a *soft* reset, so running a script with the wrong pins, seeing an error,
changing the pins and running it again will not result in subsequent I2C errors. Previously a hard reset was required.
To recreate on Breakout Garden run the following code:
```
from breakout_potentiometer import BreakoutPotentiometer
from pimoroni_i2c import PimoroniI2C
i2c = PimoroniI2C()
pot = BreakoutPotentiometer(i2c)
```
This will fail correctly with "Potentiometer breakout not found when initialising."
(The default pins are configured for Pico Explorer)
Now change that to the following and run again without hard-resetting:
```
from breakout_potentiometer import BreakoutPotentiometer
from pimoroni_i2c import PimoroniI2C
i2c = PimoroniI2C(4, 5)
pot = BreakoutPotentiometer(i2c)
```
This should now work, since the failed I2C instance was cleaned up.
Without this change, the second attempt would result in an inexplicable failure.
Since most? (many?) Pico users do not have a reset button, this trap requiring a hard-reset is pretty nasty and would likely have resulted in a support nightmare.
Whew.
Removes i2c_inst_t from constructors since it's ignored, and updated the Python bindings not to supply this argument. Instance is inferred from the supplied pins.
Removes all driver-specific SDA/SCL pin definitions and defaults.
Pin type is "uint" everywhere, but "PIN_UNUSED" is *int*_max for MicroPython compat. That's still a lot of pins!
Adds baudrate to the I2C class, and allows a driver (like Trackball) to check the baudrate is supported
This change adds a common I2C class, gathering various I2C functions into a single point of responsibility.
It's necessary for correctly managing the I2C bus pins and state across multiple devices.
* Add a common/pimoroni.hpp to list default pins for various add-ons
* Move the BG SPI Slot enum here for safe keeping
* Switch all GPIO pin references to "uint" to match Pico SDK and bring back PIN_UNUSED as UINT_MAX
This change removes file-relative include paths and adds the project root as a global include path.
* Project root added to CMakeLists.txt so that all targets can find includes
* Project root added micropython.cmake so that targets used by the MicroPython build can find includes
Note: pico-boilerplate projects must set this include path
Fixes paths that only resolve when the top-level directory is named "pimoroni-pico"
and is adjacent to the "micropython" directory when building a MicroPython release.
* C driver for LTP305 breakout
* Micropython bindings for LTP305 breakout
* Micropython examples for dotmatrix
* C++ examples for dotmatrix
Co-authored-by: Phil Howard <phil@gadgetoid.com>
Move scroll_text into the C++ library and make it support std::string.
Move show_bitmap_1d to set_bitmap_1d in the C++ library. Use it as the basis for show_text and scroll_text.
Change show_text to set_text since it does not implicitly show the result.
Add a new pico-scroll demo to show off the scrolling text functionality.
Passing interchangably as int/bytes was weird, and due to Python's signedness on int resulted in a heck of a bug-hunt.
I've switched IP address to converting from/to a tuple internally, so Python code doesn't have to be weird.
Uses an arbitrarily sized, dynamically alloc'd buffer. This should *probably* do the legwork to get the whole buffer and give it to Python without needing multiple calls.