Commit Graph

669 Commits

Author SHA1 Message Date
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 d08e790e9d Fixed namespace error with pmw examples. 2021-09-13 22:15:06 +01:00
ZodiusInfuser 27b74e140b Finished drivers bindings and examples for flow sensors. 2021-09-13 21:58:11 +01:00
Phil Howard 7375a208c6 make GAMMA common
Moves the 256 entry GAMMA table into pimoroni_common.

Should probably be added into a library so MicroPython is built with only one instance of the table.
2021-09-13 17:40:51 +01:00
Phil Howard 5a7f375ebf plasma: add gamma correction 2021-09-13 17:35:25 +01:00
Philip Howard 37209cd0c0
Merge pull request #203 from Besselking/patch-1
Correct a typo in pico_rgb_keyboard example
2021-09-09 09:40:23 +01:00
Marijn Besseling 5737228cd4
Fix comment typo in pico_rgb_keyboard
the ^ operator is a bitwise XOR not OR
2021-09-08 19:34:35 +02:00
Phil Howard 759868e787 Python bindings & docs for ICP10125 2021-09-08 14:10:21 +01:00
Phil Howard 7f486314db Driver for ICP10125 temperature/pressure sensor 2021-09-08 14:09:54 +01:00
Phil Howard 240eab7ccf Tweak 320x240 init to avoid flicker 2021-09-08 13:56:03 +01:00
Phil Howard cfe0f8731e Fix bugs in 320x240 display init 2021-09-08 13:56:03 +01:00
Phil Howard efdc05805f Drop redundant library and example 2021-09-08 13:56:03 +01:00
ZodiusInfuser 84a81be9d6 Fixed colour ordering 2021-09-08 13:56:03 +01:00
ZodiusInfuser 9906fdec38 C class and MP bindings for PicoDisplay2 2021-09-08 13:56:03 +01:00
Phil Howard 9ba3a6cfab 320x240 LCD library + tweaks to ST7789 driver
Add the init required for the 320x240 2.0" LCD.

Add an option to set baudrate, 320x240 needs 74MHz for 60FPS

Add library and example for 320x240 2.0 LCD.
2021-09-08 13:55:57 +01:00
ZodiusInfuser 53643a72d2 Merge branch 'driver/pwm3901' of https://github.com/pimoroni/pimoroni-pico into driver/pwm3901 2021-09-07 16:23:57 +01:00
ZodiusInfuser 91dfbfdac5 Added PAA secret sauce 2021-09-07 16:23:32 +01:00
ZodiusInfuser a06fff3cbf Added frame capture support and demo 2021-09-07 16:23:32 +01:00
ZodiusInfuser 77f082a984 Initial setup for PMW/PAA flow sensor 2021-09-07 16:23:32 +01:00
ZodiusInfuser a778a1f6e9 Added PAA secret sauce 2021-09-07 15:45:27 +01:00
ZodiusInfuser f86e72ea70 Added frame capture support and demo 2021-09-07 15:45:27 +01:00
ZodiusInfuser b6bc538eb5 Initial setup for PMW/PAA flow sensor 2021-09-07 15:45:27 +01:00
Philip Howard 3c3b29cfc0
Merge pull request #201 from pimoroni/patch-bump-cipy-micropython
Bump CircuitPython-compatible MicroPython to 1.16
2021-09-03 13:51:18 +01:00
Phil Howard 26537021a5 Bump CiPy MicroPython to 1.16
Rename artifact files so we can tell them apart when downloaded.
2021-09-02 10:10:02 +01:00
Philip Howard a108fddf56
Merge pull request #198 from pimoroni/patch-blinka-613-platformdetect-3153
Bump Blinka and PlatformDetect
2021-08-27 14:35:13 +01:00
Phil Howard f505be910a Bump Blinka and PlatformDetect
* Blinka 6.13
* PlatformDetect 3.15.3
2021-08-27 12:46:07 +01:00
Philip Howard c117d345e6
Merge pull request #196 from pimoroni/patch-pico-unicorn-soft-reset
Pico Unicorn: fix MP soft reset & cleanup
2021-08-27 11:14:14 +01:00
Phil Howard 90c01f613c Pico Unicorn: Add rainbow.py example 2021-08-27 10:52:26 +01:00
Philip Howard d1ca596201
Merge pull request #195 from pimoroni/patch-ioexpander-delays
Slow set/clr_bit writes a little
2021-08-27 10:45:11 +01:00
Phil Howard ab3951cd15 Pico Unicorn: fix MP soft reset & cleanup
* Enhance the soft reset guard to properly reinitialise the PIO/DMA and resume display operation
* Remove dead code and debug pin wiggle.
2021-08-26 21:58:37 +01:00
Phil Howard b5c7add90d APA102: Extra clocks to flush pixels
This covers an edge case where pixels are updated intermittently - such as the once that happens when clearing before a Python soft reset.

Under normal circumstances users should `start` the LED strip and allow it to continuously update.
2021-08-26 18:14:39 +01:00
Phil Howard 2cc6514583 Slow set/clr_bit writes a little
We chased a bug with handling/clearing interrupts on Encoder into the depths of madness, finding that a Debug build would magically fix the bug.

Turns out it was probably just us being a little aggressive with the poor little MS51-based Encoder driver.

* Fix delays to be more delayey.
* Replace big 'ol loop and boolean with straight up checks and an early exit- the bit-addressed regs are never going to change
2021-08-26 16:35:05 +01:00
Philip Howard 07f3d65a14
Merge pull request #194 from pimoroni/patch_plasma2040_examples
Extra examples and bug fixes for Plasma2040
2021-08-26 14:36:22 +01:00
Phil Howard e283d460d4 Make ws2812 and apa102 responsibly only for their own buffers
This fixes a bug where delete[] would be called on a bytearray buffer allocated by MicroPython on gc_heap.
2021-08-25 22:00:16 +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
Phil Howard 53429e0c6f Do not pio_sm_unclaim for MicroPython
Adds an ifdef guard around `pio_sm_unclaim` that prevents it being called when MicroPython cleans up/finalizes classes.

For some reason this appeared to be causing a hardfault.
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