Commit Graph

599 Commits

Author SHA1 Message Date
Phil Howard cbf330a1c7 Badger2040: Drop from regular MicroPython build 2022-03-04 15:27:28 +00:00
Phil Howard e62b3a8fc8 Badger2040: Move assets & builtin tooling to examples dir 2022-03-04 15:26:00 +00:00
Phil Howard 3756f0b707 Badger2040: Ebook font size & style controls 2022-03-04 15:25:56 +00:00
Phil Howard 4496e3e7a2 Badger2040: Image file overlay toggle 2022-03-04 14:58:52 +00:00
Phil Howard d0b52a77f1 Badger2040: List load/save 2022-03-04 14:40:09 +00:00
Philip Howard 60a9e93251
Merge pull request #263 from pimoroni/moar-badger-examples
Add simple LED example and readme tweaks
2022-03-04 13:34:46 +00:00
Hel Gibbons 7d7c4952fc Lint LED example 2022-03-04 12:34:44 +00:00
Phil Howard e096e57566 Badger2040: Add missing boot.py 2022-03-04 11:32:11 +00:00
Phil Howard e8d6d5930f Badger2040: Rename e-reader and checklist to match builtins 2022-03-04 11:13:51 +00:00
Phil Howard 167cdb13f7 Badger2040: Drop redundant modules_py dir 2022-03-04 11:13:14 +00:00
Phil Howard ef72098949 Badger2040: Build assets from source + CMake builtin copy 2022-03-04 11:06:42 +00:00
helgibbons 1975b47e33 Tweak examples readme 2022-03-04 09:00:04 +00:00
Phil Howard ee9270b283 Badger2040: Fix bugs in Launcher 2022-03-01 15:55:24 +00:00
Phil Howard 6e7d8a1682 Badger2040: Allow builtin demos to be replaced 2022-03-01 15:18:40 +00:00
Hel Gibbons fbb803e9a6
Update README.md 2022-03-01 13:13:00 +00:00
Hel Gibbons d9465aadb8 Update README.md 2022-02-28 16:19:48 +00:00
Hel Gibbons 6a26aa9802 Create led.py 2022-02-28 16:16:44 +00:00
Nathan M ee12d846a1 fix custom badge file not loading correctly 2022-02-28 00:48:40 +00:00
Philip Howard 273ca5c56d
Merge pull request #252 from pimoroni/badger2040-support
Support for Badger 2040
2022-02-25 16:25:22 +00:00
Philip Howard f4c860faba
Merge pull request #251 from helgibbons/main
Add battery example for Pimoroni Pico LiPo
2022-02-25 16:24:15 +00:00
Phil Howard e280db4d0c Badger2040: Finish Help & Info 2022-02-25 16:06:52 +00:00
Phil Howard d99c7bc3cb Badger2040: Help and Info stubs, cleanup launcher icons 2022-02-25 15:46:04 +00:00
Phil Howard e44017e0a0 Badger2040: Add launcher dark mode, USER button is shift 2022-02-25 14:57:43 +00:00
Phil Howard b2fed2b6dc Badger2040: Add launcher disk usage 2022-02-25 14:49:38 +00:00
Phil Howard f90559ed41 Badger2040: Add support for colour inverted mode 2022-02-25 14:49:28 +00:00
Phil Howard 169e332917 Badger2040: Add Medium speed, drop spicy super turbo 2022-02-25 13:37:35 +00:00
Phil Howard 81395654bf Badger2040: Drop sys from badge example 2022-02-25 11:08:32 +00:00
Phil Howard 2f8603e6b3 Badger2040: Add MicroPython README 2022-02-25 11:08:32 +00:00
Phil Howard 40616f9795 Badger2040: Attempt to power off on soft reset 2022-02-25 11:08:32 +00:00
Phil Howard 2e92f85588 Badger2040: Bump mp flash to 1m 2022-02-25 11:08:32 +00:00
ZodiusInfuser 7df528030f Added examples readme 2022-02-25 11:08:32 +00:00
Phil Howard 705a4de2fc Badger2040: Sync badge from beta build 2022-02-25 11:08:32 +00:00
Phil Howard b92eb61d0d Badger2040: Sync checklist from beta build 2022-02-25 11:08:32 +00:00
Phil Howard fa775ee196 Badger2040: Monkey-patch MicroPython flash size 2022-02-25 11:08:32 +00:00
Phil Howard 6585d6a670 MicroPython: Add missing Pico Graphics to LCD breakouts 2022-02-25 11:08:32 +00:00
Phil Howard 079e2397bf Badger2040: Build badgerOS 2022-02-25 11:08:32 +00:00
Phil Howard 2756860090 Badger2040: Launcher tweaks 2022-02-25 11:08:32 +00:00
Phil Howard f2f3e065d5 Badger2040: Tweak examples 2022-02-25 11:08:32 +00:00
ZodiusInfuser 57cd178956 Made menu in font.py a bit bigger 2022-02-25 11:08:32 +00:00
ZodiusInfuser 6187caa4fb Added no battery setting 2022-02-25 11:08:32 +00:00
Phil Howard b357eef88a Badger2040: Image help text and default unpack. 2022-02-25 11:08:32 +00:00
Phil Howard 64cbee7d2b Badger2040: Add battery status to launcher 2022-02-25 11:08:32 +00:00
Phil Howard 465f5e4c4d Badger2040: Add image example, update convert.py 2022-02-25 11:08:32 +00:00
ZodiusInfuser c9bf201ff2 Added battery level example 2022-02-25 11:08:32 +00:00
Phil Howard 5b791caee1 Badger2040: Add image to badge 2022-02-25 11:08:32 +00:00
ZodiusInfuser 74d004b939 Removed print statement 2022-02-25 11:08:32 +00:00
ZodiusInfuser 826a8f2406 Added a fonts example 2022-02-25 11:08:32 +00:00
ZodiusInfuser 5b3d9ce046 Badge bugfix 2022-02-25 11:08:32 +00:00
ZodiusInfuser 73839a4ee9 Added badge example 2022-02-25 11:08:32 +00:00
Phil Howard 2efd7b9655 Badger2040: Fix examples & prep for baking 2022-02-25 11:08:32 +00:00
Phil Howard 2c27296cc4 Badger2040: Add image & icon support 2022-02-25 11:08:32 +00:00
ZodiusInfuser a5485862af Fix for quotation marks not actually showing 2022-02-25 11:08:32 +00:00
ZodiusInfuser eb8fcda727 Added working e-reader example 2022-02-25 11:08:32 +00:00
ZodiusInfuser 3f1ed1e2db Bug fixes to Checklist 2022-02-25 11:08:32 +00:00
ZodiusInfuser a346d4f2cf Exposed text measure to MP and added Checklist example 2022-02-25 11:08:32 +00:00
Phil Howard 2820b62e8c Badger2040: Fix MicroPython binding for led 2022-02-25 11:08:32 +00:00
Phil Howard a4f7d05fe5 Badger2040: Move startup block on held buttons to launcher.py
Blocking on held buttons is bad for MicroPython, since it makes nothing happen on startup-
We need the button to be held but are waiting for a button release after some arbitrary amount of time.

Additionally running code while holding down a button would block normal MicroPython event execution and crash the host's USB bus quite severely.
2022-02-25 11:08:32 +00:00
Phil Howard 167bfbb781 Badger2040: Lint examples, launcher tweaks 2022-02-25 11:08:32 +00:00
Phil Howard 6ff5c39c1b Badger2040: Bugfixes, danger LUTs, examples 2022-02-25 11:08:32 +00:00
Phil Howard 183dd5f8cb Badger2040: Add text rotation to MicroPython
Bonus: Make rotation and scale arguments optional.
2022-02-25 11:08:32 +00:00
Phil Howard 1af63e583e Badger2040: Add WIDTH/HEIGHT constants 2022-02-25 11:08:32 +00:00
Phil Howard af230b5fd5 Badger2040: Refactor to fix MicroPython issues
Move busy wait logic into MicroPython bindings so that MICROPY_EVENT_POLL_HOOK can be called.
2022-02-25 11:08:32 +00:00
Phil Howard 5b084c1b9a Badger2040: Add Fast/Slow LUTs, bugfix and tinkering helpers 2022-02-25 11:08:32 +00:00
Phil Howard 5a0fe00149 Badger2040: Fix typo, comment out explodey wfi 2022-02-25 11:08:32 +00:00
Phil Howard 3bd875c63d Badger2040: Test code 2022-02-25 11:08:32 +00:00
Phil Howard 72d361fa74 Badger2040: Add text functions and input 2022-02-25 11:08:32 +00:00
Phil Howard 46d54072ce Badger2040 MicroPython bindings 2022-02-25 11:08:32 +00:00
ZodiusInfuser 4b96817616 Possible fix for display glitch after first program run 2022-02-22 11:00:02 +00:00
helgibbons 45927eb134 lint battery.py 2022-02-17 11:56:09 +00:00
helgibbons 14cb47b4bb Add Pimoroni Pico LiPo battery example 2022-02-17 11:16:49 +00:00
ZodiusInfuser e4afa6b6f2 Possible fix for display glitch after first program run 2022-02-14 12:56:40 +00:00
Phil Howard f763bae3f4 SCD41: Add i2c pins to MicroPython example 2022-01-27 11:13:22 +00:00
Sam Nicholls 7ee3d74a4a
Clarify BME68X humidity and gas resistance units 2022-01-25 22:33:04 +00:00
Philip Howard ab602135b6
Merge pull request #232 from waveform80/rgbgrbrg
Fix ordering of tuple returned by WS2812.get
2022-01-25 11:10:49 +00:00
Philip Howard 9c05e69573
Merge pull request #235 from mozz100/patch-1
Fix "repeat_time" docs in README
2022-01-25 11:01:29 +00:00
Philip Howard fcf7b47c31
Merge pull request #237 from pimoroni/patch-plasma-update
Plasma/MP: bind update method for #236
2022-01-25 10:56:13 +00:00
Philip Howard 553f3dee60
Merge pull request #174 from pimoroni/driver/scd4x
Driver for SCD4X series CO2 sensors
2022-01-25 10:29:28 +00:00
Phil Howard 52df22a16a Plasma/MP: bind update method for #236 2022-01-07 16:04:46 +00:00
Richard Morrison aea0756fb8
Update README.md
Fix documentation around `Button` class's `repeat_time` behaviour.
2022-01-04 22:09:38 +00:00
Dave Jones 1a66c9f6d6 Fix ordering of tuple returned by WS2812.get
(and types of numbers returned by both WS2812.get and APA102.get)
2021-12-23 00:39:22 +00:00
Hel Gibbons fe80fb4788
tweak resources links 2021-12-21 14:51:06 +00:00
Phil Howard 6d6803612a Add SCD41 MicroPython bindings 2021-12-16 11:39:34 +00:00
Philip Howard c322717eb2
Merge pull request #193 from pimoroni/pure-cpp-i75
Pure C++ HUB75 example
2021-12-08 15:25:53 +00:00
Philip Howard 33ca1b6e22
Merge pull request #226 from pimoroni/patch-ws2812-rgbw
Plasma: Add WS2812 W suppot for #220
2021-12-08 15:22:30 +00:00
Phil Howard 556d8cb57d HUB75: Add expansion and feature pins 2021-12-06 14:37:04 +00:00
helgibbons 2aace8cac9 linting examples 2021-12-05 19:57:38 +00:00
helgibbons 1c1cf528f9 Couple of festive examples for Plasma 2040 2021-12-05 19:53:45 +00:00
Phil Howard 580d8cf7a2 Plasma: Add WS2812 W suppot for #220 2021-12-03 10:50:06 +00:00
Phil Howard 1bb4383074 HUB75 Perf, C++ scrolling text, docs 2021-12-02 12:41:30 +00:00
Phil Howard 4dc3f9b9c4 HUB75 Scrolling wavy text and clock demo 2021-12-01 21:57:40 +00:00
Phil Howard 4496c25a8f HUB75: Remove debug from clock, use only flip's implicit delay 2021-11-25 18:14:36 +00:00
Phil Howard 4d33649cd2 HUB75: More rational DMA/PIO setup/teardown, fixes reset bug
Defensively tear down DMA/PIO so it's in a known good state upon (soft)reset.

Issue was a race condition with DMA interrupts firing and not being achknowledged, leaving a stuck raised IRQ.

The blocking wait for DMA transactions also exacerbated this, turning a borken DMA interrupt and blank screen into an unrecoverable hardlock.

...not that the blank screen was recoverable without a soft reset anyway!
2021-11-25 17:52:44 +00:00
Phil Howard c556391be3 HUB75 Clock example, brightness tweak 2021-11-25 16:37:46 +00:00
Phil Howard e09ff78351 HUB75 Strobe invert and larger panel chaining support 2021-11-24 21:36:58 +00:00
Phil Howard d4bf69324f HUB75 tidyup, examples 2021-11-23 13:58:34 +00:00
Phil Howard c07567f922 HUB75 Panel Types for FM6126A setup, fixes for 32x32 2021-11-23 11:29:41 +00:00
Phil Howard eed7992127 HUB75 Fix intermittent display corruption issue
The FM6126A register write was causing some weirdness on soft reset where the pin state wasn't predictable.

Have twiddled some pins at startup to ensure everything works as expected.

Add set_hsv and set_all_hsv (since setting individual pixels with hsv is S L O W)

Made "flip()" blocking, it was easy to accidentally get a little tearing.
2021-11-22 16:34:56 +00:00
Phil Howard 66d25d2e9c HUB75 Prevent stuck row on soft reset
TODO:

* Move this into drivers/ for C++ use too.
* Display still goes mighty weird sometimes!
2021-11-22 15:22:37 +00:00
Phil Howard 0e8c1228af HUB75 MicroPython DMA and PIO
Switch MicroPython HUB75 driver over to DMA/PIO.

TODO:

* Move this into drivers for C++ use too
* Fix hitting "Stop" in Thonny causing rows to stick on the display (this is bad, and should not happen)
* Fix "Stop -> Start" in Thonny causing weird display issues (it's not memory offets, maybe DMA/PIO issues?)
2021-11-22 14:12:18 +00:00
Edd Hurst 47259c55e8
Fix documentation examples setting RGB LED
Update the examples using set_led function and replacing to use set_rgb

Fixes #221
2021-11-21 14:05:12 +00:00
Phil Howard 01f546aaf1 HUB75 MicroPython bindings 2021-11-18 12:51:43 +00:00
Philip Howard e249113fea
Merge pull request #183 from pimoroni/driver/icp10125
Driver for the ICP10125 pressure & temperature sensor
2021-11-09 17:02:50 +00:00
Philip Howard e638c8ca58
Merge pull request #211 from Gadgetoid/picosystem
PicoSystem: add helper module to set up PicoSystem
2021-10-06 11:57:36 +01:00
Phil Howard 6170e258f2 PicoSystem: Bat sense scaling 2021-10-06 11:38:10 +01:00
Philip Howard 1a9e2802fe
Merge pull request #206 from pimoroni/driver/pwm3901
C++ and MP drivers and examples for Optical Flow sensors
2021-10-06 11:19:29 +01:00
Philip Howard 0c4be0dbb9
Merge pull request #209 from helgibbons/main
add Pico Explorer weather station examples
2021-10-06 11:13:28 +01:00
Philip Howard 3c57cbcdef
Merge pull request #208 from pimoroni/picowireless-ppwhttp
PicoWireless: move HTTP code to ppwhttp library
2021-10-06 11:12:13 +01:00
Phil Howard 321b9ad4af PicoSystem: Move LED after screen init
The screen init (C++ bindings) was trouncing the PWM setup (Python) for the RGB LED.

This is because the backlight pin (12) and LED G pin (13) share the same PWM slice.

This does not seem to affect the screen backlight functionality.
2021-10-06 11:07:56 +01:00
Phil Howard 44b45e8f00 PicoSystem: add buzzer support 2021-10-04 18:19:26 +01:00
Phil Howard 113cc7c96e PicoSystem: add helper module to set up PicoSystem
Sets up:
* Buttons
* RGB LED
* VBus detect
* Charge detect
* Battery sense
* LCD reset
* Display

TODO: audio
TODO: battery sense settings
2021-10-04 17:52:53 +01:00
Phil Howard 1bb61b2c52 PicoWireless: network scan example
Basic example to scan SSID networks and list them.
2021-10-04 16:20:57 +01:00
Phil Howard 71058bca1e PicoWireless: use strnlen for fwver and SSIDs
Avoid going through std::string and instead uses strnlen to get string length.

Prevents extra null chars leaking into the Python string.
2021-10-04 16:16:19 +01:00
helgibbons de05483ca6 linting Pico Explorer weather station examples 2021-09-30 19:05:11 +01:00
helgibbons 67a4490180 add Pico Explorer tiny weather station examples 2021-09-30 18:37:53 +01:00
Phil Howard 7772959450 PicoWireless: add TLS support to ppwhttp
* Add a new "connection_mode" argument to http_request. This can be TLS_MODE or TCP_MODE
* Fix a bug where assumptions about json parsing don't hold up
* Check for TCP_STATE_CLOSED and bail early from connect_to_server
2021-09-30 10:47:30 +01:00
Phil Howard 78d50c2986 PicoWireless: ppwhttp add wildcard routes
This slightly reckless extension to ppwhttp adds support for wildcard routes, eg:

/get_led/<int:index>

Which will serve URLs in the form:

/get_led/10
/get_led/22

etc.

The wildcard includes <type:key>, attempting to match the behaviour of Flask.

Only type "int" is supported currently.

/get_led/<index> - would set data["index"] to a string
/get_led/<int:index> - would attempt to parse the URL part to an int, and would not serve eg: /get_led/hi

See plasma_ws2812_http.py for example usage.
2021-09-29 16:27:02 +01:00
Phil Howard b92d77a2f9 PicoWireless: handle encoding/content type better in ppwhttp
Uses the correct? default Content-Type and encoding for HTTP.

Parses the Content-Type header *before* decoding the content body.

Handles JSON type gracefully.

Decodes the response body accoding to the encoding header.
2021-09-29 14:09:59 +01:00
Phil Howard eb3c8b0ebc PicoWireless: ppwhttp fix to support JSON content type
This is a bit of a fudge, and was only tested against the Cheerlights API.

Detects JSON content type, parses out the content length and truncates the response body to length.

Should probably do this *before* decoding from utf-8.

Updates cheerlights.py API example to support XML, JSON and TEXT endpoints.
2021-09-29 12:47:55 +01:00
Phil Howard 9f07be90da PicoWireless: move HTTP code to ppwhttp library
Creates a new ppwhttp library to hide the implementation detail of HTTP clients/servers from the examples.

Adds a new example - plasma_ws2812_http.py - showing how to expand rgb_http.py to use a WS2812 pixel strip.

Adds "secrets.py" and moves WIFI connection information there. ppwhttp will throw an error if it's missing.
2021-09-29 12:20:06 +01:00
ZodiusInfuser 27b74e140b Finished drivers bindings and examples for flow sensors. 2021-09-13 21:58:11 +01:00
Phil Howard 759868e787 Python bindings & docs for ICP10125 2021-09-08 14:10:21 +01:00
ZodiusInfuser 9906fdec38 C class and MP bindings for PicoDisplay2 2021-09-08 13:56:03 +01:00
Phil Howard 90c01f613c Pico Unicorn: Add rainbow.py example 2021-08-27 10:52:26 +01:00
Phil Howard 5abdad05a8 Fix MicroPython alloc'd bytearray support in APA102 driver
A bytearray allocated in Python would point to uninitialised bytes, missing the SOF byte and brightness for APA102 pixels.

Add a blunt loop over the MicroPython buffer, calling "brightness" for each RGB element to ensure the SOF byte and brightness are initialized.
2021-08-25 22:00:12 +01:00
ZodiusInfuser bb23ba22db Added C++ port of accelerometer example 2021-08-25 18:12:10 +01:00
Phil Howard 03a7cbee06 Fix speed gauge 2021-08-25 16:06:51 +01:00
ZodiusInfuser 08a54a600f Linting fixes 2021-08-25 15:23:22 +01:00
ZodiusInfuser 9d505f208a Added MP accelerometer example 2021-08-25 15:06:05 +01:00
ZodiusInfuser 4393372726 Linting Fixes 2021-08-24 16:10:23 +01:00
ZodiusInfuser f92d35a014 Added I2C defines 2021-08-24 16:06:44 +01:00
ZodiusInfuser 51d4901e34 Added rotary encoder MP example 2021-08-24 16:01:51 +01:00
ZodiusInfuser 8a4c4d8af8 Exposed clear on rotary breakout 2021-08-24 15:35:14 +01:00
ZodiusInfuser cf4b45acc7 Exposed Get to MP, and added I2C pin numbers 2021-08-24 15:21:14 +01:00
ZodiusInfuser a5d9fcf48a Renamed bme68x plasma example to Monitor 2021-08-24 11:41:56 +01:00
ZodiusInfuser c8f90ea846 Changed default color order to GRB to match our strips 2021-08-23 17:18:34 +01:00
ZodiusInfuser 5b40899e44 Linting fixes 2021-08-23 16:30:03 +01:00
ZodiusInfuser a98252993d Linting fixes 2021-08-23 16:28:27 +01:00
ZodiusInfuser 88a9449e0a Added micropython version of bme example, and backported some fixes 2021-08-23 16:21:38 +01:00
ZodiusInfuser 4976c90ab3
Updated readme with changes, and description of current sensing 2021-08-19 16:15:38 +01:00
ZodiusInfuser 41365fd89e Updated button example for new mp 2021-08-19 15:50:16 +01:00
ZodiusInfuser 7496e8c8ba Renamed plasma mp directory to match module name 2021-08-19 15:25:12 +01:00
ZodiusInfuser c4e0316fd8 Linting fix 2021-08-19 15:19:01 +01:00
ZodiusInfuser 0faa312358 Updated micropython example to use working submodule 2021-08-19 15:16:40 +01:00
ZodiusInfuser aac8c8d2fc Test of sub module 2021-08-19 14:51:37 +01:00
ZodiusInfuser 823729dc24 Move apa and ws PIO into drivers so they can be easily used with more boards 2021-08-19 13:40:46 +01:00
ZodiusInfuser 64e6d248d5 Updated rainbow example to be consistant across languages 2021-08-19 12:58:13 +01:00
ZodiusInfuser 281288a6f4 Added Dat and Clk defines 2021-08-19 12:58:13 +01:00
ZodiusInfuser 373a7df923 Linting fixes 2021-08-19 12:58:13 +01:00
ZodiusInfuser 336791ed77 Updated plasma mp examples to use user_sw and current sensing 2021-08-19 12:58:13 +01:00
ZodiusInfuser 5b27d7ac0d Fix for "Changed rgb to use full pwm range" 2021-08-19 12:58:13 +01:00
ZodiusInfuser 2b8fbde659 Changed rgb to use full pwm range 2021-08-19 12:58:13 +01:00
ZodiusInfuser a9883788f8 Added pins for user sw and current sense 2021-08-19 12:58:13 +01:00
Phil Howard eb91f04129 Add general purpose Analog wrapper for isense
Add ADC_GAIN and SHUNT_RESISTOR values to plasma for configuring Analog current sense.
2021-08-12 15:47:59 +01:00
Phil Howard 6ce80cd289 Plasma WS2812: Add RGBW and color-order support 2021-08-02 14:37:07 +01:00
Phil Howard 693e84c73d Allow uP allocated buffer for Plasma LEDs 2021-08-02 14:37:07 +01:00
Phil Howard 59d3c91f1b Demo and document RGBLED and Button
Add constants to `plasma` module for Plasma 2040 pins.
2021-08-02 14:37:07 +01:00
Phil Howard 596fb55a57 Add "plasma" MicroPython module
Includes "WS2812" and "APA102" modules, wrapping the libraries.

Uses a destructor to clean up the LED strip and resources when MicroPython is stopped/restarted.
2021-08-02 14:37:06 +01:00
Phil Howard 218d8ea929 Add documentation and features to BMx280 modules 2021-08-02 14:21:00 +01:00
Phil Howard be9b1437db Add MicroPython bindings for BME280 and BMP280 2021-08-02 14:20:59 +01:00
Phil Howard 746e21c542 BME68X Add Time/Temp config to Gas, document 2021-08-02 14:12:46 +01:00
Phil Howard 618fd559f9 BME68X Python example, docs and configure 2021-08-02 14:12:46 +01:00
Phil Howard c402d92e0f Basic MicroPython bindings for BME68X
The BME68X library is *linked* against the MicroPython bindings, rather than compiled directly in.
This saves specifing the list of target files twice.
2021-08-02 14:12:46 +01:00
Phil Howard a0c2201df2 BH1745: Add I2C address constants 2021-07-30 13:46:28 +01:00
Phil Howard b80b714c4f BH1745 MicroPython bindings & example 2021-07-30 12:41:06 +01:00
Phil Howard 6a4df04ac6 Add python module for RGBLED and Button
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.
2021-07-28 12:06:57 +01:00
Philip Howard 27fa43087b
Merge pull request #161 from pimoroni/patch-lcdtext
MP Fix for text scaling on lcd breakouts not working, and non-string vars hard-locking
2021-07-12 17:42:52 +01:00
Phil Howard 9d897276f4 Support both kwarg and positional scale
Relies on the default value of the scale argument to avoid needing to explicitly check if it's been supplied.

Fixes x/y (again) on character.
2021-07-12 17:31:17 +01:00
Phil Howard 91c346a17c Change wr to wordwrap for clarity 2021-07-12 16:07:10 +01:00
Phil Howard b4c0d78ef7 Fix RTC year argument for #176 2021-07-07 17:11:02 +01:00
Phil Howard ff8917cbe0 Retry failed HTTP connections in cheerlights.py
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!
2021-06-05 19:45:07 +01:00
frankdrn f65d2d00ed
Fix character positioning for colourlcd160x80 2021-06-05 09:09:20 +01:00
frankdrn a2d2165f81
Fix character positioning for colourlcd240x240 2021-06-05 09:07:08 +01:00
frankdrn 09b443bf2d
Update breakout_roundlcd.cpp 2021-06-05 09:04:34 +01:00
ZodiusInfuser dbbe71702a Fix for text scaling on lcd breakouts not working, and non-string vars hard-locking 2021-05-25 17:06:52 +01:00
Phil Howard 225d5e024f Append CMAKE_MODULE_PATHs to simplify micropython.cmake, drop .mk files
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.
2021-05-21 11:34:52 +01:00
Phil Howard 0bda2abd2a Fix AS7262 constructor and example 2021-05-18 11:36:14 +01:00
Phil Howard 66f6983290 Port remaining modules to PimoroniI2C, update examples 2021-05-18 11:18:41 +01:00
Phil Howard edf77ddb76 Add finaliser for Pimoroni I2C
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.
2021-05-18 09:48:41 +01:00
Phil Howard b2056040e8 Port Encoder and Potentiometer to Pimoroni I2C
Wraps just enough of Pimoroni I2C to make it work in MicroPython.

Ports Encoder and Potentiometer to use a PimorniI2C() instance in lieu of sda/scl.
2021-05-17 18:09:39 +01:00
Phil Howard 77839e2a6a Tidy up constructors, drop unused variables, const single addr
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.
2021-05-17 14:50:49 +01:00
Phil Howard 445737088f Switch drivers over to I2C class, tidy up common include
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
2021-05-17 11:46:12 +01:00
Phil Howard 42c7555c96 Add common I2C class
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.
2021-05-14 23:02:38 +01:00
Phil Howard 3dfae2ed5c Add a common header for pins and settings
* 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
2021-05-14 21:55:19 +01:00
ZodiusInfuser 3e9d670298 Better solution to keywords and constructors, for SPI breakouts 2021-05-14 18:26:44 +01:00
ZodiusInfuser 1508f650b9 Fix for i2c select 2021-05-14 18:13:47 +01:00
ZodiusInfuser 1ee5101826 Fix for i2c select 2021-05-14 18:00:26 +01:00
ZodiusInfuser f2ee2a4f8d Better solution to keywords and constructors. Just for I2C for now 2021-05-14 17:14:07 +01:00
ZodiusInfuser 09fc7ca4a7 Added MP address printout for supported breakouts 2021-05-14 15:14:47 +01:00
ZodiusInfuser 8cbc290de2 Fix for keyworks not always working in MP class constructors of breakouts (and removed some whitespaces) 2021-05-14 14:30:08 +01:00
ZodiusInfuser 0a804a426b Micropython linting fixes 2021-05-14 13:15:39 +01:00
ZodiusInfuser 7886b8e78d Finished MP bindings for RV3028 and included a simple example 2021-05-14 13:15:39 +01:00
ZodiusInfuser 2be5528ec7 Partial micropython bindings for RV3028 2021-05-14 13:15:38 +01:00
Phil Howard 0c34de23f5 Tidy up include paths 2021-05-14 12:49:48 +01:00
ZodiusInfuser 707aeba5aa MP linting fix 2021-05-14 12:41:46 +01:00
ZodiusInfuser 7eb8197e45 Added micropython examples for IOExpander 2021-05-14 12:41:46 +01:00
ZodiusInfuser 370167f0f4 Renamed MICS demo file to match other breakouts 2021-05-14 12:41:46 +01:00
Phil Howard 7202926fbb Add mics6814 python demo 2021-05-14 12:41:46 +01:00
ZodiusInfuser 4b850b9290 Added micropython examples for Pot and Enc 2021-05-14 12:41:46 +01:00
ZodiusInfuser 1b860840a3 MP path fixes 2021-05-14 12:41:46 +01:00
ZodiusInfuser d4ba1d97d9 Switch C++ to use Direction enum for functions and added Direction contants to MP 2021-05-14 12:41:46 +01:00
ZodiusInfuser 4a206a9b70 Fix for set brightness not working 2021-05-14 12:41:46 +01:00
ZodiusInfuser 42f2bff6c7 Fixed pot read from returning bool to returning a float, and removed read_as_percent for read_raw 2021-05-14 12:41:46 +01:00
ZodiusInfuser d45a92fef3 Micropython bindings for IOExpander breakout 2021-05-14 12:41:46 +01:00
ZodiusInfuser 31edcf8f93 Renamed IOE's set_addr method to set_address 2021-05-14 12:41:46 +01:00
ZodiusInfuser 3b9927fbef Added initialisation check to Enc, Pot and MICS MP bindings 2021-05-14 12:41:46 +01:00
ZodiusInfuser fd38343924 Micropython bindings for MICS breakout 2021-05-14 12:41:45 +01:00
ZodiusInfuser 0ce424275f Removed some whitespaces 2021-05-14 12:41:27 +01:00
ZodiusInfuser f527b25fed Micropython bindings for Encoder and Pot breakouts 2021-05-14 12:41:23 +01:00
Philip Howard e26677f81a
Merge pull request #148 from pimoroni/patch-better-include-paths
Remove relative include paths
2021-05-14 10:36:19 +01:00
ZodiusInfuser ea460f9519 Micropython bindings and example for MSA301 2021-05-14 10:02:56 +01:00
Phil Howard 37cac5940b Remove relative include paths
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
2021-05-13 12:06:01 +01:00
Phil Howard a4b464df12 AS7262 add Pico Explorer bargraph example 2021-05-12 16:05:43 +01:00
Phil Howard ae489873ee AS7262 add set_integration_time 2021-05-12 16:04:50 +01:00
ZodiusInfuser 9cbeb79b43 Micropython linting fixes 2021-05-12 16:04:50 +01:00
ZodiusInfuser a6c738d018 Finished micropython bindings for AS7262, and added example 2021-05-12 16:04:50 +01:00
ZodiusInfuser 5af43311f4 Micropython bindings and minor tweaks for AS7262 2021-05-12 16:04:50 +01:00
Phil Howard cf8f2dfac2 Fix invalid include paths
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.
2021-05-12 11:46:50 +01:00
Philip Howard 5d27dbc711
Merge pull request #137 from pimoroni/driver/st7789
C++ and MP support and example for 1.3" LCD breakout
2021-05-10 08:59:19 +01:00
Phil Howard d33c0caa27 Simple example for scrolling text 2021-05-07 15:02:52 +01:00
Philip Howard 5a60c477ac
Merge pull request #121 from graeme-winter/set-pixels-as-image
Set pixels as image, add show_bitmap_1d(), show_text()
2021-05-07 14:26:33 +01:00
ZodiusInfuser 84015d7de9 ST7789 tidyup, incl. whitespace removal 2021-05-07 13:48:56 +01:00
ZodiusInfuser 7b0823d867 Fixes for python linting 2021-05-07 13:48:56 +01:00
ZodiusInfuser 16106d5596 Micropython bindings for ColourLCD and minor tweaks for ST7789, and RoundLCD 2021-05-07 13:48:51 +01:00
ZodiusInfuser 2be5b11c42 Micropython bindings for small ColourLCD and ST7735 2021-05-07 11:10:47 +01:00
ZodiusInfuser 76c0b29f8a Micropython linting fixes 2021-05-06 10:16:17 +01:00
ZodiusInfuser ded2710f90 Micropython binding fixes and example for SGP30 2021-05-06 10:16:10 +01:00
ZodiusInfuser 77ca674ac8 Micropython bindings and minor tweaks for SGP30 2021-05-06 10:01:55 +01:00
ZodiusInfuser 3f379d04e7
C++ and MP support and example for LTR559 breakout (#135)
* C driver and example for LTR559 breakout
* Micropython bindings and example for LTR559
2021-05-06 09:48:17 +01:00
ZodiusInfuser 7d3eb60b33
C++ and MP support and example for Trackball breakout (#134)
* C and Micropython bindings for trackball
* C and Micropython examples for trackball
2021-05-04 22:29:53 +01:00
ZodiusInfuser 69ba1c88ef
C++ and MP support and examples for Dotmatrix breakout (#133)
* 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>
2021-05-04 10:34:52 +01:00
helgibbons cde1b97e57 Green fixed! 2021-04-29 20:18:24 +01:00
Phil Howard 8a15da1f66 Move scroll_text, show_text, bitmap_1d and set_pixels into C++ library
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.
2021-04-22 20:00:25 +01:00
Phil Howard 1f4fe5c3b0 Add MicroPython bindings for RGBMatrix5x5 and Matrix11x7
Co-authored-by: ZodiusInfuser <christopher.parrott2@gmail.com>
2021-04-22 17:34:40 +01:00
Philip Howard 7776536d83
Merge pull request #126 from pimoroni/pico-wireless
C++/MicroPython Support & Examples for Pico Wireless
2021-04-22 13:40:59 +01:00
ZodiusInfuser a406bb5e11 Added final missing functions from wifi api 2021-04-20 12:05:29 +01:00
ZodiusInfuser c1d9af3628 Removed old esp32spi MP code 2021-04-19 17:19:20 +01:00
ZodiusInfuser 15ccd8f001 Added digital_read and analog_read functions 2021-04-19 16:44:11 +01:00
Graeme Winter 54e4c1c177 Add bitmap 2021-04-17 15:50:59 +01:00
Graeme Winter bde588c1fd Font bitmap 2021-04-17 15:49:28 +01:00
Graeme Winter c81b137f7b Update README 2021-04-17 15:37:13 +01:00
Graeme Winter 797f60b0f3
Restore commented out sections 2021-04-17 13:27:02 +01:00
Graeme Winter 3b8d999c15 Update character table
0-5 dice 1-6
2 x rectangle
2 x square
smile / neutral / sad / confused
top, bottom lines
2021-04-17 13:01:20 +01:00
Graeme Winter 4cafb301fe Static buffer for text show
Also fixed space assignment in font render
2021-04-17 12:08:44 +01:00
Philip Howard eee38968a5
Merge pull request #123 from helgibbons/main
Add Pico Lipo SHIM example
2021-04-16 15:54:26 +01:00
helgibbons f7977dc17c Linting battery.py 2021-04-16 10:09:40 +01:00
Graeme Winter a14c124fa1 Correction 2021-04-16 06:39:19 +01:00
Graeme Winter eb1b1b238e Implement scroll_text() 2021-04-16 06:33:39 +01:00
Graeme Winter d5e9dd001e clamg-format - new code 2021-04-16 06:13:36 +01:00
Graeme Winter 4a0523ef1e clang-format 2021-04-16 06:09:19 +01:00
Graeme Winter c58ab0e388 Doc update 2021-04-15 21:28:57 +01:00
Graeme Winter 30a17683a9 Fix working with str 2021-04-15 21:23:37 +01:00
Graeme Winter 39b88182a8 WIP but nearly there: need to resolve string vs. buffer protocol 2021-04-15 20:01:37 +01:00
Phil Howard 6167589812 Add Pico Wireless Python examples 2021-04-15 12:02:18 +01:00
Phil Howard c748437d60 Make set_dns more idiomatic of Python
Now accepts either one or two DNS servers and uses n_args to figure out how many you supplied and pass it on.
2021-04-15 10:11:16 +01:00
Phil Howard d3829e73a8 Use tuples for IP address
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.
2021-04-15 10:11:16 +01:00
Phil Howard 9e2f0ebf09 Fix get_data_buf to request *some* data
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.
2021-04-15 10:11:16 +01:00
ZodiusInfuser 6ac8ea1db0 Added set_led and is_pressed functions to PicoWireless MP 2021-04-15 10:11:16 +01:00
ZodiusInfuser 72aee2d202 Fix for string object not being identified correctly 2021-04-15 10:11:16 +01:00
ZodiusInfuser 47bfada0d9 Fixes for picowireless not showing in Micropython 2021-04-15 10:11:16 +01:00
ZodiusInfuser 971ac565dd Finished micropython bindings for current C++ class implementation 2021-04-15 10:11:16 +01:00
ZodiusInfuser d1b3e4d768 Added partial micropython bindings for C++ class implementation 2021-04-15 10:11:16 +01:00
ZodiusInfuser e5545c1c02 Added latest local code for wireless pack 2021-04-15 10:11:16 +01:00
Phil Howard 47be7e5f31 Add Python linting 2021-04-15 09:36:38 +01:00
Graeme Winter f984754b2a WIP: 5x7 font
Derived from

https://github.com/graeme-winter/rpi-pico/blob/main/font5x7/generate.py

which in turn derives the character set from

http://sdf.org/~kt8216/font5x7/unknown-small-5x7.txt

which I will properly document in a follow-up README
2021-04-15 06:10:09 +01:00
helgibbons 7245d3c47e Add Pico Lipo SHIM example 2021-04-12 17:22:42 +01:00
Graeme Winter 9477387df7 Invert y: this is now using standard definition 2021-04-10 10:42:46 +01:00
Graeme Winter d17cd858b5 Fix pixel / bitmap order in README.md
Avoid buffer overflow
2021-04-08 09:44:00 +01:00
Graeme Winter e1027353ab 🤔 original comparison did not work... 2021-04-08 08:16:47 +01:00
Graeme Winter 54c03d48dc Implementation of show_bitmap_1d() 2021-04-08 08:09:08 +01:00
Graeme Winter b7f42585fa Error handling is nice 2021-04-07 16:01:50 +01:00
Graeme Winter 3ef0ddfecc Add set_pixels() function 2021-04-07 15:42:26 +01:00
DiddyWolf d7955e9653
Fix picokeypad.clear()
Using release 0.1.1 of pimoroni-pico-micropython, the picokeypad.clear() function does not seem to work. Looking through the code, it appears that clear is actually calling init instead.
2021-04-04 10:44:24 -05:00
ZodiusInfuser 787ba585b2 Fix for MicroPython hard lock when passing in non-string object to text function 2021-03-30 18:07:43 +01:00
Phil Howard b2006878d3 Fix include paths in MicroPython modules
The ../../../pimoroni-pico path was selecting the "pimoroni-pico" directory adjacent my "micropython" directory

However I was attempting to build against one in a different parent directory.

This resulted in the MicroPython modules including the wrong (old) header and exploding.
2021-03-30 15:50:18 +01:00
ZodiusInfuser 848aa19c2c Added micropython support and example for roundlcd breakout 2021-03-30 15:15:13 +01:00
Phil Howard 051013a1b3 Improved thermometer demo colour range
* Display temp as 00.00 with floating point component
* Use the temp value to blend from a list of display colours
* Fixed slowdown bug when screen begins to scroll
2021-03-29 16:57:58 +01:00
Philip Howard 69c7183c47
Merge pull request #87 from slabua/main
Display thermo example Keep last 48 temperatures
2021-03-29 16:26:05 +01:00
Phil Howard e2cc795e66 Bump ULAB to version with micropython.mk 2021-03-29 13:51:11 +01:00
Philip Howard d88f659b29
Merge pull request #91 from helgibbons/main
Add MicroPython function reference for Pico Explorer
2021-03-29 13:47:00 +01:00
Phil Howard 4e8b2f6d1f Drop defunct font_data.cpp from usermods 2021-03-29 13:33:48 +01:00
Philip Howard 1fb7dcd358
Merge pull request #103 from pimoroni/Pinkyatacme-disp_enhance
ST7789 refactor + round LCD support
2021-03-29 13:26:53 +01:00
dsssssssss9 5a7d053c62
Create balls_demo.py example (#98)
This is adapted from the demo.py in the examples/pico_display directory.
It now displays full screen on a Pico Explorer
2021-03-29 13:24:50 +01:00
David Tillotson 43d7e65ee0 Added display.flip to the Micropython code. 2021-03-29 13:18:31 +01:00
Phil Howard 2ebad4e735 Drop redundant -D 2021-03-23 13:00:01 +00:00
Phil Howard a1125d6e2f Rename usermod.cmake files to micropython.cmake 2021-03-23 12:43:40 +00:00
Philip Howard 9eab4c3934
Merge pull request #100 from pimoroni/patch-ulab-use-upstream
Switch to upstream ulab
2021-03-22 20:48:53 +00:00
Phil Howard 675106ece4 Patch or suppress warnings
The upstream MicroPython rp2 port has re-enabled -Werror so we need to either fix warnings or,
in the case of those generated by C++/C MicroPython binding weirdness, suppress them.
2021-03-22 20:43:23 +00:00
Phil Howard 2d4354a898 Switch to upstream ulab 2021-03-22 16:51:29 +00:00
helgibbons c61937adba Add MicroPython function reference for Pico Explorer 2021-03-12 11:03:16 +00:00
Phil Howard d9a12f8509 Add ulab to included modules
This change submodules in our fork of ulab with an added usermod.cmake and adds it to the top-level usermod.cmake for our shipped modules.

It should - in theory - result in ulab being included in release builds.
2021-03-08 21:23:19 +00:00
Salvatore La Bua 13b94c59c4
Display thermo example Keep last 48 temperatures 2021-03-09 02:16:10 +09:00
Philip Howard 62b869474d
Merge pull request #69 from pimoroni/patch-bouncing-balls
Improved bouncing balls demo
2021-02-23 15:05:30 +00:00
Phil Howard e17aa01f5d Improved bouncing balls demo
Keep the bouncing balls in the court and gives balls a speed in proportion to their size. Created from code in #63

Co-authored-by: Mark Emery <mark@markemerylimited.co.uk>
2021-02-23 12:46:50 +00:00
helgibbons 5f1bc6b641 Tweaks to examples 2021-02-16 16:52:48 +00:00
helgibbons 5a6a5b42c1 Update buttons.py 2021-02-16 14:50:11 +00:00
helgibbons 5118339781 Add simple button example for Display and Explorer 2021-02-16 14:43:57 +00:00
helgibbons 8b96198604 add PWM audio example 2021-02-16 12:54:23 +00:00
helgibbons 29dd151923 add links to Display readme 2021-02-16 12:47:19 +00:00
helgibbons fcfd679e56 fix error in Display readme 2021-02-15 09:24:08 +00:00
helgibbons 15569842e8 add Explorer examples 2021-02-14 18:24:01 +00:00