Compare commits

...

1017 Commits

Author SHA1 Message Date
Philip Howard f3b53b6b5f
Merge pull request #939 from coadkins/coadkins-patch-1
Add PNG File subsection to Pico Graphics documentation
2024-05-09 11:02:35 +01:00
coadkins 37c4d22527
Add PNG File subsection to Pico Graphics documentation
I added a subsection for PNG File support in Pico Graphics by copying and adapting the text from these release notes - https://github.com/pimoroni/pimoroni-pico/releases/tag/v1.20.4 - about the PNGdec functionality.
2024-05-08 11:22:07 -04:00
Philip Howard 616b1cc8d6
Merge pull request #938 from pimoroni/ci/py_decl
CI: Add py_decl verify step to catch binary overflows.
2024-05-03 12:25:04 +01:00
Phil Howard 45a9925072 CI: Add py_decl verify step to catch binary overflows. 2024-05-03 10:59:35 +01:00
Connor Linfoot 32c10482d9
Add support for 96x48 display to Interstate75 (#867)
* Add DISPLAY_INTERSTATE75_96X48
2024-04-17 13:41:02 +01:00
Philip Howard 4c44b77193
Merge pull request #912 from pimoroni/patch-picodisplay-180
PicoDisplay: Fix misalignment on rotated Pico Displays (fixes #562.)
2024-04-17 12:54:18 +01:00
Phil Howard 5510c82564 PicoDisplay: Fix rotation offset for #562.
Pico Display would have a pixel offset at 90 and 180 degree rotations.

Add a special case offset tweak for these, and demystify the rotate_180 variable.
2024-04-17 12:44:40 +01:00
Philip Howard 3a10b29f54
Merge pull request #920 from pimoroni/patch-inky7-update-timeout
inky73: Add busy wait timeout.
2024-04-17 12:42:53 +01:00
Phil Howard 8cf276b992 inky73: Add busy wait timeout.
Add a timeout to fix Inky 7.3" hanging on batteries.

Basically assumes the update has finished if it takes > 45s, and allows a subsequent attempt
rather than hanging indefinitely.

Raised, texted and fixed by w3stbam: https://github.com/pimoroni/pimoroni-pico/pull/900

Rewritten as mentioned in the PR.
2024-04-17 12:33:24 +01:00
Philip Howard f1ea35fbbf
Merge pull request #911 from pimoroni/patch-unicorn-brightness
G/S/C Unicorn: Fix get_brightness to use correct max value.
2024-04-11 17:45:48 +01:00
Philip Howard c066325ca0
Merge pull request #909 from pimoroni/patch-ltr559-interrupt
LTR559: Add interrupt.py demo from #169.
2024-04-11 17:41:58 +01:00
Philip Howard fd4eb165f8
Merge pull request #930 from pimoroni/patch-misc-ci-fixes
Slightly less frustrating MicroPython builds.
2024-04-11 17:08:44 +01:00
Phil Howard 8fc8a8ee06 CI: Rename tiny2040 to tiny2040_8mb.
It was not super obvious that this build is specific to the 8mb
version of Tiny 2040.
2024-04-11 17:01:21 +01:00
Phil Howard 3bfb548686 CI: Continue other MicroPython builds if one fails.
In almost all cases it's more useful to know if a given build
is likely to succeed rather than have *everything* fail. This
change adjusts the workflow to allow other builds to continue
if one fails.
2024-04-11 17:01:09 +01:00
Philip Howard 9edcdcc126
Merge pull request #919 from pimoroni/patch-pngdec-palette-offset
PNGdec: Add support for palette offsets and greyscale copy mode
2024-04-11 16:32:08 +01:00
Philip Howard e8e550b18b
Merge pull request #929 from pimoroni/patch/wordclock
Fixed arg order bug
2024-04-11 14:57:07 +01:00
thirdr cdb7b4bf2c fixed arg order bug 2024-04-11 14:02:26 +01:00
Philip Howard 4fc3095433
Merge pull request #925 from pimoroni/patch-actions-nodejs
CI: Update actions to fix nodejs deprecation warnings.
2024-04-08 12:58:00 +01:00
Phil Howard 9c5b529754 CI: Update actions to fix nodejs deprecation warnings. 2024-04-08 12:47:14 +01:00
ZodiusInfuser a87d5581aa
Merge pull request #923 from pimoroni/patch/inventor_encoders
Added example for reading speeds from Inventor 2040W's encoders
2024-04-03 14:57:41 +01:00
ZodiusInfuser 44d7875f7e Relocated example and updated readme 2024-04-03 14:37:26 +01:00
ZodiusInfuser a90c31fb3b More explanation of encoder capture 2024-04-03 14:29:17 +01:00
ZodiusInfuser 458b0ac209 Added a speed reading example for inventor 2024-04-03 14:29:01 +01:00
Phil Howard a537672dd4 PNGdec: Don't convert greys if mode=COPY. 2024-03-28 15:35:05 +00:00
Phil Howard d34e692f51 PNGdec: Don't add palette_offset twice. 2024-03-28 15:30:32 +00:00
Phil Howard 27b913124c PNGdec: Add copy support and offset to greyscale. 2024-03-28 15:04:06 +00:00
Phil Howard c7b788cd1d PNGdec: Add palette offset arg.
Allow index colour PNGs to be copied with a palette offset.

EG: a 4bit PNG could be offset 16 times for as many colour variations.
2024-03-28 15:04:02 +00:00
Philip Howard c386b3e9cf
Merge pull request #910 from pimoroni/patch-readme-stubs
README.md: Add link to pimoroni-pico-stubs.
2024-03-28 10:17:02 +00:00
Philip Howard a7a2e2bee0
Merge pull request #918 from pimoroni/patch-pngdec-1bit
PNGdec: Add greyscale support.
2024-03-27 12:59:25 +00:00
Phil Howard 19fa8864cf PNGdec: Add greyscale support.
Add an optional MODE_PEN to draw the PNG in the current pen colour.

Best used with, but not limited to, 1bit PNG images.
2024-03-27 12:49:09 +00:00
Phil Howard 964cf5eedf G/S/C Unicorn: Fix get_brightness to use correct max value.
Add a comment noting that 256 is the correct maximum brightness.
2024-03-11 21:14:43 +00:00
Phil Howard eab1595352 README.md: Add link to pimoroni-pico-stubs. 2024-03-11 15:04:18 +00:00
Phil Howard 5dd76ed31b LTR559: Add interrupt.py demo from #169. 2024-03-11 13:38:07 +00:00
Philip Howard 6eb0f90e53
Merge pull request #904 from pimoroni/ci/micropython-1.22.2
CI: Bump MicroPython to v1.22.2.
2024-03-06 10:29:16 +00:00
Phil Howard b0d53dadb3 Hub75: avoid clobbering shared IRQ handlers.
MicroPython's DMA class uses shared IRQ handlers, which would be
clobbered by Hub75's use of an exclusive handler.

Additionally clean up some dead code (DMA_IRQ_1??), more epxlicitly
clean up the claimed PIOs and programs, and do not use a fixed
DMA channel. This seems to have fixed a bug whereupon Hub75 would
hardlock on the 5th soft reset.
2024-03-05 10:30:48 +00:00
Phil Howard ad518064e9 CI: Bump MicroPython to v1.22.2. 2024-02-27 16:43:47 +00:00
Philip Howard d83107474e
Merge pull request #907 from pimoroni/patch-pngdec-1bit
Fixes for PNGDEC on Badger 2040 / Badger 2040 W
2024-02-27 16:42:12 +00:00
Phil Howard c4f70df1cf Pen1BitY: Correct RGB to dither lookup conversion. 2024-02-27 13:54:25 +00:00
Phil Howard 10221066dd PNGDEC: Support for 1bpp. 2024-02-27 13:31:52 +00:00
Philip Howard ab64fcaccc
Merge pull request #899 from pimoroni/jpegdec/width_height_fix
JPEGDEC: Backport width/height changes from pngdec.
2024-02-27 12:21:17 +00:00
Hel Gibbons 32c63c343d
Merge pull request #905 from pimoroni/helgibbons-patch-3
Plasma Stick: add link
2024-02-26 14:24:49 +00:00
Hel Gibbons 8d964bce2c
Plasma Stick: add link 2024-02-26 14:08:56 +00:00
ZodiusInfuser 8ca47d6405
Merge pull request #890 from robberwick/motor2040_i2c_pins
Add I2C pin definitions to motor2040 and servo2040 headers
2024-02-13 12:00:05 +00:00
Skyler Mansfield b23a71b889 JPEGDEC: Backport width/height changes from pngdec.
Open JPEG file or stream to read width/height before decode.
2024-01-23 16:18:13 +00:00
Philip Howard 6b23c1526d
Merge pull request #898 from pimoroni/patch-tufty2040-567
st7789: Remove mystery meat command implicated by #567.
2024-01-23 15:09:49 +00:00
Phil Howard c19b2276f1 st7789: Remove mystery meat command implicated by #567.
This should, in theory, fix the weird display corruption bug affecting Tufty 2040.
2024-01-23 13:14:12 +00:00
Philip Howard 392d75b00d
Merge pull request #878 from pimoroni/ci/tooling
CI: Move some workflow steps into ci/micropython.sh
2024-01-19 10:32:20 +00:00
Philip Howard 911cbb710e
Merge pull request #877 from pacohope/tz-adjust
add adjustment for time zone offset
2024-01-16 14:35:16 +00:00
Philip Howard 4e3e2c836d
Merge pull request #876 from pimoroni/docs/picoscroll
update picoscroll docs
2024-01-16 14:27:06 +00:00
Philip Howard 5bd5334379
Merge pull request #813 from andrewjw/andrewjw-patch-1
fix: Only set time if the wlan is connected
2024-01-16 14:18:37 +00:00
Philip Howard 9ddbb17a82
Merge pull request #860 from pimoroni/patch-bye-bye-badger
Badger2040/2040W: Remove old/incompatible examples.
2024-01-16 14:17:08 +00:00
Phil Howard 5126263f91 Badger2038/2040W: Remove old/incompatible examples.
Badger now lives at: https://github.com/pimoroni/badger2040
2024-01-16 14:01:34 +00:00
Philip Howard 0d3fce9b9d
Merge pull request #883 from raybellis/main
fix hue errors in plasma_stick_rainbows
2024-01-16 11:32:43 +00:00
Rob Berwick 9e6a0725c0 add `I2C_*` definitions to `servo2040.hpp`
Add pin definitions for `I2C_INT`, `I2C_SDA`, and `I2C_SCL` to `servo2040.hpp`
2024-01-08 13:08:44 +00:00
Rob Berwick 3e81b245a1 add I2C_INT & reorder
Add `I2C_INT` to `motor2040.hpp` and put pin defs in numeric order.
2024-01-08 12:57:30 +00:00
Phil Howard bd6bd289d1 CI: Try to ccache mpy-cross 2024-01-08 11:20:08 +00:00
Phil Howard b6953c25a1 CI: Tidy up build steps 2024-01-08 11:20:08 +00:00
Phil Howard b5df0ac277 CI: Setup version env, patch skipped message. 2024-01-08 11:20:08 +00:00
Phil Howard 116bbb1296 CI: Use arm-none-eabi-gcc-action
Speeds up toolchain install (when cached) to ~7s an decouples us from the runner OS ARM GCC version.
2024-01-08 11:20:08 +00:00
Phil Howard 6154116662 CI: Move build steps to a bash script. 2024-01-08 11:20:04 +00:00
Phil Howard d45daef654 MicroPython: Switch from MICROPY_EVENT_POLL_HOOK to mp_event_handle_nowait().
Note: Unsure if mp_event_handle_nowait() is the right answer in all cases,
but this seems to be what we want in our blocking loops.
2024-01-08 10:33:28 +00:00
Phil Howard 1b3d9d9fb2 Pimoroni I2C: Update to use modmachine.h consolidated header. 2024-01-08 10:15:28 +00:00
Phil Howard 4dd76525f6 CI: Update MicroPython patch for v1.22.1. 2024-01-08 10:06:17 +00:00
Phil Howard 3bac13fcc8 CI: Bump MicroPython to v1.22.1. 2024-01-08 09:46:43 +00:00
Hel Gibbons bff245324b
Merge pull request #886 from bitcdr/feature/add-other-resource-to-plasma-stick-examples-readme
[Plasma Stick 2040W] add Plasma LEDs link
2024-01-03 14:36:04 +00:00
Hel Gibbons 400347b862
Merge pull request #888 from everyplace/main
[Inky Frame] Fix news headline redirect example
2024-01-03 13:03:42 +00:00
Ray Bellis da0ac1821f resolve precision error in python example too 2024-01-02 22:22:09 +00:00
Rob Berwick 6dcc0d4fa0 Add I2C pin definitions to motor2040 header
Add definitions for the QW/ST connector SDA & SCL pins
2024-01-01 20:07:58 +00:00
Erin Sparling fc3f8e5654 Updated commented out url protocols as well 2023-12-29 13:26:33 -05:00
Erin Sparling c001f9bb59 Swapped protocol for https so redirect handling isn't necessary 2023-12-29 13:24:08 -05:00
Erin Sparling 59fa0a1ff8 Added comment for 7.3 frame 2023-12-29 13:23:31 -05:00
Stefan Werder a803c3cee4 add Plasma LEDs link 2023-12-21 00:43:19 +01:00
Ray Bellis 6fd667b1ca fix hue errors in plasma_stick_rainbows 2023-12-13 21:43:01 +00:00
Paco Hope 078d81312f add adjustment for time zone offset 2023-11-14 22:05:12 -05:00
Hel Gibbons a60c856ea8 update picoscroll docs 2023-11-09 12:53:03 +00:00
Philip Howard b4451c3bdc
Merge pull request #862 from pimoroni/patch-polygon-clip
Pico Graphics: Avoid unecessary and broken polygon scanline clip.
2023-10-16 10:46:58 +01:00
Phil Howard ce42d814a7 Pico Graphics: Avoid unecessary and broken polygon scanline clip. 2023-10-16 09:56:40 +01:00
Philip Howard ee7f2758dd
Merge pull request #858 from pimoroni/patch-bump-micropython-oct-2023
CI: Bump MicroPython to v1.21.0.
2023-10-06 17:47:02 +01:00
Phil Howard 388d8af3dc Unicorn/others: Add SDCard library from micropython-lib to RPI_PICO_W builds. 2023-10-06 13:55:29 +01:00
Phil Howard 0f75a2839f Inky Frame: Include SDCard from micropython-lib. 2023-10-06 13:55:29 +01:00
Phil Howard e691628723 CI: Bump MicroPython to v1.21.0.
I swear I had no idea this was imminent.

Changes: 856e08b193...v1.21.0
2023-10-06 13:55:29 +01:00
Phil Howard 08ce4fbb81 MicroPython: Update boards to match upstream naming conventions. 2023-10-06 13:55:29 +01:00
Phil Howard 20de8a3198 CI: Bump MicroPython to 6f76d1c.
Changes: 856e08b193...6f76d1c7fa
2023-10-06 13:55:29 +01:00
Philip Howard 9499b7e908
Merge pull request #855 from pimoroni/patch-jpegdec
JPEGDEC: Treat byte arrays as raw JPEG data for #435.
2023-10-06 13:55:17 +01:00
Philip Howard 65fd3b1c5a
Merge pull request #850 from pimoroni/helgibbons-patch-1
IOExpander: add I2C address change example
2023-09-29 09:38:44 +01:00
Phil Howard 4b3e83f2ff JPEGDEC: Treat byte arrays as raw JPEG data for #435. 2023-09-29 09:18:55 +01:00
Philip Howard fc777ff0ca
Merge pull request #852 from pimoroni/helgibbons-patch-2
Add I2C pins for PicoVision
2023-09-27 10:57:10 +01:00
Hel Gibbons 5345cc42d2
Add I2C pins for PicoVision 2023-09-25 14:53:54 +01:00
Hel Gibbons 169ed9c763 IOExpander: add I2C address change example 2023-09-21 16:16:10 +01:00
Philip Howard 8eac60afc6
Merge pull request #846 from pimoroni/patch-bitmap-fixed-space
Bitmap Fonts: Fixed-width space for #765.
2023-09-15 09:32:23 +01:00
Phil Howard 93525a422f Bitmap Fonts: Fixed-width space for #765. 2023-09-15 09:07:59 +01:00
Hel Gibbons 36f3e3a69f
Merge pull request #844 from pimoroni/helgibbons-patch-1
Galactic: add links
2023-09-14 10:37:35 +01:00
Hel Gibbons 29a13305d2
Update README.md 2023-09-13 10:57:56 +01:00
Philip Howard 1f4704afdb
Merge pull request #843 from pimoroni/feature/picovector
PicoVector - Fixes & Improvements
2023-09-12 13:49:17 +01:00
Phil Howard ae7e6e8c6c PicoVector: Add a bounds method for polygon bounds. 2023-09-12 13:18:33 +01:00
Phil Howard 5f730ff400 PicoVector: Pass PicoGraphics clip into Pretty Poly. 2023-09-12 12:03:09 +01:00
Philip Howard c3919bd648
Merge pull request #840 from MichaelBell/patch-pretty-poly-perf
Improve pretty_poly performance
2023-09-11 12:03:25 +01:00
Philip Howard ed3ce45f00
Merge pull request #842 from MichaelBell/patch-fix-text-newline
Fix newlines in rotated text
2023-09-11 11:37:38 +01:00
Philip Howard 1a7deaab71
Merge pull request #841 from MichaelBell/patch-fix-vector-transform
Initialize all matrix values
2023-09-11 11:36:52 +01:00
Philip Howard 9735402ee3
Merge pull request #839 from MichaelBell/feature/fast-blend
Allow pen function for fast tile alpha blending
2023-09-11 11:36:04 +01:00
Philip Howard c045c405c3
Merge pull request #838 from MichaelBell/patch-micropython-build
Fix clean Micropython build
2023-09-11 10:32:46 +01:00
Mike Bell 80e1e16782 Fixes from compiling with gcc 12 2023-09-10 21:02:16 +01:00
Mike Bell cdd648f3f6 Small improvements to rotated font rendering 2023-09-10 17:20:44 +01:00
Mike Bell 81f42f25b6 Fix newlines in rotated text 2023-09-10 17:20:10 +01:00
Mike Bell 841c141ebf Interpolators for line segment, and faster transforms 2023-09-10 13:22:21 +01:00
Mike Bell c812eec432 Initialize all matrix values 2023-09-10 13:18:13 +01:00
Mike Bell 41eb2b503e Additional improvements to pretty_poly 2023-09-10 00:08:35 +01:00
Mike Bell 581481c2ef Improve pretty_poly performance
(cherry picked from commit 1077a12ff4fd958a7ea6d9e4fa5a86551eba5126)
2023-09-09 01:30:10 +01:00
Mike Bell e908d5e53e Allow pen function for fast tile alpha blending 2023-09-08 23:48:16 +01:00
Mike Bell 34b8ac9f0c Wrap pio.h includes in NO_QSTR so a fresh Micropython build doesn't fall over. 2023-09-08 18:59:25 +01:00
Philip Howard 9124b376d2
Merge pull request #837 from pimoroni/patch-tufty2040-vector
Tufty 2040: Vector examples.
2023-09-07 10:38:26 +01:00
Phil Howard c725b4eee0 Tufty 2040: Vector examples.
Add AdvRe.af for PicoW Explorer and Tufty 2040 spectrometer examples.
2023-09-07 10:14:32 +01:00
Philip Howard a334899b61
Merge pull request #783 from pimoroni/feature/ppaf
PicoVector.
2023-09-06 15:15:30 +01:00
Phil Howard cca2d569e4 PicoVector: Add vector spectrometer example for PicoW Explorer. 2023-09-06 14:07:23 +01:00
Philip Howard 3d8f8c9a83
Merge pull request #829 from ahnlak/lib-driver-include-fixes
Added includes to allow for libraries to be linked to out-of-tree
2023-09-06 10:32:53 +01:00
Phil Howard 788f6c3232 PicoVector: Add clock example for PicoW Explorer. 2023-09-06 10:31:40 +01:00
Phil Howard 231ceb70f2 PicoVector: Add basic polygon center of mass function. 2023-09-06 10:12:08 +01:00
Phil Howard c9fd68ec58 PNGDEC: Remove PNG RAM debug text. 2023-09-06 09:39:28 +01:00
Hel Gibbons b82429caf0
Merge pull request #834 from pimoroni/helgibbons-patch-1
Cosmic Unicorn: add link
2023-09-06 09:39:18 +01:00
Hel Gibbons 386a3594c0
Cosmic Unicorn: add link 2023-09-05 17:31:25 +01:00
Hel Gibbons 9e0b3adc0c
Merge pull request #830 from ahnlak/pico-unicorn-mp-examples
Added some PicoGraphics based MP examples for the PicoUnicorn
2023-09-05 16:46:52 +01:00
Pete Favelle 8c3a21ec1a Made sure all columns are used! 2023-09-05 16:09:02 +01:00
Pete Favelle 2f44e85431 Added some PicoGraphics based MP examples for the PicoUnicorn 2023-09-04 14:31:32 +01:00
Phil Howard 5a92a9c735 PNGDEC: Support for 2bpp indexed PNGs, fix open_RAM. 2023-09-04 13:55:15 +01:00
Pete Favelle 8a9ef39158 Added includes to allow for libraries to be linked to out-of-tree 2023-08-31 10:05:08 +01:00
Phil Howard c443f8d206 PicoVector: Tweak polygon tile rendering loop. 2023-08-22 09:32:28 +01:00
Phil Howard 591058fb12 PicoVector: Store pointer to PP mem. 2023-08-22 09:32:28 +01:00
Phil Howard cfe8b3c096 PicoVector: Text rotation support. 2023-08-22 09:32:28 +01:00
Phil Howard 9d0501a43c PicoVector: Polygon iter interface. 2023-08-22 09:32:28 +01:00
Phil Howard 7c5ebfce8c PicoVector: Matrix transforms and polygon type. 2023-08-22 09:32:28 +01:00
Phil Howard 61c9d7e9b6 PicoVector: Experimental matrix transforms. 2023-08-22 09:32:28 +01:00
Phil Howard c7d9fe411a PicoVector: Bugfixes and font/aa options. 2023-08-22 09:32:28 +01:00
Phil Howard 4671607b3a PicoVector: Vector anti-aliasing support. 2023-08-22 09:32:28 +01:00
Phil Howard 95ab839ba5 PicoVector: Text wrap support. 2023-08-22 09:32:28 +01:00
Phil Howard 9e430fd68c PicoVector: Better separation of concerns, add Alright Fonts support. 2023-08-22 09:32:28 +01:00
Phil Howard c9a8d5ef49 PicoVector: Move polygon drawing to a new home. 2023-08-22 09:32:28 +01:00
Phil Howard 38aaa04c5d Tufty 2040: Basic pretty polygon example. 2023-08-22 09:32:28 +01:00
Phil Howard e8dba75aff PicoGraphics: Use std:: prefix, fix some type issues. 2023-08-22 09:32:28 +01:00
Phil Howard 09a58b269f PicoGraphics: Various compile warning fixes for Pretty Poly. 2023-08-22 09:32:28 +01:00
Phil Howard cc7219b44a PicoGraphics: Experimental Pretty Poly bring-up. 2023-08-22 09:32:28 +01:00
Philip Howard 57042bfed3
Merge pull request #821 from pimoroni/dv_stick_minimal
PicoVision: Minimal changes required to support PV specific drivers/pen types.
2023-08-22 09:31:30 +01:00
Hel Gibbons dc4ee0d459
Merge pull request #822 from pimoroni/helgibbons-patch-1
stellar: correct paths to tiny font
2023-08-21 15:59:14 +01:00
Hel Gibbons 157180c476 stellar: correct path to font 2023-08-21 14:28:08 +01:00
Hel Gibbons 7344e4d1a4
stellar: correct path to 3x5 font 2023-08-21 14:16:25 +01:00
Phil Howard 1157e605a1 Picovision: Remove DV stick drivers to PV repo. 2023-08-21 14:04:49 +01:00
Philip Howard b82d16e8ae
Merge pull request #817 from pimoroni/feature/pico-explorer-pins
PicoGraphics: Add Pico W Explorer SPI pins.
2023-08-15 15:52:51 +01:00
Hel Gibbons 095122c606
Merge pull request #816 from pimoroni/helgibbons-patch-1
Galactic Unicorn: add link
2023-08-14 12:42:36 +01:00
Mike Bell 211e0aa618 DV Display: Fix unaligned read across page boundary 2023-08-14 12:40:15 +01:00
Mike Bell b8116fc371 DV Display: Ability to load sprites in native format 2023-08-14 12:40:15 +01:00
Mike Bell 0cfcb22aa4 DV Display: Add sprite test to cmake 2023-08-14 12:40:15 +01:00
Mike Bell 3cdfe558e8 DV Display: Ability to specify sprite blend mode 2023-08-14 12:40:15 +01:00
Mike Bell 103228a88d DV Display: Sprites in palette mode 2023-08-14 12:40:15 +01:00
Mike Bell 3a5f069ec1 DV Display: Fix clear sprite, fix tearing 2023-08-14 12:40:15 +01:00
Mike Bell 765b8a6226 DV Display: Begin exposing sprites 2023-08-14 12:40:15 +01:00
Mike Bell 3c2c7ccc94 DV Display: Support multiple scroll offsets 2023-08-14 12:40:15 +01:00
Mike Bell b9cd998709 DV Display: Allow scrolling by single pixel in x coordinate 2023-08-14 12:40:15 +01:00
Mike Bell 1a54f7b77d DV Display: Ability to specify a larger frame than the display, and scroll it 2023-08-14 12:40:15 +01:00
Mike Bell 8f78e3d6bc DV Display: Switch SWD loader back to pio0 to avoid conflict with wifi 2023-08-14 12:40:15 +01:00
Mike Bell a396512e7f DV Display: Expose reset functionality 2023-08-14 12:40:15 +01:00
Mike Bell 9a0b21d417 DV Display: Fix palette error 2023-08-14 12:40:15 +01:00
Mike Bell e9779fc0e7 DV Display: Probable fix for frame corruption 2023-08-14 12:40:15 +01:00
Mike Bell 559ce08e04 DV Display: Fix C++ examples 2023-08-14 12:40:15 +01:00
Phil Howard cbc05863c0 DV Display: Claim unused channels and SMs. 2023-08-14 12:40:15 +01:00
Phil Howard 7d8bbf5c08 DV Display: Claim DMA channels and cleanup unused pio_prog.
TODO: Use claim_unused_channel in a way that survives MicroPython soft reset.
2023-08-14 12:40:15 +01:00
Mike Bell 7e9f16d80c DV Display: Pixel doubled palette mode 2023-08-14 12:40:15 +01:00
Mike Bell 4b57162c06 DV Display: External I2C interface option 2023-08-14 12:40:15 +01:00
Phil Howard de4aaa80b6 DV Display: Refactor pio usage with mutex program loader. 2023-08-14 12:40:15 +01:00
Phil Howard 4afe062d19 MicroPython: Make DV display us fixed pio/dma. 2023-08-14 12:40:15 +01:00
Mike Bell 3bc215074c Make it possible to derive from DVDisplay if you want to do fancy things with the frame header 2023-08-14 12:40:15 +01:00
Mike Bell a6bd626334 RGB888 JPEG decode (implemented in some cases only) 2023-08-14 12:40:15 +01:00
Mike Bell 575e806cc8 Remove unnecessary data from JPEG range tables 2023-08-14 12:40:15 +01:00
Mike Bell be943bd5a0 Fix build 2023-08-14 12:40:15 +01:00
Mike Bell daf7232024 Limited support for palette and RGB888 modes 2023-08-14 12:40:15 +01:00
Mike Bell a7435c6a5e GPIO High and palette mode support 2023-08-14 12:40:15 +01:00
Mike Bell 5a6aa0186c Add EDID decoder 2023-08-14 12:40:15 +01:00
Mike Bell 360588ff67 LED control 2023-08-14 12:40:15 +01:00
Mike Bell 4ed1d61336 Ability to read EDID 2023-08-14 12:40:15 +01:00
Mike Bell 31b480d138 Support for half resolutions (pixel/line doubling in the driver) 2023-08-14 12:40:15 +01:00
Mike Bell c7049f4ff1 Ability to choose the resolution for the display 2023-08-14 12:40:15 +01:00
Mike Bell 1d8c836635 Read button state from display driver 2023-08-14 12:40:15 +01:00
Mike Bell e295e69c72 Slideshow from jpegs in SD card directory 2023-08-14 12:40:15 +01:00
Mike Bell 5971bc9ad8 Streamline RAM writes 2023-08-14 12:40:15 +01:00
Mike Bell a1caa9495c Buffer sequential writes 2023-08-14 12:40:15 +01:00
Mike Bell f4b8bc9025 Fix Micropython build 2023-08-14 12:40:15 +01:00
Mike Bell 2e8632f2b6 Use rescue DP to always get driver into a known state before load, boot via watchdog, better logging from driver. 2023-08-14 12:40:15 +01:00
Mike Bell da36b0ad32 Load DV Stick Driver over SWD. Currently unreliable. 2023-08-14 12:40:15 +01:00
Mike Bell 9acc270418 Growing circles - runs at 30FPS 2023-08-14 12:40:15 +01:00
Mike Bell 5f8e7556f0 Begin DV Stick display driver 2023-08-14 12:40:15 +01:00
Philip Howard a7efef0049
Merge pull request #815 from pimoroni/toolchain_env
Fix out of box failure when ARM toolchain is not in path
2023-08-14 12:27:44 +01:00
Hel Gibbons 5a5786d066
Merge pull request #812 from simonprickett/add-gfx-pack-carbon-intensity
Add gfx pack carbon intensity bar graph example.
2023-08-14 11:01:25 +01:00
Simon Prickett 710863099d Another go at the linter. 2023-08-14 10:40:43 +01:00
Simon Prickett 316957c263 Import order changed. 2023-08-12 13:39:18 +01:00
Simon Prickett 9b18ed2594 Further linter checks after running pylint in VSCode. 2023-08-12 13:38:25 +01:00
Simon Prickett 658025a99b Linter issues. 2023-08-12 13:33:03 +01:00
Hel Gibbons fef22530ea
Galactic Unicorn: add link 2023-08-11 16:38:33 +01:00
Angus Logan fc28845fb9 * Fix out of box failure when ARM toolchain is not in path
- Use pico_find_compiler to find linker
2023-08-11 11:48:58 +01:00
Andrew Wilkinson 14c7f6c9c8
fix: Only set time if the wlan is connected
Previously, if we dropped out of the wlan loop early because of an error (wlan.status() < 0) it would still print "Connected", and try to set the time.
2023-08-10 15:58:52 +01:00
Simon Prickett 14eabf360f Adds carbon intensity graph example. 2023-08-07 22:47:01 +01:00
Simon Prickett fe805a711a Adds carbon intensity graph example. 2023-08-07 22:46:55 +01:00
Philip Howard d93839d56a
Merge pull request #793 from awjlogan/enviro-tidy
Enviro Pico description generation did not match f-string rounding
2023-08-04 10:43:06 +01:00
Philip Howard e1527c44d5
Merge pull request #811 from pimoroni/feature/rotation
Support for text and PNG 90-degree rotations
2023-08-04 10:42:17 +01:00
Phil Howard 4ad6df5cc3 PNGDEC: Rotation support. 2023-08-03 16:30:25 +01:00
Phil Howard 004c8de8eb Bitmap Fonts: Add rotation support.
* Fix bug with word-wrap ignoring \n
* Fix bug with word-wrap miscalculating word size
2023-08-03 16:30:25 +01:00
Philip Howard 3639b46881
Merge pull request #810 from pimoroni/patch-linting
CI: Fix linting issues.
2023-08-03 16:25:01 +01:00
Phil Howard b744f78a46 CI: Fix linting issues. 2023-08-03 16:06:24 +01:00
Philip Howard 5bc85c0e6d
Merge pull request #797 from North101/main
Make Galactic clock example responsive
2023-08-03 15:56:33 +01:00
ZodiusInfuser 6bd5a445ba
Merge pull request #809 from makosa-irvin/main
Added light sensor example to the cosmic and stellar unicorns
2023-08-03 15:35:43 +01:00
Irvin 6306d5e753 Minor formatting changes 2023-08-03 15:26:24 +01:00
Irvin f0bfc7c13b Improved readability 2023-08-03 15:19:01 +01:00
Irvin e1e467185a Minor changes on the unicorns 2023-08-03 15:03:55 +01:00
Irvin 7e65c15cfb Reduced flickering 2023-08-03 14:01:29 +01:00
Irvin Makosa 462724210c Modified the calculate_brightness function to reduce flickering on gu 2023-08-02 23:33:15 +01:00
Irvin Makosa 0b0474e062 Added light sensor example to the su 2023-08-02 01:15:38 +01:00
Irvin Makosa 90a2076b7b display percentage icon 2023-08-02 00:56:16 +01:00
Irvin Makosa e14903dd27 Added light sensor example on cu 2023-08-02 00:43:48 +01:00
Irvin Makosa f06d1035a4 Modified gu readme 2023-08-01 22:59:03 +01:00
Hel Gibbons d0c40af766
Merge pull request #807 from makosa-irvin/main
Added light sensor example with auto brightness feature
2023-08-01 12:35:44 +01:00
Hel Gibbons 439b97d96e
Merge pull request #806 from pimoroni/helgibbons-patch-1
Add link
2023-08-01 09:51:48 +01:00
Irvin Makosa 8bb5e17e65 Fixed minor formatting issues 2023-08-01 00:34:39 +01:00
Irvin b8cdff8f4f Added light sensor example with auto brightness feature 2023-07-31 17:31:02 +01:00
Hel Gibbons eb31f9b043
Add link 2023-07-31 17:28:52 +01:00
Phil Howard b368950f02 PicoGraphics: Add Pico W Explorer SPI pins. 2023-07-27 17:14:01 +01:00
Philip Howard 51574f839d
Merge pull request #802 from pimoroni/feature/pngdec
PicoGraphics: Add support for PNG decoding.
2023-07-27 11:01:40 +01:00
Hel Gibbons 03232bbeb5
Merge pull request #803 from pimoroni/examples/tiny2040
Tiny 2040: add button/LED example
2023-07-21 13:33:07 +01:00
Phil Howard 5ec6903f7f PNGDEC: Clean up API, add get_palette and index copy. 2023-07-21 13:23:08 +01:00
helgibbons c696cd5e2d Tiny 2040: add button/LED example 2023-07-21 13:03:44 +01:00
Phil Howard 6db7a9a0a6 PNGDEC: Add crude cropping/scaling. 2023-07-21 10:19:31 +01:00
Phil Howard 1630ddbbb2 PicoGraphics: Add support for PNG decoding. 2023-07-19 16:04:05 +01:00
Hel Gibbons 25237c54ce
Merge pull request #795 from pimoroni/patch/stellar-examples
Stellar: tidy examples
2023-07-04 19:06:17 +01:00
Alexander Wilde 16c2dc0356 Make Galatic clock example responsive 2023-07-04 10:41:33 +01:00
Hel Gibbons 8f5a94482b
Merge pull request #796 from thinkier/patch-1
Doc error in Pico Display Pack 2 README (C++)
2023-07-04 09:12:28 +01:00
thinkier aa8b158ba3
📝 maybe a copypaste error 2023-07-04 11:19:32 +10:00
Hel Gibbons 52df18e550 stellar: lint BME280/68x examples 2023-07-03 14:34:10 +01:00
Hel Gibbons 1d1b521dfb stellar: add BME280 and BME68x examples 2023-07-03 14:29:56 +01:00
Hel Gibbons 3786cbdfe6 Stellar: correct typo 2023-07-03 13:18:18 +01:00
Hel Gibbons 58cdc85b1f stellar: add encoder wheel demo 2023-07-03 12:15:12 +01:00
helgibbons 6b67f652c7 Stellar: adjust exchange_ticker.py 2023-07-02 19:17:24 +01:00
helgibbons 37638172ae Stellar: add temperature example 2023-07-02 19:02:08 +01:00
helgibbons 3236503805 Stellar: add pizazz to weather example 2023-07-02 17:48:53 +01:00
helgibbons ce24330842 Stellar: move font to common 2023-07-02 15:19:32 +01:00
helgibbons 130685eeeb Stellar: adjust html text example 2023-07-02 15:14:25 +01:00
Hel Gibbons 6afdfef45b Stellar: update weather example 2023-06-27 17:36:08 +01:00
Angus Logan 1e6e68356a Add rounding to lux report to prevent unit being overwritten
Correct unit for centigrade
2023-06-23 20:27:10 +01:00
Angus Logan d25c6953d0 Correct comment for backlight button functionality 2023-06-23 20:22:18 +01:00
Angus Logan 0a0b72701e Match descriptive terms to Python f-string rounding 2023-06-23 20:20:23 +01:00
Hel Gibbons 40f0554259
Merge pull request #792 from pimoroni/patch/co2-examples
SCD41: update examples
2023-06-23 16:13:54 +01:00
Hel Gibbons d9064f0162 SCD41: update Plasma Stick example 2023-06-23 15:23:41 +01:00
Hel Gibbons dc1f000134 SCD41: add Plasma 2040 example 2023-06-23 12:11:05 +01:00
Hel Gibbons 32ae70d16d SCD41: update example to use default pins 2023-06-23 11:55:25 +01:00
Hel Gibbons 8a6bb65d73
Merge pull request #791 from LionsPhil/doc765
Document PicoGraphics fixed_width
2023-06-23 10:01:57 +01:00
LionsPhil a0fe954b7c Document PicoGraphics fixed_width
(VSCode also stubbornly fixed some trailing space.)

Closes #765.
2023-06-22 23:58:03 +01:00
Hel Gibbons 951fe4d8b8 SCD41: update example to use default pins 2023-06-22 17:12:55 +01:00
Hel Gibbons cbaf1fa27d fix co2.py formatting 2023-06-22 12:20:25 +01:00
Hel Gibbons 16f8f0ab05 Adjust lava_lamp.py 2023-06-21 16:50:21 +01:00
Hel Gibbons d759522b08 Adjust clock.py
Clock now uses smaller font so it fits on the screen
2023-06-21 16:49:13 +01:00
Hel Gibbons 9307ea1360 add co2 example 2023-06-21 16:24:37 +01:00
Philip Howard 6fb35df544
Merge pull request #789 from pimoroni/feature/picographics-custom-fonts
PicoGraphics: Add MicroPython support for custom font data.
2023-06-19 08:56:34 +01:00
Phil Howard b0d63ef777 PicoGraphics: Add MicroPython support for custom font data. 2023-06-16 11:25:17 +01:00
Philip Howard d523eded0b
Merge pull request #716 from pimoroni/feature/bluetooth
MicroPython: Pico W Bluetooth Support
2023-06-16 11:15:37 +01:00
Phil Howard 090ce9d2c6 MicroPython: Enable Bluetooth support for Pico W builds. 2023-06-15 11:58:41 +01:00
Philip Howard 9d96d061e9
Merge pull request #786 from pimoroni/feature/stellar_unicorn
16% More Unicorn
2023-06-15 10:59:43 +01:00
Phil Howard 70a1b26041 ADC: Avoid re-initialising ADC.
Only init the ADC if it's not already running.

In MicroPython this could trounce an already initialised and configured ADC,
and would disable the temperature sensor if it had been enabled by a user
before initialising any of the affected libraries.
2023-06-04 21:46:23 +01:00
Phil Howard bff6bd023e Unicorn: Move gamma LUTs to pimoroni_common. 2023-06-04 21:46:12 +01:00
Phil Howard 19c57ebb20 Stellar: Refined stalemate detection in Life. 2023-06-01 20:21:24 +01:00
Phil Howard 94c5d74894 Stellar: Tweak & tidy examples. 2023-05-31 13:54:34 +01:00
ZodiusInfuser 67152e32e5 Copied Cosmic MPy examples to Stellar 2023-05-30 12:42:27 +01:00
ZodiusInfuser 7aa75e57a4 Add C++ examples for Stellar, and fix init 2023-05-30 12:06:58 +01:00
ZodiusInfuser 68f610184f Possible fix for stellar pio? 2023-05-30 11:16:51 +01:00
ZodiusInfuser aabe789f21 Initial setup for StellarUnicorn build 2023-05-30 10:32:25 +01:00
ZodiusInfuser bd4238945d Fixed case of some CosmicUnicorn variables 2023-05-30 10:25:33 +01:00
ZodiusInfuser ae252fbc6e Removed comma in *Unicorn readme code 2023-05-30 10:24:28 +01:00
Philip Howard d4609699ba
Merge pull request #781 from pimoroni/ci/caching-fun
CI: Add workflow version to cache key.
2023-05-25 11:31:39 +01:00
Philip Howard 74064407e9
Merge pull request #779 from pimoroni/picographics/fonts
PicoGraphics: Fixed-width bitmap font support.
2023-05-24 15:00:15 +01:00
Phil Howard 0a2e099886 CI: Add workflow version to cache key. 2023-05-18 11:55:21 +01:00
Hel Gibbons c8d3b6b7d1
Merge pull request #780 from pimoroni/helgibbons-patch-1
Add link to RGB Encoder Wheel shop page
2023-05-17 15:38:12 +01:00
Hel Gibbons 5aa227ff45
Update README.md 2023-05-17 14:04:16 +01:00
Phil Howard fba7b53c36 PicoGraphics: Fixed-width bitmap font support. 2023-05-15 11:03:39 +01:00
Philip Howard 00d1617947
Merge pull request #777 from pimoroni/patch-st7789-parallel-dma
Tufty 2040: DMA display update.
2023-05-12 14:19:31 +01:00
Phil Howard 652de85f4d Tufty 2040: RGB565 DMA display update.
Use DMA to transfer a native RGB565 display buffer to PIO rather than pushing into the TX FIFO in a loop.

Co-authored by @zx64 - https://github.com/pimoroni/pimoroni-pico/issues/776
2023-05-12 13:38:19 +01:00
Philip Howard 8648196cc2
Merge pull request #774 from pimoroni/breakout_encoder_wheel
Support for RGB Encoder Wheel Breakout
2023-05-12 11:58:15 +01:00
Philip Howard ec205fb045
Merge pull request #775 from MichaelBell/cosmic-ghost-fix
Ghosting fix for Cosmic
2023-05-12 09:14:01 +01:00
Mike Bell 5b31e018ff Possible ghosting fix for Cosmic 2023-05-10 20:09:59 +01:00
ZodiusInfuser d00185d831 Added C & MP interrupt example 2023-05-10 16:57:38 +01:00
ZodiusInfuser 0120975b3c Readme improvements 2023-05-10 16:08:51 +01:00
ZodiusInfuser 12e38c1157 Implemented GPIO MP support for Encoder wheel 2023-05-10 14:54:32 +01:00
Philip Howard 89699fd78f
Merge pull request #773 from pimoroni/ulab/bump-6.0.12
Ulab: Bump to 6.0.12.
2023-05-10 13:26:56 +01:00
Phil Howard 05cad0c157 Ulab: Bump to 6.0.12. 2023-05-10 13:03:47 +01:00
ZodiusInfuser 653090c89e Exposed support for GPIO pins on encoder wheel 2023-05-10 12:46:00 +01:00
Philip Howard 1c39da4997
Merge pull request #746 from mutatrum/main
Fix web server only serving file once and wifi country configuration
2023-05-09 14:15:04 +01:00
Philip Howard 092fbe472f
Merge pull request #748 from Quitsoon/patch-1
pico_rtc.py, Just a little PR for a possible typo :)
2023-05-09 14:00:18 +01:00
Philip Howard ecbd1e66de
Merge pull request #771 from raybellis/macos_fixes
Fixes for compilation under macOS / GCC 13.3.1
2023-05-09 13:48:05 +01:00
Ray Bellis bfb6490ec8 fix dangling pointer error 2023-05-08 13:19:47 +01:00
Ray Bellis 32dfdc6a20 use __builtin_bswap32 2023-05-08 13:17:51 +01:00
Ray Bellis 67df015bfe fonts need cstdint 2023-05-08 13:17:16 +01:00
Hel Gibbons 302d6ae0eb
Merge pull request #768 from pimoroni/helgibbons-patch-1
Cosmic: add links
2023-05-05 12:19:27 +01:00
Hel Gibbons 1be888f397
Cosmic: add links 2023-05-05 12:11:50 +01:00
Philip Howard 7491ced13b
Merge pull request #767 from pimoroni/1.14_lcd_improved
Display initialisation fixes for the Pico Display Pack 1.14" LCD
2023-05-04 15:42:37 +01:00
Niko Kotilainen 1dcad21ed2 Pico Display Pack: Display init fixes. 2023-05-04 15:07:27 +01:00
ZodiusInfuser 8966cbf348 Added C++ readme 2023-05-04 14:59:01 +01:00
Pete Favelle a59aa35df5
Improved inky's sleep_for, now handles up to 28 days (#754) 2023-05-04 14:54:23 +01:00
Philip Howard b6499e71fc
Merge pull request #764 from pimoroni/ci/smolmodules
Reduce size & workload of MicroPython build cache
2023-05-04 14:48:21 +01:00
ZodiusInfuser 5619274d3d Added MP readme 2023-05-04 14:10:39 +01:00
ZodiusInfuser 862806f357 Simplified example I2C setup 2023-05-04 14:10:12 +01:00
Phil Howard 7951ef9668 CI: Hack: Patch MicroPython to remove exception handling.
Force "-specs=nano.specs" on MicroPython builds and disable various stack unwinding and exception handling features for C++ modules.
2023-05-04 14:09:23 +01:00
ZodiusInfuser 4dadeb0d4d Add c++ examples readme 2023-05-04 11:16:55 +01:00
Phil Howard b30d9ca554 CI: Switch py modules from cmake hacks to manifest.py.
A long overdue fix. Uses board-specific manifest.py files to freeze Python modules, instead of polluting ports/rp2/modules.
2023-05-03 18:04:55 +01:00
ZodiusInfuser e0a405739c Fix namespace issue 2023-05-03 17:41:18 +01:00
ZodiusInfuser 9f925b5259 Ported most encoder wheel examples to C++ 2023-05-03 17:22:58 +01:00
Phil Howard 8648597134 CI: Clean ports/rp2/modules before each build. 2023-05-03 17:21:18 +01:00
ZodiusInfuser e3f9f14dcf Fix ioe reset timing out too early, and encoder reversed 2023-05-03 12:34:59 +01:00
ZodiusInfuser 226e7507dd Fix 2023-05-02 22:58:38 +01:00
ZodiusInfuser 1cfae8b5f8 More work on encoder wheel C++, adding reset to ioe 2023-05-02 22:55:19 +01:00
ZodiusInfuser 387df3bd12 Progress on encoder wheel C++ and MP 2023-05-02 17:31:11 +01:00
Phil Howard 45a2e0f5b1 MicroPython: Set hostname for Enviro and Inky. 2023-05-02 16:35:37 +01:00
Phil Howard e90ae33a99 CI: All MicroPython builds use local board dirs.
Simplify the build to use *only* local (to pimoroni-pico) copies of MicroPython board config dirs.

This allows us to specify MICROPY_C_HEAP_SIZE (and potentially other options) in board config rather than at build-time.
2023-05-02 16:21:11 +01:00
ZodiusInfuser d4d6cd1936 Progress on encoder wheel C++ and MP 2023-05-02 16:19:22 +01:00
Phil Howard dd4347dac3 CI: Grab only necessary modules.
Reduces the MicroPython cache from ~879MB down to ~187MB for a reduction of around 6,920MB across builds.
2023-05-02 15:35:02 +01:00
ZodiusInfuser 928c28b677 Switch to rom_map 2023-05-02 13:28:49 +01:00
ZodiusInfuser 2d45ed6ace Updated mp function list 2023-05-02 12:51:05 +01:00
ZodiusInfuser 178afd1469 remove description prints 2023-05-02 10:22:14 +01:00
ZodiusInfuser 6464f44437 Fix micropython config 2023-05-02 10:22:14 +01:00
ZodiusInfuser cd83a51e8a Fix micropython config 2023-05-02 10:22:14 +01:00
ZodiusInfuser f353525090 First porting of python examples 2023-05-02 10:22:14 +01:00
ZodiusInfuser 7c11593f7c Fix for IOExpander address not getting changed 2023-05-02 10:22:14 +01:00
ZodiusInfuser e3c3692e31 Test python for encoder 2023-05-02 10:22:14 +01:00
ZodiusInfuser 15978e5ddc Temporary fix for compiler issues 2023-05-02 10:22:14 +01:00
ZodiusInfuser 59d57a193b Initial support for Encoder wheel breakout 2023-05-02 10:22:14 +01:00
Philip Howard 56dba370c6
Merge pull request #762 from pimoroni/ci/single-job
CI: Single-job builds to avoid #761.
2023-04-28 16:39:23 +01:00
Phil Howard 22a659a559 CI: Set C heap size.
This broke our release v1.20.0 since we clearly use malloc somewhere. Oops.

Set the heap size to get us a working release.
2023-04-28 16:09:41 +01:00
Phil Howard 70f133dd62 CI: Single-job builds to avoid #761. 2023-04-27 16:10:18 +01:00
Philip Howard f0975778f6
Merge pull request #759 from pimoroni/ci/version-info
CI: Set MICROPY_GIT_TAG for #752.
2023-04-27 15:40:18 +01:00
Phil Howard c885789ada CI: Bump to MicroPython v1.20.0. 2023-04-27 15:04:06 +01:00
Phil Howard 8e0fe155c5 CI: Fix patch revert hack. 2023-04-27 15:03:59 +01:00
Hel Gibbons b512bdcea1
Merge pull request #760 from andrewmk/main
Fix relative link to PicoGraphics documentation
2023-04-26 12:24:15 +01:00
andrewmk 49e0b25557
Fix relative link to PicoGraphics documentation 2023-04-26 11:27:44 +01:00
Phil Howard c25de67247 CI: Set MICROPY_GIT_TAG and MICROPY_GIT_HASH for #752. 2023-04-26 10:36:39 +01:00
Philip Howard 334283a8f6
Merge pull request #757 from pimoroni/ci/board-manifests
MicroPython: Set board manifest for Inky, Enviro.
2023-04-24 15:21:12 +01:00
Phil Howard af99d6d5f8 MicroPython: Set board manifest for Inky, Enviro. 2023-04-24 15:05:21 +01:00
Philip Howard 5bfc0eba4c
Merge pull request #756 from pimoroni/ci/fix-caching
CI: Fix various build errors due to a caching race condition.
2023-04-24 12:25:41 +01:00
Phil Howard 1d003a80c2 CI: Revert lib/pico-sdk before build.
Revert lib/pico-sdk back to default before building.

Avoids a patched tree (fetched via the cache) leaking into or breaking subsequent builds.
2023-04-24 11:46:02 +01:00
Phil Howard a19f5943c3 CI: Use name instead of board for build dir.
Disambiguate build dir between multiple firmwares that use the same board, but different config.

Avoids cryptic errors caused by incompatible build artifacts leaking into other builds via the MicroPython cache.
2023-04-24 11:36:21 +01:00
Hel Gibbons cb5dcb965e
Merge pull request #750 from pimoroni/helgibbons-patch-1
Galactic: add link
2023-04-19 11:02:55 +01:00
Hel Gibbons f48c17ae1f
Merge pull request #751 from phennessey7/patch-1
Update noise.py
2023-04-19 11:01:51 +01:00
phennessey7 d78fffcd54
Update noise.py
Replaced extra blank line after edit on line 112 that was mistakenly deleted!
2023-04-14 10:04:07 -07:00
phennessey7 7b7959ef20
Update noise.py
Updated the song notes to play a more accurate version of the "Sailor's Hornpipe" tune!
2023-04-13 12:15:55 -07:00
Hel Gibbons 39eae8d42c
Galactic: add link 2023-04-13 13:31:01 +01:00
Quitsoon f6206876b7
Update pico_rtc.py
Just a little correction of the word "timer" instead of "alarm" for the last test.
2023-04-11 21:17:35 +02:00
mutatrum 7bdd85d677 Fix web server only serving file once and wifi country configuration 2023-04-08 16:57:01 +02:00
Philip Howard 7b7352130f
Merge pull request #739 from pimoroni/helgibbons-patch-1
PicoGraphics: document `dither=False`
2023-03-29 11:38:07 +01:00
Philip Howard 40d4774cf6
Merge pull request #737 from pimoroni/patch-cleanup-workflows
CI: Tidyup and combine MicroPython builds.
2023-03-29 11:36:49 +01:00
Phil Howard 3a35013667 CI: Apply patch from MicroPython root dir. 2023-03-28 22:24:11 +01:00
Phil Howard 3bdb27458f CI: Don't monkey with manifest.py paths. 2023-03-28 22:12:00 +01:00
Phil Howard cce02feabd CI: Set MICROPY_BOARD_DIR in CI workflow.
Move out of the USER_C_MODULES .cmake file.
2023-03-28 22:04:41 +01:00
Phil Howard aeca08f275 CI: Restore Tufty 2040 board def.
Set the PICO_BOARD_HEADER_DIRS environment variable as per https://github.com/raspberrypi/pico-sdk/blob/master/src/boards/generic_board.cmake

Add our local search path alongside the existing Pico SDK boards dir.
2023-03-28 21:25:22 +01:00
Phil Howard d69797689a CI: Reduce repetition in product names. 2023-03-28 21:06:07 +01:00
Phil Howard af352ff33f CI: Remove repetition of Build from build names. 2023-03-28 21:05:11 +01:00
Phil Howard 883d751f52 CI: Switch to MICROPY_BOARD_DIR and simplify fixups. 2023-03-28 21:05:05 +01:00
Hel Gibbons 5fa99c0690 PicoGraphics: add link 2023-03-28 16:44:30 +01:00
Hel Gibbons 75602b3fbb Galactic: add link 2023-03-28 16:17:45 +01:00
Hel Gibbons 6e7ec899eb
PicoGraphics: document `dither=False` 2023-03-28 15:56:15 +01:00
Phil Howard acf0e568bd CI: Tidyup and combine MicroPython builds. 2023-03-28 14:16:40 +01:00
Philip Howard c9bee93372
Merge pull request #733 from pimoroni/patch-cpp-init-heap
Refactor out remaining C++ heap usage during init.
2023-03-27 15:28:15 +01:00
Phil Howard 540bc2f75f Pico Unicorn/Scroll: Add buttons/dimensions to both module and class. 2023-03-27 15:11:30 +01:00
Phil Howard 761e8b5c3c MicroPython: Don't include Hershey font map. 2023-03-27 15:11:30 +01:00
Phil Howard 07bc005958 LTR559: Refactor std::vector lookup to template. 2023-03-27 15:11:30 +01:00
Phil Howard bad6a9e8d6 CPPMEM: Reduce fixed C++ heap to 1k.
Removing the use of std::map from LTP305's "dotfont" dramatically reduced init heap usage. Reduce the fixed buffer to account for this.
2023-03-27 15:11:30 +01:00
Phil Howard 049a121974 Dot Matrix: Allow set char from string. 2023-03-27 15:11:30 +01:00
Phil Howard cc5a2bdb6f Dot Matrix: Replace std::map to avoid excessive init heap usage. 2023-03-27 15:11:30 +01:00
Phil Howard 140fe913ae MicroPython: Don't include wireless pack in W builds. 2023-03-27 15:11:30 +01:00
Philip Howard 64941584d1
Merge pull request #732 from pimoroni/patch-bump-micropython
CI: Bump MicroPython to 38e7b84.
2023-03-27 15:06:12 +01:00
Phil Howard 569bcadcae CI: Bump MicroPython to 38e7b84.
Diff 05bb26010e...38e7b842c6
2023-03-27 11:24:01 +01:00
Philip Howard 9f71c04ea8
Merge pull request #731 from pimoroni/patch-wifi-examples
MicroPython: Various networking fixes to code & examples.
2023-03-27 11:16:44 +01:00
Phil Howard 0d0dc6a781 MicroPython: Various networking fixes to code & examples.
Replaces https://github.com/pimoroni/pimoroni-pico/pull/712, https://github.com/pimoroni/pimoroni-pico/pull/632 and https://github.com/pimoroni/pimoroni-pico/pull/630

Co-authored-by: ben4github <ben4github@users.noreply.github.com>
Co-authored-by: Alexander Gee <bostwickenator@gmail.com>
2023-03-27 11:06:36 +01:00
Philip Howard 2303702c15
Merge pull request #730 from pimoroni/patch-boot-py
Move boot.py to modules_py.cmake
2023-03-27 10:59:25 +01:00
Philip Howard d9d71c663f
Merge pull request #722 from pimoroni/docs/badger2040
Badger 2040: Add deprecation warnings and firmware links.
2023-03-27 10:50:39 +01:00
Phil Howard 0148e5f5e7 MicroPython: Move boot.py to modules_py.cmake.
The cppmem module *must* be switched into MicroPython heap mode or C++ code will inevitably run out of RAM.

Thus boot.py needs to be included in every build.
2023-03-27 10:41:16 +01:00
Phil Howard f5859ad371 Badger: Drop deprecated cmake files. 2023-03-27 10:31:12 +01:00
Phil Howard 393879581a Badger 2040: Add deprecation warnings and firmware links. 2023-03-27 10:30:19 +01:00
Philip Howard c6b4a30c09
Merge pull request #725 from pimoroni/patch-frame-convert-heap
MicroPython: Magic C++ Memory Management.
2023-03-27 10:28:16 +01:00
Hel Gibbons fbcd7836de
Merge pull request #729 from tjp/patch-1
Add reference to 7.3 inkyframe
2023-03-27 09:54:59 +01:00
Janos P Toth be1b827cfc
Update README.md 2023-03-25 10:14:58 -07:00
Phil Howard 2c0310ca9a MicroPython: Switch C++ allocation mode in boot.py. 2023-03-24 20:37:26 +00:00
Phil Howard 667faf70d1 MicroPython: Magic C++ allocator module.
This module redirects all pre-init object memory allocations into a static, fixed-sized, linear, non-freeing memory pool.

It then auto-switches into "MICROPYTHON" mode, whereupon all C++ `new` and `delete` calls are remapped to `m_malloc` and `m_free` respectively.
2023-03-24 15:11:07 +00:00
Hel Gibbons 1da4472926
Merge pull request #727 from pimoroni/helgibbons-patch-1
Docs: Fix link
2023-03-24 11:05:06 +00:00
Hel Gibbons 139569c2f3
Fix link 2023-03-24 10:17:27 +00:00
Philip Howard aa70394495
Merge pull request #723 from pimoroni/helgibbons-patch-1
Scroll Pack: Fix demo.py
2023-03-21 15:28:19 +00:00
Hel Gibbons 0666dc885a
Scroll Pack: Fix demo.py 2023-03-21 14:24:03 +00:00
Hel Gibbons 5392c5aa03
Merge pull request #713 from pimoroni/examples/inky_frame
Inky Frame: add new examples and update sample images
2023-03-20 14:18:43 +00:00
Philip Howard cb5db1d594
Merge pull request #711 from pimoroni/patch-jpegdec-filename
MicroPython: Avoid heap allocations in all C++ modules.
2023-03-17 14:08:27 +00:00
Phil Howard 587588dca5 CI: Bump MicroPython to 05bb260.
Changes: 294098d28e...05bb26010e
2023-03-17 11:22:56 +00:00
Phil Howard bb004e03a6 Badger: Deprecate firmware builds.
Remove builds for Badger 2040 and Badger 2040 W, these now live at: https://github.com/pimoroni/badger2040/
2023-03-17 11:18:45 +00:00
Phil Howard f9b46ba3a7 Pico Scroll: PicoGraphics scrolling text example. 2023-03-16 17:34:52 +00:00
helgibbons ec4c6c83f4 Inky Frame: correct typo 2023-03-16 17:13:23 +00:00
helgibbons 6f06ab246c Inky Frame: update image_gallery.py 2023-03-16 17:10:16 +00:00
Phil Howard 1b0b783a2f Pico Scroll: Add support for PicoGraphics. 2023-03-16 16:59:31 +00:00
helgibbons 9aa0465d8b hub75: function correction 2023-03-16 16:52:17 +00:00
Phil Howard b83bdbf198 MicroPython: Pico W parity with Pico build. 2023-03-16 15:02:32 +00:00
Phil Howard f2751ba6e9 Pico Unicorn: Add support for PicoGraphics. 2023-03-16 15:02:28 +00:00
Phil Howard 3eb42336e6 Pico Unicorn: Refactor into class.
Borrow heavily from Galactic/Cosmic Unicorn for the PIO/chained-DMA setup.
2023-03-16 13:25:19 +00:00
Phil Howard 044313551b Pico Scroll: Refactor to class. 2023-03-16 13:25:19 +00:00
Phil Howard bd3651d97d Pico RGB Keypad: Refactor to class.
Because `mp_tracked_calloc` does not survive a soft reset but the memory region will, resulting in half-initialised frankenclasses that behave unpredictably.

Using the class pattern fixes this since it's always guaranteed to be initialised when a user instantiates it, and __del__ can handle cleanup.
2023-03-16 13:25:19 +00:00
Phil Howard 9964ed716b Servo/Motor: Use m_new instead of new. 2023-03-16 13:25:19 +00:00
Phil Howard af2b74d65d Servo/Motor/PWM: Avoid runtime memory alloc. 2023-03-16 13:25:19 +00:00
Phil Howard a45eeb1623 Pico Wireless: Use tracked alloc. 2023-03-16 13:25:19 +00:00
Phil Howard aa91450f59 Pico Unicorn: Use tracked alloc. 2023-03-16 13:25:19 +00:00
Phil Howard dd7ea6fdc3 Pico Scroll: Use tracked alloc. 2023-03-16 13:25:19 +00:00
Phil Howard e4cb7ce95f Pico RGB Keypad: Use tracked alloc. 2023-03-16 13:25:19 +00:00
Phil Howard 157841f9db MicroPython: Add tracked alloc/free class helpers. 2023-03-16 13:25:19 +00:00
Phil Howard a0ab44067f BMP280: Avoid runtime memory allocation. 2023-03-16 13:25:19 +00:00
Phil Howard 1f0302bd66 BME280: Check read status and throw error on fail. 2023-03-16 13:25:19 +00:00
Phil Howard bcebccca1d BME68X: Avoid runtime memory allocation. 2023-03-16 13:25:19 +00:00
Phil Howard 59ae107982 BME280: Avoid runtime memory allocation. 2023-03-16 13:25:19 +00:00
Phil Howard 73f50e43ec Hershey Fonts: Replace map lookup to avoid std::string. 2023-03-16 13:25:19 +00:00
Phil Howard 375df60ff3 PicoGraphics: Switch to string_view.
MicroPython's GET_STR_DATA_LEN macro returns a const byte array and len, which std::string would copy into heap.

Using string_view lets us wrap the existing const values.
2023-03-16 13:25:19 +00:00
Phil Howard b74b371d2b JPEGDEC: Don't pass filename through std::string.
The result of GET_STR_DATA_LEN should be null terminated, so converting to a std::string and then using .c_str() is both redundant and need
s heap.
2023-03-16 13:25:19 +00:00
Hel Gibbons d0e2425e07
Merge pull request #655 from pimoroni/patch/i75-userbutton
i75/i75w: Auto-detect board and set up user button.
2023-03-16 11:58:59 +00:00
Hel Gibbons 60fe949fc5 fix link 2023-03-15 16:57:15 +00:00
Hel Gibbons d4d2b6fcbc
Merge pull request #715 from mogenson/clock-modulo
clock.py: constrain hour to 0 to 24
2023-03-15 14:02:10 +00:00
Hel Gibbons 0e6dbc1a6c add link 2023-03-15 11:22:23 +00:00
Hel Gibbons 9bee6d7431 tweak carbon intensity example 2023-03-15 10:39:54 +00:00
Michael Mogenson 2f26c172ed clock.py: constrain hour to 0 to 24
Use a modulo to constrain the displayed hour to 0 - 24 after applying
the UTC offset.
2023-03-14 21:22:59 -04:00
Hel Gibbons 2db116ccec update readme 2023-03-14 14:29:20 +00:00
Hel Gibbons 9ed2c40808 add carbon intensity example 2023-03-14 14:22:28 +00:00
Hel Gibbons 9730fee753 update readmes 2023-03-13 17:12:29 +00:00
Hel Gibbons 0138980849 update images, add new random image example 2023-03-13 16:56:28 +00:00
helgibbons 6f73f8fc83 Inky Frame: add more space images 2023-03-09 23:56:28 +00:00
Philip Howard 94d5b0cd33
Merge pull request #709 from pimoroni/refactor/micropython-cmake
MicroPython: Tidy up CMake files for our boards.
2023-03-09 20:25:31 +00:00
Phil Howard 13599b55a1 MicroPython: Tidy up CMake files for our boards.
* Feature parity between Badger 2040 and Tufty 2040.
* Add ulab to Tufty 2040.
* Don't include modules_py modules for boards that don't use/need them.
* Tweak modules_py.cmake so modules can be copied by parent CMake files.
* Simplify copy_module function to avoid repetition.
2023-03-09 11:36:55 +00:00
Philip Howard faf4efac34
Merge pull request #702 from pimoroni/docs/inky73
Inky 7.3 tweaks & docs
2023-03-08 21:02:06 +00:00
Phil Howard a448043870 Inky Frame: Document buttons & LEDs.
Expand upon memoryview caveat with Inky 7.3.
2023-03-08 20:48:58 +00:00
Phil Howard 75d56d04ad Inky Frame: Use PWMLED for button LEDs. 2023-03-08 20:31:30 +00:00
Phil Howard f255f419a1 Inky Frame: Use new PWMLED for led_busy and led_wifi. 2023-03-08 20:15:38 +00:00
Phil Howard 3f92caee22 Inky Frame: Better document colour constants. 2023-03-08 16:57:33 +00:00
Hel Gibbons 3d597e7d03 Inky Frame: make image_gallery work with all sizes 2023-03-08 16:54:36 +00:00
Phil Howard a8a8321405 PicoGraphics: (Try to) handle non-div-2 thickness. 2023-03-08 14:49:09 +00:00
Phil Howard 83f88c034d PicoGraphics: Enable thickness for all pens. Document. 2023-03-08 14:34:28 +00:00
Phil Howard aed14aca22 PicoGraphics: Expose line thickness support. 2023-03-08 12:08:47 +00:00
Phil Howard cacb5749ae Inky Frame: Add thickness support for Hershey text. 2023-03-08 11:35:07 +00:00
Hel Gibbons 789e63bd81
Merge pull request #708 from antonmosich/patch-1
Fix small typo in README
2023-03-07 08:57:58 +00:00
Anton Mosich aee0a2879b
Fix small typo in README 2023-03-06 23:28:47 +01:00
Phil Howard 63d4c23cd5 Inky Frame: Basic RTC demo. 2023-03-06 10:51:21 +00:00
Phil Howard a6e35e207d Inky Frame: Check current button state in woken_by_button.
Makes it easier to test wakeup logic in Thonny by holding a button when hitting "Run."
2023-03-06 10:51:21 +00:00
Phil Howard 07a5aac48f Inky Frame: Python Documentation. 2023-03-06 10:51:16 +00:00
Hel Gibbons f194715108
Merge pull request #701 from LionsPhil/autobrightstandalone
Contribute an automatic display brightness example
2023-03-03 11:34:16 +00:00
Phil Howard 56e5878b62 Inky Frame: Fix button masks, fakesleep on USB. 2023-03-03 10:56:50 +00:00
Phil Howard b6d0e54803 Inky Frame: Add RTC helper functions to Python module. 2023-03-02 17:33:30 +00:00
Phil Howard cb39d5c0f3 PCF85063A: Remove static keyword.
The use of "static" in `set_datetime` meant that "data" was only getting set to the correct values *once.*
2023-03-02 15:38:08 +00:00
Phil Howard 9e120995b2 Inky Frame: Add colour constants to Python module. 2023-03-02 13:09:55 +00:00
Phil Howard f4f5c6319a Inky Frame: Add dithering example. 2023-03-02 13:09:14 +00:00
Phil Howard 64632559f9 Inky 7.3: Raise error on PicoGraphics buffer operations. 2023-03-02 13:08:44 +00:00
Philip Howard 6be46dd429
Merge pull request #700 from pimoroni/examples/galactic-co2
Galactic: add CO2 breakout example
2023-03-02 11:44:04 +00:00
LionsPhil 0a6d6b91b3 Contribute an automatic display brightness example
Standalone smoothed display auto-brightness, reactive to the on-board
LUX and battery ADC sensors, with debugging keys so it's easier to test
(and play with).

Closes pull requests #628 and #629, which did this to the retro_badge
example, but made it too complicated.
2023-03-02 00:29:23 +00:00
Hel Gibbons 3d96ff9d92 Galactic: update examples readme 2023-03-01 14:16:12 +00:00
Hel Gibbons 421e715f06 Galactic: lint CO2 example 2023-03-01 13:55:40 +00:00
Hel Gibbons 8e91108ce5
Merge pull request #695 from pimoroni/inkyframe7-launch
Launcher for Inky Frame 7.3"
2023-03-01 12:32:38 +00:00
thirdr b66fc524ae adjustment to joke delivery position 2023-03-01 12:11:18 +00:00
thirdr 0cec01cf37 Switching from using JPEG to JSON files 2023-03-01 11:08:49 +00:00
Hel Gibbons 1dbd3ea312
Merge pull request #546 from Corteil/Galactic-Unicorn-CheerLights
CheerLights example for the Galactic Unicorn
2023-03-01 09:52:12 +00:00
Brian Corteil f882efc901 Update cheerlights.py
removed white space from line 20 in cheerlights
2023-02-28 23:39:35 +00:00
Hel Gibbons bc49a69416 Galactic: add co2 example 2023-02-28 17:51:08 +00:00
Philip Howard 5abbf9b5c8
Merge pull request #699 from pimoroni/docs/picographics_create_pen_hsv
PicoGraphics: correct hsv pen reference
2023-02-28 16:57:28 +00:00
Philip Howard f1809f3ebe
Merge pull request #697 from pimoroni/patch-cosmic-esc-numpy
Cosmic Unicorn: Eighties super computer in numpy/ulab.
2023-02-28 16:56:14 +00:00
Hel Gibbons 5ca10794a8
PicoGraphics: clarify hsv units 2023-02-28 15:43:19 +00:00
Hel Gibbons 1cb170664e
PicoGraphics: correct hsv pen reference 2023-02-28 15:16:08 +00:00
Phil Howard 07a1bf645a Cosmic Unicorn: RGB channels example in ulab/numpy. 2023-02-28 14:46:41 +00:00
thirdr 45a12892b8 adding blank secrets.py 2023-02-28 13:36:25 +00:00
Hel Gibbons de6b7e2828 Inky Frame: fix more typo 2023-02-28 13:10:44 +00:00
Hel Gibbons 579b8daa4e fix typo 2023-02-28 12:54:28 +00:00
Phil Howard 0fda232dcb Cosmic Unicorn: Melody Maker. 2023-02-28 10:10:57 +00:00
Phil Howard cbc21e52be Galactic/Cosmic Unicorn: Add sound to 80s computer. 2023-02-28 08:48:15 +00:00
Phil Howard b4d72d250d Galactic/Cosmic Unicorn: Remove loop from life.
More numpy magic to remove the Python loop and drastically increase life generation performance.
2023-02-27 23:13:44 +00:00
Phil Howard 10ea8757ea Galactic/Cosmic Unicorn: Life. 2023-02-27 22:31:52 +00:00
Phil Howard c836f9f8fe Galactic Unicorn: Backport Cosmic ulab/numpy examples. 2023-02-27 20:47:39 +00:00
Phil Howard d750532180 Cosmic Unicorn: Fix typo in lava_lamp.
Found while backporting to Galactic.
2023-02-27 20:34:03 +00:00
Phil Howard 5f3f14e5ce Galactic Unicorn: Add support for P4 and P8 pen modes. 2023-02-27 20:00:17 +00:00
Phil Howard ad5e4cc10e Cosmic Unicorn: Eighties super computer in numpy/ulab. 2023-02-27 19:52:56 +00:00
Hel Gibbons ab45fee123
Merge pull request #696 from pimoroni/docs/cosmic
Cosmic: tidy examples and docs
2023-02-27 17:09:45 +00:00
Hel Gibbons ec601de9a4 Cosmic: Update examples readme 2023-02-27 16:47:08 +00:00
Hel Gibbons 6aa5aaf50c Cosmic: update examples readme 2023-02-27 16:01:37 +00:00
Hel Gibbons 8069ae0e8f Cosmic: make examples consistent 2023-02-27 15:43:38 +00:00
Hel Gibbons 3459cc5f62 Cosmic: update clock example 2023-02-27 15:09:58 +00:00
Hel Gibbons 7b8b2796ed Cosmic: tweak generic docs 2023-02-27 15:09:58 +00:00
Hel Gibbons 931b3b26b2 PicoGraphics: add note about HSV pen 2023-02-27 15:09:58 +00:00
Hel Gibbons 6fc8ebd024 Cosmic: update C/C++ function reference 2023-02-27 15:09:58 +00:00
Hel Gibbons b6042e78c1 Cosmic: update function reference 2023-02-27 15:09:58 +00:00
Hel Gibbons c194fc7a2b Cosmic: add examples readme 2023-02-27 15:09:58 +00:00
Hel Gibbons 3e44edf66a Galactic/Cosmic: fix #556 2023-02-27 15:09:58 +00:00
Hel Gibbons c2b1eb47e5 Galactic - fix #661 2023-02-27 15:09:58 +00:00
Hel Gibbons 86c304d192 Cosmic - update remaining examples 2023-02-27 15:09:58 +00:00
thirdr b762ee8861 more colour and layout adjustments 2023-02-27 14:54:27 +00:00
thirdr 36458436bc oops, linting fix 2023-02-27 14:54:27 +00:00
thirdr d29666b87a colour adjustments 2023-02-27 14:54:27 +00:00
thirdr 797c0bbfd4 added exception handling 2023-02-27 14:54:27 +00:00
thirdr 9f8596c031 Switched from Taupe to Orange background text 2023-02-27 14:54:27 +00:00
thirdr 2357e8225b removed taupe colour from launcher 2023-02-27 14:54:27 +00:00
thirdr bc89afb58c Updated layout for Inky Frame 7 & 4 2023-02-27 14:54:27 +00:00
thirdr e8ff06dac8 Updated standalone examples for Inky Frame 7 2023-02-27 14:54:27 +00:00
thirdr 1fe071b713 support for inky 7 2023-02-27 14:54:27 +00:00
thirdr 44cc9d6e5e comment change 2023-02-27 14:54:27 +00:00
thirdr 66fbdde5e1 7.3 Frame support for Nasa APOD 2023-02-27 14:54:27 +00:00
thirdr 93dff218dc updated main launcher for 7 2023-02-27 14:54:27 +00:00
Philip Howard 9c1c9e6b8d
Merge pull request #694 from pimoroni/patch-cosmic-paint
Cosmic Unicorn: Port paint example.
2023-02-27 14:30:02 +00:00
Philip Howard c3498750ae
Merge pull request #683 from pimoroni/cosmic-wifi-mp-examples
added in the wifi examples from another branch
2023-02-27 14:29:45 +00:00
thirdr d25b04c93f standalone today example 2023-02-27 13:44:30 +00:00
Phil Howard c9d39d813c Cosmic Unicorn: Port paint example. 2023-02-27 12:28:25 +00:00
Gee Bartlett ca9b9d6b6a checked and updated nostalga prompt example 2023-02-27 12:22:19 +00:00
Hel Gibbons 35cc345eb4 Hooray, linting! 2023-02-27 11:53:20 +00:00
Hel Gibbons 69ee5cff3a remove out of date upip install code 2023-02-27 11:53:20 +00:00
Hel Gibbons 9a613975d7 delete empty file 2023-02-27 11:53:20 +00:00
Gee Bartlett 4bc002091e added in the wifi examples from another branch 2023-02-27 11:53:20 +00:00
Brian Corteil 37ff6b8b37 Update cheerlights.py
updated with @Gadgetoid suggestion.
2023-02-23 21:35:29 +00:00
Philip Howard d4bb43a537
Merge pull request #687 from pimoroni/ci/patch-picow-cmake-ccache
CI: Separate CCache cache for Pico/PicoW.
2023-02-23 18:01:54 +00:00
Phil Howard 52f9c33874 CI: Separate CCache cache for Pico/PicoW. 2023-02-23 17:41:21 +00:00
Philip Howard 9ae42fdaab
Merge pull request #686 from pimoroni/patch-pico-graphics-deps
PicoGraphics: Include dependencies if necessary.
2023-02-23 17:39:39 +00:00
Phil Howard 0c0a7b3bf6 PicoGraphics: Include dependencies if necessary.
Replaces #346

Co-authored-by: Charlie Birks <charlie@daft.games>
Co-authored-by: ThomasPDye <tompdye@googlemail.com>
2023-02-23 17:23:59 +00:00
Philip Howard aab8f0be35
Merge pull request #225 from pimoroni/driver/mlx90640
Driver for the mlx90640 thermal camera
2023-02-23 17:18:46 +00:00
Phil Howard 8ff40fae6e MLX90640: MicroPython module. 2023-02-23 16:52:59 +00:00
Philip Howard 206d4089d7
Merge pull request #533 from pimoroni/automini-webio-fixes
fixed example for automation2040wmini
2023-02-23 16:41:08 +00:00
ZodiusInfuser 446d7189c6 Automation 2040W Mini: Add dedicated HTML page. 2023-02-23 16:02:36 +00:00
Gee Bartlett 0616a0694e Automation2040W Mini: Fixed example. 2023-02-23 16:02:29 +00:00
Philip Howard 9dbd25bd51
Merge pull request #685 from pimoroni/feature/inky73-dither
Inky 7.3: Support dithering of arbitrary colours.
2023-02-23 15:51:43 +00:00
Phil Howard bfb2f8d2ba Inky 7.3: Drop unpredictable taupe from dither palette. 2023-02-23 14:37:06 +00:00
Phil Howard bff2e79a56 Inky 5.7: Dithered drawing ported from 7.3. 2023-02-23 14:17:54 +00:00
Phil Howard a5b0633469 Inky 7.3: Dither pixel spans, move RGB flag out of RGB888. 2023-02-23 13:35:41 +00:00
Phil Howard 80fab77270 Inky 7.3: Remove side-effect from set_pixel_dither.
Do not change "color" when dithering the same colour across multiple pixels.
2023-02-23 13:12:07 +00:00
Phil Howard c9f6dfec4f PicoGraphics: from_hsv to RGB::from_hsv. 2023-02-23 12:59:19 +00:00
Phil Howard 3e0cd28876 Inky 7.3: Support dithering of arbitrary colours.
`create_pen` returns an int with the most significant byte set to indicate it is an RGB888 colour.

Pen values without the most significant byte set are treated as palette entries and handled normally.
2023-02-23 12:09:52 +00:00
Philip Howard 63de02016f
Merge pull request #682 from pimoroni/feature/inky73c++
Inky 7.3: C++ library and JPEG example compatibility.
2023-02-22 16:42:15 +00:00
Phil Howard bea90dfd60 JPEGDEC: Experimental 3bit/4bit palette no-dither. 2023-02-22 15:40:22 +00:00
Phil Howard d3a1a571d3 Inky 7.3: C++ library and JPEG example compatibility. 2023-02-22 14:34:25 +00:00
Phil Howard 2ff5d462c8 MLX90640: Driver and 32x32 LED matrix example 2023-02-22 13:06:55 +00:00
Philip Howard 1317f2e04e
Merge pull request #680 from pimoroni/pico-display-mandelbrot
Added a pico display 2.0 Mandelbrot set example.
2023-02-22 13:02:07 +00:00
Phil Howard 8047f29ba6 Port Pico Display 2.0 Mandelbrot to PicoGraphics.
Move into Pico Display examples directory and update for PicoGraphics.
2023-02-22 12:14:50 +00:00
Martin Budden e66a2893ed Added a pico display 2.0 Mandelbrot set example.
Both pico cores are used: core0 handles the key input and updates the
display at low resolution. Core1 updates the display at high resolution.

For speed, fixed point arithmetic is used. The main loop also checks
for cyles to speed things up.

Six color palettes are provided, including 3 HSV, greyscale and black/white.
2023-02-22 11:57:13 +00:00
Phil Howard 5f9d4e33b3 Interstate 75: Auto-detect board version. 2023-02-22 11:47:23 +00:00
Gee Bartlett 552339a49e Update interstate75.md 2023-02-22 11:41:07 +00:00
Gee Bartlett 8637967605 Made edits from review 2023-02-22 11:41:05 +00:00
Gee Bartlett 93a18a874a updated examples 2023-02-22 11:39:32 +00:00
Gee Bartlett 979cc38b2a updated button defs 2023-02-22 11:39:30 +00:00
Gee Bartlett 96c83f8ae4 Update interstate75.md 2023-02-22 11:35:33 +00:00
Gee Bartlett 2a1c1e464f moved text size and placement 2023-02-22 11:35:33 +00:00
Gee Bartlett 58ee3b1e97 added boot button to module 2023-02-22 11:35:33 +00:00
Philip Howard f17c04b7ff
Merge pull request #658 from SimonShirley/main
List index out of range fix, remove default QR message if text files are available and file housekeeping
2023-02-22 11:11:59 +00:00
Philip Howard b08cf1fba0
Merge pull request #678 from pimoroni/patch-cosmic-example
Patch: fixed error caused by missing secrets.py
2023-02-22 11:04:01 +00:00
Hel Gibbons 8c4e54ad6b
Merge pull request #679 from Zoobdude/main
Update function names in readme
2023-02-22 10:41:50 +00:00
Brian Corteil a5538da8e6 Update cheerlights.py
added newline to last line
2023-02-22 02:05:20 +00:00
Brian Corteil ba7a17ff43 removed white space on lines 26 and 27 2023-02-22 01:57:33 +00:00
Zoobdude b4be3014fc
Update function names in readme
Looks like someone forgot to update the function names in the Badgerw's readme (they were still the ones from the old library)
2023-02-21 21:54:52 +00:00
Zoobdude 3797d4b76e
Update README.md 2023-02-21 21:48:44 +00:00
thirdr e3dc655a34 fixed error caused by missing secrets.py 2023-02-21 16:34:47 +00:00
Philip Howard af46e0379f
Merge pull request #676 from pimoroni/cosmic-launch-examples
Cosmic Unicorn: Launch Examples.
2023-02-21 14:39:44 +00:00
Philip Howard c78e85a171
Merge pull request #677 from pimoroni/patch-noisy-artifacts
CI: Don't include debug .elf files in artifacts.
2023-02-21 14:39:27 +00:00
Phil Howard 85881db00c CI: Don't include debug .elf files in artifacts. 2023-02-21 13:28:20 +00:00
Phil Howard 81884448ab Cosmic Unicorn: Launch Examples.
Co-authored-by: thirdr <ryan@pimoroni.com>
2023-02-21 13:25:39 +00:00
Philip Howard 049219c7f4
Merge pull request #641 from pimoroni/cosmic
Cosmic
2023-02-21 13:18:26 +00:00
Phil Howard 2176e0feb1 MicroPython: Avoid some duplication in CMake files. 2023-02-21 12:52:47 +00:00
Phil Howard fc37ef100d Cosmic Unicorn: Tidy up audio feature test a little. 2023-02-21 12:52:47 +00:00
Phil Howard a09fde770f Cosmic Unicorn: Fix feature test for #661. 2023-02-21 12:52:47 +00:00
Phil Howard 6c0c45d6c8 Cosmic Unicorn: Fast, numpy effect examples. 2023-02-21 12:52:46 +00:00
Phil Howard f4b0434229 PicoGraphics: Add create_pen_hsv to p4, p8 and rgb332 pens. 2023-02-21 12:52:46 +00:00
Phil Howard bbeac41785 Cosmic Unicorn: Implement RGB888 frame convert. 2023-02-21 12:52:46 +00:00
Phil Howard aa9c5b6538 Cosmic Unicorn: Add P4 and P8 support. 2023-02-21 12:52:46 +00:00
Phil Howard ff3efc0d28 Cosmic Unicorn: Include ulab. 2023-02-21 12:52:46 +00:00
Phil Howard 72ad4dcc47 Cosmic Unicorn: Optimise buffer flip. 2023-02-21 12:52:46 +00:00
Phil Howard 1b2dae45d3 Cosmic Unicorn: Add config and workflow for .uf2. 2023-02-21 12:52:46 +00:00
Gee Bartlett 53162737a1 Cosmic Unicorn: MicroPython Examples.
updating demos

other demos

Update rainbow.py

linting fixes

Faster flames
2023-02-21 12:52:46 +00:00
Gee Bartlett 9bc616690e Cosmic Unicorn: MicroPython bindings.
started on MP driver

removed duplacte audio_i2s.pio

disabled GU lib options

bug fixes

bringing Picographics into line

Update picographics.cpp

fixing naming Cosmic to cosmic fixed H and W
2023-02-21 12:52:44 +00:00
lowfatcode c3672d7e3d Cosmic Unicorn: Driver and C++ examples. 2023-02-21 12:50:48 +00:00
Philip Howard 93ac854672
Merge pull request #663 from pimoroni/feature/inky73
Support for Inky Frame 7.3" (using direct pen into PSRAM framebuffer)
2023-02-21 12:48:56 +00:00
Hel Gibbons f06d7c2e83
Merge pull request #673 from Zoobdude/main
Update to Badger 2040 W getting started
2023-02-21 09:44:04 +00:00
Zoobdude ae908c6075
Update README.md 2023-02-20 19:50:01 +00:00
Philip Howard 1b87ec8bd8
Merge pull request #648 from pimoroni/patch/interstate-examples
Few more Interstate examples
2023-02-20 12:39:07 +00:00
Phil Howard ab488a4452 Fixup: Add pins.csv files to W builds. 2023-02-20 12:29:59 +00:00
Phil Howard 00988c6207 Inky: Add urllib.urequest to manifest.py. 2023-02-20 12:29:59 +00:00
Phil Howard b0c25a57a2 Inky 7.3: Add LEDs to Python module. 2023-02-20 12:29:59 +00:00
Phil Howard 776383c111 Inky 7.3: Add ordered dither support. 2023-02-20 12:29:59 +00:00
Phil Howard 88e50891d1 Inky 7.3: Add to PicoGraphics. 2023-02-20 12:29:59 +00:00
Phil Howard 4928ceff8d Inky 7.3: Add pen type to JPEGDEC. 2023-02-20 12:29:59 +00:00
Phil Howard 1659139c97 Inky 7.3: Rename class. 2023-02-20 12:29:59 +00:00
Phil Howard 43382ba2c0 Inky 7.3: Add ShiftRegister driver. 2023-02-20 12:29:59 +00:00
Phil Howard 93979cb735 Inky 7.3: Rename driver to inky73. 2023-02-20 12:29:59 +00:00
AndrewCapon 0067b101a0 Inky 7.3: Direct pen & PSRAM update. 2023-02-20 12:29:52 +00:00
Philip Howard b810ffdfdb
Merge pull request #672 from pimoroni/patch-bump-micropython-pico-sdk-1.5.0
CI: Bump MicroPython to latest commit post Pico SDK 1.5.0 bump.
2023-02-20 12:14:34 +00:00
Phil Howard d34171381c MicroPython: Update fixups for v1.5.0. 2023-02-20 12:00:23 +00:00
Hel Gibbons 68411ba6ec
Merge pull request #671 from pimoroni/docs/tidyup
some minor docs tidying
2023-02-20 11:44:45 +00:00
Hel Gibbons de48394764 port GFX pack examples 2023-02-20 11:01:34 +00:00
Hel Gibbons 259bad7ce8 Update placekitten.py 2023-02-20 11:01:34 +00:00
Hel Gibbons 740aa14cac Add I75 placekitten example 2023-02-20 11:01:34 +00:00
Phil Howard fd2f285f16 CI: Bump MicroPython to latest commit post Pico SDK 1.5.0 bump. 2023-02-20 10:56:39 +00:00
Hel Gibbons fa275e6919 update examples readme 2023-02-17 16:47:08 +00:00
Hel Gibbons dc121aa4f1 add badger w examples readme 2023-02-17 16:43:27 +00:00
Hel Gibbons ed021665e6 update MicroPython readmes 2023-02-17 15:56:29 +00:00
Philip Howard 3bc0f019b2
Merge pull request #670 from pimoroni/patch-badger-2040w-release-uf2
CI: Upload Badger 2040 W examples .uf2 to release files.
2023-02-16 15:56:49 +00:00
Phil Howard 25efb91eae CI: Upload Badger 2040 W examples .uf2 to release files. 2023-02-16 15:42:08 +00:00
ZodiusInfuser 943ea1390a
Merge pull request #633 from pimoroni/feature/badger2040w
Badger2040w support
2023-02-16 10:43:25 +00:00
ZodiusInfuser 5a62a79a93 Renamed thick_line 2023-02-16 10:28:07 +00:00
helgibbons 2bdb05ce68 fix a couple of typos 2023-02-15 11:18:45 +00:00
Brian Corteil 47a8373bbb Create cheerlights.py
Updated to use the Pimoroni standard Wi-Fi method to be inline with other examples and rename filed to cheerlights.py so can be import from REPL
2023-02-14 23:07:35 +00:00
Hel Gibbons 8a420ca0e4 update qrcode.py with badger w details 2023-02-14 15:21:46 +00:00
Hel Gibbons 9bba17cc47 add missing .py 2023-02-13 17:39:13 +00:00
Philip Howard 05391d27cd
Merge pull request #668 from LionsPhil/menuredo
Rewrite the Tufty2040 main menu somewhat
2023-02-13 15:24:11 +00:00
Phil Howard cb82878cd2 Badger2040W: Add README.md for MicroPython. 2023-02-13 13:41:56 +00:00
LionsPhil 033157503b Rewrite the Tufty2040 main menu somewhat
Primarily motivated to get almost everything out of globals and fix
issue #631. This is a stripped-down version of the gist there without
the memory debugging and reboot-into-direct-boot mode.

Mostly move things to functions. Clean up some dead code and comments.
I think the biggest win is not actually the PicoGraphics framebuffer,
which is well-behaved, but random temporary floats that were leaking
previously.

Also type-annotated and lints clean.

Fixes #631. (As much as I think is possible.)
2023-02-12 12:33:28 +00:00
Phil Howard 2952fd760e Badger2040W: Fix news text wrapping and URLs. 2023-02-10 22:15:09 +00:00
Phil Howard 0410b7c775 Badger2040W: Add thickness back. Better error backdrop. 2023-02-10 22:15:09 +00:00
Phil Howard 3f0efa9765 Badger2040W/CI: Bump MicroPython to 35524a6. 2023-02-10 22:15:09 +00:00
Phil Howard d7b9881c0f Badger2040W: Add pins.csv to board fixup. 2023-02-10 22:15:09 +00:00
Phil Howard a275f31c7a Badger2040W: (Try to) fix abrupt poweroff screen corruption. 2023-02-10 22:15:09 +00:00
Phil Howard 3a2a43f4b3 Badger2040W: Correct wakeup LED. 2023-02-10 22:15:09 +00:00
Phil Howard cbcd9edd9a Badger2040W: Fix wakeup and quit to launcher button handling. 2023-02-10 22:15:09 +00:00
Mike Bell 26eeb2b042 Badger2040W: Use partial update for seconds on clock 2023-02-10 22:15:09 +00:00
Phil Howard 2109d7fb37 Badger2040W: Move weather icons from examples dir to icons/. 2023-02-10 22:15:09 +00:00
Phil Howard 9ea196adb1 Badger2040W: Tidyup icons, crop to 52x52. 2023-02-10 22:15:09 +00:00
Phil Howard a70ce8a4a6 Badger2040W: Call wrapped-update in lib. 2023-02-10 22:15:09 +00:00
Phil Howard 16e99a5a89 Badger2040W: Bump MicroPython to 67fac4e. 2023-02-10 22:15:09 +00:00
Hel Gibbons d4273ebbcb Badger2040W: Add weather example and icons. 2023-02-10 22:15:09 +00:00
Phil Howard 7a2ffccf16 Badger2040W: Simplify clock, time is set via NTP. 2023-02-10 22:15:09 +00:00
Phil Howard 548e1fdbdb Badger2040: Add image path to badge.txt. 2023-02-10 22:15:09 +00:00
Phil Howard b5fb62c8f6 Badger2040W: Fix noise in icon files. 2023-02-10 22:15:09 +00:00
Phil Howard c56844ae69 Badger2040W: Fix clock network check. 2023-02-10 22:15:09 +00:00
Phil Howard c3ad87765d PicoGraphics: Extremely cursed thickness support for 1bit pens.
Experimental. There must be less cursed way to do this.
2023-02-10 22:15:07 +00:00
thirdr 6e44434e7d fixed quit to launcher 2023-02-10 22:12:02 +00:00
Phil Howard de8ed26460 Badger2040W: Force wait for screen refresh finish. 2023-02-10 22:12:02 +00:00
Phil Howard 6349d45768 Badger2040W: Remove BUTTON_USER since it doesn't exist. 2023-02-10 22:12:02 +00:00
Phil Howard d8f9b81eca Badger2040W: Port ebook example. 2023-02-10 22:12:02 +00:00
Phil Howard 23f792caa9 Badger2040W: Finish core libs, add Badge. 2023-02-10 22:12:02 +00:00
thirdr 379a1cb3ef Badger2040W: New examples. 2023-02-10 22:12:02 +00:00
Phil Howard 6526787772 Badger2040W: Drop turbo clock from launcher. 2023-02-10 22:12:02 +00:00
Phil Howard 15dabdba1f Badger2040W: Fix very slow and very wrong __getattr__. 2023-02-10 22:12:02 +00:00
Phil Howard a02834be9e Badger2040: Port more examples. 2023-02-10 22:12:02 +00:00
Phil Howard f82e21018f Badger2040W: Remove font sizes from launcher.py. 2023-02-10 22:12:02 +00:00
Phil Howard 1dbc992180 Badger2040W: Fixes to launcher and badger libs. 2023-02-10 22:12:02 +00:00
Phil Howard 03d5224e3e Badger2040W: Use correct MicroPython manifest.py. 2023-02-10 22:12:02 +00:00
Phil Howard d1646e5d76 CI: Badger2040W: Fix deprecation warnings. 2023-02-10 22:12:02 +00:00
Phil Howard e859b39e11 Badger2040W: Fix linting, use micropython-lib urllib. 2023-02-10 22:12:02 +00:00
Phil Howard 2b3b1e4676 Badger2040W: Fix (blank line in) .uf2 manifest. 2023-02-10 22:12:02 +00:00
Phil Howard 984dbd5185 Badger2040W: Switch launcher to jpegdec, reorganise files. 2023-02-10 22:12:02 +00:00
Phil Howard 9bd29e0ef2 JPEGDEC: Fix iWidthUsed skip not advancing pixel pointer. 2023-02-10 22:12:02 +00:00
Phil Howard 81d9b2ab81 Badger2040W: Add examples and libs. 2023-02-10 22:12:02 +00:00
Phil Howard ac2da23c96 Badger2040W: Append filesystem. 2023-02-10 22:12:02 +00:00
Phil Howard c70043922a Badger2040W: Switch to PicoGraphics. 2023-02-10 22:12:02 +00:00
Phil Howard 21b4ff68d7 Change __bswap16 to __builtin_bswap16. 2023-02-10 22:12:02 +00:00
Phil Howard 6ea105bb03 MicroPython: Switch Badger2040 to m_new_class. 2023-02-10 22:12:02 +00:00
Phil Howard d25324d6c7 MicroPython: Add Badger2040W firmware build. 2023-02-10 22:12:02 +00:00
Philip Howard de8cb95ab4
Merge pull request #660 from pimoroni/patch/hub75_color_order
Add support to Interstate / HUB 75 for panels with different color orders
2023-02-10 21:43:28 +00:00
Philip Howard 5e135b8901
Merge pull request #667 from pimoroni/patch-pimoroni-pico-version
CI: Generate version.py for #664.
2023-02-10 21:36:02 +00:00
Phil Howard 1fc00ac5af CI: Generate version.py for #664. 2023-02-10 21:12:56 +00:00
Philip Howard 029b697cb1
Merge pull request #666 from MichaelBell/galactic-ghost-buster
Fix ghosting on the Galactic Unicorn
2023-02-10 19:59:04 +00:00
Mike Bell 3371b6c751 Select new row earlier to avoid lighting pixel on previous row very slightly 2023-02-10 10:36:56 +00:00
Philip Howard c4decc5003
PicoGraphics: HSV Pen (#665)
Co-authored-by: Gee Bartlett <122281230+ageeandakeyboard@users.noreply.github.com>
2023-02-09 16:13:37 +00:00
Philip Howard cd2f45dee4
Merge pull request #659 from ahnlak/unicorn-rgb332pen-fix
Added PEN_RGB332 support
2023-02-07 15:18:40 +00:00
Simon Shirley cd95edc707 Refactor: Attempt to fix Python linting 2023-01-31 19:49:51 +00:00
ZodiusInfuser cacfbd174b Previous idea did not work, so now checking color order for every pixel set 2023-01-31 14:07:14 +00:00
ZodiusInfuser eda6e996ce Updated interstate module 2023-01-31 13:11:50 +00:00
ZodiusInfuser 1343f23316 Attempt at adding color order support to Hub75 2023-01-31 13:00:22 +00:00
Pete Favelle d84d9f4520 Added PEN_RGB332 support 2023-01-31 12:57:35 +00:00
Simon Shirley 9aedf16bb5 Free up file resources once text has been read 2023-01-30 17:36:08 +00:00
Simon Shirley 77ee234caa Only create and show demo QR code if no other QR codes are available 2023-01-30 17:35:49 +00:00
Simon Shirley eb7eaae885 Fixes 'list index out of range' if current_qr state is outside CODES range 2023-01-30 17:35:20 +00:00
Philip Howard 884722de50
Merge pull request #649 from pimoroni/patch-bump-micropython
CI: Bump MicroPython to 67fac4e.
2023-01-27 11:19:28 +00:00
Philip Howard d52fe23d81
Merge pull request #651 from pimoroni/patch-ci-pico-w
CI: CMake build for Pico W and Pico.
2023-01-27 10:06:49 +00:00
Phil Howard b548d67609 C++: Don't assume PICO_DEFAULT_LED_PIN is defined. 2023-01-27 09:54:28 +00:00
Phil Howard 2d28880529 CI: CMake build for Pico W and Pico. 2023-01-27 09:54:24 +00:00
Phil Howard 9bf6bdde06 CI: Bump MicroPython to 67fac4e. 2023-01-25 12:13:26 +00:00
Philip Howard 397ef786a9
Merge pull request #640 from pimoroni/patch-plasma-make-new
Plasma: Swap make_new/print functions for WS2812 module.
2023-01-19 15:46:35 +00:00
Hel Gibbons db5004d51c
Merge pull request #639 from pimoroni/docs/add-links
Update docs and add links
2023-01-19 14:45:59 +00:00
Phil Howard 6bf5c7f7b5 Plasma: Swap make_new/print functions for WS2812 module.
Fixes #637
2023-01-19 10:29:30 +00:00
Hel Gibbons 7a6857b371 add links 2023-01-18 17:27:35 +00:00
Hel Gibbons 1ece897490 add link 2023-01-18 17:11:06 +00:00
Hel Gibbons 9aa2e33d46 PicoGraphics documentation tweaks 2023-01-18 16:59:05 +00:00
Hel Gibbons 92d58a17c0 Picographics documentation tweaks 2023-01-18 16:56:08 +00:00
Hel Gibbons d2da1c6213 add link 2023-01-18 16:32:08 +00:00
Hel Gibbons b3edbc47d0
Merge pull request #638 from pimoroni/patch/bytes-not-kilobytes
Correct RAM units
2023-01-18 15:50:31 +00:00
Hel Gibbons 914a4b345c
Correct RAM units 2023-01-18 15:41:33 +00:00
Philip Howard 39c4848bcc
Merge pull request #636 from pimoroni/gadgetoid-patch-readme-ci-status
Update CI status badges on README.md
2023-01-17 14:35:19 +00:00
Philip Howard cb5ad29ee1
Update CI status badges on README.md
Implement change described here: https://github.com/badges/shields/issues/8671
2023-01-17 11:18:53 +00:00
Philip Howard 63fc338ca6
Merge pull request #625 from pimoroni/patch/bme68x-configure-fix
Fix BME68x configure function
2023-01-16 15:01:11 +00:00
Philip Howard c98d0daaf4
Merge pull request #626 from pimoroni/patch/inky-launcher-57-update
Patch/inky launcher 57 update
2023-01-16 14:16:14 +00:00
thirdr 50b456d42f Switched to built in module for ntp 2023-01-11 14:13:01 +00:00
Philip Howard 62d46210a3
Merge pull request #515 from pimoroni/micropython/mp_obj_type_t_upgrade
MicroPython: Update to support new slots mp_obj_type_t.
2023-01-11 13:14:38 +00:00
Phil Howard 0709878cec MicroPython: Bump ulab.
Bump up to the tip of master for the latest fixes.

Need to switch this to targeting a release when one's available with the mp_obj_type_t fix.
2023-01-11 12:25:28 +00:00
thirdr e0d578bd07 Adjusted error message layout and wording 2023-01-11 09:49:31 +00:00
Phil Howard 828ff8453d Inky: Switch to mip, add nptime. 2023-01-11 09:46:45 +00:00
Phil Howard c46320656d MicroPython: Bump to 699477d. 2023-01-11 09:46:45 +00:00
Phil Howard 0e1b37d36a MicroPython: Bump to bb77c1d. 2023-01-11 09:46:45 +00:00
Phil Howard c7bdf4a3cc MicroPython: Bump to d1ed0f1. 2023-01-11 09:46:45 +00:00
Phil Howard fb6fdcc115 MicroPython: Update GU to MP_DEFINE_CONST_OBJ_TYPE. 2023-01-11 09:46:45 +00:00
Phil Howard c42679b355 MicroPython: Bump Pico and Badger to MicroPython eefd946. 2023-01-11 09:46:45 +00:00
Phil Howard 9bf1583787 MicroPython: Change machine_hw_i2c_type to machine_i2c_type. 2023-01-11 09:46:45 +00:00
Phil Howard 04888da334 MicroPython: Bump PicoW to eefd946. 2023-01-11 09:46:45 +00:00
Phil Howard ff5dc0078f Enviro: Switch upip to mip, add ntptime. 2023-01-11 09:46:45 +00:00
Phil Howard 8b1bd814e5 MicroPython: Switch QRCode back to feature/micropython with fix. 2023-01-11 09:46:45 +00:00
Phil Howard 5f94ee7acc CI: Bump ulab to latest commit. 2023-01-11 09:46:45 +00:00
Phil Howard a4a5b58d93 CI: Bump MicroPython Pico W to latest upstream commit. 2023-01-11 09:46:45 +00:00
Phil Howard 5b3f84ebf0 MicroPython: TEST: Switch QRCode to fixed branch. 2023-01-11 09:46:45 +00:00
Phil Howard 77a5edc83f MicroPython: Update to support new slots mp_obj_type_t.
Follows the lead from: 662b9761b3

Update to support MP_DEFINE_CONST_OBJ_TYPE with backwards compatibility.
2023-01-11 09:46:45 +00:00
Phil Howard a29ce1e180 MicroPython: Rewrite Enviro manifest.py to new style. 2023-01-11 09:46:45 +00:00
Phil Howard a612e66779 MicroPython: Use MPY_LIB_DIR unconditionally.
We can always rely on the micropython-lib dir (now a submodule) being present.

See: da7f2537a1
2023-01-11 09:46:45 +00:00
Phil Howard b041b546e6 MicroPython: Bump PicoW to 4903e48. 2023-01-11 09:46:45 +00:00
Hel Gibbons 84cd34b24f
Merge pull request #627 from pimoroni/helgibbons-patch-1
add link
2023-01-10 16:32:18 +00:00
Hel Gibbons 80c93e7067
add link 2023-01-10 16:19:55 +00:00
Hel Gibbons 45014853e6 update example to match docs 2023-01-10 14:29:02 +00:00
Hel Gibbons 1e1d8bf4f5
Fix bme68x configure 2023-01-09 15:07:06 +00:00
ZodiusInfuser d432948a4c
Merge pull request #621 from pimoroni/patch/inventor_typo_fix
Fixed typo with inventor examples
2023-01-09 13:28:05 +00:00
thirdr 97f2232e07 changed title colours 2023-01-05 14:56:16 +00:00
thirdr 14af0fd646 changed default news feed 2023-01-05 14:51:39 +00:00
thirdr 3a2e212e36 Updated with Inky Frame 5.7 support 2023-01-05 13:27:47 +00:00
ZodiusInfuser b4d1c42669 Fixed typo with inventor examples 2023-01-05 12:01:59 +00:00
Philip Howard 955f4e57a4
Merge pull request #609 from pimoroni/patch-usbfix
usb-fix for Inky Frame Launcher
2022-12-21 16:37:57 +00:00
thirdr f4ab44489c increased delay for USB init 2022-12-21 12:07:23 +00:00
Philip Howard f4a86fb5e5
Merge pull request #608 from pimoroni/patch/inkylauncher
Launcher + Examples for Inky Frame
2022-12-20 19:49:16 +00:00
thirdr 1c03a48e19 fixed incorrect capitalisation 2022-12-20 19:37:22 +00:00
ZodiusInfuser 4c0a34769d Added LED for when app draws, and delay at start to fix USB issue 2022-12-20 19:37:22 +00:00
thirdr 417f5d9210 centred text 2022-12-20 19:37:22 +00:00
thirdr 192625956b linting fix 2022-12-20 19:37:22 +00:00
thirdr e2e4687f0c added LED indicator for display refresh on launcher 2022-12-20 19:37:22 +00:00
thirdr daf2770d28 updated button LEDs 2022-12-20 19:37:22 +00:00
thirdr 16e8e0bcd4 added instructions to launcher 2022-12-20 19:37:22 +00:00
thirdr da52a1ab92 Changed button combo for esc to launcher 2022-12-20 19:37:22 +00:00
thirdr a11d2b6fc0 added colour and layout changes to the launcher 2022-12-20 19:37:22 +00:00
thirdr 5a89f5be97 sensible update intervals 2022-12-20 19:37:22 +00:00
thirdr 3a3b82889d udpated error msg 2022-12-20 19:37:22 +00:00
thirdr be39aafd2d fixed a typo 2022-12-20 19:37:22 +00:00
ZodiusInfuser 4273e9743e Linting fix 2022-12-20 19:37:22 +00:00
thirdr 1c88dcca40 consistent error messages across apps 2022-12-20 19:37:22 +00:00
thirdr 3749f19756 changed esc to launcher key combo 2022-12-20 19:37:22 +00:00
thirdr db4473ff5e adjusted grid layout 2022-12-20 19:37:22 +00:00
thirdr 227317f4fb added UPDATE_INTERVAL 2022-12-20 19:37:22 +00:00
ZodiusInfuser 3bf10632c2 Upload of inkylauncher example 2022-12-20 19:37:22 +00:00
Philip Howard a46a53a709
Merge pull request #605 from pimoroni/patch/inky_build
Inky Frame Build
2022-12-20 19:35:45 +00:00
ZodiusInfuser 944830f616 Inky Frame: Enable Wakeup RTC, don't meddle with SR config. 2022-12-20 13:54:14 +00:00
Phil Howard 940b31bab1 Inky Frame: Add LED on/off methods to SR button class. 2022-12-20 13:46:02 +00:00
Phil Howard e5bfe76970 Inky Frame: Return latched SR state in read() regardless of debounce. 2022-12-20 13:46:02 +00:00
Phil Howard 2ea5de97df Inky Frame: reset latched SR state after read. 2022-12-20 13:46:02 +00:00
Phil Howard 5251baf764 Wakeup: Add method to reset latched SR state. 2022-12-20 13:46:02 +00:00
Phil Howard f1e9e00cd5 Inky Frame: Add wakeup SR to lib, fix wakeup bug. 2022-12-20 13:46:02 +00:00
Phil Howard ba100ae069 Wakeup: Disable RTC & enable SR for Inky, always include shift function.
Due to quirks with how QSTRs are passed, conditionally including a function is difficult.

Instead, always include "get_shift_state" but throw a RuntimeError if its use is invalid (no shift register).
2022-12-20 13:46:02 +00:00
ZodiusInfuser 05d26aeecb Wakeup: Add shift register support. 2022-12-20 13:46:02 +00:00
ZodiusInfuser 43ef76b945 CI: Add build for Inky Frame. 2022-12-20 13:46:02 +00:00
Philip Howard 6f74017894
Merge pull request #606 from Daft-Freak/actions-update
Update actions for deprecation warnings
2022-12-19 15:26:51 +00:00
Charlie Birks 52164a1c34 Update actions for deprecation warnings 2022-12-19 12:54:16 +00:00
Philip Howard fe55d9beef
Merge pull request #569 from pimoroni/patch-inky-frame-buttons
MicroPython: Create inky_frame module for buttons.
2022-12-16 22:05:20 +00:00
Philip Howard 3891eef94f
Merge pull request #388 from thinkofher/fetch-from-git
Fetch pimoroni-pico SDK from git repository
2022-12-16 21:45:49 +00:00
Philip Howard 5a2a62b471
Merge pull request #602 from housten/patch-1
Correct badge picture dimensions
2022-12-16 21:04:13 +00:00
Philip Howard ec0077ae71
Merge pull request #603 from ahnlak/unicorn-volume-fix
Unicorn volume fix
2022-12-16 21:03:04 +00:00
Philip Howard 930784df08
Merge pull request #600 from pimoroni/patch-jpegdec-rgb888
JPEGDEC/PicoGraphics: Add support for RGB888 target.
2022-12-16 20:53:55 +00:00
Gee Bartlett 104c819412
Hub75: Update to use Picographics (#601)
* have a basic pg working needs optimizing

* working well ported some examples from GU

* started on micropython module

* Fixes to get new Hub75 compiling in MP

* stripped down for faster compilling

* Update hub75.cmake

* added hub75 to galatic and eviro as it is needed for picographics

* Update picographics.c

* added hu75 update

* added _ModPicoGraphics_obj_t

* Update hub75.cpp

* update bindings

* some examples needs linting

* added other panel sizes and linted

* Update picographics.cpp

* Update picographics.c

* fixing gc memory allocation

* Update hub75.cpp

* Update interstate75_balls_demo.cpp

* review

* broke

* working with built in panel defs

* still borked

* not much change needs review

* Update hub75.cpp

* reverted alot of things

* adding i75 lib

* lots of updates ready to test compile mp

* Update picographics.h

* little tweaks

* an inability to count fixed!

* fixed some readme's

* lots of tiding

* fixed linting and removed experimental code

* Minor formatting

* Minor formatting and cmake tidy

* Removed unneeded parts of examples

* Final tidy

* tidy examples and adding more

* updated to new library

* documentation tweaks

* fixed inclusion of interstate75 module

* syncing some stuff

* fixed linting

Co-authored-by: ZodiusInfuser <christopher.parrott2@gmail.com>
2022-12-16 20:53:16 +00:00
Phil Howard 13414b5037 JPEGDEC: Clip drawing to iWidthUsed.
Corrects clipping width using new iWidthUsed value, noticable particularly on smaller jpegs and those that aren't a multiple of the MCU sized.

Fixes #573
2022-12-14 18:42:03 +00:00
housten 28b53f174e
Correct badge picture dimensions
Using 108 resulted in a 'smeared' image because the image width is wrong for the result. 
Check the [getting started guide](https://learn.pimoroni.com/article/getting-started-with-badger-2040) where it says 104x128 for badge picture
2022-12-14 17:35:15 +01:00
Hel Gibbons a9d9c1089e
Merge pull request #599 from pimoroni/helgibbons-patch-1
Use http instead of https to avoid memory errors
2022-12-14 10:02:13 +00:00
Phil Howard 241e725464 JPEGDEC: Sync with upstream.
Adds setUserPointer and pDraw->pUser which we now use to store a pointer to the PicoGraphics instance.
2022-12-13 14:21:57 +00:00
Phil Howard e0a1627fba JPEGDEC/PicoGraphics: Add support for RGB888 target.
Fixes https://github.com/pimoroni/pimoroni-pico/issues/573
2022-12-13 14:03:30 +00:00
Hel Gibbons d5e1a2d8a0 make sure socket is closed 2022-12-13 13:52:51 +00:00
Hel Gibbons 50b8e2ef90
Use http instead of https to avoid memory errors 2022-12-13 12:50:13 +00:00
Pete Favelle b81c43f479 Removed const from picosynth volume 2022-12-08 17:19:35 +00:00
Pete Favelle 875119da70 Adjust PicoSynth volume when setting it in the Galactic Unicorn API 2022-12-08 17:07:07 +00:00
Hel Gibbons b1e8ed0864
Merge pull request #592 from pimoroni/hel-festive-plasma-stick
Add festive Plasma Stick examples
2022-12-02 15:39:23 +00:00
helgibbons a62c3f0e20 update readme 2022-12-01 17:49:53 +00:00
helgibbons 95252f2de5 update readme 2022-12-01 17:46:48 +00:00
helgibbons 7ac2a285d8 fix typo 2022-12-01 17:11:44 +00:00
helgibbons 7555ac97fd linting 2022-11-29 18:22:53 +00:00
helgibbons 3b0317b118 update readme 2022-11-29 18:18:33 +00:00
helgibbons 963702a6e5 add pulse example 2022-11-29 18:11:42 +00:00
helgibbons d612f4b4dc add festive examples 2022-11-29 18:08:15 +00:00
Hel Gibbons 993609342e
Merge pull request #585 from pimoroni/hel-fix-graph
correct sine wave in calc.py
2022-11-23 16:46:52 +00:00
helgibbons be76ec01af add readme links 2022-11-23 16:20:58 +00:00
helgibbons 96aa82fcb1 improve maths 2022-11-22 11:54:39 +00:00
Gee Bartlett 7b127d5f19
Driver/st7567 (#581)
Add ST7567/Pico GFX examples
2022-11-18 14:30:22 +00:00
Hel Gibbons 62303b6912
Merge pull request #577 from ahpook/led-pulse
Badger2040: Make the LED example pulse instead of strobe
2022-11-18 09:23:13 +00:00
Eric Sorenson 2b7a77e110 Badger2040: Make the LED example pulse instead of strobe
This makes a slightly nicer example as the LED goes gently
from off to on and back down again instead of strobing.
2022-11-17 10:47:31 -08:00
Hel Gibbons 4b3d39bf44
Merge pull request #568 from pimoroni/hel-gfx-pack
GFX pack examples and docs tweaks
2022-11-16 16:13:15 +00:00
helgibbons 6eb62b1a67 fix I2C constants 2022-11-16 14:12:12 +00:00
helgibbons 660fcea744 add community links 2022-11-15 14:26:57 +00:00
Hel Gibbons 40945c4cee correct i2c constants 2022-11-14 13:01:33 +00:00
Phil Howard 36401e174e MicroPython: Create inky_frame module for buttons. 2022-11-09 13:34:30 +00:00
helgibbons 8bee978d0b add GFX Pack link to readme 2022-11-09 13:19:53 +00:00
helgibbons e3496efda0 a few doc fixes 2022-11-09 13:16:29 +00:00
helgibbons 59ed91c755 add GFX Pack examples readme 2022-11-09 13:02:28 +00:00
helgibbons ff2bb4f026 fix typo in inventor example 2022-11-09 10:20:53 +00:00
Hel Gibbons 6ebf1a97f8
Merge pull request #565 from johnmccabe/fix-typos
Fix typo galactic_unicorn feature_test_with_audio.py
2022-11-09 09:51:00 +00:00
helgibbons 4f8eb8fd20 linting co2 example 2022-11-09 09:37:21 +00:00
John McCabe e2d330e9c9
Fix typo galactic_unicorn feature_test_with_audio.py
Fixes a minor typo, SWITCH_BRIGHTNESS_DOWN text should be Lower not Power.
2022-11-09 00:23:04 +00:00
helgibbons 22774b88c7 add co2 example 2022-11-08 19:38:03 +00:00
helgibbons 78baea7ef5 add button example 2022-11-08 14:20:32 +00:00
Hel Gibbons be1c39e80c
Merge pull request #555 from MichaelBell/fix-ltp305-brightness
Fix setting the LTP305 brightness
2022-11-08 11:26:45 +00:00
Hel Gibbons 55821d2896
Merge pull request #561 from pimoroni/driver/st7567
Driver/st7567
2022-11-08 11:24:36 +00:00
ZodiusInfuser f1d9ec7c61
Merge branch 'main' into driver/st7567 2022-11-08 11:17:24 +00:00
ZodiusInfuser 23f56f05e4 Minor readme tweaks 2022-11-08 11:10:51 +00:00
Gee Bartlett 4f4b0b277c updated readme's 2022-11-07 18:07:48 +00:00
ZodiusInfuser 91a2e7f5fb Fixed typos 2022-11-07 16:11:05 +00:00
Hel Gibbons 31ecfef156 Merge branch 'driver/st7567' of https://github.com/pimoroni/pimoroni-pico into driver/st7567 2022-11-07 15:38:52 +00:00
Hel Gibbons 98e29e07fb add dancing 2022-11-07 15:38:44 +00:00
Gee Bartlett cf88add1ad Merge branch 'driver/st7567' of https://github.com/pimoroni/pimoroni-pico into driver/st7567 2022-11-07 14:23:43 +00:00
Gee Bartlett 7a458f32e4 Update gfx_pack.md 2022-11-07 14:23:20 +00:00
Hel Gibbons 065b55b6af add rainbow example 2022-11-07 14:20:12 +00:00
Gee Bartlett b3893d0052 couple of minor fixes 2022-11-07 13:43:53 +00:00
ZodiusInfuser 678b8d7cf9 Review of GfxPack code 2022-11-07 12:50:50 +00:00
Gee Bartlett f3f260e176 finish docs and cmake gfx module 2022-11-04 17:23:30 +00:00
Hel Gibbons df881f12aa
Merge pull request #559 from pimoroni/hel-galactic-tidy
Tidy Galactic Unicorn docs
2022-11-04 11:34:07 +00:00
ZodiusInfuser 64b1a8c2d5
Additions to PicoGraphics readme for GU 2022-11-04 11:27:56 +00:00
ZodiusInfuser 408d105e8b
Link fixes 2022-11-04 11:13:57 +00:00
ZodiusInfuser 3765d43ce0
Link fixes 2022-11-04 11:12:20 +00:00
ZodiusInfuser c247770f48
Updated example descriptions 2022-11-04 10:57:53 +00:00
ZodiusInfuser d11c73d45e
Updated GU readme 2022-11-04 10:57:37 +00:00
Gee Bartlett 61a80ce66e fixed some linting errors 2022-11-04 10:28:26 +00:00
Gee Bartlett eef9334805 gxf module and examples done 2022-11-04 10:21:27 +00:00
Gee Bartlett 78101c47b5 linting demo 2022-11-03 17:33:58 +00:00
Hel Gibbons c2b695f7e9 remove unused variable 2022-11-03 16:44:36 +00:00
Hel Gibbons 4319570960 update function reference 2022-11-03 15:57:59 +00:00
Hel Gibbons 0e80e1d96a update examples readme 2022-11-03 15:48:21 +00:00
Hel Gibbons 6d98cec7de update examples readme 2022-11-03 15:44:43 +00:00
Hel Gibbons 080da22b5f update readme 2022-11-03 15:42:45 +00:00
Hel Gibbons 91505c2976 update examples readme 2022-11-03 15:31:21 +00:00
Hel Gibbons c599ae4941 update examples readme 2022-11-03 15:20:28 +00:00
Hel Gibbons 0f5e96495c add cheerlights history example 2022-11-03 14:16:05 +00:00
Gee Bartlett 9085c48a62 mp working 2022-11-03 13:30:07 +00:00
Gee Bartlett 7be5376abf some small fixes for easier merging later 2022-11-02 20:58:20 +00:00
Gee Bartlett 952be145ec Merge branch 'main' into driver/st7567 2022-11-02 20:50:18 +00:00
Gee Bartlett 79eb998183 adjustments prior to micropython 2022-11-02 20:43:07 +00:00
helgibbons 347cd19ab9 update GU readmes 2022-11-02 16:58:18 +00:00
helgibbons 689326ac55 update function reference 2022-11-02 14:56:08 +00:00
helgibbons cac74a94bb update function reference 2022-11-02 13:47:41 +00:00
helgibbons 79a2349fac update micropython function reference 2022-11-02 13:45:14 +00:00
helgibbons 738531ebcf add micropython function reference 2022-11-02 12:51:45 +00:00
Hel Gibbons f592d2cd4d
Merge pull request #558 from pimoroni/main
pull GU function reference
2022-11-02 09:28:49 +00:00
lowfatcode 92a48d20ae
Merge pull request #557 from pimoroni/galactic_documentation
Added Galactic Unicorn function reference and example
2022-11-02 07:41:14 +00:00
lowfatcode b0e194b2b1 Added Galactic Unicorn function reference and example 2022-11-02 07:35:37 +00:00
Brian Corteil 4082d99186 Update cheer-lights.py
corrected formatting,
2022-11-01 20:19:12 +00:00
helgibbons 987f98f7ca update readme 2022-11-01 16:53:47 +00:00
Brian Corteil 263c61c21a
Update secrets.py
Add new line to line 2
2022-10-31 20:00:20 +00:00
Gee Bartlett e85367a961 started mp 2022-10-31 13:44:23 +00:00
Hel Gibbons 9014c49ae1
Merge pull request #553 from MichaelBell/patch-gu-ntp-clock
Add time synchronization from NTP to GU clock example
2022-10-31 13:08:05 +00:00
Mike Bell b0d7f4c611 Fix setting the LTP305 brightness 2022-10-30 20:29:22 +00:00
Mike Bell f76019f31c Add time synchronization from NTP to GU clock example 2022-10-29 13:02:42 +01:00
Gee Bartlett 982253c416 Update gfx_demo.cpp 2022-10-28 17:57:18 +01:00
Gee Bartlett 9af1081e68 gfx c libs working 2022-10-28 17:54:37 +01:00
Hel Gibbons 69d5afb5c5
Merge pull request #552 from pimoroni/patch/galactic_examples
More Galactic Unicorn Examples
2022-10-28 16:40:59 +01:00
ZodiusInfuser f74261474e Added scroll example and improved clock 2022-10-28 14:33:01 +01:00
ZodiusInfuser 7ee40260c9 Added a basic clock example that uses the Pico's RTC 2022-10-28 13:29:20 +01:00
Hel Gibbons a5079f72f6
Merge pull request #550 from pimoroni/patch/galactic_examples
Added launch software for Galactic Unicorn, and improved other examples
2022-10-27 13:25:06 +01:00
ZodiusInfuser 5a7939e95d Improvements to GU launcher 2022-10-27 13:18:51 +01:00
ZodiusInfuser efba56b8b2 Linting fixes for Galactic 2022-10-27 13:16:39 +01:00
ZodiusInfuser 6e8f2d8a27 Linting fixes for Galactic 2022-10-27 13:11:36 +01:00
ZodiusInfuser 00d7b99589 Added launch software and tweaked other GU examples 2022-10-27 12:51:59 +01:00
Hel Gibbons 8ec96cee93
Merge pull request #547 from pimoroni/helgibbons-patch-1
make function reference consistent
2022-10-26 16:52:37 +01:00
Hel Gibbons 152af1f72f
Update README.md 2022-10-26 16:20:37 +01:00
Hel Gibbons 4e23ade374
Update README.md 2022-10-26 16:10:40 +01:00
Hel Gibbons 9bfa4b70b6
make function reference consistent 2022-10-26 15:53:50 +01:00
Brian Corteil c41b2b2109
secrets.py file added
change name and password to match your network in secrets.py
2022-10-26 00:31:12 +01:00
Brian Corteil b035a1f007 Create cheer-lights.py
CheerLights MicroPython client. You will need the secrets file with your network details, in the same folder as cheerlights.py to run on start rename cheerlights.py to main.py
2022-10-26 00:09:29 +01:00
Hel Gibbons db72276c1b
Merge pull request #544 from pimoroni/helgibbons-patch-1
Add note about LED colour order
2022-10-25 14:36:28 +01:00
Hel Gibbons d9587f06fa
Update README.md 2022-10-25 14:25:55 +01:00
Hel Gibbons f678687735
Update README.md 2022-10-25 14:23:35 +01:00
Hel Gibbons 6a859134cf
Merge pull request #543 from pimoroni/helgibbons-update-picounicorn-readme
Update Pico Unicorn readme
2022-10-24 12:59:49 +01:00
Hel Gibbons bafceb110a
Update Pico Unicorn readme 2022-10-24 12:53:58 +01:00
Hel Gibbons 23e73d043d
Merge pull request #540 from pimoroni/patch/plasma_stick_c_examples
Switched the Plasma Stick colour order and fixed BME280 example
2022-10-21 11:47:00 +01:00
ZodiusInfuser 27bf5549e6 Switched colour ordering for Skully LEDs and fixed BME280 example 2022-10-21 11:32:39 +01:00
Hel Gibbons be95e71049
Merge pull request #539 from pimoroni/micropython-install-instructions
tweak micropython docs
2022-10-20 17:08:01 +01:00
Hel Gibbons 1ab922bb63 update docs 2022-10-20 16:22:07 +01:00
Hel Gibbons 64efea7ab5 update docs 2022-10-20 16:20:21 +01:00
Hel Gibbons 277080d786 add MicroPython FAQ 2022-10-20 16:11:05 +01:00
Hel Gibbons 2dbf28fa9b tweak instructions 2022-10-19 17:36:24 +01:00
Hel Gibbons 7fadbdc156 add toc 2022-10-19 17:31:17 +01:00
Hel Gibbons 21c32cfb34 revamp installing micropython page 2022-10-19 17:22:50 +01:00
Hel Gibbons 11a7be85a9
Merge pull request #538 from pimoroni/hel-plasma-rgb
change default colour order
2022-10-19 16:45:48 +01:00
Hel Gibbons b1f6b00997 change default colour order 2022-10-19 16:31:36 +01:00
Philip Howard e928129d59
Merge pull request #537 from pimoroni/feature/galactic_unicorn
Galactic Unicorn
2022-10-19 14:08:20 +01:00
Philip Howard 3405130820
Merge pull request #536 from pimoroni/hel-plasma
Plasma Stick examples
2022-10-19 10:51:27 +01:00
helgibbons f43293adf4 linting 2022-10-18 15:53:20 +01:00
helgibbons 490d21f7e0 seems ok without gc.collect() 2022-10-18 15:49:59 +01:00
helgibbons 8f2837d930 add a bit of onboard led flashage 2022-10-18 15:17:10 +01:00
helgibbons ce76ff5ea3 update docs 2022-10-18 14:25:02 +01:00
ZodiusInfuser a7dd4b3baf Updated MP examples with plasma_stick defs 2022-10-18 13:13:57 +01:00
ZodiusInfuser 41225090ef Added some C specific examples for Plasma Stick 2022-10-17 16:15:02 +01:00
Phil Howard d736342578 Galactic Unicorn: Paint app. 2022-10-17 16:06:28 +01:00
helgibbons 5d45f9aa06 add error handling 2022-10-13 19:01:02 +01:00
helgibbons e986832414 add spooky rainbows for @guru 2022-10-13 18:15:35 +01:00
Phil Howard 70b7d3065d Galactic Unicorn: Add dedicated firmware build. 2022-10-13 14:53:22 +01:00
Phil Howard a41715a377 PicoGraphics: Include RGB888 pen type for MicroPython. 2022-10-13 14:02:36 +01:00
Phil Howard 1357cb876d Galactic Unicorn: Fix audio test linting. 2022-10-13 13:47:25 +01:00
ZodiusInfuser 52a107e6d6 Switched GU over to chained DMA to remove interrupt use 2022-10-13 13:28:59 +01:00
ZodiusInfuser df79caf34e Exposed remaining AudioChannel parameters 2022-10-13 13:28:59 +01:00
lowfatcode 2695982182 Galactic Unicorn: Rainbow text demo. 2022-10-13 13:28:52 +01:00
ZodiusInfuser 8e8299a80b Linting 2022-10-13 13:27:58 +01:00
jon 27e9d467ff Galactic Unicorn: Example tweaks. 2022-10-13 13:27:46 +01:00
ZodiusInfuser 53dfb9866d Started splitting out synth into separate channel objects 2022-10-13 13:26:57 +01:00
ZodiusInfuser 882f76dcbc More work on GU synth 2022-10-13 13:26:57 +01:00
ZodiusInfuser deec835692 First addition of synth to GU 2022-10-13 13:26:57 +01:00
ZodiusInfuser 12ea527f44 Audio performance improvements and bugfixes 2022-10-13 13:26:57 +01:00
ZodiusInfuser f809db6434 Added play_tone support to GU C++ and MP 2022-10-13 13:26:57 +01:00
ZodiusInfuser e08ddd9837 Exposed audio to MP, and made it teardown cleanly 2022-10-13 13:26:57 +01:00
ZodiusInfuser 4551c991fb Re-added audio PIO and made it's restart cleaner 2022-10-13 13:26:57 +01:00
ZodiusInfuser b2e4e16fab Cleanup of GU and fix for flashes on MP soft reset 2022-10-13 13:26:57 +01:00
ZodiusInfuser 739ca71f69 Added partial tear down 2022-10-13 13:26:57 +01:00
ZodiusInfuser bb91d9e75b WIP improvements to GU hardware reuse (temp disabled audio) 2022-10-13 13:26:57 +01:00
ZodiusInfuser fbc6737f1e Finished feature_test.py 2022-10-13 13:26:57 +01:00
ZodiusInfuser b35ed5d5ba Moved MP examples over to PicoGraphics 2022-10-13 13:26:57 +01:00
ZodiusInfuser c8b5ffff8c More MP examples for GU 2022-10-13 13:26:57 +01:00
ZodiusInfuser 2283e73368 Fix for native comments raising linting errors 2022-10-13 13:26:57 +01:00
ZodiusInfuser 34a1a54cd1 Added nostalgia prompt example, and fixed linting 2022-10-13 13:26:57 +01:00
ZodiusInfuser 82b5110691 Fixed colour order and added working MP examples 2022-10-13 13:26:57 +01:00
ZodiusInfuser 7fd175abc5 Galactic Unicorn: More MicroPython bringup. 2022-10-13 13:26:41 +01:00
ZodiusInfuser a25699c73d Initial setup og GU Micropython 2022-10-13 13:25:26 +01:00
jon 5ea389c12a Added support for new RGB888 pen type 2022-10-13 13:25:26 +01:00
jon 678be33b53 Update to use new RGB888 pen type 2022-10-13 13:25:26 +01:00
jon f2c3d15b8e Galactic Unicorn: Playing basic audio samples now works, added rainbow example for photoshoot 2022-10-13 13:25:18 +01:00
jon eaaed2e862 Galactic Unicorn: Examples + features. 2022-10-13 13:24:08 +01:00
jon 5fdd08438f stuff 2022-10-13 13:22:21 +01:00
jon a3d3707284 more stuff 2022-10-13 13:22:21 +01:00
jon 09846ab221 Galactic Unicorn: Initial C++ experimentaion. 2022-10-13 13:21:22 +01:00
jon 241be438b8 Fixed a couple of small bugs in fire demo 2022-10-13 13:19:50 +01:00
jon a322c400f0 Added support for new RGB888 pen type 2022-10-13 13:19:50 +01:00
jon c91c5d6bf4 Update to use new RGB888 pen type 2022-10-13 13:19:50 +01:00
jon a486150470 Playing basic audio samples now works, added rainbow example for photoshoot 2022-10-13 13:19:50 +01:00
jon 63183d28be Lots of features added 2022-10-13 13:19:50 +01:00
jon e50827c412 stuff 2022-10-13 13:19:50 +01:00
jon 210b334fff more stuff 2022-10-13 13:19:50 +01:00
jon 54ad59c77a Rebasing Galactic Unicorn branch to main 2022-10-13 13:19:50 +01:00
helgibbons d7f85c1160 tweak readme 2022-10-12 18:38:14 +01:00
helgibbons 8b19a9b314 linting 2022-10-12 18:32:45 +01:00
helgibbons 76c6e36e59 tweak readme 2022-10-12 18:32:00 +01:00
helgibbons 6e93e4d5bf add readme 2022-10-12 18:23:24 +01:00
helgibbons bdc22af6e5 add fire example 2022-10-12 18:20:32 +01:00
helgibbons 7014bcb749 add sensor examples 2022-10-12 16:54:48 +01:00
Gee Bartlett 54018afde3 small tweeks 2022-10-12 13:10:12 +01:00
helgibbons db170a7b76 linting 2022-10-12 12:25:38 +01:00
helgibbons 2c71351ef7 add RV3028 function example 2022-10-12 12:21:13 +01:00
helgibbons 97abbb7af8 add spoooky mooon example 2022-10-12 12:06:41 +01:00
Gee Bartlett d03c00383a driver working for PG1Bit mode 2022-10-12 11:07:17 +01:00
Gee Bartlett 0e5e7feb7d page 0 working 2022-10-12 09:13:38 +01:00
Hel Gibbons b22c536dcc add PIR example 2022-10-10 17:17:03 +01:00
Hel Gibbons f6cd2839cc Update weather.py 2022-10-10 15:17:25 +01:00
Gee Bartlett fa04fef4f0 Update st7567.cpp 2022-10-10 14:33:28 +01:00
Gee Bartlett 337cd390d4 wip 2022-10-10 14:12:45 +01:00
Hel Gibbons a27a539a1f
Merge pull request #532 from pimoroni/hel-automation-mini
Automation Mini tidyup
2022-10-06 16:09:41 +01:00
helgibbons 86b1cd40dc Update readmes 2022-10-06 15:54:50 +01:00
helgibbons 262bd673ed Add Automation 2040 W Mini init to examples 2022-10-06 15:54:16 +01:00
helgibbons 3fa620db10 Fix error in automation.py 2022-10-06 15:52:48 +01:00
Gee Bartlett 2f7afad12d Update st7567.cpp
still trying to get this working properly
2022-10-06 12:28:22 +01:00
Gee Bartlett 28b6698430
Automation 2040w MicroPython PWM (#489)
Co-authored-by: ZodiusInfuser <christopher.parrott2@gmail.com>
2022-10-06 12:27:46 +01:00
Philip Howard 8280a6a720
Merge pull request #491 from adriangalilea/main
Add adjust_to_sea_pressure function
2022-10-06 12:13:24 +01:00
Philip Howard 9878e4bff7
Merge pull request #528 from pimoroni/patch-plasma-alloc
Plasma: Use m_new to alloc buffer on gc_heap if not supplied.
2022-10-06 12:12:34 +01:00
Philip Howard 1ac55c49ea
Merge pull request #527 from pimoroni/driver/inky-frame-4.0
Support for Inky Frame 4.0"
2022-10-06 12:09:17 +01:00
Philip Howard 32ae781186
Merge pull request #520 from gauntface/patch-1
Correct common path
2022-10-05 15:45:32 +01:00
Philip Howard c3f3d7fa35
Merge pull request #525 from PeterCopeland/patch-1
Move set_brightness to APA102
2022-10-05 15:37:48 +01:00
helgibbons 1886c4c3d2 add rainbows and blinkies 2022-10-05 15:00:59 +01:00
Gee Bartlett 8f645257c3 display running but data corrupt 2022-10-05 14:26:17 +01:00
helgibbons 283986b531 more weather linting 2022-10-05 12:20:20 +01:00
helgibbons 9653dcaabd linting 2022-10-05 12:17:00 +01:00
Phil Howard 00ca53a30b Inky Frame: Update C++ library to support 4.0" 2022-10-05 09:57:16 +01:00
helgibbons dd6d0a23ea add examples 2022-10-04 19:17:09 +01:00
Phil Howard eaf9fcdf93 Plasma: Use m_new to alloc buffer on gc_heap if not supplied.
When no buffer was supplied it would fall upon the class to call "new" and allocate within C/C++'s (very small) heap.

Ensure a MicroPython managed buffer (allocated from gc_heap) is always supplied to the APA102/WS2812 classes.
2022-10-04 11:39:56 +01:00
Phil Howard 9663be2787 Inky Frame: New button test, old is now button demo. 2022-10-03 14:37:02 +01:00
Phil Howard 9424ae7081 Inky Frame: Improve LED PWM example to test all LEDs. 2022-10-03 14:35:42 +01:00
Phil Howard 14fec0406d Inky Frame: Update examples to support 4.0". 2022-10-03 14:35:27 +01:00
Hel Gibbons 92ff903d1d
Merge pull request #526 from pimoroni/helgibbons-patch-1
Update README.md
2022-10-03 09:18:24 +01:00
Hel Gibbons 6393e74f86
Update README.md 2022-10-03 09:10:59 +01:00
Peter Copeland 8cc6e85f98
Move set_brightness to APA102
Documentation for set_brightness function was under WS2812 but text referred to APA102, and set_brightness is not supported on WS2812. I've moved the paragraph to the end of the APA102, verbatim.
2022-10-02 23:43:12 +01:00
Phil Howard 6aa1bbd271 UC8159: 0/180 degree rotation support. 2022-09-30 21:04:22 +01:00
Phil Howard 7f02501fa6 UC8159: Alternate resolution support. 2022-09-30 15:18:01 +01:00
Gee Bartlett 7b5946ef48 all complies needs testing against finished unit 2022-09-29 15:48:33 +01:00
Phil Howard c1816ae9d6 PicoGraphics: MicroPython support for Inky Frame 4.0 2022-09-29 14:04:56 +01:00
Gee Bartlett c48f81bc90 started on converting pico display demo 2022-09-29 12:01:35 +01:00
Gee Bartlett 3f24b442f1 inital work needs testing 2022-09-29 10:21:14 +01:00
Matt Gaunt-Seo 4a645a1a68
Correct common path 2022-09-25 19:07:05 -07:00
Hel Gibbons fb8cde305d
Merge pull request #517 from pimoroni/helgibbons-patch-1
Add link to common files
2022-09-21 15:15:35 +01:00
Hel Gibbons d6d1e00307
Add link to common files 2022-09-21 15:02:13 +01:00
Philip Howard 3868e42b66
Merge pull request #506 from TimAidley/feature/progress-pride-flag
Add Progress Pride flag to pride badge example.
2022-09-21 11:46:08 +01:00
Philip Howard ad3cc3560a
Merge pull request #516 from pimoroni/mike/fix-scanline-convert
PicoGraphics: Fix a bug that broke #422
2022-09-21 11:44:43 +01:00
Philip Howard 92c8a650c5
Merge pull request #422 from MichaelBell/fix-scanline-convert
Pico Graphics: Double buffer scanline conversion
2022-09-21 11:37:13 +01:00
Phil Howard fc3060b640 PicoGraphics: Simplify RGB565 frame convert.
Rewrite RGB565 frame convert to iterate over pixels by index, and transfer the buffer when it fills.

Avoid using a bitmask so BUF_LEN can be arbitrary.
2022-09-21 11:32:19 +01:00
Phil Howard bb9b5b69d3 PicoGraphics: Fix byte alignment bug in Pen P4.
Fix byte alignment to use the pixel index, rather than just the x-coordinate.

Prevent new rows from being erroneously byte-aligned in displays without an even width (eg: Pico Display portrait).
2022-09-21 11:26:58 +01:00
Philip Howard 675de25985
Merge pull request #514 from dreambucket13/main
set pen for text to 15 for better visibility
2022-09-21 09:18:45 +01:00
Mike Bell 799ed0786d Use DMA for SPI frame buffer too 2022-09-17 20:16:57 +01:00
dreambucket13 f427a74d55 set pen for text to 15 for better visibility 2022-09-16 15:17:25 -04:00
Philip Howard c00fee673e
Merge pull request #498 from pimoroni/purge-picoexplorer
Remove `picoexplorer` references
2022-09-07 10:00:13 +01:00
Tim Aidley 213e47ffd7 Fixed chevron size mismatch.
I decided I wanted the first chevron a little smaller, and realized I had the sign of the chevron height value reversed. The initial white triangle is now a bit smaller, and the chevron stripes slightly wider.
2022-09-06 20:13:16 -07:00
Tim Aidley 6292d33cdb Fixes to align with flake8 style 2022-09-06 20:08:12 -07:00
Tim Aidley f1aee84ef1 Add Progress Pride flag to pride badge example.
Adds the chevrons from the progress pride flag as an option on the Tufty pride flag example.
2022-09-01 08:22:17 -07:00
helgibbons dd872f5102 fix typo 2022-08-25 17:12:51 +01:00
helgibbons b8110f3905 Update LiPo examples to use PicoGraphics 2022-08-25 17:11:13 +01:00
helgibbons 2cbd710620 Remove references to old picoexplorer module 2022-08-25 16:10:32 +01:00
Mike Bell 7f330d1a04 Pico Graphics: Use fixed size buffer for frame conversion 2022-08-23 23:07:13 +01:00
Mike Bell f341c15fa7 Pico Graphics: Double buffer scanline conversion 2022-08-23 21:48:26 +01:00
Philip Howard 05ef0d7f03
Merge pull request #492 from pimoroni/feature/jpegdec-nodither
JPEGDEC: Add option to disable dither on RGB332.
2022-08-22 11:00:01 +01:00
Philip Howard b8100d22e8
Merge pull request #487 from MichaelBell/tufty-overclock
ST7789 Parallel: Work with SYS clock faster than default
2022-08-11 13:07:51 +01:00
Phil Howard fddac54f86 JPEGDEC: Add option to disable dither on RGB332. 2022-08-11 11:46:45 +01:00
Philip Howard 4e005c03d1
Merge pull request #480 from pimoroni/feature/wakeup
MicroPython: Early wakeup GPIO latch module.
2022-08-10 12:45:55 +01:00
btmask 3cfac2787b Add adjust_to_sea_pressure function
Now describe_pressure() gives meaningful insights if you set the altitude
2022-08-09 23:52:51 +02:00
Phil Howard 42a29dbe7b Wakeup: Port to Badger 2040. 2022-08-08 12:05:55 +01:00
Mike Bell ac449ff640 Wakeup: Early ROSC to ~48MHz.
Speed up MicroPython Pico W startup to init_priority(101) execution from ~160ms to ~32ms.
2022-08-08 12:05:18 +01:00
Phil Howard f7781e2696 Wakeup: Fixup crt0.S and runtime.c.
Assert the VSYS_EN pin before copying SRAM and zeroing BSS.

Saves ~142ms of startup time before GPIO input is latched and pin is asserted.
2022-08-08 12:05:18 +01:00
Phil Howard 898e2a1b32 Wakeup: Optionally turn off RTC CLOCK_OUT. 2022-08-08 12:05:18 +01:00
Phil Howard 9ec77c2f10 LTR559: Lux as float.
Avoid truncating Lux to uint16_t.
2022-08-08 12:05:18 +01:00
Phil Howard fb246441bd MicroPython: Add picow_enviro build. 2022-08-08 12:05:18 +01:00
Phil Howard a4b6d86ac7 MicroPython: Port wakeup GPIO latch to asm. 2022-08-08 12:05:18 +01:00
Phil Howard dfa13f2a39 MicroPython: Early wakeup GPIO latch module. 2022-08-08 12:05:18 +01:00
Philip Howard 82756a3fc9
Merge pull request #488 from pimoroni/patch-bump-micropython-picow
MicroPython: Bump PicoW.
2022-08-08 11:59:53 +01:00
Philip Howard 5b900cb088
Merge pull request #482 from pimoroni/guru-patch-1
Update bme68x_demo.py
2022-08-08 11:26:21 +01:00
Philip Howard 54ef2ddfd3
Merge pull request #476 from pimoroni/hel_more_inky_frame
add SD card example for Inky Frame
2022-08-08 10:05:04 +01:00
Paul Beech 553cedc80e Update bme68x_demo.py 2022-08-08 10:02:02 +01:00
Phil Howard d0dfa890df MicroPython: Bump PicoW. 2022-08-08 09:59:06 +01:00
Philip Howard 832a8e261a
Merge pull request #485 from pimoroni/patch-badger2040-with-modules
BadgerOS: Fix with-modules build.
2022-08-06 11:57:08 +01:00
Mike Bell b8ba66f593 ST7789 Parallel: Work with SYS clock faster than 125MHz 2022-08-04 20:44:17 +01:00
Phil Howard d7894df308 BadgerOS: Fix with-modules build. 2022-08-04 11:39:30 +01:00
Philip Howard 2855159921
Merge pull request #483 from pimoroni/patch-python-linting
Python: Show source of linting errors.
2022-08-03 09:26:22 +01:00
Phil Howard b529475148 Python: Fix new linting errors. 2022-08-03 09:07:32 +01:00
Phil Howard 527b97fb91 Python: Show source of linting errors. 2022-08-03 08:58:04 +01:00
Philip Howard 4abe57d0f3
Merge pull request #478 from pimoroni/patch_pcf85063a_mp
Exposed byte access for PCF RTC
2022-08-02 10:29:06 +01:00
Philip Howard abbfb76eaa
Merge pull request #477 from pimoroni/bug/dont-reset-rtc-please
Don't reset RTC.
2022-08-02 10:28:38 +01:00
Hel Gibbons 41ea541b19 add Inky Frame to supported products 2022-07-29 15:48:27 +01:00
jon e9c18b109d whoops. 2022-07-29 10:59:24 +01:00
helgibbons 822f3354aa add SD card example for Inky Frame 2022-07-28 18:39:12 +01:00
Philip Howard e8e8ecdf5a
Merge pull request #474 from pimoroni/patch-inky-frame-random-joke
Inky Frame: Fix random joke for #462.
2022-07-27 14:25:43 +01:00
Phil Howard 0734de30ea Inky Frame: Fix random joke for #462. 2022-07-27 13:53:06 +01:00
ZodiusInfuser 1cf7e29d09 MP for new function 2022-06-27 17:23:07 +01:00
thinkofher 2a9c2be115
Fetch pimoroni-pico SDK from git repository
When $PIMORONI_PICO_FETCH_FROM_GIT environment variable is set
cmake script will fetch on the go git repository and use it to
build your project.

User can additionally use $PIMORONI_PICO_FETCH_FROM_GIT_PATH to
specify target directory for source code of fetched SDK.

This patch was inspired by external/pico_sdk_import.cmake from
official C/C++ pico-sdk repository.
2022-06-12 16:19:59 +02:00
866 changed files with 87212 additions and 8106 deletions

View File

@ -10,38 +10,37 @@ env:
jobs:
build:
name: ${{matrix.name}}
name: ${{matrix.name}} (C++)
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- os: ubuntu-20.04
name: Linux
cache-key: linux
cmake-args: '-DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk -DPICO_SDK_POST_LIST_DIRS=$GITHUB_WORKSPACE/pico-extras'
apt-packages: ccache gcc-arm-none-eabi
runs-on: ${{matrix.os}}
- name: Pico
board: pico
- name: Pico W
board: pico_w
env:
PICO_SDK_PATH: $GITHUB_WORKSPACE/pico-sdk
steps:
- name: Compiler Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: /home/runner/.ccache
key: ccache-cmake-${{github.ref}}-${{github.sha}}
key: ccache-cmake-${{github.ref}}-${{matrix.board}}-${{github.sha}}
restore-keys: |
ccache-cmake-${{github.ref}}-${{matrix.board}}
ccache-cmake-${{github.ref}}
ccache-cmake
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
# Check out the Pico SDK
- name: Checkout Pico SDK
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
path: pico-sdk
@ -49,7 +48,7 @@ jobs:
# Check out the Pico Extras
- name: Checkout Pico Extras
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-extras
path: pico-extras
@ -59,7 +58,7 @@ jobs:
- name: Install deps
if: runner.os == 'Linux'
run: |
sudo apt update && sudo apt install ${{matrix.apt-packages}}
sudo apt update && sudo apt install ccache gcc-arm-none-eabi
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
@ -67,7 +66,7 @@ jobs:
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ${{matrix.cmake-args}}
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk -DPICO_SDK_POST_LIST_DIRS=$GITHUB_WORKSPACE/pico-extras -DPICO_BOARD=${{matrix.board}}
- name: Build
working-directory: ${{runner.workspace}}/build

View File

@ -1,172 +0,0 @@
name: MicroPython for Badger2040
on:
push:
pull_request:
release:
types: [created]
env:
MICROPYTHON_VERSION: v1.19
BOARD_TYPE: PIMORONI_BADGER2040
# MicroPython version will be contained in github.event.release.tag_name for releases
RELEASE_FILE: pimoroni-badger2040-${{github.event.release.tag_name || github.sha}}-micropython
jobs:
deps:
runs-on: ubuntu-20.04
name: Dependencies
steps:
- name: Workspace Cache
id: cache
uses: actions/cache@v2
with:
path: ${{runner.workspace}}
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}
restore-keys: |
workspace-micropython-${{env.MICROPYTHON_VERSION}}
# Check out MicroPython
- name: Checkout MicroPython
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: micropython/micropython
ref: ${{env.MICROPYTHON_VERSION}}
submodules: false # MicroPython submodules are hideously broken
path: micropython
- name: Fetch base MicroPython submodules
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: micropython
run: git submodule update --init
- name: Fetch Pico SDK submodules
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: micropython/lib/pico-sdk
run: git submodule update --init
- name: Build mpy-cross
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: micropython/mpy-cross
run: make
build:
needs: deps
name: Build Badger 2040
runs-on: ubuntu-20.04
steps:
- name: Compiler Cache
uses: actions/cache@v2
with:
path: /home/runner/.ccache
key: ccache-micropython-badger2040-${{github.ref}}-${{github.sha}}
restore-keys: |
ccache-micropython-badger2040-${{github.ref}}
ccache-micropython-badger2040-
- name: Workspace Cache
uses: actions/cache@v2
with:
path: ${{runner.workspace}}
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}
restore-keys: |
workspace-micropython-${{env.MICROPYTHON_VERSION}}
- uses: actions/checkout@v2
with:
submodules: true
path: pimoroni-pico-${{ github.sha }}
- name: "HACK: MicroPython Board Fixups"
shell: bash
working-directory: micropython/ports/rp2
run: |
../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board/board-fixup.sh badger2040 ${{env.BOARD_TYPE}} ../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board
# Linux deps
- name: Install Compiler & CCache
if: runner.os == 'Linux'
run: |
sudo apt update && sudo apt install ccache gcc-arm-none-eabi
python3 -m pip install pillow
# Build without BadgerOS
- name: Configure MicroPython (No BadgerOS)
shell: bash
working-directory: micropython/ports/rp2
run: |
cmake -S . -B build-${{env.BOARD_TYPE}} -DBADGER2040_NO_MODULES=1 -DPICO_BUILD_DOCS=0 -DUSER_C_MODULES=../../../pimoroni-pico-${GITHUB_SHA}/micropython/modules/badger2040-micropython.cmake -DMICROPY_BOARD=${{env.BOARD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build MicroPython (No BadgerOS)
shell: bash
working-directory: micropython/ports/rp2
run: |
ccache --zero-stats || true
cmake --build build-${{env.BOARD_TYPE}} -j 2
ccache --show-stats || true
- name: Rename .uf2 for artifact (No BadgerOS)
shell: bash
working-directory: micropython/ports/rp2/build-${{env.BOARD_TYPE}}
run: |
cp firmware.uf2 ${{env.RELEASE_FILE}}-without-badger-os.uf2
- name: Store .uf2 as artifact (No BadgerOS)
uses: actions/upload-artifact@v2
with:
name: ${{env.RELEASE_FILE}}-without-badger-os.uf2
path: micropython/ports/rp2/build-${{env.BOARD_TYPE}}/${{env.RELEASE_FILE}}-without-badger-os.uf2
- name: Upload .uf2 (No BadgerOS)
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
asset_path: micropython/ports/rp2/build-${{env.BOARD_TYPE}}/${{env.RELEASE_FILE}}-without-badger-os.uf2
upload_url: ${{github.event.release.upload_url}}
asset_name: ${{env.RELEASE_FILE}}-without-badger-os.uf2
asset_content_type: application/octet-stream
# Build with BadgerOS
- name: Configure MicroPython
shell: bash
working-directory: micropython/ports/rp2
run: |
cmake -S . -B build-${{env.BOARD_TYPE}} -DPICO_BUILD_DOCS=0 -DUSER_C_MODULES=../../../pimoroni-pico-${GITHUB_SHA}/micropython/modules/badger2040-micropython.cmake -DMICROPY_BOARD=${{env.BOARD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build MicroPython
shell: bash
working-directory: micropython/ports/rp2
run: |
ccache --zero-stats || true
cmake --build build-${{env.BOARD_TYPE}} -j 2
ccache --show-stats || true
- name: Rename .uf2 for artifact
shell: bash
working-directory: micropython/ports/rp2/build-${{env.BOARD_TYPE}}
run: |
cp firmware.uf2 ${{env.RELEASE_FILE}}.uf2
- name: Store .uf2 as artifact
uses: actions/upload-artifact@v2
with:
name: ${{env.RELEASE_FILE}}.uf2
path: micropython/ports/rp2/build-${{env.BOARD_TYPE}}/${{env.RELEASE_FILE}}.uf2
- name: Upload .uf2
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
asset_path: micropython/ports/rp2/build-${{env.BOARD_TYPE}}/${{env.RELEASE_FILE}}.uf2
upload_url: ${{github.event.release.upload_url}}
asset_name: ${{env.RELEASE_FILE}}.uf2
asset_content_type: application/octet-stream

View File

@ -1,152 +0,0 @@
name: MicroPython
on:
push:
pull_request:
release:
types: [created]
env:
MICROPYTHON_VERSION: 45ab801c300d605db96229f6e0626ebe2801f24d
jobs:
deps:
runs-on: ubuntu-20.04
name: Dependencies
steps:
- name: Workspace Cache
id: cache
uses: actions/cache@v2
with:
path: ${{runner.workspace}}
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs
restore-keys: |
workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs
# Check out MicroPython
- name: Checkout MicroPython
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: micropython/micropython
ref: ${{env.MICROPYTHON_VERSION}}
submodules: false # MicroPython submodules are hideously broken
path: micropython
# Check out MicroPython Libs
- name: Checkout MicroPython Libs
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: micropython/micropython-lib
path: micropython-lib
- name: Fetch base MicroPython submodules
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: micropython
run: git submodule update --init
- name: Fetch Pico SDK submodules
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: micropython/lib/pico-sdk
run: git submodule update --init
- name: Build mpy-cross
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: micropython/mpy-cross
run: make
build:
needs: deps
name: Build ${{matrix.board}}
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- name: picow
board: PICO_W
env:
# MicroPython version will be contained in github.event.release.tag_name for releases
RELEASE_FILE: pimoroni-${{matrix.name}}-${{github.event.release.tag_name || github.sha}}-micropython
steps:
- name: Compiler Cache
uses: actions/cache@v2
with:
path: /home/runner/.ccache
key: ccache-micropython-${{matrix.name}}-${{github.ref}}-${{github.sha}}
restore-keys: |
ccache-micropython-${{matrix.name}}-${{github.ref}}
ccache-micropython-${{matrix.name}}-
- name: Workspace Cache
uses: actions/cache@v2
with:
path: ${{runner.workspace}}
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs
restore-keys: |
workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs
- name: Install Compiler & CCache
if: runner.os == 'Linux'
run: |
sudo apt update && sudo apt install ccache gcc-arm-none-eabi
- uses: actions/checkout@v2
with:
submodules: true
path: pimoroni-pico-${{ github.sha }}
- name: "HACK: MicroPython Board Fixups"
shell: bash
working-directory: micropython/ports/rp2
run: |
../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board/board-fixup.sh ${{matrix.name}} ${{matrix.board}} ../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board
- name: Configure MicroPython
shell: bash
working-directory: micropython/ports/rp2
run: |
cmake -S . -B build-${{matrix.board}} -DPICO_BUILD_DOCS=0 -DUSER_C_MODULES=../../../pimoroni-pico-${GITHUB_SHA}/micropython/modules/micropython-${{matrix.name}}.cmake -DMICROPY_BOARD=${{matrix.board}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build MicroPython
shell: bash
working-directory: micropython/ports/rp2
run: |
ccache --zero-stats || true
cmake --build build-${{matrix.board}} -j 2
ccache --show-stats || true
- name: Rename .uf2 for artifact
shell: bash
working-directory: micropython/ports/rp2/build-${{matrix.board}}
run: |
cp firmware.uf2 $RELEASE_FILE.uf2
cp firmware.elf $RELEASE_FILE.elf
- name: Store .uf2 as artifact
uses: actions/upload-artifact@v2
with:
name: ${{env.RELEASE_FILE}}.uf2
path: micropython/ports/rp2/build-${{matrix.board}}/${{env.RELEASE_FILE}}.uf2
- name: Store .elf as artifact
uses: actions/upload-artifact@v2
with:
name: ${{env.RELEASE_FILE}}.elf
path: micropython/ports/rp2/build-${{matrix.board}}/${{env.RELEASE_FILE}}.elf
- name: Upload .uf2
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
asset_path: micropython/ports/rp2/build-${{matrix.board}}/firmware.uf2
upload_url: ${{github.event.release.upload_url}}
asset_name: ${{env.RELEASE_FILE}}.uf2
asset_content_type: application/octet-stream

View File

@ -7,60 +7,21 @@ on:
types: [created]
env:
MICROPYTHON_VERSION: v1.19
MICROPYTHON_VERSION: v1.22.2
jobs:
deps:
runs-on: ubuntu-20.04
name: Dependencies
steps:
- name: Workspace Cache
id: cache
uses: actions/cache@v2
with:
path: ${{runner.workspace}}
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}
restore-keys: |
workspace-micropython-${{env.MICROPYTHON_VERSION}}
# Check out MicroPython
- name: Checkout MicroPython
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: micropython/micropython
ref: ${{env.MICROPYTHON_VERSION}}
submodules: false # MicroPython submodules are hideously broken
path: micropython
- name: Fetch base MicroPython submodules
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: micropython
run: git submodule update --init
- name: Fetch Pico SDK submodules
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: micropython/lib/pico-sdk
run: git submodule update --init
- name: Build mpy-cross
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: micropython/mpy-cross
run: make
build:
needs: deps
name: Build ${{matrix.board}}
name: ${{ matrix.name }} (${{ matrix.board }})
runs-on: ubuntu-20.04
continue-on-error: true
strategy:
matrix:
include:
- name: pico
board: PICO
- name: tiny2040
board: RPI_PICO
- name: picow
board: RPI_PICO_W
- name: tiny2040_8mb
board: PIMORONI_TINY2040
- name: picolipo_4mb
board: PIMORONI_PICOLIPO_4MB
@ -68,77 +29,113 @@ jobs:
board: PIMORONI_PICOLIPO_16MB
- name: tufty2040
board: PIMORONI_TUFTY2040
- name: enviro
board: PICO_W_ENVIRO
- name: galactic_unicorn
board: RPI_PICO_W
- name: cosmic_unicorn
board: RPI_PICO_W
- name: stellar_unicorn
board: RPI_PICO_W
- name: inky_frame
board: PICO_W_INKY
env:
# MicroPython version will be contained in github.event.release.tag_name for releases
RELEASE_FILE: pimoroni-${{matrix.name}}-${{github.event.release.tag_name || github.sha}}-micropython.uf2
RELEASE_FILE: pimoroni-${{ matrix.name }}-${{ github.event.release.tag_name || github.sha }}-micropython
PIMORONI_PICO_DIR: "${{ github.workspace }}/pimoroni-pico-${{ github.sha }}"
MICROPY_BOARD_DIR: "${{ github.workspace }}/pimoroni-pico-${{ github.sha }}/micropython/board/${{ matrix.BOARD }}"
USER_C_MODULES: "${{ github.workspace }}/pimoroni-pico-${{ github.sha }}/micropython/modules/micropython-${{ matrix.name }}.cmake"
TAG_OR_SHA: ${{ github.event.release.tag_name || github.sha }}
MICROPY_BOARD: ${{ matrix.board }}
BOARD_NAME: ${{ matrix.name }}
BUILD_TOOLS: pimoroni-pico-${{ github.sha }}/ci/micropython.sh
steps:
- name: Compiler Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: /home/runner/.ccache
key: ccache-micropython-${{matrix.name}}-${{github.ref}}-${{github.sha}}
key: ccache-micropython-${{ matrix.name }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
ccache-micropython-${{matrix.name}}-${{github.ref}}
ccache-micropython-${{matrix.name}}-
- name: Workspace Cache
uses: actions/cache@v2
with:
path: ${{runner.workspace}}
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}
restore-keys: |
workspace-micropython-${{env.MICROPYTHON_VERSION}}
ccache-micropython-${{ matrix.name }}-${{ github.ref }}
ccache-micropython-${{ matrix.name }}-
- name: Install Compiler & CCache
if: runner.os == 'Linux'
run: |
sudo apt update && sudo apt install ccache gcc-arm-none-eabi
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
path: pimoroni-pico-${{ github.sha }}
- name: "HACK: MicroPython Board Fixups"
shell: bash
working-directory: micropython/ports/rp2
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '9-2020-q2'
- name: Install CCache
run: |
../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board/board-fixup.sh ${{matrix.name}} ${{matrix.board}} ../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board
source $BUILD_TOOLS
apt_install_build_deps
- name: Checkout MicroPython & Submodules
run: |
source $BUILD_TOOLS
micropython_clone
- name: "Py_Decl: Checkout py_decl"
uses: actions/checkout@v4
with:
repository: gadgetoid/py_decl
ref: v0.0.1
path: py_decl
- name: Build MPY Cross
run: |
source $BUILD_TOOLS
micropython_build_mpy_cross
- name: "HACK: CMakeLists.txt Disable C++ Exceptions Patch"
shell: bash
run: |
source $BUILD_TOOLS
hack_patch_micropython_disable_exceptions
- name: "HACK: Pico SDK Patch"
shell: bash
run: |
source $BUILD_TOOLS
hack_patch_pico_sdk
- name: Configure MicroPython
shell: bash
working-directory: micropython/ports/rp2
run: |
cmake -S . -B build-${{matrix.board}} -DPICO_BUILD_DOCS=0 -DUSER_C_MODULES=../../../pimoroni-pico-${GITHUB_SHA}/micropython/modules/micropython-${{matrix.name}}.cmake -DMICROPY_BOARD=${{matrix.board}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
source $BUILD_TOOLS
micropython_version
cmake_configure
- name: Build MicroPython
shell: bash
working-directory: micropython/ports/rp2
run: |
ccache --zero-stats || true
cmake --build build-${{matrix.board}} -j 2
ccache --show-stats || true
source $BUILD_TOOLS
cmake_build
- name: Rename .uf2 for artifact
- name: "Py_Decl: Verify UF2"
shell: bash
working-directory: micropython/ports/rp2/build-${{matrix.board}}
run: cp firmware.uf2 $RELEASE_FILE
run: |
python3 py_decl/py_decl.py --to-json --verify build-${{ matrix.name }}/${{ env.RELEASE_FILE }}.uf2
- name: Store .uf2 as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{env.RELEASE_FILE}}
path: micropython/ports/rp2/build-${{matrix.board}}/${{env.RELEASE_FILE}}
name: ${{ env.RELEASE_FILE }}.uf2
path: build-${{ matrix.name }}/${{ env.RELEASE_FILE }}.uf2
- name: Upload .uf2
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_path: micropython/ports/rp2/build-${{matrix.board}}/firmware.uf2
upload_url: ${{github.event.release.upload_url}}
asset_name: ${{env.RELEASE_FILE}}
asset_path: build-${{ matrix.name }}/firmware.uf2
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ env.RELEASE_FILE }}.uf2
asset_content_type: application/octet-stream

View File

@ -9,7 +9,7 @@ jobs:
name: Python Linting
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Python Deps
run: python3 -m pip install flake8
@ -17,14 +17,14 @@ jobs:
- name: Lint micropython/modules_py
shell: bash
run: |
python3 -m flake8 --ignore E501 micropython/modules_py
python3 -m flake8 --show-source --ignore E501 micropython/modules_py
- name: Lint micropython/examples
shell: bash
run: |
python3 -m flake8 --ignore E501 micropython/examples
python3 -m flake8 --show-source --ignore E501 micropython/examples
- name: Lint .py tools in C++ examples
shell: bash
run: |
python3 -m flake8 --ignore E501 examples
python3 -m flake8 --show-source --ignore E501 examples

4
.gitmodules vendored
View File

@ -17,7 +17,11 @@
[submodule "micropython/modules/qrcode"]
path = micropython/modules/qrcode
url = https://github.com/pimoroni/QR-Code-Generator
branch = micropython/mp_obj_type_t_upgrade
[submodule "drivers/vl53l5cx/src"]
path = drivers/vl53l5cx/src
url = https://github.com/ST-mirror/VL53L5CX_ULD_driver
branch = no-fw/lite/en
[submodule "drivers/mlx90640/src"]
path = drivers/mlx90640/src
url = https://github.com/melexis/mlx90640-library

View File

@ -10,6 +10,8 @@ set(CMAKE_CXX_STANDARD 17)
# Initialize the SDK
pico_sdk_init()
pico_find_compiler(PICO_COMPILER_LD ${PICO_GCC_TRIPLE}-ld)
function(add_resource target file)
get_filename_component(NAME ${ARGV1} NAME_WE)
set(FILENAME ${ARGV1})
@ -21,7 +23,7 @@ function(add_resource target file)
${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}
${CMAKE_CURRENT_BINARY_DIR}
COMMAND arm-none-eabi-ld -r -b binary -o ${NAME}.o ${FILENAME}
COMMAND ${PICO_COMPILER_LD} -r -b binary -o ${NAME}.o ${FILENAME}
DEPENDS ${FILENAME}
)

View File

@ -4,9 +4,9 @@ Welcome to the brave new world of Pico!
This repository contains the C/C++ and MicroPython libraries for our range of RP2040-based boards, Raspberry Pi Pico addons & [supported Breakout Garden sensors](#breakouts).
[![CMake Build Status](https://img.shields.io/github/workflow/status/pimoroni/pimoroni-pico/CMake?label=C%2B%2B)](https://github.com/pimoroni/pimoroni-pico/actions/workflows/cmake.yml)
[![MicroPython Build Status](https://img.shields.io/github/workflow/status/pimoroni/pimoroni-pico/MicroPython?label=MicroPython)](https://github.com/pimoroni/pimoroni-pico/actions/workflows/micropython.yml)
[![MicroPython+Blinka Status](https://img.shields.io/github/workflow/status/pimoroni/pimoroni-pico/MicroPython+Blinka?label=MicroPython%2BBlinka)](https://github.com/pimoroni/pimoroni-pico/actions/workflows/micropython-with-blinka.yml)
[![CMake Build Status](https://img.shields.io/github/actions/workflow/status/pimoroni/pimoroni-pico/cmake.yml?branch=main&label=CMake)](https://github.com/pimoroni/pimoroni-pico/actions/workflows/cmake.yml)
[![MicroPython Build Status](https://img.shields.io/github/actions/workflow/status/pimoroni/pimoroni-pico/micropython.yml?branch=main&label=MicroPython)](https://github.com/pimoroni/pimoroni-pico/actions/workflows/micropython.yml)
[![MicroPython PicoW Build Status](https://img.shields.io/github/actions/workflow/status/pimoroni/pimoroni-pico/micropython-picow.yml?branch=main&label=MicroPython%20PicoW)](https://github.com/pimoroni/pimoroni-pico/actions/workflows/micropython-picow.yml)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/pimoroni/pimoroni-pico)](https://github.com/pimoroni/pimoroni-pico/releases/latest/)
@ -16,7 +16,13 @@ This repository contains the C/C++ and MicroPython libraries for our range of RP
- [C++ Examples](#c-examples)
- [Boilerplate for C++ Projects](#boilerplate-for-c-projects)
- [Supported Products](#supported-products)
- [Tutorials & Guides](#tutorials--guides)
- [Packs and Bases](#packs-and-bases)
- [SHIMs](#shims)
- [RP2040 Boards](#rp2040-boards)
- [Pico W Aboard](#pico-w-aboard)
- [Breakouts](#breakouts)
- [Kits](#kits)
- [Tutorials and Guides](#tutorials-and-guides)
# MicroPython
@ -26,8 +32,9 @@ The easiest way to get started. If you're new to Pico, we recommend you read our
New releases are issued regularly with new libraries, bug fixes to our existing libraries and new features inherited from MicroPython upstream. Be sure to check back!
* :link: [Tutorial: Getting started with Pico](https://learn.pimoroni.com/article/getting-started-with-pico)
* [Readme: Instructions for setting up MicroPython](setting-up-micropython.md)
* :link: [Learn: Getting started with Pico](https://learn.pimoroni.com/article/getting-started-with-pico)
* [Readme: Instructions for installing MicroPython](setting-up-micropython.md)
* [Readme: Frequently Asked Questions](faqs-micropython.md)
* [Pimoroni Pico MicroPython + Drivers Releases](https://github.com/pimoroni/pimoroni-pico/releases)
* [Readme: PicoGraphics](micropython/modules/picographics)
@ -37,11 +44,15 @@ You can find MicroPython examples for supported sensors, packs and bases in the
* [MicroPython Examples](micropython/examples)
You can also install MicroPython stubs into Visual Studio Code to give you auto-complete, see:
* [MicroPython Stubs](https://github.com/pimoroni/pimoroni-pico-stubs)
# C/C++
For more advanced users that want to unleash the full power of Pico, you can use our C++ libraries. If you know what you're doing and want to build your own Pimoroni Pico project then start with the [Pimoroni Pico SDK Boilerplate](https://github.com/pimoroni/pico-boilerplate).
Advanced users that want to unleash the full power of Pico can use our C++ libraries. If you know what you're doing and want to build your own Pimoroni Pico project then start with the [Pimoroni Pico SDK Boilerplate](https://github.com/pimoroni/pico-boilerplate).
* :link: [Tutorial: Pico C++ Development on Windows](https://learn.pimoroni.com/article/pico-development-using-wsl)
* :link: [Learn: Pico C++ Development on Windows](https://learn.pimoroni.com/article/pico-development-using-wsl)
* [Readme: Instructions for setting up the C/C++ SDK](setting-up-the-pico-sdk.md)
## C++ Examples
@ -72,6 +83,7 @@ We also maintain a C++/CMake boilerplate with GitHub workflows configured for te
* Pico Display 2.0 - https://shop.pimoroni.com/products/pico-display-pack-2-0
* Pico Enviro+ Pack - https://shop.pimoroni.com/products/pico-enviro-pack
* Pico Inky Pack - https://shop.pimoroni.com/products/pico-inky-pack
* Pico GFX Pack - https://shop.pimoroni.com/products/pico-gfx-pack
## SHIMs
@ -81,7 +93,7 @@ We also maintain a C++/CMake boilerplate with GitHub workflows configured for te
## RP2040 Boards
* Plasma 2040 (LED strip driver) - https://shop.pimoroni.com/products/plasma-2040
* Interstate 75 (HUB75 driver) - https://shop.pimoroni.com/products/interstate-75
* Interstate 75 (HUB75 matrix driver) - https://shop.pimoroni.com/products/interstate-75
* Badger 2040 (E Ink badge) - https://shop.pimoroni.com/products/badger-2040
* Servo 2040 (18 Channel Servo Controller) - https://shop.pimoroni.com/products/servo-2040
* Motor 2040 (Quad Motor+Encoder Controller) - https://shop.pimoroni.com/products/motor-2040
@ -91,6 +103,15 @@ We also maintain a C++/CMake boilerplate with GitHub workflows configured for te
* Automation 2040 W (inputs, outputs and relays, 6-40V compatible) - https://shop.pimoroni.com/products/automation-2040-w
* Inventor 2040 W (motors, servos, noise) - https://shop.pimoroni.com/products/inventor-2040-w
* Inky Frame 5.7" (7-colour E Ink) - https://shop.pimoroni.com/products/inky-frame-5-7
* Automation 2040 W Mini (inputs, outputs and a relay, 6-40V compatible) - https://shop.pimoroni.com/products/automation-2040-w-mini
* Plasma Stick 2040 W (bijou LED strip controller) - https://shop.pimoroni.com/products/plasma-stick-2040-w
* Galactic Unicorn (53 x 11 LED matrix) - https://shop.pimoroni.com/products/galactic-unicorn
* Interstate 75 W (HUB75 matrix driver) - https://shop.pimoroni.com/products/interstate-75-w
* Inky Frame 4.0" (7-colour E Ink) - https://shop.pimoroni.com/products/inky-frame-4
* Badger 2040 W (E Ink badge) - https://shop.pimoroni.com/products/badger-2040-w
* Cosmic Unicorn (32 x 32 LED matrix) - https://shop.pimoroni.com/products/cosmic-unicorn
* Inky Frame 7.3" (7-colour E Ink) - https://shop.pimoroni.com/products/inky-frame-7-3
## Breakouts
@ -99,6 +120,7 @@ We also maintain a C++/CMake boilerplate with GitHub workflows configured for te
* MICS6814 - Gas Sensor - https://shop.pimoroni.com/products/mics6814-gas-sensor-breakout
* RGB Potentiometer - https://shop.pimoroni.com/products/rgb-potentiometer-breakout
* RGB Encoder - https://shop.pimoroni.com/products/rgb-encoder-breakout
* RGB Encoder Wheel - https://shop.pimoroni.com/products/rgb-encoder-wheel-breakout
* IO Expander - https://shop.pimoroni.com/products/io-expander
* RV3028 - Real-Time Clock (RTC) - https://shop.pimoroni.com/products/rv3028-real-time-clock-rtc-breakout
* ST7735 - 0.96" LCD - https://shop.pimoroni.com/products/0-96-spi-colour-lcd-160x80-breakout
@ -122,15 +144,23 @@ We also maintain a C++/CMake boilerplate with GitHub workflows configured for te
* ICP10125 - High Accuracy Pressure / Altitude / Temperature Sensor - https://shop.pimoroni.com/products/icp10125-air-pressure-breakout
* SCD41 CO2 Sensor (Carbon Dioxide / Temperature / Humidity) - https://shop.pimoroni.com/products/scd41-co2-sensor-breakout
* VL53L5CX 8x8 Time of Flight Array Sensor - https://shop.pimoroni.com/products/vl53l5cx-time-of-flight-tof-sensor-breakout
* RGB Encoder Wheel - https://shop.pimoroni.com/products/rgb-encoder-wheel-breakout
## Kits
# Tutorials & Guides
* Wireless Plasma Kit (Plasma Stick + LED wire + bottle!) - https://shop.pimoroni.com/products/wireless-plasma-kit
- :link: [Getting started with (MicroPython on) Pico](https://learn.pimoroni.com/article/getting-started-with-pico)
- :link: [Pico C++ Development on Windows / WSL](https://learn.pimoroni.com/article/pico-development-using-wsl)
- :link: [Getting Started with Interstate 75](https://learn.pimoroni.com/article/getting-started-with-interstate-75)
# Tutorials and Guides
- :link: [Getting Started with (MicroPython on) Pico](https://learn.pimoroni.com/article/getting-started-with-pico)
- :link: [Pico C/C++ Development on Windows / WSL](https://learn.pimoroni.com/article/pico-development-using-wsl)
- :link: [Getting Started with Interstate 75 (and W)](https://learn.pimoroni.com/article/getting-started-with-interstate-75)
- :link: [Getting Started with Plasma 2040](https://learn.pimoroni.com/article/plasma-2040)
- :link: [Assembling Keybow 2040](https://learn.pimoroni.com/article/assembling-keybow-2040)
- :link: [Getting Started with Badger 2040](https://learn.pimoroni.com/article/getting-started-with-badger-2040)
- :link: [MicroPython and VL53L5CX](https://learn.pimoroni.com/article/micropython-and-vl53l5cx)
- :link: [Getting Started with Tufty 2040](https://learn.pimoroni.com/article/getting-started-with-tufty-2040)
- :link: [Getting Started with Inky Frame](https://learn.pimoroni.com/article/getting-started-with-inky-frame)
- :link: [Getting Started with Automation 2040 W (and Mini)](https://learn.pimoroni.com/article/getting-started-with-automation-2040-w)
- :link: [Assembling Wireless Plasma Kit](https://learn.pimoroni.com/article/assembling-wireless-plasma-kit)
- :link: [Getting Started with Badger 2040 W](https://learn.pimoroni.com/article/getting-started-with-badger-2040-w)

75
ci/micropython.sh Normal file
View File

@ -0,0 +1,75 @@
export TERM=${TERM:="xterm-256color"}
function log_success {
echo -e "$(tput setaf 2)$1$(tput sgr0)"
}
function log_inform {
echo -e "$(tput setaf 6)$1$(tput sgr0)"
}
function log_warning {
echo -e "$(tput setaf 1)$1$(tput sgr0)"
}
function micropython_clone {
log_inform "Using MicroPython $MICROPYTHON_VERSION"
git clone https://github.com/micropython/micropython --depth=1 --branch=$MICROPYTHON_VERSION
cd micropython
git submodule update --init lib/pico-sdk
git submodule update --init lib/cyw43-driver
git submodule update --init lib/lwip
git submodule update --init lib/mbedtls
git submodule update --init lib/micropython-lib
git submodule update --init lib/tinyusb
git submodule update --init lib/btstack
cd ../
}
function micropython_build_mpy_cross {
cd micropython/mpy-cross
ccache --zero-stats || true
CROSS_COMPILE="ccache " make
ccache --show-stats || true
cd ../../
}
function apt_install_build_deps {
sudo apt update && sudo apt install ccache
}
function micropython_version {
echo "MICROPY_GIT_TAG=$MICROPYTHON_VERSION, $BOARD_NAME $TAG_OR_SHA" >> $GITHUB_ENV
echo "MICROPY_GIT_HASH=$MICROPYTHON_VERSION-$TAG_OR_SHA" >> $GITHUB_ENV
}
function hack_patch_micropython_disable_exceptions {
cd micropython
git apply $PIMORONI_PICO_DIR/micropython/micropython_nano_specs.patch
cd ../
}
function hack_patch_pico_sdk {
# pico-sdk-patch.sh will apply the patch if it exists
cd micropython
$PIMORONI_PICO_DIR/micropython/board/pico-sdk-patch.sh $MICROPY_BOARD
cd ../
}
function cmake_configure {
cmake -S micropython/ports/rp2 -B build-$BOARD_NAME \
-DPICO_BUILD_DOCS=0 \
-DUSER_C_MODULES=$USER_C_MODULES \
-DMICROPY_BOARD_DIR=$MICROPY_BOARD_DIR \
-DMICROPY_BOARD=$MICROPY_BOARD \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
}
function cmake_build {
ccache --zero-stats || true
cmake --build build-$BOARD_NAME -j 2
ccache --show-stats || true
cd build-$BOARD_NAME
cp firmware.uf2 $RELEASE_FILE.uf2
}

BIN
common/fonts/3x5.bitmapfont Normal file

Binary file not shown.

View File

@ -50,9 +50,11 @@ namespace pimoroni {
enum BOARD {
BREAKOUT_GARDEN,
PICO_EXPLORER,
PLASMA_STICK,
PLASMA_2040,
INTERSTATE_75,
SERVO_2040
SERVO_2040,
MOTOR_2040
};
enum Rotation {
@ -76,7 +78,7 @@ namespace pimoroni {
return to_ms_since_boot(get_absolute_time());
}
constexpr uint8_t GAMMA_8BIT[256] = {
inline constexpr uint8_t GAMMA_8BIT[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5,
@ -96,7 +98,7 @@ namespace pimoroni {
/* Moved from pico_unicorn.cpp
v = (uint16_t)(powf((float)(n) / 255.0f, 2.2) * 16383.0f + 0.5f) */
constexpr uint16_t GAMMA_14BIT[256] = {
inline constexpr uint16_t GAMMA_14BIT[256] = {
0, 0, 0, 1, 2, 3, 4, 6, 8, 10, 13, 16, 20, 23, 28, 32,
37, 42, 48, 54, 61, 67, 75, 82, 90, 99, 108, 117, 127, 137, 148, 159,
170, 182, 195, 207, 221, 234, 249, 263, 278, 294, 310, 326, 343, 361, 379, 397,

View File

@ -29,9 +29,15 @@ namespace pimoroni {
scl = I2C_DEFAULT_SCL;
interrupt = I2C_DEFAULT_INT;
break;
case PLASMA_STICK:
sda = I2C_BG_SDA;
scl = I2C_BG_SCL;
interrupt = PIN_UNUSED;
break;
case PLASMA_2040:
case INTERSTATE_75:
case SERVO_2040:
case MOTOR_2040:
sda = I2C_HEADER_SDA;
scl = I2C_HEADER_SCL;
interrupt = I2C_HEADER_INT;

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
dfu_mode.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -27,6 +27,7 @@ add_subdirectory(rgbled)
add_subdirectory(icp10125)
add_subdirectory(scd4x)
add_subdirectory(hub75)
add_subdirectory(hub75_legacy)
add_subdirectory(uc8151)
add_subdirectory(uc8159)
add_subdirectory(uc8151_legacy)
@ -38,3 +39,8 @@ add_subdirectory(vl53l5cx)
add_subdirectory(pcf85063a)
add_subdirectory(pms5003)
add_subdirectory(sh1107)
add_subdirectory(st7567)
add_subdirectory(psram_display)
add_subdirectory(shiftregister)
add_subdirectory(inky73)
add_subdirectory(mlx90640)

View File

@ -11,7 +11,7 @@ namespace pimoroni {
public:
Analog(uint pin, float amplifier_gain = 1.0f, float resistor = 0.0f, float offset = 0.0f) :
pin(pin), amplifier_gain(amplifier_gain), resistor(resistor), offset(offset) {
adc_init();
if (!(adc_hw->cs & ADC_CS_EN_BITS)) adc_init();
//Make sure GPIO is high-impedance, no pullups etc
adc_gpio_init(pin);

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 = bme280_intf::BME280_I2C_INTF;
device.read = (bme280_read_fptr_t)&read_bytes;
device.write = (bme280_write_fptr_t)&write_bytes;

View File

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

View File

@ -11,8 +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 = bme68x_intf::BME68X_I2C_INTF;
device.read = (bme68x_read_fptr_t)&read_bytes;
device.write = (bme68x_write_fptr_t)&write_bytes;

View File

@ -18,6 +18,8 @@ namespace pimoroni {
int8_t address;
};
i2c_intf_ptr i2c_interface;
bool debug = true;
bool init();

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();

View File

@ -4,7 +4,10 @@
#include "hardware/irq.h"
#include "hardware/clocks.h"
#include "encoder.hpp"
#ifndef NO_QSTR
#include "encoder.pio.h"
#endif
#define LAST_STATE(state) ((state) & 0b0011)
#define CURR_STATE(state) (((state) & 0b1100) >> 2)

View File

@ -3,9 +3,10 @@ add_library(hub75 INTERFACE)
target_sources(hub75 INTERFACE
${CMAKE_CURRENT_LIST_DIR}/hub75.cpp)
pico_generate_pio_header(hub75 ${CMAKE_CURRENT_LIST_DIR}/hub75.pio)
target_include_directories(hub75 INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(hub75 INTERFACE pico_stdlib hardware_pio hardware_dma)
target_link_libraries(hub75 INTERFACE pico_stdlib hardware_pio hardware_dma pico_graphics)
pico_generate_pio_header(hub75 ${CMAKE_CURRENT_LIST_DIR}/hub75.pio)

View File

@ -4,40 +4,10 @@
#include "hub75.hpp"
namespace pimoroni {
// Basic function to convert Hue, Saturation and Value to an RGB colour
Pixel hsv_to_rgb(float h, float s, float v) {
if(h < 0.0f) {
h = 1.0f + fmod(h, 1.0f);
}
int i = int(h * 6);
float f = h * 6 - i;
v = v * 255.0f;
float sv = s * v;
float fsv = f * sv;
auto p = uint8_t(-sv + v);
auto q = uint8_t(-fsv + v);
auto t = uint8_t(fsv - sv + v);
uint8_t bv = uint8_t(v);
switch (i % 6) {
default:
case 0: return Pixel(bv, t, p);
case 1: return Pixel(q, bv, p);
case 2: return Pixel(p, bv, t);
case 3: return Pixel(p, q, bv);
case 4: return Pixel(t, p, bv);
case 5: return Pixel(bv, p, q);
}
}
Hub75::Hub75(uint width, uint height, Pixel *buffer, PanelType panel_type, bool inverted_stb)
: width(width), height(height), panel_type(panel_type), inverted_stb(inverted_stb)
Hub75::Hub75(uint width, uint height, Pixel *buffer, PanelType panel_type, bool inverted_stb, COLOR_ORDER color_order)
: width(width), height(height), panel_type(panel_type), inverted_stb(inverted_stb), color_order(color_order)
{
// Set up allllll the GPIO
gpio_init(pin_r0); gpio_set_function(pin_r0, GPIO_FUNC_SIO); gpio_set_dir(pin_r0, true); gpio_put(pin_r0, 0);
@ -59,12 +29,10 @@ Hub75::Hub75(uint width, uint height, Pixel *buffer, PanelType panel_type, bool
gpio_init(pin_oe); gpio_set_function(pin_oe, GPIO_FUNC_SIO); gpio_set_dir(pin_oe, true); gpio_put(pin_clk, !oe_polarity);
if (buffer == nullptr) {
front_buffer = new Pixel[width * height];
back_buffer = new Pixel[width * height];
managed_buffer = true;
} else {
front_buffer = buffer;
back_buffer = buffer + width * height;
back_buffer = buffer;
managed_buffer = false;
}
@ -86,15 +54,30 @@ void Hub75::set_color(uint x, uint y, Pixel c) {
} else {
offset = (y * width + x) * 2;
}
front_buffer[offset] = c;
back_buffer[offset] = c;
}
void Hub75::set_rgb(uint x, uint y, uint8_t r, uint8_t g, uint8_t b) {
set_color(x, y, Pixel(r, g, b));
}
void Hub75::set_hsv(uint x, uint y, float h, float s, float v) {
set_color(x, y, hsv_to_rgb(h, s, v));
void Hub75::set_pixel(uint x, uint y, uint8_t r, uint8_t g, uint8_t b) {
switch(color_order) {
case COLOR_ORDER::RGB:
set_color(x, y, Pixel(r, g, b));
break;
case COLOR_ORDER::RBG:
set_color(x, y, Pixel(r, b, g));
break;
case COLOR_ORDER::GRB:
set_color(x, y, Pixel(g, r, b));
break;
case COLOR_ORDER::GBR:
set_color(x, y, Pixel(g, b, r));
break;
case COLOR_ORDER::BRG:
set_color(x, y, Pixel(b, r, g));
break;
case COLOR_ORDER::BGR:
set_color(x, y, Pixel(b, g, r));
break;
}
}
void Hub75::FM6126A_write_register(uint16_t value, uint8_t position) {
@ -130,12 +113,6 @@ void Hub75::FM6126A_setup() {
void Hub75::start(irq_handler_t handler) {
if(handler) {
dma_channel = 0;
// Try as I might, I can't seem to coax MicroPython into leaving PIO in a known state upon soft reset
// check for claimed PIO and prepare a clean slate.
stop(handler);
if (panel_type == PANEL_FM6126A) {
FM6126A_setup();
}
@ -156,31 +133,21 @@ void Hub75::start(irq_handler_t handler) {
// Prevent flicker in Python caused by the smaller dataset just blasting through the PIO too quickly
pio_sm_set_clkdiv(pio, sm_data, width <= 32 ? 2.0f : 1.0f);
dma_channel_claim(dma_channel);
dma_channel = dma_claim_unused_channel(true);
dma_channel_config config = dma_channel_get_default_config(dma_channel);
channel_config_set_transfer_data_size(&config, DMA_SIZE_32);
channel_config_set_bswap(&config, false);
channel_config_set_dreq(&config, pio_get_dreq(pio, sm_data, true));
dma_channel_configure(dma_channel, &config, &pio->txf[sm_data], NULL, 0, false);
dma_channel_claim(dma_flip_channel);
dma_channel_config flip_config = dma_channel_get_default_config(dma_flip_channel);
channel_config_set_transfer_data_size(&flip_config, DMA_SIZE_32);
channel_config_set_read_increment(&flip_config, true);
channel_config_set_write_increment(&flip_config, true);
channel_config_set_bswap(&flip_config, false);
dma_channel_configure(dma_flip_channel, &flip_config, nullptr, nullptr, 0, false);
// Same handler for both DMA channels
irq_set_exclusive_handler(DMA_IRQ_0, handler);
irq_set_exclusive_handler(DMA_IRQ_1, handler);
irq_add_shared_handler(DMA_IRQ_0, handler, PICO_SHARED_IRQ_HANDLER_DEFAULT_ORDER_PRIORITY);
dma_channel_set_irq1_enabled(dma_flip_channel, true);
dma_channel_set_irq0_enabled(dma_channel, true);
irq_set_enabled(pio_get_dreq(pio, sm_data, true), true);
irq_set_enabled(DMA_IRQ_0, true);
irq_set_enabled(DMA_IRQ_1, true);
row = 0;
bit = 0;
@ -192,13 +159,11 @@ void Hub75::start(irq_handler_t handler) {
}
void Hub75::stop(irq_handler_t handler) {
do_flip = false;
irq_set_enabled(DMA_IRQ_0, false);
irq_set_enabled(DMA_IRQ_1, false);
irq_set_enabled(pio_get_dreq(pio, sm_data, true), false);
if(dma_channel_is_claimed(dma_channel)) {
if(dma_channel != -1 && dma_channel_is_claimed(dma_channel)) {
dma_channel_set_irq0_enabled(dma_channel, false);
irq_remove_handler(DMA_IRQ_0, handler);
//dma_channel_wait_for_finish_blocking(dma_channel);
@ -207,29 +172,24 @@ void Hub75::stop(irq_handler_t handler) {
dma_channel_unclaim(dma_channel);
}
if(dma_channel_is_claimed(dma_flip_channel)){
dma_channel_set_irq1_enabled(dma_flip_channel, false);
irq_remove_handler(DMA_IRQ_1, handler);
//dma_channel_wait_for_finish_blocking(dma_flip_channel);
dma_channel_abort(dma_flip_channel);
dma_channel_acknowledge_irq1(dma_flip_channel);
dma_channel_unclaim(dma_flip_channel);
}
if(pio_sm_is_claimed(pio, sm_data)) {
pio_sm_set_enabled(pio, sm_data, false);
pio_sm_drain_tx_fifo(pio, sm_data);
pio_remove_program(pio, &hub75_data_rgb888_program, data_prog_offs);
pio_sm_unclaim(pio, sm_data);
}
if(pio_sm_is_claimed(pio, sm_row)) {
pio_sm_set_enabled(pio, sm_row, false);
pio_sm_drain_tx_fifo(pio, sm_row);
if (inverted_stb) {
pio_remove_program(pio, &hub75_row_inverted_program, row_prog_offs);
} else {
pio_remove_program(pio, &hub75_row_program, row_prog_offs);
}
pio_sm_unclaim(pio, sm_row);
}
pio_clear_instruction_memory(pio);
// Make sure the GPIO is in a known good state
// since we don't know what the PIO might have done with it
gpio_put_masked(0b111111 << pin_r0, 0);
@ -240,7 +200,6 @@ void Hub75::stop(irq_handler_t handler) {
Hub75::~Hub75() {
if (managed_buffer) {
delete[] front_buffer;
delete[] back_buffer;
}
}
@ -248,31 +207,13 @@ Hub75::~Hub75() {
void Hub75::clear() {
for(auto x = 0u; x < width; x++) {
for(auto y = 0u; y < height; y++) {
set_rgb(x, y, 0, 0, 0);
set_pixel(x, y, 0, 0, 0);
}
}
}
void Hub75::flip(bool copybuffer) {
dma_channel_config flip_config = dma_get_channel_config(dma_flip_channel);
channel_config_set_read_increment(&flip_config, copybuffer);
dma_channel_configure(dma_flip_channel, &flip_config, nullptr, nullptr, 0, false);
dma_channel_set_read_addr(dma_flip_channel, copybuffer ? front_buffer : &background, false);
dma_channel_set_write_addr(dma_flip_channel, back_buffer, false);
// Flip and block until the front buffer has been prepared
do_flip = true;
while(do_flip) {
best_effort_wfe_or_timeout(make_timeout_time_us(10));
};
}
void Hub75::dma_complete() {
if(dma_channel_get_irq1_status(dma_flip_channel)) {
dma_channel_acknowledge_irq1(dma_flip_channel);
do_flip = false;
}
if(dma_channel_get_irq0_status(dma_channel)) {
dma_channel_acknowledge_irq0(dma_channel);
@ -290,15 +231,6 @@ void Hub75::dma_complete() {
// Latch row data, pulse output enable for new row.
pio_sm_put_blocking(pio, sm_row, row | (brightness << 5 << bit));
if (do_flip && bit == 0 && row == 0) {
// Literally flip the front and back buffers by swapping their addresses
Pixel *tmp = back_buffer;
back_buffer = front_buffer;
front_buffer = tmp;
// Then, read the contents of the back buffer into the front buffer
dma_channel_set_trans_count(dma_flip_channel, width * height, true);
}
row++;
if(row == height / 2) {
@ -313,4 +245,34 @@ void Hub75::dma_complete() {
dma_channel_set_trans_count(dma_channel, width * 2, false);
dma_channel_set_read_addr(dma_channel, &back_buffer[row * width * 2], true);
}
}
void Hub75::update(PicoGraphics *graphics) {
if(graphics->pen_type == PicoGraphics::PEN_RGB888) {
uint32_t *p = (uint32_t *)graphics->frame_buffer;
for(uint y = 0; y < height; y++) {
for(uint x = 0; x < width; x++) {
uint32_t col = *p;
uint8_t r = (col & 0xff0000) >> 16;
uint8_t g = (col & 0x00ff00) >> 8;
uint8_t b = (col & 0x0000ff) >> 0;
set_pixel(x, y, r, g, b);
p++;
}
}
}
else if(graphics->pen_type == PicoGraphics::PEN_RGB565) {
uint16_t *p = (uint16_t *)graphics->frame_buffer;
for(uint y = 0; y < height; y++) {
for(uint x = 0; x < width; x++) {
uint16_t col = __builtin_bswap16(*p);
uint8_t r = (col & 0b1111100000000000) >> 8;
uint8_t g = (col & 0b0000011111100000) >> 3;
uint8_t b = (col & 0b0000000000011111) << 3;
set_pixel(x, y, r, g, b);
p++;
}
}
}
}
}

View File

@ -4,8 +4,13 @@
#include "hardware/pio.h"
#include "hardware/dma.h"
#include "hardware/irq.h"
#include "hub75.pio.h"
#include "libraries/pico_graphics/pico_graphics.hpp"
#ifndef NO_QSTR
#include "hub75.pio.h"
#endif
namespace pimoroni {
const uint DATA_BASE_PIN = 0;
const uint DATA_N_PINS = 6;
const uint ROWSEL_BASE_PIN = 6;
@ -50,19 +55,25 @@ Pixel hsv_to_rgb(float h, float s, float v);
class Hub75 {
public:
enum class COLOR_ORDER {
RGB,
RBG,
GRB,
GBR,
BRG,
BGR
};
uint width;
uint height;
Pixel *front_buffer;
Pixel *back_buffer;
bool managed_buffer = false;
PanelType panel_type;
bool inverted_stb = false;
COLOR_ORDER color_order;
Pixel background = 0;
// DMA & PIO
uint dma_channel = 0;
uint dma_flip_channel = 1;
volatile bool do_flip = false;
int dma_channel = -1;
uint bit = 0;
uint row = 0;
@ -110,20 +121,22 @@ class Hub75 {
unsigned int pin_led_g = 17;
unsigned int pin_led_b = 18;
Hub75(uint width, uint height, Pixel *buffer) : Hub75(width, height, buffer, PANEL_GENERIC, false) {};
Hub75(uint width, uint height) : Hub75(width, height, nullptr) {};
Hub75(uint width, uint height, Pixel *buffer) : Hub75(width, height, buffer, PANEL_GENERIC) {};
Hub75(uint width, uint height, Pixel *buffer, PanelType panel_type) : Hub75(width, height, buffer, panel_type, false) {};
Hub75(uint width, uint height, Pixel *buffer, PanelType panel_type, bool inverted_stb);
Hub75(uint width, uint height, Pixel *buffer, PanelType panel_type, bool inverted_stb, COLOR_ORDER color_order=COLOR_ORDER::RGB);
~Hub75();
void FM6126A_write_register(uint16_t value, uint8_t position);
void FM6126A_setup();
void set_color(uint x, uint y, Pixel c);
void set_rgb(uint x, uint y, uint8_t r, uint8_t g, uint8_t b);
void set_hsv(uint x, uint y, float r, float g, float b);
void set_pixel(uint x, uint y, uint8_t r, uint8_t g, uint8_t b);
void display_update();
void clear();
void start(irq_handler_t handler);
void stop(irq_handler_t handler);
void flip(bool copybuffer=true);
void dma_complete();
};
void update(PicoGraphics *graphics);
};
}

View File

@ -0,0 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/hub75.cmake)

View File

@ -0,0 +1,11 @@
add_library(hub75_legacy INTERFACE)
target_sources(hub75_legacy INTERFACE
${CMAKE_CURRENT_LIST_DIR}/hub75.cpp)
target_include_directories(hub75_legacy INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(hub75_legacy INTERFACE pico_stdlib hardware_pio hardware_dma)
pico_generate_pio_header(hub75_legacy ${CMAKE_CURRENT_LIST_DIR}/hub75.pio)

View File

@ -0,0 +1,316 @@
#include <cstring>
#include <algorithm>
#include <cmath>
#include "hub75.hpp"
// Basic function to convert Hue, Saturation and Value to an RGB colour
Pixel hsv_to_rgb(float h, float s, float v) {
if(h < 0.0f) {
h = 1.0f + fmod(h, 1.0f);
}
int i = int(h * 6);
float f = h * 6 - i;
v = v * 255.0f;
float sv = s * v;
float fsv = f * sv;
auto p = uint8_t(-sv + v);
auto q = uint8_t(-fsv + v);
auto t = uint8_t(fsv - sv + v);
uint8_t bv = uint8_t(v);
switch (i % 6) {
default:
case 0: return Pixel(bv, t, p);
case 1: return Pixel(q, bv, p);
case 2: return Pixel(p, bv, t);
case 3: return Pixel(p, q, bv);
case 4: return Pixel(t, p, bv);
case 5: return Pixel(bv, p, q);
}
}
Hub75::Hub75(uint width, uint height, Pixel *buffer, PanelType panel_type, bool inverted_stb)
: width(width), height(height), panel_type(panel_type), inverted_stb(inverted_stb)
{
// Set up allllll the GPIO
gpio_init(pin_r0); gpio_set_function(pin_r0, GPIO_FUNC_SIO); gpio_set_dir(pin_r0, true); gpio_put(pin_r0, 0);
gpio_init(pin_g0); gpio_set_function(pin_g0, GPIO_FUNC_SIO); gpio_set_dir(pin_g0, true); gpio_put(pin_g0, 0);
gpio_init(pin_b0); gpio_set_function(pin_b0, GPIO_FUNC_SIO); gpio_set_dir(pin_b0, true); gpio_put(pin_b0, 0);
gpio_init(pin_r1); gpio_set_function(pin_r1, GPIO_FUNC_SIO); gpio_set_dir(pin_r1, true); gpio_put(pin_r1, 0);
gpio_init(pin_g1); gpio_set_function(pin_g1, GPIO_FUNC_SIO); gpio_set_dir(pin_g1, true); gpio_put(pin_g1, 0);
gpio_init(pin_b1); gpio_set_function(pin_b1, GPIO_FUNC_SIO); gpio_set_dir(pin_b1, true); gpio_put(pin_b1, 0);
gpio_init(pin_row_a); gpio_set_function(pin_row_a, GPIO_FUNC_SIO); gpio_set_dir(pin_row_a, true); gpio_put(pin_row_a, 0);
gpio_init(pin_row_b); gpio_set_function(pin_row_b, GPIO_FUNC_SIO); gpio_set_dir(pin_row_b, true); gpio_put(pin_row_b, 0);
gpio_init(pin_row_c); gpio_set_function(pin_row_c, GPIO_FUNC_SIO); gpio_set_dir(pin_row_c, true); gpio_put(pin_row_c, 0);
gpio_init(pin_row_d); gpio_set_function(pin_row_d, GPIO_FUNC_SIO); gpio_set_dir(pin_row_d, true); gpio_put(pin_row_d, 0);
gpio_init(pin_row_e); gpio_set_function(pin_row_e, GPIO_FUNC_SIO); gpio_set_dir(pin_row_e, true); gpio_put(pin_row_e, 0);
gpio_init(pin_clk); gpio_set_function(pin_clk, GPIO_FUNC_SIO); gpio_set_dir(pin_clk, true); gpio_put(pin_clk, !clk_polarity);
gpio_init(pin_stb); gpio_set_function(pin_stb, GPIO_FUNC_SIO); gpio_set_dir(pin_stb, true); gpio_put(pin_clk, !stb_polarity);
gpio_init(pin_oe); gpio_set_function(pin_oe, GPIO_FUNC_SIO); gpio_set_dir(pin_oe, true); gpio_put(pin_clk, !oe_polarity);
if (buffer == nullptr) {
front_buffer = new Pixel[width * height];
back_buffer = new Pixel[width * height];
managed_buffer = true;
} else {
front_buffer = buffer;
back_buffer = buffer + width * height;
managed_buffer = false;
}
if (brightness == 0) {
if (width >= 64) brightness = 6;
if (width >= 96) brightness = 3;
if (width >= 128) brightness = 2;
if (width >= 160) brightness = 1;
}
}
void Hub75::set_color(uint x, uint y, Pixel c) {
int offset = 0;
if(x >= width || y >= height) return;
if(y >= height / 2) {
y -= height / 2;
offset = (y * width + x) * 2;
offset += 1;
} else {
offset = (y * width + x) * 2;
}
front_buffer[offset] = c;
}
void Hub75::set_rgb(uint x, uint y, uint8_t r, uint8_t g, uint8_t b) {
set_color(x, y, Pixel(r, g, b));
}
void Hub75::set_hsv(uint x, uint y, float h, float s, float v) {
set_color(x, y, hsv_to_rgb(h, s, v));
}
void Hub75::FM6126A_write_register(uint16_t value, uint8_t position) {
gpio_put(pin_clk, !clk_polarity);
gpio_put(pin_stb, !stb_polarity);
uint8_t threshold = width - position;
for(auto i = 0u; i < width; i++) {
auto j = i % 16;
bool b = value & (1 << j);
gpio_put(pin_r0, b);
gpio_put(pin_g0, b);
gpio_put(pin_b0, b);
gpio_put(pin_r1, b);
gpio_put(pin_g1, b);
gpio_put(pin_b1, b);
// Assert strobe/latch if i > threshold
// This somehow indicates to the FM6126A which register we want to write :|
gpio_put(pin_stb, i > threshold);
gpio_put(pin_clk, clk_polarity);
sleep_us(10);
gpio_put(pin_clk, !clk_polarity);
}
}
void Hub75::FM6126A_setup() {
// Ridiculous register write nonsense for the FM6126A-based 64x64 matrix
FM6126A_write_register(0b1111111111111110, 12);
FM6126A_write_register(0b0000001000000000, 13);
}
void Hub75::start(irq_handler_t handler) {
if(handler) {
dma_channel = 0;
// Try as I might, I can't seem to coax MicroPython into leaving PIO in a known state upon soft reset
// check for claimed PIO and prepare a clean slate.
stop(handler);
if (panel_type == PANEL_FM6126A) {
FM6126A_setup();
}
// Claim the PIO so we can clean it upon soft restart
pio_sm_claim(pio, sm_data);
pio_sm_claim(pio, sm_row);
data_prog_offs = pio_add_program(pio, &hub75_data_rgb888_program);
if (inverted_stb) {
row_prog_offs = pio_add_program(pio, &hub75_row_inverted_program);
} else {
row_prog_offs = pio_add_program(pio, &hub75_row_program);
}
hub75_data_rgb888_program_init(pio, sm_data, data_prog_offs, DATA_BASE_PIN, pin_clk);
hub75_row_program_init(pio, sm_row, row_prog_offs, ROWSEL_BASE_PIN, ROWSEL_N_PINS, pin_stb);
// Prevent flicker in Python caused by the smaller dataset just blasting through the PIO too quickly
pio_sm_set_clkdiv(pio, sm_data, width <= 32 ? 2.0f : 1.0f);
dma_channel_claim(dma_channel);
dma_channel_config config = dma_channel_get_default_config(dma_channel);
channel_config_set_transfer_data_size(&config, DMA_SIZE_32);
channel_config_set_bswap(&config, false);
channel_config_set_dreq(&config, pio_get_dreq(pio, sm_data, true));
dma_channel_configure(dma_channel, &config, &pio->txf[sm_data], NULL, 0, false);
dma_channel_claim(dma_flip_channel);
dma_channel_config flip_config = dma_channel_get_default_config(dma_flip_channel);
channel_config_set_transfer_data_size(&flip_config, DMA_SIZE_32);
channel_config_set_read_increment(&flip_config, true);
channel_config_set_write_increment(&flip_config, true);
channel_config_set_bswap(&flip_config, false);
dma_channel_configure(dma_flip_channel, &flip_config, nullptr, nullptr, 0, false);
// Same handler for both DMA channels
irq_set_exclusive_handler(DMA_IRQ_0, handler);
irq_set_exclusive_handler(DMA_IRQ_1, handler);
dma_channel_set_irq1_enabled(dma_flip_channel, true);
dma_channel_set_irq0_enabled(dma_channel, true);
irq_set_enabled(pio_get_dreq(pio, sm_data, true), true);
irq_set_enabled(DMA_IRQ_0, true);
irq_set_enabled(DMA_IRQ_1, true);
row = 0;
bit = 0;
hub75_data_rgb888_set_shift(pio, sm_data, data_prog_offs, bit);
dma_channel_set_trans_count(dma_channel, width * 2, false);
dma_channel_set_read_addr(dma_channel, &back_buffer, true);
}
}
void Hub75::stop(irq_handler_t handler) {
do_flip = false;
irq_set_enabled(DMA_IRQ_0, false);
irq_set_enabled(DMA_IRQ_1, false);
irq_set_enabled(pio_get_dreq(pio, sm_data, true), false);
if(dma_channel_is_claimed(dma_channel)) {
dma_channel_set_irq0_enabled(dma_channel, false);
irq_remove_handler(DMA_IRQ_0, handler);
//dma_channel_wait_for_finish_blocking(dma_channel);
dma_channel_abort(dma_channel);
dma_channel_acknowledge_irq0(dma_channel);
dma_channel_unclaim(dma_channel);
}
if(dma_channel_is_claimed(dma_flip_channel)){
dma_channel_set_irq1_enabled(dma_flip_channel, false);
irq_remove_handler(DMA_IRQ_1, handler);
//dma_channel_wait_for_finish_blocking(dma_flip_channel);
dma_channel_abort(dma_flip_channel);
dma_channel_acknowledge_irq1(dma_flip_channel);
dma_channel_unclaim(dma_flip_channel);
}
if(pio_sm_is_claimed(pio, sm_data)) {
pio_sm_set_enabled(pio, sm_data, false);
pio_sm_drain_tx_fifo(pio, sm_data);
pio_sm_unclaim(pio, sm_data);
}
if(pio_sm_is_claimed(pio, sm_row)) {
pio_sm_set_enabled(pio, sm_row, false);
pio_sm_drain_tx_fifo(pio, sm_row);
pio_sm_unclaim(pio, sm_row);
}
pio_clear_instruction_memory(pio);
// Make sure the GPIO is in a known good state
// since we don't know what the PIO might have done with it
gpio_put_masked(0b111111 << pin_r0, 0);
gpio_put_masked(0b11111 << pin_row_a, 0);
gpio_put(pin_clk, !clk_polarity);
gpio_put(pin_clk, !oe_polarity);
}
Hub75::~Hub75() {
if (managed_buffer) {
delete[] front_buffer;
delete[] back_buffer;
}
}
void Hub75::clear() {
for(auto x = 0u; x < width; x++) {
for(auto y = 0u; y < height; y++) {
set_rgb(x, y, 0, 0, 0);
}
}
}
void Hub75::flip(bool copybuffer) {
dma_channel_config flip_config = dma_get_channel_config(dma_flip_channel);
channel_config_set_read_increment(&flip_config, copybuffer);
dma_channel_configure(dma_flip_channel, &flip_config, nullptr, nullptr, 0, false);
dma_channel_set_read_addr(dma_flip_channel, copybuffer ? front_buffer : &background, false);
dma_channel_set_write_addr(dma_flip_channel, back_buffer, false);
// Flip and block until the front buffer has been prepared
do_flip = true;
while(do_flip) {
best_effort_wfe_or_timeout(make_timeout_time_us(10));
};
}
void Hub75::dma_complete() {
if(dma_channel_get_irq1_status(dma_flip_channel)) {
dma_channel_acknowledge_irq1(dma_flip_channel);
do_flip = false;
}
if(dma_channel_get_irq0_status(dma_channel)) {
dma_channel_acknowledge_irq0(dma_channel);
// Push out a dummy pixel for each row
pio_sm_put_blocking(pio, sm_data, 0);
pio_sm_put_blocking(pio, sm_data, 0);
// SM is finished when it stalls on empty TX FIFO
hub75_wait_tx_stall(pio, sm_data);
// Check that previous OEn pulse is finished, else things WILL get out of sequence
hub75_wait_tx_stall(pio, sm_row);
// Latch row data, pulse output enable for new row.
pio_sm_put_blocking(pio, sm_row, row | (brightness << 5 << bit));
if (do_flip && bit == 0 && row == 0) {
// Literally flip the front and back buffers by swapping their addresses
Pixel *tmp = back_buffer;
back_buffer = front_buffer;
front_buffer = tmp;
// Then, read the contents of the back buffer into the front buffer
dma_channel_set_trans_count(dma_flip_channel, width * height, true);
}
row++;
if(row == height / 2) {
row = 0;
bit++;
if (bit == BIT_DEPTH) {
bit = 0;
}
hub75_data_rgb888_set_shift(pio, sm_data, data_prog_offs, bit);
}
dma_channel_set_trans_count(dma_channel, width * 2, false);
dma_channel_set_read_addr(dma_channel, &back_buffer[row * width * 2], true);
}
}

View File

@ -0,0 +1,132 @@
#include <stdint.h>
#include "pico/stdlib.h"
#include "hardware/pio.h"
#include "hardware/dma.h"
#include "hardware/irq.h"
#ifndef NO_QSTR
#include "hub75.pio.h"
#endif
const uint DATA_BASE_PIN = 0;
const uint DATA_N_PINS = 6;
const uint ROWSEL_BASE_PIN = 6;
const uint ROWSEL_N_PINS = 5;
const uint BIT_DEPTH = 10;
// This gamma table is used to correct our 8-bit (0-255) colours up to 11-bit,
// allowing us to gamma correct without losing dynamic range.
constexpr uint16_t GAMMA_10BIT[256] = {
0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8,
8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16,
16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 25,
26, 27, 29, 30, 31, 33, 34, 35, 37, 38, 40, 41, 43, 44, 46, 47,
49, 51, 53, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
80, 82, 85, 87, 89, 92, 94, 96, 99, 101, 104, 106, 109, 112, 114, 117,
120, 122, 125, 128, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 161, 164,
168, 171, 174, 178, 181, 185, 188, 192, 195, 199, 202, 206, 210, 214, 217, 221,
225, 229, 233, 237, 241, 245, 249, 253, 257, 261, 265, 270, 274, 278, 283, 287,
291, 296, 300, 305, 309, 314, 319, 323, 328, 333, 338, 343, 347, 352, 357, 362,
367, 372, 378, 383, 388, 393, 398, 404, 409, 414, 420, 425, 431, 436, 442, 447,
453, 459, 464, 470, 476, 482, 488, 494, 499, 505, 511, 518, 524, 530, 536, 542,
548, 555, 561, 568, 574, 580, 587, 593, 600, 607, 613, 620, 627, 633, 640, 647,
654, 661, 668, 675, 682, 689, 696, 703, 711, 718, 725, 733, 740, 747, 755, 762,
770, 777, 785, 793, 800, 808, 816, 824, 832, 839, 847, 855, 863, 872, 880, 888,
896, 904, 912, 921, 929, 938, 946, 954, 963, 972, 980, 989, 997, 1006, 1015, 1023
};
struct Pixel {
uint32_t color;
constexpr Pixel() : color(0) {};
constexpr Pixel(uint32_t color) : color(color) {};
constexpr Pixel(uint8_t r, uint8_t g, uint8_t b) : color((GAMMA_10BIT[b] << 20) | (GAMMA_10BIT[g] << 10) | GAMMA_10BIT[r]) {};
};
enum PanelType {
PANEL_GENERIC = 0,
PANEL_FM6126A,
};
Pixel hsv_to_rgb(float h, float s, float v);
class Hub75 {
public:
uint width;
uint height;
Pixel *front_buffer;
Pixel *back_buffer;
bool managed_buffer = false;
PanelType panel_type;
bool inverted_stb = false;
Pixel background = 0;
// DMA & PIO
uint dma_channel = 0;
uint dma_flip_channel = 1;
volatile bool do_flip = false;
uint bit = 0;
uint row = 0;
PIO pio = pio0;
uint sm_data = 0;
uint sm_row = 1;
uint data_prog_offs = 0;
uint row_prog_offs = 0;
uint brightness = 6;
// Top half of display - 16 rows on a 32x32 panel
unsigned int pin_r0 = 0;
unsigned int pin_g0 = 1;
unsigned int pin_b0 = 2;
// Bottom half of display - 16 rows on a 64x64 panel
unsigned int pin_r1 = 3;
unsigned int pin_g1 = 4;
unsigned int pin_b1 = 5;
// Address pins, 5 lines = 2^5 = 32 values (max 64x64 display)
unsigned int pin_row_a = 6;
unsigned int pin_row_b = 7;
unsigned int pin_row_c = 8;
unsigned int pin_row_d = 9;
unsigned int pin_row_e = 10;
// Sundry things
unsigned int pin_clk = 11; // Clock
unsigned int pin_stb = 12; // Strobe/Latch
unsigned int pin_oe = 13; // Output Enable
const bool clk_polarity = 1;
const bool stb_polarity = 1;
const bool oe_polarity = 0;
// User buttons and status LED
unsigned int pin_sw_a = 14;
unsigned int pin_sw_user = 23;
unsigned int pin_led_r = 16;
unsigned int pin_led_g = 17;
unsigned int pin_led_b = 18;
Hub75(uint width, uint height, Pixel *buffer) : Hub75(width, height, buffer, PANEL_GENERIC, false) {};
Hub75(uint width, uint height, Pixel *buffer, PanelType panel_type) : Hub75(width, height, buffer, panel_type, false) {};
Hub75(uint width, uint height, Pixel *buffer, PanelType panel_type, bool inverted_stb);
~Hub75();
void FM6126A_write_register(uint16_t value, uint8_t position);
void FM6126A_setup();
void set_color(uint x, uint y, Pixel c);
void set_rgb(uint x, uint y, uint8_t r, uint8_t g, uint8_t b);
void set_hsv(uint x, uint y, float r, float g, float b);
void display_update();
void clear();
void start(irq_handler_t handler);
void stop(irq_handler_t handler);
void flip(bool copybuffer=true);
void dma_complete();
};

View File

@ -0,0 +1,158 @@
;
; Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
;
; SPDX-License-Identifier: BSD-3-Clause
;
.program hub75_row
; side-set pin 0 is LATCH
; side-set pin 1 is OEn
; OUT pins are row select A-E
;
; Each FIFO record consists of:
; - 5-bit row select (LSBs)
; - Pulse width - 1 (27 MSBs)
;
; Repeatedly select a row, pulse LATCH, and generate a pulse of a certain
; width on OEn.
.side_set 2
.wrap_target
out pins, 5 [1] side 0x2 ; Deassert OEn, output row select
out x, 27 [7] side 0x3 ; Pulse LATCH, get OEn pulse width
pulse_loop:
jmp x-- pulse_loop side 0x0 ; Assert OEn for x+1 cycles
.wrap
.program hub75_row_inverted
; side-set pin 0 is LATCH
; side-set pin 1 is OEn
; OUT pins are row select A-E
;
; Each FIFO record consists of:
; - 5-bit row select (LSBs)
; - Pulse width - 1 (27 MSBs)
;
; Repeatedly select a row, pulse LATCH, and generate a pulse of a certain
; width on OEn.
.side_set 2
.wrap_target
out pins, 5 [1] side 0x3 ; Deassert OEn, output row select
out x, 27 [7] side 0x2 ; Pulse LATCH, get OEn pulse width
pulse_loop:
jmp x-- pulse_loop side 0x1 ; Assert OEn for x+1 cycles
.wrap
% c-sdk {
static inline void hub75_row_program_init(PIO pio, uint sm, uint offset, uint row_base_pin, uint n_row_pins, uint latch_base_pin) {
pio_sm_set_consecutive_pindirs(pio, sm, row_base_pin, n_row_pins, true);
pio_sm_set_consecutive_pindirs(pio, sm, latch_base_pin, 2, true);
for (uint i = row_base_pin; i < row_base_pin + n_row_pins; ++i)
pio_gpio_init(pio, i);
pio_gpio_init(pio, latch_base_pin);
pio_gpio_init(pio, latch_base_pin + 1);
pio_sm_config c = hub75_row_program_get_default_config(offset);
sm_config_set_out_pins(&c, row_base_pin, n_row_pins);
sm_config_set_sideset_pins(&c, latch_base_pin);
sm_config_set_out_shift(&c, true, true, 32);
pio_sm_init(pio, sm, offset, &c);
pio_sm_set_enabled(pio, sm, true);
}
static inline void hub75_wait_tx_stall(PIO pio, uint sm) {
uint32_t txstall_mask = 1u << (PIO_FDEBUG_TXSTALL_LSB + sm);
pio->fdebug = txstall_mask;
while (!(pio->fdebug & txstall_mask))
tight_loop_contents();
}
%}
.program hub75_data_rgb888
.side_set 1
; Each FIFO record consists of a RGB888 pixel. (This is ok for e.g. an RGB565
; source which has been gamma-corrected)
;
; Even pixels are sent on R0, G0, B0 and odd pixels on R1, G1, B1 (typically
; these are for different parts of the screen, NOT for adjacent pixels, so the
; frame buffer must be interleaved before passing to PIO.)
;
; Each pass through, we take bit n, n + 8 and n + 16 from each pixel, for n in
; {0...7}. Therefore the pixels need to be transmitted 8 times (ouch) to build
; up the full 8 bit value for each channel, and perform bit-planed PWM by
; varying pulse widths on the other state machine, in ascending powers of 2.
; This avoids a lot of bit shuffling on the processors, at the cost of DMA
; bandwidth (which we have loads of).
; Might want to close your eyes before you read this
public entry_point:
.wrap_target
public shift0: ; R0 G0 B0 (Top half of 64x64 displays)
pull side 0 ; gets patched to `out null, n` if n nonzero (otherwise the PULL is required for fencing)
in osr, 1 side 0 ; Red0 N
out null, 10 side 0 ; Red0 discard
in osr, 1 side 0 ; Green0 N
out null, 10 side 0 ; Green0 discard
in osr, 1 side 0 ; Blue0 N
out null, 32 side 0 ; Remainder discard
public shift1: ; R1 G1 B1 (Bottom half of 64x64 displays)
pull side 0 ; gets patched to `out null, n` if n nonzero (otherwise the PULL is required for fencing)
in osr, 1 side 1 ; Red1 N
out null, 10 side 1 ; Red1 discard
in osr, 1 side 1 ; Green1 N
out null, 10 side 1 ; Green1 discard
in osr, 1 side 1 ; Blue1 N
out null, 32 side 1 ; Remainder discard
in null, 26 side 1 ; Note we are just doing this little manoeuvre here to get GPIOs in the order
mov pins, ::isr side 1 ; R0, G0, B0, R1, G1, B1. Can go 1 cycle faster if reversed
.wrap
; Note that because the clock edge for pixel n is in the middle of pixel n +
; 1, a dummy pixel at the end is required to clock the last piece of genuine
; data. (Also 1 pixel of garbage is clocked out at the start, but this is
; harmless)
% c-sdk {
static inline void hub75_data_rgb888_program_init(PIO pio, uint sm, uint offset, uint rgb_base_pin, uint clock_pin) {
pio_sm_set_consecutive_pindirs(pio, sm, rgb_base_pin, 6, true);
pio_sm_set_consecutive_pindirs(pio, sm, clock_pin, 1, true);
for (uint i = rgb_base_pin; i < rgb_base_pin + 6; ++i)
pio_gpio_init(pio, i);
pio_gpio_init(pio, clock_pin);
pio_sm_config c = hub75_data_rgb888_program_get_default_config(offset);
sm_config_set_out_pins(&c, rgb_base_pin, 6);
sm_config_set_sideset_pins(&c, clock_pin);
sm_config_set_out_shift(&c, true, true, 32);
// ISR shift to left. R0 ends up at bit 5. We push it up to MSB and then flip the register.
sm_config_set_in_shift(&c, false, false, 32);
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);
pio_sm_init(pio, sm, offset, &c);
pio_sm_exec(pio, sm, offset + hub75_data_rgb888_offset_entry_point);
pio_sm_set_enabled(pio, sm, true);
}
// Patch a data program at `offset` to preshift pixels by `shamt`
static inline void hub75_data_rgb888_set_shift(PIO pio, uint sm, uint offset, uint shamt) {
uint16_t instr;
if (shamt == 0)
instr = pio_encode_pull(false, true); // blocking PULL
else
instr = pio_encode_out(pio_null, shamt);
pio->instr_mem[offset + hub75_data_rgb888_offset_shift0] = instr;
pio->instr_mem[offset + hub75_data_rgb888_offset_shift1] = instr;
}
%}

View File

@ -39,13 +39,13 @@ namespace pimoroni {
}
void ICP10125::reset() {
uint16_t command = __bswap16(SOFT_RESET);
uint16_t command = __builtin_bswap16(SOFT_RESET);
i2c->write_blocking(address, (uint8_t *)&command, 2, false);
sleep_ms(10); // Soft reset time is 170us but you can never be too sure...
}
ICP10125::reading ICP10125::measure(meas_command cmd) {
uint16_t command = __bswap16(cmd);
uint16_t command = __builtin_bswap16(cmd);
reading result = {0.0f, 0.0f, OK};
uint16_result results[3];
@ -74,9 +74,9 @@ namespace pimoroni {
if(results[1].crc8 != crc8((uint8_t *)&results[1].data, 2)) {result.status = CRC_FAIL; return result;};
if(results[2].crc8 != crc8((uint8_t *)&results[2].data, 2)) {result.status = CRC_FAIL; return result;};
int temperature = __bswap16(results[0].data);
int temperature = __builtin_bswap16(results[0].data);
// Due to all the byte swapping nonsense I'm not sure if I've discarded the LLSB or LMSB here...
int pressure = ((int32_t)__bswap16(results[1].data) << 8) | (__bswap16(results[2].data >> 8)); // LLSB is discarded
int pressure = ((int32_t)__builtin_bswap16(results[1].data) << 8) | (__builtin_bswap16(results[2].data >> 8)); // LLSB is discarded
process_data(pressure, temperature, &result.pressure, &result.temperature);
return result;
@ -84,7 +84,7 @@ namespace pimoroni {
int ICP10125::chip_id() {
uint16_result result;
uint16_t command = __bswap16(READ_ID);
uint16_t command = __builtin_bswap16(READ_ID);
i2c->write_blocking(address, (uint8_t *)&command, 2, true);
i2c->read_blocking(address, (uint8_t *)&result, 3, false);
@ -93,12 +93,12 @@ namespace pimoroni {
return -1;
}
return __bswap16(result.data) & 0x3f;
return __builtin_bswap16(result.data) & 0x3f;
}
bool ICP10125::read_otp() {
uint16_result result[4];
uint16_t command = __bswap16(READ_OTP);
uint16_t command = __builtin_bswap16(READ_OTP);
uint8_t move_address_ptr[] = {
MOVE_ADDRESS_PTR >> 8, MOVE_ADDRESS_PTR & 0xff,
0x00,
@ -114,7 +114,7 @@ namespace pimoroni {
if(result[x].crc8 != crc8((uint8_t *)&result[x].data, 2)) {
return false;
}
sensor_constants[x] = (float)__bswap16(result[x].data);
sensor_constants[x] = (float)__builtin_bswap16(result[x].data);
}
return true;

View File

@ -0,0 +1 @@
include(inky73.cmake)

View File

@ -0,0 +1,14 @@
if(NOT TARGET shiftregister)
include(${CMAKE_CURRENT_LIST_DIR}/../shiftregister/shiftregister.cmake)
endif()
set(DRIVER_NAME inky73)
add_library(${DRIVER_NAME} INTERFACE)
target_sources(${DRIVER_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/${DRIVER_NAME}.cpp)
target_include_directories(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(${DRIVER_NAME} INTERFACE pico_stdlib hardware_spi shiftregister)

197
drivers/inky73/inky73.cpp Normal file
View File

@ -0,0 +1,197 @@
#include "inky73.hpp"
#include <cstdlib>
#include <math.h>
#include <string.h>
namespace pimoroni {
enum reg {
PSR = 0x00,
PWR = 0x01,
POF = 0x02,
PFS = 0x03,
PON = 0x04,
BTST1 = 0x05,
BTST2 = 0x06,
DSLP = 0x07,
BTST3 = 0x08,
DTM1 = 0x10,
DSP = 0x11,
DRF = 0x12,
IPC = 0x13,
PLL = 0x30,
TSC = 0x40,
TSE = 0x41,
TSW = 0x42,
TSR = 0x43,
CDI = 0x50,
LPD = 0x51,
TCON = 0x60,
TRES = 0x61,
DAM = 0x65,
REV = 0x70,
FLG = 0x71,
AMV = 0x80,
VV = 0x81,
VDCS = 0x82,
T_VDCS = 0x84,
AGID = 0x86,
CMDH = 0xAA,
CCSET =0xE0,
PWS = 0xE3,
TSSET = 0xE6 // E5 or E6
};
bool Inky73::is_busy() {
return !(sr.read() & 128);
}
void Inky73::busy_wait(uint timeout_ms) {
absolute_time_t timeout = make_timeout_time_ms(timeout_ms);
while(is_busy() && !time_reached(timeout)) {
tight_loop_contents();
}
}
void Inky73::reset() {
gpio_put(RESET, 0); sleep_ms(10);
gpio_put(RESET, 1); sleep_ms(10);
busy_wait();
}
void Inky73::init() {
// configure spi interface and pins
spi_init(spi, 20'000'000);
gpio_set_function(DC, GPIO_FUNC_SIO);
gpio_set_dir(DC, GPIO_OUT);
gpio_set_function(CS, GPIO_FUNC_SIO);
gpio_set_dir(CS, GPIO_OUT);
gpio_put(CS, 1);
gpio_set_function(RESET, GPIO_FUNC_SIO);
gpio_set_dir(RESET, GPIO_OUT);
gpio_put(RESET, 1);
gpio_set_function(SCK, GPIO_FUNC_SPI);
gpio_set_function(MOSI, GPIO_FUNC_SPI);
};
void Inky73::setup() {
reset();
busy_wait();
command(CMDH, {0x49, 0x55, 0x20, 0x08, 0x09, 0x18});
command(PWR, {0x3F, 0x00, 0x32, 0x2A, 0x0E, 0x2A});
if (rotation == ROTATE_0) {
command(PSR, {0x53, 0x69});
} else {
command(PSR, {0x5F, 0x69});
}
//command(PSR, {0x5F, 0x69});
command(PFS, {0x00, 0x54, 0x00, 0x44});
command(BTST1, {0x40, 0x1F, 0x1F, 0x2C});
command(BTST2, {0x6F, 0x1F, 0x16, 0x25});
command(BTST3, {0x6F, 0x1F, 0x1F, 0x22});
command(IPC, {0x00, 0x04});
command(PLL, {0x02});
command(TSE, {0x00});
command(CDI, {0x3F});
command(TCON, {0x02, 0x00});
command(TRES, {0x03, 0x20, 0x01, 0xE0});
command(VDCS, {0x1E});
command(T_VDCS, {0x00});
command(AGID, {0x00});
command(PWS, {0x2F});
command(CCSET, {0x00});
command(TSSET, {0x00});
}
void Inky73::set_blocking(bool blocking) {
this->blocking = blocking;
}
void Inky73::power_off() {
busy_wait();
command(POF); // turn off
}
void Inky73::command(uint8_t reg, size_t len, const uint8_t *data) {
gpio_put(CS, 0);
gpio_put(DC, 0); // command mode
spi_write_blocking(spi, &reg, 1);
if(len > 0) {
gpio_put(DC, 1); // data mode
spi_write_blocking(spi, (const uint8_t*)data, len);
}
gpio_put(CS, 1);
}
void Inky73::data(size_t len, const uint8_t *data) {
gpio_put(CS, 0);
gpio_put(DC, 1); // data mode
spi_write_blocking(spi, (const uint8_t*)data, len);
gpio_put(CS, 1);
}
void Inky73::command(uint8_t reg, std::initializer_list<uint8_t> values) {
command(reg, values.size(), (uint8_t *)values.begin());
}
void Inky73::update(PicoGraphics *graphics) {
if(graphics->pen_type != PicoGraphics::PEN_INKY7) return; // Incompatible buffer
if(blocking) {
busy_wait();
}
setup();
gpio_put(CS, 0);
uint8_t reg = DTM1;
gpio_put(DC, 0); // command mode
spi_write_blocking(spi, &reg, 1);
gpio_put(DC, 1); // data mode
uint totalLength = 0;
gpio_put(CS, 1);
graphics->frame_convert(PicoGraphics::PEN_INKY7, [this, &totalLength](void *buf, size_t length) {
if (length > 0) {
gpio_put(CS, 0);
spi_write_blocking(spi, (const uint8_t*)buf, length);
totalLength += length;
gpio_put(CS, 1);
}
});
gpio_put(DC, 0); // data mode
gpio_put(CS, 1);
busy_wait();
command(PON, {0}); // turn on
busy_wait();
command(DRF, {0}); // start display refresh
busy_wait();
if(blocking) {
busy_wait();
command(POF); // turn off
}
}
bool Inky73::is_pressed(Button button) {
return sr.read() & button;
}
}

94
drivers/inky73/inky73.hpp Normal file
View File

@ -0,0 +1,94 @@
#pragma once
#include <initializer_list>
#include "pico/stdlib.h"
#include "hardware/spi.h"
#include "hardware/gpio.h"
#include "common/pimoroni_common.hpp"
#include "common/pimoroni_bus.hpp"
#include "libraries/pico_graphics/pico_graphics.hpp"
#include "drivers/shiftregister/shiftregister.hpp"
namespace pimoroni {
class Inky73 : public DisplayDriver {
//--------------------------------------------------
// Variables
//--------------------------------------------------
private:
spi_inst_t *spi = PIMORONI_SPI_DEFAULT_INSTANCE;
// interface pins with our standard defaults where appropriate
uint CS = SPI_BG_FRONT_CS;
uint DC = 28; // 27;
uint SCK = SPI_DEFAULT_SCK;
uint MOSI = SPI_DEFAULT_MOSI;
uint RESET = 27; //25;
uint SR_CLOCK = 8;
uint SR_LATCH = 9;
uint SR_DATA = 10;
bool blocking = false;
ShiftRegister<uint8_t> sr = ShiftRegister<uint8_t>(SR_CLOCK, SR_LATCH, SR_DATA);
public:
enum Button : uint8_t {
BUTTON_A = 1,
BUTTON_B = 2,
BUTTON_C = 4,
BUTTON_D = 8,
BUTTON_E = 16
};
enum colour : uint8_t {
BLACK = 0,
WHITE = 1,
GREEN = 2,
BLUE = 3,
RED = 4,
YELLOW = 5,
ORANGE = 6,
CLEAN = 7
};
Inky73(uint16_t width, uint16_t height) : Inky73(width, height, ROTATE_0, {PIMORONI_SPI_DEFAULT_INSTANCE, SPI_BG_FRONT_CS, SPI_DEFAULT_SCK, SPI_DEFAULT_MOSI, PIN_UNUSED, 28, PIN_UNUSED}) {};
Inky73(uint16_t width, uint16_t height, SPIPins pins, uint reset=27) : Inky73(width, height, ROTATE_0, pins, reset) {};
Inky73(uint16_t width, uint16_t height, Rotation rotation, SPIPins pins, uint reset=27) :
DisplayDriver(width, height, rotation),
spi(pins.spi),
CS(pins.cs), DC(pins.dc), SCK(pins.sck), MOSI(pins.mosi), RESET(reset) {
init();
}
//--------------------------------------------------
// Methods
//--------------------------------------------------
public:
void busy_wait(uint timeout_ms=45000);
void reset();
void power_off();
bool is_busy() override;
void update(PicoGraphics *graphics) override;
void set_blocking(bool blocking);
bool is_pressed(Button button);
private:
void init();
void setup();
void command(uint8_t reg, size_t len, const uint8_t *data);
void command(uint8_t reg, std::initializer_list<uint8_t> values);
void command(uint8_t reg, const uint8_t data) {command(reg, 0, &data);};
void command(uint8_t reg) {command(reg, 0, nullptr);};
void data(size_t len, const uint8_t *data);
};
}

View File

@ -320,8 +320,21 @@ namespace pimoroni {
Pin::adc(1, 7, 0)}
{}
bool IOExpander::init(bool skipChipIdCheck) {
bool succeeded = true;
bool IOExpander::init(bool skipChipIdCheck, bool perform_reset) {
if(!skipChipIdCheck) {
uint16_t chip_id = get_chip_id();
if(chip_id != CHIP_ID) {
if(debug) {
printf("Chip ID invalid: %04x expected: %04x\n", chip_id, CHIP_ID);
}
return false;
}
}
// Reset the chip if requested, to put it into a known state
if(perform_reset && !reset()) {
return false;
}
if(interrupt != PIN_UNUSED) {
gpio_set_function(interrupt, GPIO_FUNC_SIO);
@ -331,17 +344,36 @@ namespace pimoroni {
enable_interrupt_out(true);
}
if(!skipChipIdCheck) {
uint16_t chip_id = get_chip_id();
if(chip_id != CHIP_ID) {
if(debug) {
printf("Chip ID invalid: %04x expected: %04x\n", chip_id, CHIP_ID);
}
succeeded = false;
return true;
}
uint8_t IOExpander::check_reset() {
uint8_t user_flash_reg = reg::USER_FLASH;
uint8_t value;
if(i2c_write_blocking(i2c->get_i2c(), address, &user_flash_reg, 1, false) == PICO_ERROR_GENERIC) {
return 0x00;
}
if(i2c_read_blocking(i2c->get_i2c(), address, (uint8_t *)&value, sizeof(uint8_t), false) == PICO_ERROR_GENERIC) {
return 0x00;
}
return value;
}
bool IOExpander::reset() {
uint32_t start_time = millis();
set_bits(reg::CTRL, ctrl_mask::RESET);
// Wait for a register to read its initialised value
while(check_reset() != 0x78) {
sleep_ms(1);
if(millis() - start_time >= RESET_TIMEOUT_MS) {
if(debug)
printf("Timed out waiting for Reset!");
return false;
}
}
return succeeded;
return true;
}
i2c_inst_t* IOExpander::get_i2c() const {
@ -370,7 +402,7 @@ namespace pimoroni {
void IOExpander::set_address(uint8_t address) {
set_bit(reg::CTRL, 4);
i2c->reg_write_uint8(address, reg::ADDR, address);
i2c->reg_write_uint8(this->address, reg::ADDR, address);
this->address = address;
sleep_ms(250); //TODO Handle addr change IOError better
//wait_for_flash()
@ -491,13 +523,35 @@ namespace pimoroni {
return divider_good;
}
void IOExpander::set_pwm_period(uint16_t value, bool load) {
void IOExpander::set_pwm_period(uint16_t value, bool load, bool wait_for_load) {
value &= 0xffff;
i2c->reg_write_uint8(address, reg::PWMPL, (uint8_t)(value & 0xff));
i2c->reg_write_uint8(address, reg::PWMPH, (uint8_t)(value >> 8));
if(load)
pwm_load();
pwm_load(wait_for_load);
}
uint16_t IOExpander::set_pwm_frequency(float frequency, bool load, bool wait_for_load) {
uint32_t period = (uint32_t)(CLOCK_FREQ / frequency);
if (period / 128 > MAX_PERIOD) {
return MAX_PERIOD;
}
if (period < 2) {
return 2;
}
uint8_t divider = 1;
while ((period > MAX_PERIOD) && (divider < MAX_DIVIDER)) {
period >>= 1;
divider <<= 1;
}
period = MIN(period, MAX_PERIOD); // Should be unnecessary because of earlier raised errors, but kept in case
set_pwm_control(divider);
set_pwm_period((uint16_t)(period - 1), load, wait_for_load);
return (uint16_t)period;
}
uint8_t IOExpander::get_mode(uint8_t pin) {
@ -669,7 +723,7 @@ namespace pimoroni {
}
}
void IOExpander::output(uint8_t pin, uint16_t value, bool load) {
void IOExpander::output(uint8_t pin, uint16_t value, bool load, bool wait_for_load) {
if(pin < 1 || pin > NUM_PINS) {
printf("Pin should be in range 1-14.");
return;
@ -685,7 +739,7 @@ namespace pimoroni {
i2c->reg_write_uint8(address, io_pin.reg_pwml, (uint8_t)(value & 0xff));
i2c->reg_write_uint8(address, io_pin.reg_pwmh, (uint8_t)(value >> 8));
if(load)
pwm_load();
pwm_load(wait_for_load);
}
else {
if(value == LOW) {

View File

@ -26,6 +26,8 @@ namespace pimoroni {
static const uint8_t PIN_MODE_PWM = 0b00101; // PWM, Output, Push-Pull mode
static const uint8_t PIN_MODE_ADC = 0b01010; // ADC, Input-only (high-impedance)
static const uint32_t RESET_TIMEOUT_MS = 1000;
public:
static const uint8_t DEFAULT_I2C_ADDRESS = 0x18;
@ -45,6 +47,10 @@ namespace pimoroni {
static const uint16_t LOW = 0;
static const uint16_t HIGH = 1;
static const uint32_t CLOCK_FREQ = 24000000;
static const uint32_t MAX_PERIOD = (1 << 16) - 1;
static const uint32_t MAX_DIVIDER = (1 << 7);
//--------------------------------------------------
// Subclasses
@ -171,7 +177,12 @@ namespace pimoroni {
// Methods
//--------------------------------------------------
public:
bool init(bool skip_chip_id_check = false);
bool init(bool skip_chip_id_check = false, bool perform_reset = false);
private:
uint8_t check_reset();
public:
bool reset();
// For print access in micropython
i2c_inst_t* get_i2c() const;
@ -198,7 +209,8 @@ namespace pimoroni {
void pwm_clear(bool wait_for_clear = true);
bool pwm_clearing();
bool set_pwm_control(uint8_t divider);
void set_pwm_period(uint16_t value, bool load = true);
void set_pwm_period(uint16_t value, bool load = true, bool wait_for_load = true);
uint16_t set_pwm_frequency(float frequency, bool load = true, bool wait_for_load = true);
uint8_t get_mode(uint8_t pin);
void set_mode(uint8_t pin, uint8_t mode, bool schmitt_trigger = false, bool invert = false);
@ -206,7 +218,7 @@ namespace pimoroni {
int16_t input(uint8_t pin, uint32_t adc_timeout = 1);
float input_as_voltage(uint8_t pin, uint32_t adc_timeout = 1);
void output(uint8_t pin, uint16_t value, bool load = true);
void output(uint8_t pin, uint16_t value, bool load = true, bool wait_for_load = true);
void setup_rotary_encoder(uint8_t channel, uint8_t pin_a, uint8_t pin_b, uint8_t pin_c = 0, bool count_microsteps = false);
int16_t read_rotary_encoder(uint8_t channel);

View File

@ -8,10 +8,11 @@ namespace pimoroni {
static const uint8_t DOT_CHAR_WIDTH = 5;
struct DotChar {
uint16_t code;
uint8_t data[DOT_CHAR_WIDTH];
};
static const std::map<uint16_t, DotChar> dotfont = {
static const DotChar dotfont[] = {
{32, {0x00, 0x00, 0x00, 0x00, 0x00}}, // (space)
{33, {0x00, 0x00, 0x5f, 0x00, 0x00}}, // !
{34, {0x00, 0x07, 0x00, 0x07, 0x00}}, // "

View File

@ -27,8 +27,8 @@ namespace pimoroni {
return i2c->get_scl();
}
void LTP305::set_brightness(uint8_t brightness, bool update) {
brightness = std::min((uint8_t)MAX_BRIGHTNESS, brightness);
void LTP305::set_brightness(uint8_t brightness_, bool update) {
brightness = std::min((uint8_t)MAX_BRIGHTNESS, brightness_);
if(update)
i2c->reg_write_uint8(address, CMD_BRIGHTNESS, brightness);
}
@ -64,13 +64,18 @@ namespace pimoroni {
}
void LTP305::set_character(uint8_t x, uint16_t ch) {
std::map<uint16_t, DotChar>::const_iterator it = dotfont.find(ch);
const uint8_t *data = nullptr;
for(const auto& c : dotfont) {
if(c.code == ch) {
data = &c.data[0];
break;
}
}
if(it != dotfont.end()) {
DotChar dchar = it->second;
if(data) {
for(uint8_t cx = 0; cx < DOT_CHAR_WIDTH; cx++) {
for(uint8_t cy = 0; cy < HEIGHT; cy++) {
uint8_t c = dchar.data[cx] & (0b1 << cy);
uint8_t c = data[cx] & (0b1 << cy);
set_pixel(x + cx, cy, c);
}
}
@ -123,4 +128,4 @@ namespace pimoroni {
i2c->reg_write_uint8(address, CMD_BRIGHTNESS, brightness);
i2c->reg_write_uint8(address, CMD_UPDATE, 0x01);
}
}
}

View File

@ -2,30 +2,6 @@
#include <algorithm>
namespace pimoroni {
lookup::lookup(std::initializer_list<uint16_t> values) : lut(values) {
}
uint8_t lookup::index(uint16_t value) {
auto it = find(lut.begin(), lut.end(), value);
if(it == lut.end())
return 0;
return it - lut.begin();
}
uint16_t lookup::value(uint8_t index) {
return lut[index];
}
pimoroni::lookup LTR559::lookup_led_current({5, 10, 20, 50, 100});
pimoroni::lookup LTR559::lookup_led_duty_cycle({25, 50, 75, 100});
pimoroni::lookup LTR559::lookup_led_pulse_freq({30, 40, 50, 60, 70, 80, 90, 100});
pimoroni::lookup LTR559::lookup_proximity_meas_rate({10, 50, 70, 100, 200, 500, 1000, 2000});
pimoroni::lookup LTR559::lookup_light_integration_time({100, 50, 200, 400, 150, 250, 300, 350});
pimoroni::lookup LTR559::lookup_light_repeat_rate({50, 100, 200, 500, 1000, 2000});
pimoroni::lookup LTR559::lookup_light_gain({1, 2, 4, 8, 0, 0, 48, 96});
bool LTR559::init() {
if(interrupt != PIN_UNUSED) {
gpio_set_function(interrupt, GPIO_FUNC_SIO);
@ -129,7 +105,7 @@ namespace pimoroni {
i2c->read_bytes(address, LTR559_ALS_DATA_CH1, (uint8_t *)&als, 4);
data.als0 = als[1];
data.als1 = als[0];
data.gain = this->lookup_light_gain.value((status >> LTR559_ALS_PS_STATUS_ALS_GAIN_SHIFT) & LTR559_ALS_PS_STATUS_ALS_GAIN_MASK);
data.gain = lookup_light_gain[(status >> LTR559_ALS_PS_STATUS_ALS_GAIN_SHIFT) & LTR559_ALS_PS_STATUS_ALS_GAIN_MASK];
data.ratio = 101.0f;
@ -148,7 +124,7 @@ namespace pimoroni {
float lux = ((int32_t)data.als0 * ch0_c[ch_idx]) - ((int32_t)data.als1 * ch1_c[ch_idx]);
lux /= (float)this->data.integration_time / 100.0f;
lux /= (float)this->data.gain;
data.lux = (uint16_t)(lux / 10000.0f);
data.lux = lux / 10000.0f;
}
return has_updated;
@ -163,12 +139,12 @@ namespace pimoroni {
}
void LTR559::proximity_led(uint8_t current, uint8_t duty_cycle, uint8_t pulse_freq, uint8_t num_pulses) {
current = lookup_led_current.index(current);
current = lookup<lookup_led_current>(current);
duty_cycle = lookup_led_duty_cycle.index(duty_cycle);
duty_cycle = lookup<lookup_led_duty_cycle>(duty_cycle);
duty_cycle <<= LTR559_PS_LED_DUTY_CYCLE_SHIFT;
pulse_freq = lookup_led_pulse_freq.index(pulse_freq);
pulse_freq = lookup<lookup_led_pulse_freq>(pulse_freq);
pulse_freq <<= LTR559_PS_LED_PULSE_FREQ_SHIFT;
uint8_t buf = current | duty_cycle | pulse_freq;
@ -180,7 +156,7 @@ namespace pimoroni {
void LTR559::light_control(bool active, uint8_t gain) {
uint8_t buf = 0;
gain = lookup_light_gain.index(gain);
gain = lookup<lookup_light_gain>(gain);
buf |= gain << LTR559_ALS_CONTROL_GAIN_SHIFT;
if(active)
@ -223,8 +199,8 @@ namespace pimoroni {
void LTR559::light_measurement_rate(uint16_t integration_time, uint16_t rate) {
data.integration_time = integration_time;
integration_time = lookup_light_integration_time.index(integration_time);
rate = lookup_light_repeat_rate.index(rate);
integration_time = lookup<lookup_light_integration_time>(integration_time);
rate = lookup<lookup_light_repeat_rate>(rate);
uint8_t buf = 0;
buf |= rate;
buf |= integration_time << LTR559_ALS_MEAS_RATE_INTEGRATION_TIME_SHIFT;
@ -232,7 +208,7 @@ namespace pimoroni {
}
void LTR559::proximity_measurement_rate(uint16_t rate) {
uint8_t buf = lookup_proximity_meas_rate.index(rate);
uint8_t buf = lookup<lookup_proximity_meas_rate>(rate);
i2c->write_bytes(address, LTR559_PS_MEAS_RATE, &buf, 1);
}

View File

@ -94,18 +94,9 @@ namespace pimoroni {
uint16_t integration_time;
uint16_t gain;
float ratio;
uint16_t lux;
float lux;
} ltr559_reading;
class lookup {
private:
std::vector<uint16_t> lut;
public:
lookup(std::initializer_list<uint16_t> values);
uint8_t index(uint16_t value);
uint16_t value(uint8_t index);
};
class LTR559 {
//--------------------------------------------------
// Constants
@ -131,14 +122,13 @@ namespace pimoroni {
const uint8_t address = DEFAULT_I2C_ADDRESS;
uint interrupt = PIN_UNUSED;
static pimoroni::lookup lookup_led_current;
static pimoroni::lookup lookup_led_duty_cycle;
static pimoroni::lookup lookup_led_pulse_freq;
static pimoroni::lookup lookup_proximity_meas_rate;
static pimoroni::lookup lookup_light_integration_time;
static pimoroni::lookup lookup_light_repeat_rate;
static pimoroni::lookup lookup_light_gain;
static constexpr uint16_t lookup_led_current[5] = {5, 10, 20, 50, 100};
static constexpr uint16_t lookup_led_duty_cycle[4] = {25, 50, 75, 100};
static constexpr uint16_t lookup_led_pulse_freq[8] = {30, 40, 50, 60, 70, 80, 90, 100};
static constexpr uint16_t lookup_proximity_meas_rate[8] = {10, 50, 70, 100, 200, 500, 1000, 2000};
static constexpr uint16_t lookup_light_integration_time[8] = {100, 50, 200, 400, 150, 250, 300, 350};
static constexpr uint16_t lookup_light_repeat_rate[6] = {50, 100, 200, 500, 1000, 2000};
static constexpr uint16_t lookup_light_gain[8] = {1, 2, 4, 8, 0, 0, 48, 96};
//--------------------------------------------------
// Constructors/Destructor
@ -177,6 +167,15 @@ namespace pimoroni {
void proximity_measurement_rate(uint16_t rate);
void proximity_offset(uint16_t offset);
template<auto T>
const uint16_t lookup(uint16_t value) {
size_t length = sizeof(T) / sizeof(uint16_t);
for(auto i = 0u; i < length; i++) {
if(T[i] == value) return i;
}
return 0;
}
private:
uint16_t bit12_to_uint16(uint16_t value);
uint16_t uint16_to_bit12(uint16_t value);

View File

@ -0,0 +1 @@
include(mlx90640.cmake)

View File

@ -0,0 +1,50 @@
#include "src/headers/MLX90640_I2C_Driver.h"
#include "mlx90640.hpp"
#include "stdio.h"
static pimoroni::I2C *i2c;
void MLX90640_I2CConfigure(pimoroni::I2C *i2c_instance) {
i2c = i2c_instance;
}
void MLX90640_I2CInit()
{
// i2c->init(); // Called in constructor
}
int MLX90640_I2CGeneralReset(void)
{
return 0;
}
int MLX90640_I2CRead(uint8_t slaveAddr, uint16_t startAddress, uint16_t nMemAddressRead, uint16_t *data)
{
uint8_t cmd[2] = {(char)(startAddress >> 8), (char)(startAddress & 0xFF)};
// Set 16-bit register pointer
i2c->write_blocking(slaveAddr, cmd, sizeof(cmd), true);
// Read result
i2c->read_blocking(slaveAddr, (uint8_t*)data, nMemAddressRead * sizeof(uint16_t), false);
for(auto n = 0u; n < nMemAddressRead; n++) {
data[n] = __builtin_bswap16(data[n]);
}
return 0;
}
void MLX90640_I2CFreqSet(int freq)
{
// We can't assume we own the I2C instance and can wiggle the baudrate ad-hoc
}
int MLX90640_I2CWrite(uint8_t slaveAddr, uint16_t writeAddress, uint16_t data)
{
uint8_t cmd[4] = {(char)(writeAddress >> 8), (char)(writeAddress & 0x00FF), (char)(data >> 8), (char)(data & 0x00FF)};
i2c->write_blocking(slaveAddr, cmd, sizeof(cmd), false);
return 0;
}

View File

@ -0,0 +1,13 @@
set(DRIVER_NAME mlx90640)
add_library(${DRIVER_NAME} INTERFACE)
target_sources(${DRIVER_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/src/functions/MLX90640_API.cpp
${CMAKE_CURRENT_LIST_DIR}/MLX90640_RP2040_I2C_Driver.cpp
${CMAKE_CURRENT_LIST_DIR}/mlx90640.cpp
)
target_link_libraries(${DRIVER_NAME} INTERFACE pico_stdlib hardware_i2c pimoroni_i2c)
target_include_directories(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
target_include_directories(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR}/src/headers)

View File

@ -0,0 +1,92 @@
#include <stdint.h>
#include <iostream>
#include <cstring>
#include <fstream>
#include <chrono>
#include <thread>
#include <math.h>
#include "src/headers/MLX90640_API.h"
#include "mlx90640.hpp"
namespace pimoroni {
MLX90640::MLX90640_Error MLX90640::setup(int fps){
MLX90640_I2CConfigure(i2c_instance);
//MLX90640_SetDeviceMode(i2c_address, 0);
//MLX90640_SetSubPageRepeat(i2c_address, 0);
switch(fps){
case 1:
MLX90640_SetRefreshRate(i2c_address, 0b001);
break;
case 2:
MLX90640_SetRefreshRate(i2c_address, 0b010);
break;
case 4:
MLX90640_SetRefreshRate(i2c_address, 0b011);
break;
case 8:
MLX90640_SetRefreshRate(i2c_address, 0b100);
break;
case 16:
MLX90640_SetRefreshRate(i2c_address, 0b101);
if(i2c_instance->get_baudrate() < 1000000) {
return INVALID_BAUDRATE;
}
break;
case 32:
MLX90640_SetRefreshRate(i2c_address, 0b110);
if(i2c_instance->get_baudrate() < 1000000) {
return INVALID_BAUDRATE;
}
break;
case 64:
MLX90640_SetRefreshRate(i2c_address, 0b111);
if(i2c_instance->get_baudrate() < 1000000) {
return INVALID_BAUDRATE;
}
break;
default:
#ifdef DEBUG
printf("Unsupported framerate: %d", fps);
#endif
return INVALID_FPS;
}
//MLX90640_SetChessMode(i2c_address);
MLX90640_SetInterleavedMode(i2c_address);
//MLX90640_SetResolution(i2c_address, 0);
MLX90640_DumpEE(i2c_address, eeMLX90640);
MLX90640_ExtractParameters(eeMLX90640, &mlx90640);
return OK;
}
int MLX90640::get_image(void){
MLX90640_I2CConfigure(i2c_instance);
MLX90640_GetFrameData(i2c_address, frame0);
sleep_us(1000);
MLX90640_GetFrameData(i2c_address, frame1);
MLX90640_GetImage(frame0, &mlx90640, mlx90640To);
MLX90640_GetImage(frame1, &mlx90640, mlx90640To);
return 0;
}
int MLX90640::get_frame(void){
MLX90640_I2CConfigure(i2c_instance);
MLX90640_GetFrameData(i2c_address, frame0);
sleep_us(1000);
MLX90640_GetFrameData(i2c_address, frame1);
int tr0 = MLX90640_GetTa(frame0, &mlx90640) - reflected_temperature;
MLX90640_CalculateTo(frame0, &mlx90640, emissivity, tr0, mlx90640To);
int tr1 = MLX90640_GetTa(frame1, &mlx90640) - reflected_temperature;
MLX90640_CalculateTo(frame1, &mlx90640, emissivity, tr1, mlx90640To);
return 0;
}
}

View File

@ -0,0 +1,37 @@
#include <stdint.h>
#include "src/headers/MLX90640_API.h"
#include "common/pimoroni_i2c.hpp"
void MLX90640_I2CConfigure(pimoroni::I2C *i2c_instance);
#define MLX90640_DEFAULT_I2C_ADDRESS 0x33
namespace pimoroni {
class MLX90640 {
public:
static const int WIDTH = 32;
static const int HEIGHT = 24;
enum MLX90640_Error {
OK = 0,
INVALID_BAUDRATE = 1,
INVALID_FPS = 2,
};
float mlx90640To[WIDTH * HEIGHT] = {0.0f};
float emissivity = 1.0f;
float reflected_temperature = 8.0f;
MLX90640(pimoroni::I2C *i2c_instance, uint i2c_address=MLX90640_DEFAULT_I2C_ADDRESS) : i2c_instance(i2c_instance), i2c_address(i2c_address) {};
MLX90640_Error setup(int fps);
int get_image(void);
int get_frame(void);
private:
pimoroni::I2C *i2c_instance;
uint i2c_address = MLX90640_DEFAULT_I2C_ADDRESS;
paramsMLX90640 mlx90640;
uint16_t eeMLX90640[832] = {0};
uint16_t frame0[834] = {0};
uint16_t frame1[834] = {0};
};
}

1
drivers/mlx90640/src Submodule

@ -0,0 +1 @@
Subproject commit 4dbbc56957b6cb7fce2f7ba2d6351c3f5446f0cb

View File

@ -1,3 +1,7 @@
if(NOT TARGET pwm)
include(${CMAKE_CURRENT_LIST_DIR}/../pwm/pwm.cmake)
endif()
set(DRIVER_NAME motor)
add_library(${DRIVER_NAME} INTERFACE)

View File

@ -1,3 +1,7 @@
if(NOT TARGET pwm_cluster)
include(${CMAKE_CURRENT_LIST_DIR}/../pwm/pwm_cluster.cmake)
endif()
set(DRIVER_NAME motor_cluster)
add_library(${DRIVER_NAME} INTERFACE)

View File

@ -29,8 +29,6 @@ namespace motor {
}
MotorCluster::~MotorCluster() {
delete[] states;
delete[] configs;
}
bool MotorCluster::init() {
@ -713,10 +711,8 @@ namespace motor {
float deadzone, DecayMode mode, bool auto_phase) {
uint8_t motor_count = pwms.get_chan_pair_count();
if(motor_count > 0) {
states = new MotorState[motor_count];
configs = new motor_config[motor_count];
for(uint motor = 0; motor < motor_count; motor++) {
configs[motor] = motor_config();
states[motor] = MotorState(direction, speed_scale, zeropoint, deadzone);
configs[motor].phase = (auto_phase) ? (float)motor / (float)motor_count : 0.0f;
configs[motor].mode = mode;

View File

@ -22,12 +22,15 @@ namespace motor {
//--------------------------------------------------
// Variables
//--------------------------------------------------
public:
static const uint MAX_MOTOR_CHANNELS = 16;
private:
PWMCluster pwms;
uint32_t pwm_period;
float pwm_frequency;
MotorState* states;
motor_config* configs;
MotorState states[MAX_MOTOR_CHANNELS];
motor_config configs[MAX_MOTOR_CHANNELS];
//--------------------------------------------------

View File

@ -1,189 +1,187 @@
#include "pcf85063a.hpp"
#include <chrono>
#include <cstdio>
// binary coded decimal conversion helper functions
uint8_t bcd_encode(uint v) {
uint v10 = v / 10, v1 = v - (v10 * 10); return v1 | (v10 << 4); }
int8_t bcd_decode(uint v) {
uint v10 = (v >> 4) & 0x0f, v1 = v & 0x0f; return v1 + (v10 * 10); }
namespace pimoroni {
void PCF85063A::init() {
if(interrupt != PIN_UNUSED) {
gpio_set_function(interrupt, GPIO_FUNC_SIO);
gpio_set_dir(interrupt, GPIO_IN);
gpio_set_pulls(interrupt, false, true);
}
reset();
}
void PCF85063A::reset() {
// magic soft reset command
i2c->reg_write_uint8(address, Registers::CONTROL_1, 0x58);
// read the oscillator status bit until it is cleared
uint8_t status = 0x80;
while(status & 0x80) {
// attempt to clear oscillator stop flag, then read it back
i2c->reg_write_uint8(address, Registers::OSCILLATOR_STATUS, 0x00);
status = i2c->reg_read_uint8(address, Registers::OSCILLATOR_STATUS);
}
}
// i2c helper methods
i2c_inst_t* PCF85063A::get_i2c() const {
return i2c->get_i2c();
}
int PCF85063A::get_address() const {
return address;
}
int PCF85063A::get_sda() const {
return i2c->get_sda();
}
int PCF85063A::get_scl() const {
return i2c->get_scl();
}
int PCF85063A::get_int() const {
return interrupt;
}
datetime_t PCF85063A::get_datetime() {
static uint8_t result[7] = {0};
i2c->read_bytes(address, Registers::SECONDS, result, 7);
datetime_t dt = {
.year = (int16_t)(bcd_decode(result[6]) + 2000), // offset year
.month = ( int8_t) bcd_decode(result[5]),
.day = ( int8_t) bcd_decode(result[3]),
.dotw = ( int8_t) bcd_decode(result[4]),
.hour = ( int8_t) bcd_decode(result[2]),
.min = ( int8_t) bcd_decode(result[1]),
.sec = ( int8_t) bcd_decode(result[0] & 0x7f) // mask out status bit
};
return dt;
}
void PCF85063A::set_datetime(datetime_t *t) {
static uint8_t data[7] = {
bcd_encode((uint)t->sec),
bcd_encode((uint)t->min),
bcd_encode((uint)t->hour),
bcd_encode((uint)t->day),
bcd_encode((uint)t->dotw),
bcd_encode((uint)t->month),
bcd_encode((uint)t->year - 2000) // offset year
};
i2c->write_bytes(address, Registers::SECONDS, data, 7);
}
void PCF85063A::set_alarm(int second, int minute, int hour, int day) {
uint8_t alarm[5] = {
uint8_t(second != PARAM_UNUSED ? bcd_encode(second) : 0x80),
uint8_t(minute != PARAM_UNUSED ? bcd_encode(minute) : 0x80),
uint8_t(hour != PARAM_UNUSED ? bcd_encode( hour) : 0x80),
uint8_t(day != PARAM_UNUSED ? bcd_encode( day) : 0x80),
uint8_t(0x80)
};
i2c->write_bytes(address, Registers::SECOND_ALARM, alarm, 5);
}
void PCF85063A::set_weekday_alarm(
int second, int minute, int hour, DayOfWeek dotw) {
uint8_t alarm[5] = {
uint8_t(second != PARAM_UNUSED ? bcd_encode(second) : 0x80),
uint8_t(minute != PARAM_UNUSED ? bcd_encode(minute) : 0x80),
uint8_t(hour != PARAM_UNUSED ? bcd_encode( hour) : 0x80),
uint8_t(0x80),
uint8_t(dotw != DayOfWeek::NONE ? bcd_encode( dotw) : 0x80)
};
i2c->write_bytes(address, Registers::SECOND_ALARM, alarm, 5);
}
void PCF85063A::enable_alarm_interrupt(bool enable) {
uint8_t bits = i2c->reg_read_uint8(address, Registers::CONTROL_2);
bits = enable ? (bits | 0x80) : (bits & ~0x80);
bits |= 0x40; // ensure alarm flag isn't reset
i2c->reg_write_uint8(address, Registers::CONTROL_2, bits);
}
bool PCF85063A::read_alarm_flag() {
uint8_t bits = i2c->reg_read_uint8(address, Registers::CONTROL_2);
return bits & 0x40;
}
void PCF85063A::clear_alarm_flag() {
uint8_t bits = i2c->reg_read_uint8(address, Registers::CONTROL_2);
bits &= ~0x40;
i2c->reg_write_uint8(address, Registers::CONTROL_2, bits);
}
void PCF85063A::unset_alarm() {
uint8_t dummy[5] = {0};
i2c->write_bytes(address, Registers::SECOND_ALARM, dummy, 5);
}
void PCF85063A::set_timer(uint8_t ticks, TimerTickPeriod ttp) {
uint8_t bits = i2c->reg_read_uint8(address, Registers::TIMER_MODE);
uint8_t timer[2] = {
ticks,
uint8_t((bits & ~0x18) | (ttp << 3) | 0x04) // mask out current ttp and set new + enable
};
i2c->write_bytes(address, Registers::TIMER_VALUE, timer, 2);
}
void PCF85063A::enable_timer_interrupt(bool enable, bool flag_only) {
uint8_t bits = i2c->reg_read_uint8(address, Registers::TIMER_MODE);
bits = (bits & ~0x03) | (enable ? 0x02 : 0x00) | (flag_only ? 0x01 : 0x00);
i2c->reg_write_uint8(address, Registers::TIMER_MODE, bits);
}
bool PCF85063A::read_timer_flag() {
uint8_t bits = i2c->reg_read_uint8(address, Registers::CONTROL_2);
return bits & 0x08;
}
void PCF85063A::clear_timer_flag() {
uint8_t bits = i2c->reg_read_uint8(address, Registers::CONTROL_2);
bits &= ~0x08;
i2c->reg_write_uint8(address, Registers::CONTROL_2, bits);
}
void PCF85063A::unset_timer() {
uint8_t bits = i2c->reg_read_uint8(address, Registers::TIMER_MODE);
bits &= ~0x04;
i2c->reg_write_uint8(address, Registers::TIMER_MODE, bits);
}
// set the speed of (or turn off) the clock output
void PCF85063A::set_clock_output(ClockOut co) {
uint8_t bits = i2c->reg_read_uint8(address, Registers::CONTROL_2);
bits = (bits & ~0x07) | uint8_t(co);
i2c->reg_write_uint8(
address, Registers::CONTROL_2, bits);
}
void PCF85063A::set_byte(uint8_t v) {
i2c->reg_write_uint8(address, Registers::RAM_BYTE, v);
}
uint8_t PCF85063A::get_byte() {
return i2c->reg_read_uint8(address, Registers::RAM_BYTE);
}
}
#include "pcf85063a.hpp"
#include <chrono>
#include <cstdio>
// binary coded decimal conversion helper functions
uint8_t bcd_encode(uint v) {
uint v10 = v / 10, v1 = v - (v10 * 10); return v1 | (v10 << 4); }
int8_t bcd_decode(uint v) {
uint v10 = (v >> 4) & 0x0f, v1 = v & 0x0f; return v1 + (v10 * 10); }
namespace pimoroni {
void PCF85063A::init() {
if(interrupt != PIN_UNUSED) {
gpio_set_function(interrupt, GPIO_FUNC_SIO);
gpio_set_dir(interrupt, GPIO_IN);
gpio_set_pulls(interrupt, false, true);
}
}
void PCF85063A::reset() {
// magic soft reset command
i2c->reg_write_uint8(address, Registers::CONTROL_1, 0x58);
// read the oscillator status bit until it is cleared
uint8_t status = 0x80;
while(status & 0x80) {
// attempt to clear oscillator stop flag, then read it back
i2c->reg_write_uint8(address, Registers::OSCILLATOR_STATUS, 0x00);
status = i2c->reg_read_uint8(address, Registers::OSCILLATOR_STATUS);
}
}
// i2c helper methods
i2c_inst_t* PCF85063A::get_i2c() const {
return i2c->get_i2c();
}
int PCF85063A::get_address() const {
return address;
}
int PCF85063A::get_sda() const {
return i2c->get_sda();
}
int PCF85063A::get_scl() const {
return i2c->get_scl();
}
int PCF85063A::get_int() const {
return interrupt;
}
datetime_t PCF85063A::get_datetime() {
uint8_t result[7] = {0};
i2c->read_bytes(address, Registers::SECONDS, result, 7);
datetime_t dt = {
.year = (int16_t)(bcd_decode(result[6]) + 2000), // offset year
.month = ( int8_t) bcd_decode(result[5]),
.day = ( int8_t) bcd_decode(result[3]),
.dotw = ( int8_t) bcd_decode(result[4]),
.hour = ( int8_t) bcd_decode(result[2]),
.min = ( int8_t) bcd_decode(result[1]),
.sec = ( int8_t) bcd_decode(result[0] & 0x7f) // mask out status bit
};
return dt;
}
void PCF85063A::set_datetime(datetime_t *t) {
uint8_t data[7] = {
bcd_encode((uint)t->sec),
bcd_encode((uint)t->min),
bcd_encode((uint)t->hour),
bcd_encode((uint)t->day),
bcd_encode((uint)t->dotw),
bcd_encode((uint)t->month),
bcd_encode((uint)t->year - 2000) // offset year
};
i2c->write_bytes(address, Registers::SECONDS, data, 7);
}
void PCF85063A::set_alarm(int second, int minute, int hour, int day) {
uint8_t alarm[5] = {
uint8_t(second != PARAM_UNUSED ? bcd_encode(second) : 0x80),
uint8_t(minute != PARAM_UNUSED ? bcd_encode(minute) : 0x80),
uint8_t(hour != PARAM_UNUSED ? bcd_encode( hour) : 0x80),
uint8_t(day != PARAM_UNUSED ? bcd_encode( day) : 0x80),
uint8_t(0x80)
};
i2c->write_bytes(address, Registers::SECOND_ALARM, alarm, 5);
}
void PCF85063A::set_weekday_alarm(
int second, int minute, int hour, DayOfWeek dotw) {
uint8_t alarm[5] = {
uint8_t(second != PARAM_UNUSED ? bcd_encode(second) : 0x80),
uint8_t(minute != PARAM_UNUSED ? bcd_encode(minute) : 0x80),
uint8_t(hour != PARAM_UNUSED ? bcd_encode( hour) : 0x80),
uint8_t(0x80),
uint8_t(dotw != DayOfWeek::NONE ? bcd_encode( dotw) : 0x80)
};
i2c->write_bytes(address, Registers::SECOND_ALARM, alarm, 5);
}
void PCF85063A::enable_alarm_interrupt(bool enable) {
uint8_t bits = i2c->reg_read_uint8(address, Registers::CONTROL_2);
bits = enable ? (bits | 0x80) : (bits & ~0x80);
bits |= 0x40; // ensure alarm flag isn't reset
i2c->reg_write_uint8(address, Registers::CONTROL_2, bits);
}
bool PCF85063A::read_alarm_flag() {
uint8_t bits = i2c->reg_read_uint8(address, Registers::CONTROL_2);
return bits & 0x40;
}
void PCF85063A::clear_alarm_flag() {
uint8_t bits = i2c->reg_read_uint8(address, Registers::CONTROL_2);
bits &= ~0x40;
i2c->reg_write_uint8(address, Registers::CONTROL_2, bits);
}
void PCF85063A::unset_alarm() {
uint8_t dummy[5] = {0};
i2c->write_bytes(address, Registers::SECOND_ALARM, dummy, 5);
}
void PCF85063A::set_timer(uint8_t ticks, TimerTickPeriod ttp) {
uint8_t bits = i2c->reg_read_uint8(address, Registers::TIMER_MODE);
uint8_t timer[2] = {
ticks,
uint8_t((bits & ~0x18) | (ttp << 3) | 0x04) // mask out current ttp and set new + enable
};
i2c->write_bytes(address, Registers::TIMER_VALUE, timer, 2);
}
void PCF85063A::enable_timer_interrupt(bool enable, bool flag_only) {
uint8_t bits = i2c->reg_read_uint8(address, Registers::TIMER_MODE);
bits = (bits & ~0x03) | (enable ? 0x02 : 0x00) | (flag_only ? 0x01 : 0x00);
i2c->reg_write_uint8(address, Registers::TIMER_MODE, bits);
}
bool PCF85063A::read_timer_flag() {
uint8_t bits = i2c->reg_read_uint8(address, Registers::CONTROL_2);
return bits & 0x08;
}
void PCF85063A::clear_timer_flag() {
uint8_t bits = i2c->reg_read_uint8(address, Registers::CONTROL_2);
bits &= ~0x08;
i2c->reg_write_uint8(address, Registers::CONTROL_2, bits);
}
void PCF85063A::unset_timer() {
uint8_t bits = i2c->reg_read_uint8(address, Registers::TIMER_MODE);
bits &= ~0x04;
i2c->reg_write_uint8(address, Registers::TIMER_MODE, bits);
}
// set the speed of (or turn off) the clock output
void PCF85063A::set_clock_output(ClockOut co) {
uint8_t bits = i2c->reg_read_uint8(address, Registers::CONTROL_2);
bits = (bits & ~0x07) | uint8_t(co);
i2c->reg_write_uint8(
address, Registers::CONTROL_2, bits);
}
void PCF85063A::set_byte(uint8_t v) {
i2c->reg_write_uint8(address, Registers::RAM_BYTE, v);
}
uint8_t PCF85063A::get_byte() {
return i2c->reg_read_uint8(address, Registers::RAM_BYTE);
}
}

View File

@ -14,7 +14,9 @@ found here: https://github.com/raspberrypi/pico-examples/tree/master/pio/apa102
#include <math.h>
#include <cstdint>
#ifndef NO_QSTR
#include "apa102.pio.h"
#endif
#include "pico/stdlib.h"
#include "hardware/pio.h"

View File

@ -14,7 +14,9 @@ found here: https://github.com/raspberrypi/pico-examples/tree/master/pio/ws2812
#include <math.h>
#include <cstdint>
#ifndef NO_QSTR
#include "ws2812.pio.h"
#endif
#include "pico/stdlib.h"
#include "hardware/pio.h"

View File

@ -0,0 +1 @@
include(psram_display.cmake)

View File

@ -0,0 +1,10 @@
set(DRIVER_NAME psram_display)
add_library(${DRIVER_NAME} INTERFACE)
target_sources(${DRIVER_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/${DRIVER_NAME}.cpp)
target_include_directories(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(${DRIVER_NAME} INTERFACE pico_stdlib hardware_spi)

View File

@ -0,0 +1,75 @@
#include "psram_display.hpp"
#include <cstdlib>
#include <math.h>
#include <string.h>
namespace pimoroni {
enum reg {
WRITE = 0x02,
READ = 0x03,
RESET_ENABLE = 0x66,
RESET = 0x99
};
void PSRamDisplay::init() {
uint baud = spi_init(spi, 31'250'000);
printf("PSRam connected at %u\n", baud);
gpio_set_function(CS, GPIO_FUNC_SIO);
gpio_set_dir(CS, GPIO_OUT);
gpio_put(CS, 1);
gpio_set_function(SCK, GPIO_FUNC_SPI);
gpio_set_function(MOSI, GPIO_FUNC_SPI);
gpio_set_function(MISO, GPIO_FUNC_SPI);
gpio_put(CS, 0);
uint8_t command_buffer[2] = {RESET_ENABLE, RESET};
spi_write_blocking(spi, command_buffer, 2);
gpio_put(CS, 1);
}
void PSRamDisplay::write(uint32_t address, size_t len, const uint8_t *data)
{
gpio_put(CS, 0);
uint8_t command_buffer[4] = {WRITE, (uint8_t)((address >> 16) & 0xFF), (uint8_t)((address >> 8) & 0xFF), (uint8_t)(address & 0xFF)};
spi_write_blocking(spi, command_buffer, 4);
spi_write_blocking(spi, data, len);
gpio_put(CS, 1);
}
void PSRamDisplay::write(uint32_t address, size_t len, const uint8_t byte)
{
gpio_put(CS, 0);
uint8_t command_buffer[4] = {WRITE, (uint8_t)((address >> 16) & 0xFF), (uint8_t)((address >> 8) & 0xFF), (uint8_t)(address & 0xFF)};
spi_write_blocking(spi, command_buffer, 4);
SpiSetBlocking(byte, len);
gpio_put(CS, 1);
}
void PSRamDisplay::read(uint32_t address, size_t len, uint8_t *data)
{
gpio_put(CS, 0);
uint8_t command_buffer[4] = {READ, (uint8_t)((address >> 16) & 0xFF), (uint8_t)((address >> 8) & 0xFF), (uint8_t)(address & 0xFF)};
spi_write_blocking(spi, command_buffer, 4);
spi_read_blocking(spi, 0, data, len);
gpio_put(CS, 1);
}
void PSRamDisplay::write_pixel(const Point &p, uint8_t colour)
{
write(pointToAddress(p), 1, colour);
}
void PSRamDisplay::write_pixel_span(const Point &p, uint l, uint8_t colour)
{
write(pointToAddress(p), l, colour);
}
void PSRamDisplay::read_pixel_span(const Point &p, uint l, uint8_t *data)
{
read(pointToAddress(p), l, data);
}
}

View File

@ -0,0 +1,128 @@
#pragma once
#include <cstring>
#include "pico/stdlib.h"
#include "hardware/spi.h"
#include "hardware/gpio.h"
#include "common/pimoroni_common.hpp"
#include "common/pimoroni_bus.hpp"
#include "libraries/pico_graphics/pico_graphics.hpp"
// 8 MB PSRam
namespace pimoroni {
class PSRamDisplay : public IDirectDisplayDriver<uint8_t> {
//--------------------------------------------------
// Variables
//--------------------------------------------------
private:
spi_inst_t *spi = PIMORONI_SPI_DEFAULT_INSTANCE;
// interface pins with our standard defaults where appropriate
uint CS = 3;
uint DC = PIN_UNUSED;
uint SCK = SPI_DEFAULT_SCK;
uint MOSI = SPI_DEFAULT_MOSI;
uint MISO = SPI_DEFAULT_MISO;
uint32_t start_address = 0;
uint16_t width = 0;
uint16_t height = 0;
absolute_time_t timeout;
bool blocking = false;
public:
enum colour : uint8_t {
BLACK = 0,
WHITE = 1,
GREEN = 2,
BLUE = 3,
RED = 4,
YELLOW = 5,
ORANGE = 6,
CLEAN = 7
};
PSRamDisplay(uint16_t width, uint16_t height) : PSRamDisplay(width, height, {PIMORONI_SPI_DEFAULT_INSTANCE, 3, SPI_DEFAULT_SCK, SPI_DEFAULT_MOSI, PIN_UNUSED, PIN_UNUSED, PIN_UNUSED}) {};
PSRamDisplay(uint16_t width, uint16_t height, SPIPins pins) :
spi(pins.spi),
CS(pins.cs), DC(pins.dc), SCK(pins.sck), MOSI(pins.mosi),
width(width), height(height) {
init();
}
//--------------------------------------------------
// Methods
//--------------------------------------------------
public:
void test(void){
char writeBuffer[1024];
char readBuffer[1024];
uint mb = 8;
for(uint k = 0; k < 1024*mb; k++)
{
sprintf(writeBuffer, "%u", k);
write(k*1024, strlen(writeBuffer)+1, (uint8_t *)writeBuffer);
}
bool bSame = true;
for(uint k = 0; k < 1024*mb && bSame; k++)
{
sprintf(writeBuffer, "%u", k);
read(k*1024, strlen(writeBuffer)+1, (uint8_t *)readBuffer);
bSame = strcmp(writeBuffer, readBuffer) ==0;
printf("[%u] %s == %s ? %s\n", k, writeBuffer, readBuffer, bSame ? "Success" : "Failure");
}
}
void write_pixel(const Point &p, uint8_t colour) override;
void write_pixel_span(const Point &p, uint l, uint8_t colour) override;
void read_pixel_span(const Point &p, uint l, uint8_t *data) override;
int __not_in_flash_func(SpiSetBlocking)(const uint16_t uSrc, size_t uLen)
{
invalid_params_if(SPI, 0 > (int)uLen);
// Deliberately overflow FIFO, then clean up afterward, to minimise amount
// of APB polling required per halfword
for (size_t i = 0; i < uLen; ++i) {
while (!spi_is_writable(spi))
tight_loop_contents();
spi_get_hw(spi)->dr = uSrc;
}
while (spi_is_readable(spi))
(void)spi_get_hw(spi)->dr;
while (spi_get_hw(spi)->sr & SPI_SSPSR_BSY_BITS)
tight_loop_contents();
while (spi_is_readable(spi))
(void)spi_get_hw(spi)->dr;
// Don't leave overrun flag set
spi_get_hw(spi)->icr = SPI_SSPICR_RORIC_BITS;
return (int)uLen;
}
private:
void init();
void write(uint32_t address, size_t len, const uint8_t *data);
void write(uint32_t address, size_t len, const uint8_t byte);
void read(uint32_t address, size_t len, uint8_t *data);
uint32_t pointToAddress(const Point &p)
{
return start_address + (p.y * width) + p.x;
}
};
}

View File

@ -1,7 +1,10 @@
#include "pwm_cluster.hpp"
#include "hardware/gpio.h"
#include "hardware/clocks.h"
#ifndef NO_QSTR
#include "pwm_cluster.pio.h"
#endif
// Uncomment the below line to enable debugging
//#define DEBUG_MULTI_PWM
@ -27,7 +30,6 @@ PWMCluster::PWMCluster(PIO pio, uint sm, uint pin_mask, bool loading_zone)
, sm(sm)
, pin_mask(pin_mask & ((1u << NUM_BANK0_GPIOS) - 1))
, channel_count(0)
, channels(nullptr)
, wrap_level(0)
, loading_zone(loading_zone) {
@ -48,7 +50,6 @@ PWMCluster::PWMCluster(PIO pio, uint sm, uint pin_base, uint pin_count, bool loa
, sm(sm)
, pin_mask(0x00000000)
, channel_count(0)
, channels(nullptr)
, wrap_level(0)
, loading_zone(loading_zone) {
@ -68,7 +69,6 @@ PWMCluster::PWMCluster(PIO pio, uint sm, const uint8_t *pins, uint32_t length, b
, sm(sm)
, pin_mask(0x00000000)
, channel_count(0)
, channels(nullptr)
, wrap_level(0)
, loading_zone(loading_zone) {
@ -90,7 +90,6 @@ PWMCluster::PWMCluster(PIO pio, uint sm, std::initializer_list<uint8_t> pins, bo
, sm(sm)
, pin_mask(0x00000000)
, channel_count(0)
, channels(nullptr)
, wrap_level(0)
, loading_zone(loading_zone) {
@ -111,7 +110,6 @@ PWMCluster::PWMCluster(PIO pio, uint sm, const pin_pair *pin_pairs, uint32_t len
, sm(sm)
, pin_mask(0x00000000)
, channel_count(0)
, channels(nullptr)
, wrap_level(0)
, loading_zone(loading_zone) {
@ -137,7 +135,6 @@ PWMCluster::PWMCluster(PIO pio, uint sm, std::initializer_list<pin_pair> pin_pai
, sm(sm)
, pin_mask(0x00000000)
, channel_count(0)
, channels(nullptr)
, wrap_level(0)
, loading_zone(loading_zone) {
@ -159,8 +156,8 @@ PWMCluster::PWMCluster(PIO pio, uint sm, std::initializer_list<pin_pair> pin_pai
void PWMCluster::constructor_common() {
// Initialise all the channels this PWM will control
if(channel_count > 0) {
channels = new ChannelState[channel_count];
for(uint i = 0; i < channel_count; i++) {
channels[i] = ChannelState();
}
// Set up the transition buffers
@ -216,8 +213,6 @@ PWMCluster::~PWMCluster() {
gpio_set_function(channel_to_pin_map[channel], GPIO_FUNC_NULL);
}
}
delete[] channels;
}
void PWMCluster::dma_interrupt_handler() {

View File

@ -24,6 +24,7 @@ namespace pimoroni {
public:
static const uint BUFFER_SIZE = 64; // Set to 64, the maximum number of single rises and falls for 32 channels within a looping time period
static const uint NUM_BUFFERS = 3;
static const uint MAX_PWM_CHANNELS = 32;
//--------------------------------------------------
@ -104,7 +105,7 @@ namespace pimoroni {
int dma_channel;
uint pin_mask;
uint8_t channel_count;
ChannelState* channels;
ChannelState channels[NUM_BANK0_GPIOS];
uint8_t channel_to_pin_map[NUM_BANK0_GPIOS];
uint wrap_level;

View File

@ -7,7 +7,9 @@
#define _PIO_SPI_H
#include "hardware/pio.h"
#ifndef NO_QSTR
#include "spi.pio.h"
#endif
typedef struct pio_spi_inst {
PIO pio;

View File

@ -10,7 +10,7 @@ namespace servo {
}
Calibration::Calibration()
: calibration(nullptr), calibration_size(0), limit_lower(true), limit_upper(true) {
: calibration_size(0), limit_lower(true), limit_upper(true) {
}
Calibration::Calibration(CalibrationType default_type)
@ -19,7 +19,7 @@ namespace servo {
}
Calibration::Calibration(const Calibration &other)
: calibration(nullptr), calibration_size(0), limit_lower(other.limit_lower), limit_upper(other.limit_upper) {
: calibration_size(0), limit_lower(other.limit_lower), limit_upper(other.limit_upper) {
uint size = other.size();
apply_blank_pairs(size);
for(uint i = 0; i < size; i++) {
@ -28,10 +28,6 @@ namespace servo {
}
Calibration::~Calibration() {
if(calibration != nullptr) {
delete[] calibration;
calibration = nullptr;
}
}
Calibration &Calibration::operator=(const Calibration &other) {
@ -57,16 +53,13 @@ namespace servo {
}
void Calibration::apply_blank_pairs(uint size) {
if(calibration != nullptr) {
delete[] calibration;
}
if(size > 0) {
calibration = new Pair[size];
for(auto i = 0u; i < size; i++) {
calibration[i] = Pair();
}
calibration_size = size;
}
else {
calibration = nullptr;
calibration_size = 0;
}
}

View File

@ -19,6 +19,8 @@ namespace servo {
static constexpr float DEFAULT_MID_PULSE = 1500.0f; // in microseconds
static constexpr float DEFAULT_MAX_PULSE = 2500.0f; // in microseconds
static const uint MAX_CALIBRATION_PAIRS = 32;
private:
static constexpr float LOWER_HARD_LIMIT = 400.0f; // The minimum microsecond pulse to send
static constexpr float UPPER_HARD_LIMIT = 2600.0f; // The maximum microsecond pulse to send
@ -110,7 +112,7 @@ namespace servo {
// Variables
//--------------------------------------------------
private:
Pair* calibration;
Pair calibration[MAX_CALIBRATION_PAIRS];
uint calibration_size;
bool limit_lower;
bool limit_upper;

View File

@ -1,3 +1,7 @@
if(NOT TARGET pwm)
include(${CMAKE_CURRENT_LIST_DIR}/../pwm/pwm.cmake)
endif()
set(DRIVER_NAME servo)
add_library(${DRIVER_NAME} INTERFACE)

View File

@ -1,3 +1,7 @@
if(NOT TARGET pwm_cluster)
include(${CMAKE_CURRENT_LIST_DIR}/../pwm/pwm_cluster.cmake)
endif()
set(DRIVER_NAME servo_cluster)
add_library(${DRIVER_NAME} INTERFACE)

View File

@ -44,8 +44,6 @@ namespace servo {
}
ServoCluster::~ServoCluster() {
delete[] states;
delete[] servo_phases;
}
bool ServoCluster::init() {
@ -502,9 +500,6 @@ namespace servo {
void ServoCluster::create_servo_states(CalibrationType default_type, bool auto_phase) {
uint8_t servo_count = pwms.get_chan_count();
if(servo_count > 0) {
states = new ServoState[servo_count];
servo_phases = new float[servo_count];
for(uint servo = 0; servo < servo_count; servo++) {
states[servo] = ServoState(default_type);
servo_phases[servo] = (auto_phase) ? (float)servo / (float)servo_count : 0.0f;
@ -515,9 +510,6 @@ namespace servo {
void ServoCluster::create_servo_states(const Calibration& calibration, bool auto_phase) {
uint8_t servo_count = pwms.get_chan_count();
if(servo_count > 0) {
states = new ServoState[servo_count];
servo_phases = new float[servo_count];
for(uint servo = 0; servo < servo_count; servo++) {
states[servo] = ServoState(calibration);
servo_phases[servo] = (auto_phase) ? (float)servo / (float)servo_count : 0.0f;

View File

@ -12,12 +12,14 @@ namespace servo {
//--------------------------------------------------
// Variables
//--------------------------------------------------
public:
static const uint MAX_SERVO_CHANNELS = 32;
private:
PWMCluster pwms;
uint32_t pwm_period;
float pwm_frequency;
ServoState* states;
float* servo_phases;
ServoState states[MAX_SERVO_CHANNELS];
float servo_phases[MAX_SERVO_CHANNELS];
//--------------------------------------------------

View File

@ -0,0 +1 @@
include(shiftregister.cmake)

View File

@ -0,0 +1,10 @@
set(DRIVER_NAME shiftregister)
add_library(${DRIVER_NAME} INTERFACE)
target_sources(${DRIVER_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/${DRIVER_NAME}.cpp)
target_include_directories(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(${DRIVER_NAME} INTERFACE pico_stdlib)

View File

@ -0,0 +1,5 @@
#include "shiftregister.hpp"
namespace pimoroni {
}

View File

@ -0,0 +1,48 @@
#pragma once
#include "pico/stdlib.h"
#include "hardware/spi.h"
#include "hardware/gpio.h"
namespace pimoroni {
template<typename T> class ShiftRegister {
private:
uint CLOCK = 0;
uint LATCH = 0;
uint DATA = 0;
public:
ShiftRegister(uint clock, uint latch, uint data) :
CLOCK(clock),
LATCH(latch),
DATA(data) {
gpio_init(CLOCK);
gpio_set_function(CLOCK, GPIO_FUNC_SIO);
gpio_set_dir(CLOCK, GPIO_OUT);
gpio_init(LATCH);
gpio_set_function(LATCH, GPIO_FUNC_SIO);
gpio_set_dir(LATCH, GPIO_OUT);
gpio_init(DATA);
gpio_set_function(DATA, GPIO_FUNC_SIO);
gpio_set_dir(DATA, GPIO_IN);
}
T read() {
gpio_put(LATCH, 0);
__asm("NOP;");
gpio_put(LATCH, 1);
__asm("NOP;");
T out = 0;
for (auto i = 0u; i < sizeof(T) * 8; i++) {
out <<= 1;
out |= gpio_get(DATA);
gpio_put(CLOCK, 1);
__asm("NOP;");
gpio_put(CLOCK, 0);
__asm("NOP;");
}
return out;
}
};
}

View File

@ -0,0 +1 @@
include(st7567.cmake)

42
drivers/st7567/README.md Normal file
View File

@ -0,0 +1,42 @@
# ST7567 Display Driver for Pimoroni LCDs <!-- omit in toc -->
The ST7567 driver supports Serial (SPI) ST7567 displays and is intended for use with:
* Pico GFX Pack
## Setup
Construct an instance of the ST7567 driver with SPI pins.
SPI:
```c++
ST7567 st7567(WIDTH, HEIGHT, {
PIMORONI_SPI_DEFAULT_INSTANCE, // SPI instance
SPI_BG_FRONT_CS, // Chip-select
SPI_DEFAULT_SCK, // SPI Clock
SPI_DEFAULT_MOSI, // SPI Out
PIN_UNUSED, // SPI In
SPI_DEFAULT_DC, // SPI Data/Command
PIN_UNUSED // Backlight
});
```
## Reference
### Update
ST7567's `update` accepts an instance of `PicoGraphics` in 1 bit colour mode:
```c++
st7567.update(&graphics);
```
### Set Backlight
If a backlight pin has been configured, you can set the backlight from 0 to 255:
```c++
st7567.set_backlight(128)
```

View File

@ -0,0 +1,10 @@
set(DRIVER_NAME st7567)
add_library(${DRIVER_NAME} INTERFACE)
target_sources(${DRIVER_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/${DRIVER_NAME}.cpp)
target_include_directories(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(${DRIVER_NAME} INTERFACE pico_stdlib pimoroni_bus hardware_spi hardware_pwm pico_graphics)

183
drivers/st7567/st7567.cpp Normal file
View File

@ -0,0 +1,183 @@
#include "st7567.hpp"
#include <math.h>
#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c"
#define BYTE_TO_BINARY(byte) \
(byte & 0x80 ? '1' : '0'), \
(byte & 0x40 ? '1' : '0'), \
(byte & 0x20 ? '1' : '0'), \
(byte & 0x10 ? '1' : '0'), \
(byte & 0x08 ? '1' : '0'), \
(byte & 0x04 ? '1' : '0'), \
(byte & 0x02 ? '1' : '0'), \
(byte & 0x01 ? '1' : '0')
namespace pimoroni {
enum reg : uint8_t {
DISPOFF = 0xAE,//
DISPON = 0xAF,//
SETSTARTLINE = 0x40,//
STARTLINE_MASK = 0x3f,//
REG_RATIO = 0x20,//
SETPAGESTART = 0xb0,//
PAGESTART_MASK = 0x07,//
SETCOLL = 0x00, // # 0x00-0x0f: Set lower column address */
COLL_MASK = 0x0f,//
SETCOLH = 0x10, //# 0x10-0x1f: Set higher column address */
COLH_MASK = 0x0F,//
SEG_DIR_NORMAL = 0xa0, //# 0xa0: Column address 0 is mapped to SEG0 */
SEG_DIR_REV = 0xa1, //# 0xa1: Column address 128 is mapped to S
DISPNORMAL = 0xa6, //# 0xa6: Normal display */
DISPINVERSE = 0xa7, //# 0xa7: Inverse disp
DISPRAM = 0xa4, //# 0xa4: Resume to RAM content display */
DISPENTIRE = 0xa5, //# 0xa5: Entire display
BIAS_1_9 = 0xa2, //# 0xa2: Select BIAS setting 1/9 */
BIAS_1_7 = 0xa3, // # 0xa3: Select BIAS setting
ENTER_RMWMODE = 0xe0, //# 0xe0: Enter the Read Modify Write mode */
EXIT_RMWMODE = 0xee, //# 0xee: Leave the Read Modify Write mode */
EXIT_SOFTRST = 0xe2, // # 0xe2: Software RE
SETCOMNORMAL = 0xc0, //# 0xc0: Set COM output direction, normal mode */
SETCOMREVERSE = 0xc8, // # 0xc8: Set COM output direction, reverse m
POWERCTRL_VF = 0x29, //# 0x29: Control built-in power circuit */
POWERCTRL_VR = 0x2a, //# 0x2a: Control built-in power circuit */
POWERCTRL_VB = 0x2c, //# 0x2c: Control built-in power circuit */
POWERCTRL = 0x2f, // # 0x2c: Control built-in power circ
REG_RES_RR0 = 0x21, //# 0x21: Regulation Resistior ratio */
REG_RES_RR1 = 0x22, //# 0x22: Regulation Resistior ratio */
REG_RES_RR2 = 0x24, // # 0x24: Regulation Resistior ra
SETCONTRAST = 0x81, // # 0x81: Set contrast cont
SETBOOSTER = 0xf8, //# Set booster level */
SETBOOSTER4X = 0x00, //# Set booster level */
SETBOOSTER5X = 0x01 , // # Set booster le
NOP = 0xe3, //# 0xe3: NOP Command for no operation */
STARTBYTES = 0,
};
void ST7567::reset() {
if(reset_pin == PIN_UNUSED)
return;
gpio_put(reset_pin, 0); sleep_ms(10);
sleep_ms(100);
gpio_put(reset_pin, 1); sleep_ms(10);
sleep_ms(100);
}
void ST7567::init(bool auto_init_sequence) {
spi_init(spi, spi_baud);
gpio_set_function(reset_pin, GPIO_FUNC_SIO);
gpio_set_dir(reset_pin, GPIO_OUT);
gpio_set_function(dc, GPIO_FUNC_SIO);
gpio_set_dir(dc, GPIO_OUT);
gpio_set_function(cs, GPIO_FUNC_SIO);
gpio_set_dir(cs, GPIO_OUT);
gpio_set_function(sck, GPIO_FUNC_SPI);
gpio_set_function(mosi, GPIO_FUNC_SPI);
// if a backlight pin is provided then set it up for
// pwm control
if(bl != PIN_UNUSED) {
pwm_config cfg = pwm_get_default_config();
pwm_set_wrap(pwm_gpio_to_slice_num(bl), 65535);
pwm_init(pwm_gpio_to_slice_num(bl), &cfg, true);
gpio_set_function(bl, GPIO_FUNC_PWM);
set_backlight(0); // Turn backlight off initially to avoid nasty surprises
}
//reset display
reset();
// if auto_init_sequence then send initialisation sequence
// for our standard displays based on the width and height
if(auto_init_sequence) {
command(reg::BIAS_1_7);
command(reg::SEG_DIR_NORMAL);
command(reg::SETCOMREVERSE);
command(reg::DISPNORMAL);
command(reg::SETSTARTLINE | 0x00); //Startline from 0x40-0x7F
command(reg::POWERCTRL);
command(reg::REG_RATIO | 4);
command(reg::DISPON);
command(reg::SETCONTRAST);
command(30); // defalut contrast level
}
if(bl != PIN_UNUSED) {
set_backlight(255); // Turn backlight on now surprises have passed
}
}
void ST7567::command(uint8_t command, size_t len, const char *data) {
gpio_put(cs, 0);
gpio_put(dc, 0); // command mode
spi_write_blocking(spi, &command, 1);
gpio_put(cs, 1);
sleep_us(100);
if(data) {
gpio_put(cs, 0);
gpio_put(dc, 1); // data mode
spi_write_blocking(spi, (const uint8_t*)data, len);
gpio_put(cs, 1);
}
}
// Native 16-bit framebuffer update
void ST7567::update(PicoGraphics *graphics) {
uint8_t *fb = (uint8_t *)graphics->frame_buffer;
uint8_t page_buffer[PAGESIZE];
uint8_t page_byte_selector;
uint8_t page_bit_selector;
for(uint8_t page=0; page < 8 ; page++) { //select page
for(uint16_t pixel_index=0 ; pixel_index < (PAGESIZE * 8) ; pixel_index++) { //cycle through a page worth of bits from the fb
page_byte_selector = ((pixel_index % 128));
page_bit_selector = (pixel_index / 128);
if(*fb & (0b10000000 >> (pixel_index % 8))) { // check selected pixel is present
page_buffer[page_byte_selector] |= (1 << page_bit_selector);
}
else {
page_buffer[page_byte_selector] &= ~( 1 << page_bit_selector);
}
if((pixel_index % 8) >= 7) { //increment fb pointer at end of byte
fb++;
}
}
if(graphics->pen_type == PicoGraphics::PEN_1BIT) {
command(reg::ENTER_RMWMODE);
command(reg::SETPAGESTART | page);
command(reg::SETCOLL);
command(reg::SETCOLH);
gpio_put(dc, 1); // data mode
gpio_put(cs, 0);
spi_write_blocking(spi, &page_buffer[0], PAGESIZE );
gpio_put(cs, 1);
gpio_put(dc, 0); // Back to command mode
}
else { //other pen types incompatable
return;
}
}
gpio_put(cs, 1);
}
void ST7567::set_backlight(uint8_t brightness) {
// gamma correct the provided 0-255 brightness value onto a
// 0-65535 range for the pwm counter
float gamma = 2.8;
uint16_t value = (uint16_t)(pow((float)(brightness) / 255.0f, gamma) * 65535.0f + 0.5f);
pwm_set_gpio_level(bl, value);
}
}

64
drivers/st7567/st7567.hpp Normal file
View File

@ -0,0 +1,64 @@
#pragma once
#include "hardware/spi.h"
#include "hardware/pwm.h"
#include "common/pimoroni_bus.hpp"
#include "libraries/pico_graphics/pico_graphics.hpp"
namespace pimoroni {
class ST7567 : public DisplayDriver {
//--------------------------------------------------
// Constants
//--------------------------------------------------
private:
static const uint8_t ROWS = 64;
static const uint8_t COLS = 128;
static const uint8_t PAGESIZE = 128;
//--------------------------------------------------
// Variables
//--------------------------------------------------
private:
spi_inst_t *spi = spi0;
uint32_t dma_channel;
// interface pins with our standard defaults where appropriate
uint cs;
uint dc;
uint sck;
uint mosi;
uint bl;
uint reset_pin=21;
uint32_t spi_baud = 10000000; //10Mhz
uint8_t offset_cols = 0;
uint8_t offset_rows = 0;
//--------------------------------------------------
// Constructors/Destructor
//--------------------------------------------------
public:
ST7567(uint16_t width, uint16_t height, SPIPins pins) :
DisplayDriver(width, height, ROTATE_0),
spi(pins.spi), cs(pins.cs), dc(pins.dc), sck(pins.sck), mosi(pins.mosi), bl(pins.bl) {
init();
}
//--------------------------------------------------
// Methods
//--------------------------------------------------
public:
void update(PicoGraphics *graphics) override;
void set_backlight(uint8_t brightness) override;
void reset();
private:
void init(bool auto_init_sequence = true);
void command(uint8_t command, size_t len = 0, const char *data = NULL);
};
}

View File

@ -172,8 +172,10 @@ namespace pimoroni {
gpio_put(dc, 1); // data mode
gpio_put(cs, 0);
graphics->scanline_convert(PicoGraphics::PEN_RGB565, [this](void *data, size_t length) {
spi_write_blocking(spi, (const uint8_t*)data, length);
graphics->frame_convert(PicoGraphics::PEN_RGB565, [this](void *data, size_t length) {
if (length > 0) {
spi_write_blocking(spi, (const uint8_t*)data, length);
}
});
gpio_put(cs, 1);

View File

@ -89,11 +89,19 @@ namespace pimoroni {
if(width == 320 && height == 240) {
command(reg::GCTRL, 1, "\x35");
command(reg::VCOMS, 1, "\x1f");
command(0xd6, 1, "\xa1"); // ???
command(reg::GMCTRP1, 14, "\xD0\x08\x11\x08\x0C\x15\x39\x33\x50\x36\x13\x14\x29\x2D");
command(reg::GMCTRN1, 14, "\xD0\x08\x10\x08\x06\x06\x39\x44\x51\x0B\x16\x14\x2F\x31");
}
if(width == 240 && height == 135) { // Pico Display Pack (1.14" 240x135)
command(reg::VRHS, 1, "\x00"); // VRH Voltage setting
command(reg::GCTRL, 1, "\x75"); // VGH and VGL voltages
command(reg::VCOMS, 1, "\x3D"); // VCOM voltage
command(0xd6, 1, "\xa1"); // ???
command(reg::GMCTRP1, 14, "\x70\x04\x08\x09\x09\x05\x2A\x33\x41\x07\x13\x13\x29\x2f");
command(reg::GMCTRN1, 14, "\x70\x03\x09\x0A\x09\x06\x2B\x34\x41\x07\x12\x14\x28\x2E");
}
command(reg::INVON); // set inversion mode
command(reg::SLPOUT); // leave sleep mode
command(reg::DISPON); // turn display on
@ -110,11 +118,11 @@ namespace pimoroni {
}
void ST7789::cleanup() {
if(spi) return; // SPI mode needs no tear down
if(dma_channel_is_claimed(parallel_dma)) {
dma_channel_abort(parallel_dma);
dma_channel_unclaim(parallel_dma);
if(dma_channel_is_claimed(st_dma)) {
dma_channel_abort(st_dma);
dma_channel_unclaim(st_dma);
}
if(spi) return; // SPI mode needs no further tear down
if(pio_sm_is_claimed(parallel_pio, parallel_sm)) {
pio_sm_set_enabled(parallel_pio, parallel_sm, false);
@ -125,8 +133,6 @@ namespace pimoroni {
void ST7789::configure_display(Rotation rotate) {
bool rotate180 = rotate == ROTATE_180 || rotate == ROTATE_90;
if(rotate == ROTATE_90 || rotate == ROTATE_270) {
std::swap(width, height);
}
@ -177,20 +183,30 @@ namespace pimoroni {
// Pico Display
if(width == 240 && height == 135) {
caset[0] = 40; // 240 cols
caset[1] = 279;
raset[0] = 53; // 135 rows
raset[1] = 187;
madctl = rotate180 ? MADCTL::ROW_ORDER : MADCTL::COL_ORDER;
caset[1] = 40 + width - 1;
raset[0] = 52; // 135 rows
raset[1] = 52 + height - 1;
if (rotate == ROTATE_0) {
raset[0] += 1;
raset[1] += 1;
}
madctl = rotate == ROTATE_180 ? MADCTL::ROW_ORDER : MADCTL::COL_ORDER;
madctl |= MADCTL::SWAP_XY | MADCTL::SCAN_ORDER;
}
// Pico Display at 90 degree rotation
if(width == 135 && height == 240) {
caset[0] = 52; // 135 cols
caset[1] = 186;
caset[1] = 52 + width - 1;
raset[0] = 40; // 240 rows
raset[1] = 279;
madctl = rotate180 ? (MADCTL::COL_ORDER | MADCTL::ROW_ORDER) : 0;
raset[1] = 40 + height - 1;
madctl = 0;
if (rotate == ROTATE_90) {
caset[0] += 1;
caset[1] += 1;
madctl = MADCTL::COL_ORDER | MADCTL::ROW_ORDER;
}
madctl = rotate == ROTATE_90 ? (MADCTL::COL_ORDER | MADCTL::ROW_ORDER) : 0;
}
// Pico Display 2.0
@ -199,7 +215,7 @@ namespace pimoroni {
caset[1] = 319;
raset[0] = 0;
raset[1] = 239;
madctl = rotate180 ? MADCTL::ROW_ORDER : MADCTL::COL_ORDER;
madctl = (rotate == ROTATE_180 || rotate == ROTATE_90) ? MADCTL::ROW_ORDER : MADCTL::COL_ORDER;
madctl |= MADCTL::SWAP_XY | MADCTL::SCAN_ORDER;
}
@ -209,7 +225,7 @@ namespace pimoroni {
caset[1] = 239;
raset[0] = 0;
raset[1] = 319;
madctl = rotate180 ? (MADCTL::COL_ORDER | MADCTL::ROW_ORDER) : 0;
madctl = (rotate == ROTATE_180 || rotate == ROTATE_90) ? (MADCTL::COL_ORDER | MADCTL::ROW_ORDER) : 0;
}
// Byte swap the 16bit rows/cols values
@ -223,37 +239,21 @@ namespace pimoroni {
command(reg::MADCTL, 1, (char *)&madctl);
}
void ST7789::write_blocking_parallel_dma(const uint8_t *src, size_t len) {
while (dma_channel_is_busy(parallel_dma))
void ST7789::write_blocking_dma(const uint8_t *src, size_t len) {
while (dma_channel_is_busy(st_dma))
;
dma_channel_set_trans_count(parallel_dma, len, false);
dma_channel_set_read_addr(parallel_dma, src, true);
dma_channel_set_trans_count(st_dma, len, false);
dma_channel_set_read_addr(st_dma, src, true);
}
void ST7789::write_blocking_parallel(const uint8_t *src, size_t len) {
const uint8_t *p = src;
while(len--) {
// Does not byte align correctly
//pio_sm_put_blocking(parallel_pio, parallel_sm, *p);
while (pio_sm_is_tx_fifo_full(parallel_pio, parallel_sm))
;
*(volatile uint8_t*)&parallel_pio->txf[parallel_sm] = *p;
p++;
}
write_blocking_dma(src, len);
dma_channel_wait_for_finish_blocking(st_dma);
uint32_t sm_stall_mask = 1u << (parallel_sm + PIO_FDEBUG_TXSTALL_LSB);
parallel_pio->fdebug = sm_stall_mask;
while (!(parallel_pio->fdebug & sm_stall_mask))
;
/*uint32_t mask = 0xff << d0;
while(len--) {
gpio_put(wr_sck, false);
uint8_t v = *src++;
gpio_put_masked(mask, v << d0);
//asm("nop;");
gpio_put(wr_sck, true);
asm("nop;");
}*/
// This may cause a race between PIO and the
// subsequent chipselect deassert for the last pixel
while(!pio_sm_is_tx_fifo_empty(parallel_pio, parallel_sm))
;
}
void ST7789::command(uint8_t command, size_t len, const char *data) {
@ -284,33 +284,23 @@ namespace pimoroni {
if(graphics->pen_type == PicoGraphics::PEN_RGB565) { // Display buffer is screen native
command(cmd, width * height * sizeof(uint16_t), (const char*)graphics->frame_buffer);
} else if(spi) { // SPI Bus
} else {
gpio_put(dc, 0); // command mode
gpio_put(cs, 0);
spi_write_blocking(spi, &cmd, 1);
if(spi) { // SPI Bus
spi_write_blocking(spi, &cmd, 1);
} else { // Parallel Bus
write_blocking_parallel(&cmd, 1);
}
gpio_put(dc, 1); // data mode
graphics->scanline_convert(PicoGraphics::PEN_RGB565, [this](void *data, size_t length) {
spi_write_blocking(spi, (const uint8_t*)data, length);
});
gpio_put(cs, 1);
} else { // Parallel Bus
gpio_put(dc, 0); // command mode
gpio_put(cs, 0);
write_blocking_parallel(&cmd, 1);
gpio_put(dc, 1); // data mode
int scanline = 0;
graphics->scanline_convert(PicoGraphics::PEN_RGB565, [this, scanline](void *data, size_t length) mutable {
write_blocking_parallel_dma((const uint8_t*)data, length);
// Stall on the last scanline since "data" goes out of scope and is lost
scanline++;
if(scanline == height) {
while (dma_channel_is_busy(parallel_dma))
;
graphics->frame_convert(PicoGraphics::PEN_RGB565, [this](void *data, size_t length) {
if (length > 0) {
write_blocking_dma((const uint8_t*)data, length);
}
else {
dma_channel_wait_for_finish_blocking(st_dma);
}
});

View File

@ -5,12 +5,15 @@
#include "hardware/gpio.h"
#include "hardware/pio.h"
#include "hardware/pwm.h"
#include "hardware/clocks.h"
#include "common/pimoroni_common.hpp"
#include "common/pimoroni_bus.hpp"
#include "libraries/pico_graphics/pico_graphics.hpp"
#ifndef NO_QSTR
#include "st7789_parallel.pio.h"
#endif
#include <algorithm>
@ -39,7 +42,7 @@ namespace pimoroni {
uint parallel_sm;
PIO parallel_pio;
uint parallel_offset;
uint parallel_dma;
uint st_dma;
// The ST7789 requires 16 ns between SPI rising edges.
@ -82,18 +85,23 @@ namespace pimoroni {
sm_config_set_sideset_pins(&c, wr_sck);
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);
sm_config_set_out_shift(&c, false, true, 8);
sm_config_set_clkdiv(&c, 4);
// Determine clock divider
constexpr uint32_t max_pio_clk = 32 * MHZ;
const uint32_t sys_clk_hz = clock_get_hz(clk_sys);
const uint32_t clk_div = (sys_clk_hz + max_pio_clk - 1) / max_pio_clk;
sm_config_set_clkdiv(&c, clk_div);
pio_sm_init(parallel_pio, parallel_sm, parallel_offset, &c);
pio_sm_set_enabled(parallel_pio, parallel_sm, true);
parallel_dma = dma_claim_unused_channel(true);
dma_channel_config config = dma_channel_get_default_config(parallel_dma);
st_dma = dma_claim_unused_channel(true);
dma_channel_config config = dma_channel_get_default_config(st_dma);
channel_config_set_transfer_data_size(&config, DMA_SIZE_8);
channel_config_set_bswap(&config, false);
channel_config_set_dreq(&config, pio_get_dreq(parallel_pio, parallel_sm, true));
dma_channel_configure(parallel_dma, &config, &parallel_pio->txf[parallel_sm], NULL, 0, false);
dma_channel_configure(st_dma, &config, &parallel_pio->txf[parallel_sm], NULL, 0, false);
gpio_put(rd_sck, 1);
@ -112,6 +120,13 @@ namespace pimoroni {
gpio_set_function(wr_sck, GPIO_FUNC_SPI);
gpio_set_function(d0, GPIO_FUNC_SPI);
st_dma = dma_claim_unused_channel(true);
dma_channel_config config = dma_channel_get_default_config(st_dma);
channel_config_set_transfer_data_size(&config, DMA_SIZE_8);
channel_config_set_bswap(&config, false);
channel_config_set_dreq(&config, spi_get_dreq(spi, true));
dma_channel_configure(st_dma, &config, &spi_get_hw(spi)->dr, NULL, 0, false);
common_init();
}
@ -122,7 +137,7 @@ namespace pimoroni {
private:
void common_init();
void configure_display(Rotation rotate);
void write_blocking_parallel_dma(const uint8_t *src, size_t len);
void write_blocking_dma(const uint8_t *src, size_t len);
void write_blocking_parallel(const uint8_t *src, size_t len);
void command(uint8_t command, size_t len = 0, const char *data = NULL);
};

View File

@ -88,16 +88,35 @@ namespace pimoroni {
reset();
busy_wait();
command(0x00, {0xE3, 0x08});
command(0x01, {0x37, 0x00, 0x23, 0x23});
command(0x03, {0x00});
command(0x06, {0xC7, 0xC7, 0x1D});
command(0x30, {0x3C});
command(0x40, {0x00});
command(0x50, {0x37});
command(0x60, {0x22});
command(0x61, {0x02, 0x58, 0x01, 0xC0});
command(0xE3, {0xAA});
uint8_t dimensions[4] = {
uint8_t(width >> 8),
uint8_t(width),
uint8_t(height >> 8),
uint8_t(height)
};
if (width == 600) {
if (rotation == ROTATE_0) {
command(PSR, {0xE3, 0x08});
} else {
command(PSR, {0xEF, 0x08});
}
} else {
if (rotation == ROTATE_0) {
command(PSR, {0xA3, 0x08});
} else {
command(PSR, {0xAF, 0x08});
}
}
command(PWR, {0x37, 0x00, 0x23, 0x23});
command(PFS, {0x00});
command(BTST, {0xC7, 0xC7, 0x1D});
command(PLL, {0x3C});
command(TSC, {0x00});
command(CDI, {0x37});
command(TCON, {0x22});
command(TRES, 4, dimensions);
command(PWS, {0xAA});
sleep_ms(100);
@ -154,8 +173,19 @@ namespace pimoroni {
spi_write_blocking(spi, &reg, 1);
gpio_put(DC, 1); // data mode
graphics->scanline_convert(PicoGraphics::PEN_P4, [this](void *buf, size_t length) {
spi_write_blocking(spi, (const uint8_t*)buf, length);
// HACK: Output 48 rows of data since our buffer is 400px tall
// but the display has no offset configuration and H/V scan
// are reversed.
// Any garbage data will do.
// 2px per byte, so we need width * 24 bytes
if(height == 400 && rotation == ROTATE_0) {
spi_write_blocking(spi, (uint8_t *)graphics->frame_buffer, width * 24);
}
graphics->frame_convert(PicoGraphics::PEN_P4, [this](void *buf, size_t length) {
if (length > 0) {
spi_write_blocking(spi, (const uint8_t*)buf, length);
}
});
gpio_put(CS, 1);

View File

@ -42,10 +42,12 @@ namespace pimoroni {
CLEAN = 7
};
UC8159(uint16_t width, uint16_t height) : UC8159(width, height, {PIMORONI_SPI_DEFAULT_INSTANCE, SPI_BG_FRONT_CS, SPI_DEFAULT_SCK, SPI_DEFAULT_MOSI, PIN_UNUSED, 28, PIN_UNUSED}) {};
UC8159(uint16_t width, uint16_t height) : UC8159(width, height, ROTATE_0, {PIMORONI_SPI_DEFAULT_INSTANCE, SPI_BG_FRONT_CS, SPI_DEFAULT_SCK, SPI_DEFAULT_MOSI, PIN_UNUSED, 28, PIN_UNUSED}) {};
UC8159(uint16_t width, uint16_t height, SPIPins pins, uint busy=PIN_UNUSED, uint reset=27) :
DisplayDriver(width, height, ROTATE_0),
UC8159(uint16_t width, uint16_t height, SPIPins pins, uint busy=PIN_UNUSED, uint reset=27) : UC8159(width, height, ROTATE_0, pins, busy, reset) {};
UC8159(uint16_t width, uint16_t height, Rotation rotation, SPIPins pins, uint busy=PIN_UNUSED, uint reset=27) :
DisplayDriver(width, height, rotation),
spi(pins.spi),
CS(pins.cs), DC(pins.dc), SCK(pins.sck), MOSI(pins.mosi), BUSY(busy), RESET(reset) {
init();

View File

@ -205,7 +205,7 @@ namespace pimoroni {
i2c->read_blocking(address, (uint8_t *)&value, 2, false);
// TODO do we need to bswap this return value?
return __bswap16(value);
return __builtin_bswap16(value);
}
// Read a 32-bit register
@ -217,7 +217,7 @@ namespace pimoroni {
i2c->read_blocking(address, (uint8_t *)&value, 4, false);
// TODO do we need to bswap this return value?
return __bswap32(value);
return __builtin_bswap32(value);
}
// set distance mode to Short, Medium, or Long

View File

@ -1,5 +1,6 @@
add_subdirectory(breakout_dotmatrix)
add_subdirectory(breakout_encoder)
add_subdirectory(breakout_encoder_wheel)
add_subdirectory(breakout_ioexpander)
add_subdirectory(breakout_ltr559)
add_subdirectory(breakout_colourlcd160x80)
@ -24,6 +25,7 @@ add_subdirectory(breakout_scd41)
add_subdirectory(breakout_vl53l5cx)
add_subdirectory(breakout_pms5003)
add_subdirectory(breakout_oled_128x128)
add_subdirectory(breakout_mlx90640)
add_subdirectory(pico_display)
add_subdirectory(pico_display_2)
@ -47,6 +49,7 @@ add_subdirectory(inky_pack)
add_subdirectory(inky_frame)
add_subdirectory(automation2040w)
add_subdirectory(plasma_stick)
add_subdirectory(plasma2040)
add_subdirectory(badger2040)
add_subdirectory(tufty2040)
@ -55,3 +58,7 @@ add_subdirectory(servo2040)
add_subdirectory(motor2040)
add_subdirectory(inventor2040w)
add_subdirectory(encoder)
add_subdirectory(galactic_unicorn)
add_subdirectory(gfx_pack)
add_subdirectory(cosmic_unicorn)
add_subdirectory(stellar_unicorn)

View File

@ -12,8 +12,10 @@ BME280 bme280(&i2c);
int main() {
#ifdef PICO_DEFAULT_LED_PIN
gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
#endif
stdio_init_all();

View File

@ -15,8 +15,10 @@ I2C i2c(BOARD::BREAKOUT_GARDEN);
BME68X bme68x(&i2c);
int main() {
#ifdef PICO_DEFAULT_LED_PIN
gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
#endif
stdio_init_all();

View File

@ -28,8 +28,10 @@ uint16_t durations[profile_length] = { 5, 2, 10, 30, 5, 5, 5, 5, 5, 5 };
int main() {
#ifdef PICO_DEFAULT_LED_PIN
gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
#endif
stdio_init_all();

View File

@ -12,8 +12,10 @@ BMP280 bmp280(&i2c);
int main() {
#ifdef PICO_DEFAULT_LED_PIN
gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
#endif
stdio_init_all();

View File

@ -15,13 +15,18 @@ uint8_t values[HALF_WIDTH] = { 0, 0, 0, 0, 0 };
uint8_t next_value = 0;
int main() {
#ifdef PICO_DEFAULT_LED_PIN
gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
#endif
display.init();
while(true) {
#ifdef PICO_DEFAULT_LED_PIN
gpio_put(PICO_DEFAULT_LED_PIN, true);
#endif
absolute_time_t at = get_absolute_time();
uint64_t t = to_us_since_boot(at) / 1000000;
@ -49,7 +54,9 @@ int main() {
display.show();
#ifdef PICO_DEFAULT_LED_PIN
gpio_put(PICO_DEFAULT_LED_PIN, false);
#endif
sleep_ms(1000 / HEIGHT);
}

View File

@ -17,8 +17,10 @@ void eye(uint8_t x, uint8_t y) {
}
int main() {
#ifdef PICO_DEFAULT_LED_PIN
gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
#endif
display.init();
@ -50,7 +52,9 @@ int main() {
// This gives our crude blink code time to not look like a random flicker
display.show();
#ifdef PICO_DEFAULT_LED_PIN
gpio_put(PICO_DEFAULT_LED_PIN, led_toggle);
#endif
led_toggle = !led_toggle;
sleep_ms(100);

View File

@ -27,8 +27,10 @@ uint8_t offset = 0;
int main() {
#ifdef PICO_DEFAULT_LED_PIN
gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
#endif
display.init();
@ -36,7 +38,9 @@ int main() {
display.set_image(image, IMAGE_WIDTH, IMAGE_HEIGHT, offset, 0, true, false, ON_LEVEL, IMAGE_PADDING);
display.show();
#ifdef PICO_DEFAULT_LED_PIN
gpio_put(PICO_DEFAULT_LED_PIN, led_toggle);
#endif
led_toggle = !led_toggle;
sleep_ms(500);

View File

@ -11,8 +11,10 @@ BreakoutDotMatrix display(&i2c);
bool led_toggle = false;
int main() {
#ifdef PICO_DEFAULT_LED_PIN
gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
#endif
display.init();
display.show();
@ -37,7 +39,9 @@ int main() {
display.set_character(5, right);
display.show();
#ifdef PICO_DEFAULT_LED_PIN
gpio_put(PICO_DEFAULT_LED_PIN, led_toggle);
#endif
led_toggle = !led_toggle;
sleep_ms(1000 / 60);

View File

@ -42,8 +42,10 @@ void count_changed(int16_t count) {
}
int main() {
#ifdef PICO_DEFAULT_LED_PIN
gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
#endif
stdio_init_all();
@ -57,7 +59,9 @@ int main() {
enc.clear_interrupt_flag();
while(true) {
#ifdef PICO_DEFAULT_LED_PIN
gpio_put(PICO_DEFAULT_LED_PIN, toggle);
#endif
toggle = !toggle;
if(enc.get_interrupt_flag()) {
@ -75,7 +79,9 @@ int main() {
}
else {
printf("Encoder not found :'(\n");
#ifdef PICO_DEFAULT_LED_PIN
gpio_put(PICO_DEFAULT_LED_PIN, true);
#endif
}
return 0;

View File

@ -0,0 +1,9 @@
add_subdirectory(buttons)
add_subdirectory(chase_game)
add_subdirectory(clock)
add_subdirectory(colour_picker)
add_subdirectory(encoder)
add_subdirectory(gpio_pwm)
add_subdirectory(interrupt)
add_subdirectory(led_rainbow)
add_subdirectory(stop_watch)

View File

@ -0,0 +1,77 @@
# RGB Encoder Wheel Breakout Examples (C++) <!-- omit in toc -->
- [Function Examples](#function-examples)
- [Buttons](#buttons)
- [Encoder](#encoder)
- [Interrupt](#interrupt)
- [LED Examples](#led-examples)
- [LED Rainbow](#led-rainbow)
- [Clock](#clock)
- [Interactive Examples](#interactive-examples)
- [Colour Picker](#colour-picker)
- [Stop Watch](#stop-watch)
- [Chase Game](#chase-game)
- [GPIO Examples](#gpio-examples)
- [GPIO PWM](#gpio-pwm)
## Function Examples
### Buttons
[buttons/buttons.cpp](buttons/buttons.cpp)
A demonstration of reading the 5 buttons on Encoder Wheel.
### Encoder
[encoder/encoder.cpp](encoder/encoder.cpp)
A demonstration of reading the rotary dial of the Encoder Wheel breakout.
### Interrupt
[interrupt/interrupt.cpp](interrupt/interrupt.cpp)
How to read the buttons and rotary dial of the Encoder Wheel breakout, only when an interrupt occurs.
## LED Examples
### LED Rainbow
[led_rainbow/led_rainbow.cpp](led_rainbow/led_rainbow.cpp)
Displays a rotating rainbow pattern on Encoder Wheel's LED ring.
### Clock
[clock/clock.cpp](clock/clock.cpp)
Displays a 12 hour clock on Encoder Wheel's LED ring, getting time from the system.
## Interactive Examples
### Colour Picker
[colour_picker/colour_picker.cpp](colour_picker/colour_picker.cpp)
Create a colour wheel on the Encoder Wheel's LED ring, and use all functions of the wheel to interact with it.
### Stop Watch
[stop_watch/stop_watch.cpp](stop_watch/stop_watch.cpp)
Display a circular stop-watch on the Encoder Wheel's LED ring.
### Chase Game
[chase_game/chase_game.cpp](chase_game/chase_game.cpp)
A simple alignment game. Use Encoder Wheel's rotary dial to align the coloured band to the white goal. The closer to the goal, the greener your coloured band will be. When you reach the goal, the goal will move to a new random position.
## GPIO Examples
### GPIO PWM
[gpio_pwm/gpio_pwm.cpp](gpio_pwm/gpio_pwm.cpp)
Output a sine wave PWM sequence on the Encoder Wheel's side GPIO pins.

View File

@ -0,0 +1,13 @@
set(OUTPUT_NAME encoderwheel_buttons)
add_executable(${OUTPUT_NAME} buttons.cpp)
# Pull in pico libraries that we need
target_link_libraries(${OUTPUT_NAME}
pico_stdlib
breakout_encoder_wheel
)
# enable usb output
pico_enable_stdio_usb(${OUTPUT_NAME} 1)
pico_add_extra_outputs(${OUTPUT_NAME})

View File

@ -0,0 +1,96 @@
#include <math.h>
#include <string>
#include "pimoroni_i2c.hpp"
#include "breakout_encoder_wheel.hpp"
#include "time.h"
using namespace pimoroni;
using namespace encoderwheel;
/*
A demonstration of reading the 5 buttons on Encoder Wheel.
*/
// Constants
const std::string BUTTON_NAMES[] = {"Up", "Down", "Left", "Right", "Centre"};
// Create a new BreakoutEncoderWheel
I2C i2c(BOARD::BREAKOUT_GARDEN);
BreakoutEncoderWheel wheel(&i2c);
// Variables
bool last_pressed[NUM_BUTTONS] = {false, false, false, false, false};
bool pressed[NUM_BUTTONS] = {false, false, false, false, false};
int main() {
stdio_init_all();
// Attempt to initialise the encoder wheel
if(wheel.init()) {
// Loop forever
while(true) {
// Read all of the encoder wheel's buttons
for(int b = 0 ; b < NUM_BUTTONS; b++) {
pressed[b] = wheel.pressed(b);
if(pressed[b] != last_pressed[b]) {
printf("%s %s\n", BUTTON_NAMES[b].c_str(), pressed[b] ? "Pressed" : "Released");
}
last_pressed[b] = pressed[b];
}
// Clear the LED ring
wheel.clear();
for(int i = 0; i < NUM_LEDS; i++) {
if(i % 6 == 3) {
wheel.set_rgb(i, 64, 64, 64);
}
}
// If up is pressed, set the top LEDs to yellow
if(pressed[UP]) {
int mid = NUM_LEDS;
for(int i = mid - 2; i < mid + 3; i++) {
wheel.set_rgb(i % NUM_LEDS, 255, 255, 0);
}
}
// If right is pressed, set the right LEDs to red
if(pressed[RIGHT]) {
int mid = NUM_LEDS / 4;
for(int i = mid - 2; i < mid + 3; i++) {
wheel.set_rgb(i % NUM_LEDS, 255, 0, 0);
}
}
// If down is pressed, set the bottom LEDs to green
if(pressed[DOWN]) {
int mid = NUM_LEDS / 2;
for(int i = mid - 2; i < mid + 3; i++) {
wheel.set_rgb(i % NUM_LEDS, 0, 255, 0);
}
}
// If left is pressed, set the left LEDs to blue
if(pressed[LEFT]) {
int mid = (NUM_LEDS * 3) / 4;
for(int i = mid - 2; i < mid + 3; i++) {
wheel.set_rgb(i % NUM_LEDS, 0, 0, 255);
}
}
// If centre is pressed, set the diagonal LEDs to half white
if(pressed[CENTRE]) {
for(int i = 0; i < NUM_LEDS; i++) {
if(i % 6 >= 2 && i % 6 <= 4) {
wheel.set_rgb(i, 128, 128, 128);
}
}
}
wheel.show();
}
}
return 0;
}

View File

@ -0,0 +1,13 @@
set(OUTPUT_NAME encoderwheel_chase_game)
add_executable(${OUTPUT_NAME} chase_game.cpp)
# Pull in pico libraries that we need
target_link_libraries(${OUTPUT_NAME}
pico_stdlib
breakout_encoder_wheel
)
# enable usb output
pico_enable_stdio_usb(${OUTPUT_NAME} 1)
pico_add_extra_outputs(${OUTPUT_NAME})

View File

@ -0,0 +1,148 @@
#include <math.h>
#include <string>
#include "pimoroni_i2c.hpp"
#include "breakout_encoder_wheel.hpp"
#include "time.h"
using namespace pimoroni;
using namespace encoderwheel;
/*
A simple alignment game. Use Encoder Wheel's rotary dial to align the coloured band
to the white goal. The closer to the goal, the greener your coloured band will be.
When you reach the goal, the goal will move to a new random position.
*/
// The band colour hues to show in Angle mode
constexpr float GOAL_HUE = 0.333f;
constexpr float FAR_HUE = 0.0f;
// The width and colour settings for the band
constexpr float BAND_WIDTH = 5.0f;
constexpr float BAND_SATURATION = 1.0f;
constexpr float BAND_IN_GOAL_SATURATION = 0.5f;
constexpr float BAND_BRIGHTNESS = 1.0f;
// The width and colour settings for the goal
// Goal should be wider than the band by a small amount
constexpr float GOAL_MARGIN = 1.0f;
constexpr float GOAL_WIDTH = BAND_WIDTH + (2.0f * GOAL_MARGIN);
constexpr float GOAL_BRIGHTNESS = 0.4f;
// Create a new BreakoutEncoderWheel
I2C i2c(BOARD::BREAKOUT_GARDEN);
BreakoutEncoderWheel wheel(&i2c);
// Variables
float goal_position = 0.0f;
int16_t band_position = 0;
// Maps a value from one range to another
float map(float x, float in_min, float in_max, float out_min, float out_max) {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
// Shows a band and goal with the given widths at the positions on the strip
void colour_band(float centre_position, float width, float goal_position, float goal_width, float hue) {
if(centre_position >= 0.0f && width > 0.0f && goal_width > 0.0) {
float band_start = centre_position - (width / 2);
float band_end = centre_position + (width / 2);
float band_centre = centre_position;
float goal_start = goal_position - (goal_width / 2);
float goal_end = goal_position + (goal_width / 2);
// Go through each led in the strip
for(int i = 0; i < NUM_LEDS; i++) {
// Set saturation and brightness values for if the led is inside or outside of the goal
float saturation = BAND_SATURATION;
float brightness = 0.0f;
if(i >= goal_start && i < goal_end) {
saturation = BAND_IN_GOAL_SATURATION;
brightness = GOAL_BRIGHTNESS;
}
if(goal_end >= NUM_LEDS && i + NUM_LEDS < goal_end) {
saturation = BAND_IN_GOAL_SATURATION;
brightness = GOAL_BRIGHTNESS;
}
if(goal_start < 0 && i - NUM_LEDS >= goal_start) {
saturation = BAND_IN_GOAL_SATURATION;
brightness = GOAL_BRIGHTNESS;
}
float val = brightness;
float sat = 0.0f;
if(i >= band_start && i < band_end) {
// Inside the band
if(i < band_centre) {
// Transition into the band
val = map(i, band_centre, band_start, BAND_BRIGHTNESS, brightness);
sat = map(i, band_centre, band_start, BAND_SATURATION, saturation);
}
else {
val = map(i, band_centre, band_end, BAND_BRIGHTNESS, brightness);
sat = map(i, band_centre, band_end, BAND_SATURATION, saturation);
}
}
else if(band_end >= NUM_LEDS && i + NUM_LEDS < band_end && i < band_centre) {
val = map(i + NUM_LEDS, band_centre, band_end, BAND_BRIGHTNESS, brightness);
sat = map(i + NUM_LEDS, band_centre, band_end, BAND_SATURATION, saturation);
}
else if(band_start < 0 && i - NUM_LEDS >= band_start && i >= band_centre) {
val = map(i - NUM_LEDS, band_centre, band_start, BAND_BRIGHTNESS, brightness);
sat = map(i - NUM_LEDS, band_centre, band_start, BAND_SATURATION, saturation);
}
//else {
// Outside of the band
//}
wheel.set_hsv(i, hue, sat, val);
}
wheel.show();
}
}
int main() {
stdio_init_all();
// Attempt to initialise the encoder wheel
if(wheel.init()) {
// Loop forever
while(true) {
band_position = wheel.step();
// Convert the difference between the band and goal positions into a colour hue
float diff1, diff2;
if(band_position > goal_position) {
diff1 = band_position - goal_position;
diff2 = (goal_position + NUM_LEDS) - band_position;
}
else {
diff1 = goal_position - band_position;
diff2 = (band_position + NUM_LEDS) - goal_position;
}
float position_diff = MIN(diff1, diff2);
float hue = map(position_diff, 0, NUM_LEDS / 2.0f, GOAL_HUE, FAR_HUE);
// Convert the band and goal positions to positions on the LED strip
float strip_band_position = map(band_position, 0, NUM_LEDS, 0.0f, (float)NUM_LEDS);
float strip_goal_position = map(goal_position, 0, NUM_LEDS, 0.0f, (float)NUM_LEDS);
// Draw the band and goal
colour_band(strip_band_position, BAND_WIDTH, strip_goal_position, GOAL_WIDTH, hue);
// Check if the band is within the goal, and if so, set a new goal
if(band_position >= goal_position - GOAL_MARGIN && band_position <= goal_position + GOAL_MARGIN)
goal_position = rand() % NUM_LEDS;
if(band_position >= NUM_LEDS && band_position + NUM_LEDS < goal_position + GOAL_MARGIN)
goal_position = rand() % NUM_LEDS;
if(goal_position - GOAL_MARGIN < 0 && band_position - NUM_LEDS >= goal_position + GOAL_MARGIN)
goal_position = rand() % NUM_LEDS;
}
}
return 0;
}

View File

@ -0,0 +1,14 @@
set(OUTPUT_NAME encoderwheel_clock)
add_executable(${OUTPUT_NAME} clock.cpp)
# Pull in pico libraries that we need
target_link_libraries(${OUTPUT_NAME}
pico_stdlib
hardware_rtc
breakout_encoder_wheel
)
# enable usb output
pico_enable_stdio_usb(${OUTPUT_NAME} 1)
pico_add_extra_outputs(${OUTPUT_NAME})

Some files were not shown because too many files have changed in this diff Show More