Porównaj commity

...

333 Commity

Autor SHA1 Wiadomość Data
Hel Gibbons f18f1ba259
Merge pull request #960 from johnbintz/patch-1
Add SPI import to SD card upload example
2024-06-14 11:27:52 +01:00
John Bintz f495fb8b70
Add SPI import to SD card upload example
As the code exists now, you won't be able to mount the SD card due to the missing import.
2024-06-14 06:08:11 -04:00
Philip Howard 7a2ebe5c0d
Merge pull request #952 from pimoroni/test/revert-1.23.0
TEST: Revert to v1.23.0.
2024-06-06 19:15:17 +01:00
Phil Howard 48f2446f6c CI: Cherry-pick our pins.csv patch. 2024-06-06 19:00:48 +01:00
Phil Howard 6eef96d9c9 CI: Revert to v1.23.0.
We'd moved past v1.23.0 to do our release in order to grab:

932f76c6ba

But this broke our builds due to:

https://github.com/micropython/micropython/issues/15220
2024-06-06 18:56:17 +01:00
Philip Howard 9771274e90
Merge pull request #950 from pimoroni/patch-getting-started-doc
Docs: Fix .uf2 names, add pico_usb.
2024-06-05 11:17:59 +01:00
Phil Howard 7c05770a44 Docs: Fix .uf2 names, add pico_usb. 2024-06-05 11:09:15 +01:00
Philip Howard 3440ab232c
Merge pull request #915 from pimoroni/feature/usb
MicroPython v1.23.0 + USB-compatible Pico firmware.
2024-06-04 20:31:18 +01:00
Phil Howard 7d0bb04d6d Keybow2040: Basic-ish USB examples. 2024-06-04 19:55:24 +01:00
Phil Howard 392890e99b RP_PICO_USB: New USB-enabled version of the stock Pico firmware.
⚠️ Warning: flash/firmware split is now 1Mb/1Mb to accomodate USB libs.

BACK UP YOUR PICO before flashing this build. It *will* trash your filesystem.

* Add new RP_PICO_USB board
* Use commit 932f76c6ba64c5a3e68de3324556d9979f09303b for 932f76c6ba
2024-06-04 19:55:24 +01:00
Phil Howard 7b7d9fe383 CI: Update MicroPython patch for > v1.22.2. 2024-06-04 19:55:24 +01:00
Phil Howard ccd00f6289 Ulab: Bump to 6.5.2 for MicroPython 1.23.0 compatibility. 2024-06-04 19:54:52 +01:00
Philip Howard 10fed7edaf
Merge pull request #946 from pimoroni/patch-sh1107-example
Fixed background in SH1107 example
2024-06-03 13:54:41 +01:00
Phil Howard 517f8ae1cd global: Remove the STATIC macro.
Reflect the changes proposed in micropython/micropython#13763.
2024-06-03 13:44:23 +01:00
thirdr 5b6903ce72 fixed background 2024-06-03 12:25:16 +01:00
Phil Howard 84cabe077d MicroPython: Switch QRCode to micropython/edge branch.
Includes fixes for:

* "mp_obj_malloc_with_finaliser" replacing "m_new_obj_with_finaliser"
* "STATIC" macro dropped in favour of "static"
2024-06-03 11:40:29 +01:00
Phil Howard 64e26dc6f4 CI: Bump MicroPython to master.
CI will always run against the latest MicroPython commit.
2024-06-03 11:40:29 +01:00
Phil Howard 47e3aed88f MicroPython: Switch to mp_obj_malloc_with_finaliser. 2024-06-03 11:40:29 +01:00
Philip Howard bf6fa4bc45
Merge pull request #916 from pimoroni/examples/audio
i2s audio examples
2024-06-03 11:35:59 +01:00
Philip Howard 0b133c750e
Merge pull request #931 from pimoroni/driver/as7343
AS7343: New driver for the 14 channel spectrometer
2024-06-03 11:34:45 +01:00
Philip Howard 5691573f89
Merge pull request #933 from pimoroni/feature/scannable-release-names
CI: Scannable artifact and release names.
2024-06-03 11:34:07 +01:00
Philip Howard b41bb4abf7
Merge pull request #943 from pimoroni/patch-bme280-examples
Fixed result status bug
2024-06-03 11:33:11 +01:00
Philip Howard 8b928d8891
Merge pull request #944 from pimoroni/patch-tufty-example
Fixed button polarity
2024-06-03 11:32:09 +01:00
Philip Howard 56e6d66c9b
Merge pull request #945 from pimoroni/patch-mics6814-pins
Corrected pin definitions for OX and RED
2024-06-03 11:31:15 +01:00
thirdr ffa12c2165 corrected pin defs 2024-06-03 10:31:46 +01:00
thirdr b9f3990995 fixed button polarity 2024-06-03 09:11:49 +01:00
thirdr cca4f3f7f1 fixed result status bug 2024-05-31 12:38:58 +01:00
Philip Howard 981a38b989
Merge pull request #928 from pimoroni/examples/pngdec
Examples/pngdec
2024-05-30 23:32:14 +01:00
Philip Howard 25786def35
Merge pull request #942 from pimoroni/patch-inky-launcher
Patch inky launcher
2024-05-30 19:21:28 +01:00
thirdr a387e45098 linting fix 2024-05-30 13:32:48 +01:00
thirdr 452d700ba1 Improved XML parsing/bug fix from Pico Vision 2024-05-30 13:29:48 +01:00
Hel Gibbons 9d7d651565
Merge pull request #940 from exussum12/patch-3
Add link to png
2024-05-24 16:57:25 +01:00
Scott Dutton b3a0c4fb9d
Add link to png 2024-05-21 11:13:42 +01:00
thirdr f962c3cd3c linting 2024-05-13 12:27:23 +01:00
thirdr b5a040f6cc correct layout on pico display 1 & 2 2024-05-13 12:27:23 +01:00
thirdr d790d3d344 fixed background colour 2024-05-13 12:18:36 +01:00
thirdr ba7b8388bf fixed background colour 2024-05-13 12:18:36 +01:00
thirdr 829f688285 offset palette example 2024-05-13 12:18:36 +01:00
thirdr 8fb17a3c26 adjustment to scale and location 2024-05-13 12:18:36 +01:00
thirdr 4db7cc61ab png palette offset example 2024-05-13 12:18:36 +01:00
thirdr c510a3c875 Changed the png used 2024-05-13 12:18:36 +01:00
thirdr 425f132096 png decode example for tufty 2024-05-13 12:18:36 +01:00
thirdr 76683acb0d png decode example for display pack 2024-05-13 12:18:36 +01:00
thirdr 7c287192de Error handling 2024-05-13 12:18:36 +01:00
thirdr f15c657b44 pngdec example for inky 2024-05-13 12:18:36 +01:00
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
thirdr 3998b0c8bf simple example for Pico Audio Pack 2024-04-22 15:35:53 +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
Phil Howard 6ed743b32c Docs: Update MicroPython setup to reflect new names. 2024-04-17 13:06:04 +01:00
Phil Howard 17d59f4729 CI: Scannable artifact and release names.
When I go to fetch an artifact for a MicroPython build my brain is
always confounded by the repetition of "pimoroni-" before each file.

Change the names so the product is up-front, so the list is easier
to scan-read through.
2024-04-17 13:00:40 +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
Phil Howard 8bb17087d9 AS7343: Tufty 2040 spectrometer example. 2024-04-15 11:57:40 +01:00
Phil Howard 6fcbaf5616 AS7343: MicroPython bindings. 2024-04-15 11:53:34 +01:00
Phil Howard 6803f00b31 AS7343: New 14-channel spectral sensor driver. 2024-04-15 11:53:34 +01:00
Phil Howard 6e71a62c65 Pimoroni I2C: Add reg_write_uint16. 2024-04-15 11:53:34 +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
thirdr b499296867 added amp enable to audio.py 2024-03-27 14:38:01 +00:00
thirdr 193adaca72 linting fix 2024-03-27 13:01:35 +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
thirdr b0babcfe9f fixed audio 'pop' 2024-03-27 12:57:44 +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
thirdr e34b2420c6 i2s audio examples 2024-03-26 08:41:48 +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
472 zmienionych plików z 35039 dodań i 8964 usunięć

Wyświetl plik

@ -25,7 +25,7 @@ jobs:
steps:
- name: Compiler Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /home/runner/.ccache
key: ccache-cmake-${{github.ref}}-${{matrix.board}}-${{github.sha}}
@ -34,13 +34,13 @@ jobs:
ccache-cmake-${{github.ref}}
ccache-cmake
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
# Check out the Pico SDK
- name: Checkout Pico SDK
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
path: pico-sdk
@ -48,7 +48,7 @@ jobs:
# Check out the Pico Extras
- name: Checkout Pico Extras
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-extras
path: pico-extras

Wyświetl plik

@ -7,70 +7,23 @@ on:
types: [created]
env:
MICROPYTHON_VERSION: v1.20.0
MICROPYTHON_VERSION: v1.23.0
jobs:
deps:
runs-on: ubuntu-20.04
name: Dependencies
steps:
- name: Workspace Cache
id: cache
uses: actions/cache@v3
with:
path: ${{runner.workspace}}
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}-nano-specs
restore-keys: |
workspace-micropython-${{env.MICROPYTHON_VERSION}}-nano-specs
# Check out MicroPython
- name: Checkout MicroPython
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v3
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@v3
with:
repository: micropython/micropython-lib
path: micropython-lib
- name: Fetch Pico submodules
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: micropython/ports/rp2
run: |
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
- name: Build mpy-cross
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: micropython/mpy-cross
run: make
build:
needs: deps
name: ${{matrix.name}} (${{matrix.board}})
name: ${{ matrix.name }} (${{ matrix.board }})
runs-on: ubuntu-20.04
continue-on-error: true
strategy:
matrix:
include:
- name: pico
board: PICO
board: RPI_PICO
- name: pico_usb
board: RPI_PICO_USB
- name: picow
board: PICO_W
- name: tiny2040
board: RPI_PICO_W
- name: tiny2040_8mb
board: PIMORONI_TINY2040
- name: picolipo_4mb
board: PIMORONI_PICOLIPO_4MB
@ -80,114 +33,111 @@ jobs:
board: PIMORONI_TUFTY2040
- name: enviro
board: PICO_W_ENVIRO
patch: true
- name: galactic_unicorn
board: PICO_W
board: RPI_PICO_W
- name: cosmic_unicorn
board: PICO_W
board: RPI_PICO_W
- name: stellar_unicorn
board: RPI_PICO_W
- name: inky_frame
board: PICO_W_INKY
patch: true
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
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"
RELEASE_FILE: ${{ matrix.name }}-${{ github.event.release.tag_name || github.sha }}-pimoroni-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@v3
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@v3
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@v3
- uses: actions/checkout@v4
with:
submodules: true
path: pimoroni-pico-${{ github.sha }}
- name: Set MicroPython Version Env Vars
shell: bash
run: |
echo "MICROPY_GIT_TAG=$MICROPYTHON_VERSION, ${{matrix.name}} ${{github.event.release.tag_name || github.sha}}" >> $GITHUB_ENV
echo "MICROPY_GIT_HASH=$MICROPYTHON_VERSION-${{github.event.release.tag_name || github.sha}}" >> $GITHUB_ENV
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '9-2020-q2'
- name: "HACK: Clean ports/rp2/modules and ports/rp2/CMakeLists.txt"
shell: bash
working-directory: micropython/ports/rp2
- name: Install CCache
run: |
rm -rf modules
git checkout modules
- name: "HACK: Revert Patches" # Avoid an already-patched MicroPython tree breaking our build
shell: bash
working-directory: micropython
source $BUILD_TOOLS
apt_install_build_deps
- name: Checkout MicroPython & Submodules
run: |
git checkout lib/pico-sdk
git checkout ports/rp2/CMakeLists.txt
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
working-directory: micropython
run: git apply $GITHUB_WORKSPACE/pimoroni-pico-${{ github.sha }}/micropython/micropython_nano_specs.patch
run: |
source $BUILD_TOOLS
hack_patch_micropython_disable_exceptions
- name: "HACK: Pico SDK Patch"
if: matrix.patch == true
shell: bash
working-directory: micropython
run: |
$GITHUB_WORKSPACE/pimoroni-pico-${{ github.sha }}/micropython/board/pico-sdk-patch.sh ${{matrix.board}}
source $BUILD_TOOLS
hack_patch_pico_sdk
- name: Configure MicroPython
shell: bash
working-directory: micropython/ports/rp2
run: |
cmake -S . -B build-${{matrix.name}} -DPICO_BUILD_DOCS=0 -DUSER_C_MODULES=${{env.USER_C_MODULES}} -DMICROPY_BOARD_DIR=${{env.MICROPY_BOARD_DIR}} -DMICROPY_BOARD=${{matrix.board}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
source $BUILD_TOOLS
micropython_version
cmake_configure
- name: Build MicroPython # Multiple simultaneous jobs trigger https://github.com/pimoroni/pimoroni-pico/issues/761
- name: Build MicroPython
shell: bash
working-directory: micropython/ports/rp2
run: |
ccache --zero-stats || true
cmake --build build-${{matrix.name}} -j 1
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.name}}
run: |
cp firmware.uf2 $RELEASE_FILE.uf2
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@v3
uses: actions/upload-artifact@v4
with:
name: ${{env.RELEASE_FILE}}.uf2
path: micropython/ports/rp2/build-${{matrix.name}}/${{env.RELEASE_FILE}}.uf2
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.name}}/firmware.uf2
upload_url: ${{github.event.release.upload_url}}
asset_name: ${{env.RELEASE_FILE}}.uf2
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

Wyświetl plik

@ -9,7 +9,7 @@ jobs:
name: Python Linting
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Python Deps
run: python3 -m pip install flake8

Wyświetl plik

@ -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}
)

Wyświetl plik

@ -44,6 +44,10 @@ 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++
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).
@ -140,6 +144,7 @@ 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

77
ci/micropython.sh 100644
Wyświetl plik

@ -0,0 +1,77 @@
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
cd micropython
git checkout $MICROPYTHON_VERSION
git cherry-pick -n 932f76c6ba64c5a3e68de3324556d9979f09303b
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
}

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -78,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,
@ -98,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,

Wyświetl plik

@ -40,6 +40,15 @@ namespace pimoroni {
i2c_write_blocking(i2c, address, buffer, 2, false);
}
void I2C::reg_write_uint16(uint8_t address, uint8_t reg, uint16_t value) {
uint8_t buffer[3] = {
reg,
(uint8_t)((value & 0xff00) >> 8),
(uint8_t)(value & 0x00ff)
};
i2c_write_blocking(i2c, address, buffer, 3, false);
}
uint8_t I2C::reg_read_uint8(uint8_t address, uint8_t reg) {
uint8_t value;
i2c_write_blocking(i2c, address, &reg, 1, false);

Wyświetl plik

@ -63,6 +63,7 @@ namespace pimoroni {
i2c_inst_t* pin_to_inst(uint pin);
void reg_write_uint8(uint8_t address, uint8_t reg, uint8_t value);
void reg_write_uint16(uint8_t address, uint8_t reg, uint16_t value);
uint8_t reg_read_uint8(uint8_t address, uint8_t reg);
uint16_t reg_read_uint16(uint8_t address, uint8_t reg);
int16_t reg_read_int16(uint8_t address, uint8_t reg);

Wyświetl plik

@ -16,6 +16,7 @@ add_subdirectory(is31fl3731)
add_subdirectory(fatfs)
add_subdirectory(sdcard)
add_subdirectory(as7262)
add_subdirectory(as7343)
add_subdirectory(bh1745)
add_subdirectory(bme68x)
add_subdirectory(bmp280)
@ -41,6 +42,6 @@ add_subdirectory(pms5003)
add_subdirectory(sh1107)
add_subdirectory(st7567)
add_subdirectory(psram_display)
add_subdirectory(inky73)
add_subdirectory(shiftregister)
add_subdirectory(mlx90640)
add_subdirectory(inky73)
add_subdirectory(mlx90640)

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -0,0 +1,10 @@
set(DRIVER_NAME as7343)
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_i2c pimoroni_i2c)

Wyświetl plik

@ -0,0 +1,160 @@
#include <cstdlib>
#include <math.h>
#include <map>
#include <vector>
#include <cstring>
#include "as7343.hpp"
namespace pimoroni {
bool AS7343::init() {
if(interrupt != PIN_UNUSED) {
gpio_set_function(interrupt, GPIO_FUNC_SIO);
gpio_set_dir(interrupt, GPIO_IN);
gpio_pull_up(interrupt);
}
uint8_t aux_id, revision_id, hardware_id;
get_version(aux_id, revision_id, hardware_id);
if(hardware_id != HARDWARE_ID) {
return false;
}
reset();
bank_select(0);
// Enable all 7 channels in output FIFO
i2c->set_bits(address, reg::FIFO_MAP, 0, FIFO_MAP_CH5 | FIFO_MAP_CH4 | FIFO_MAP_CH3 | FIFO_MAP_CH2 | FIFO_MAP_CH1 | FIFO_MAP_CH0 | FIFO_MAP_ASTATUS);
// Set the PON bit
i2c->reg_write_uint8(address, reg::ENABLE, ENABLE_WEN | ENABLE_SMUXEN | ENABLE_SP_EN | ENABLE_PON);
return true;
}
void AS7343::reset() {
i2c->reg_write_uint8(address, reg::CONTROL, CONTROL_SW_RESET);
sleep_ms(1000);
}
i2c_inst_t* AS7343::get_i2c() const {
return i2c->get_i2c();
}
int AS7343::get_sda() const {
return i2c->get_sda();
}
int AS7343::get_scl() const {
return i2c->get_scl();
}
int AS7343::get_int() const {
return interrupt;
}
void AS7343::bank_select(uint8_t bank) {
if(bank == 1) {
i2c->set_bits(address, reg::CFG0, 0, CFG0_BANK);
} else {
i2c->clear_bits(address, reg::CFG0, 0, CFG0_BANK);
}
}
void AS7343::get_version(uint8_t &auxid, uint8_t &revid, uint8_t &hwid) {
bank_select(1);
auxid = i2c->reg_read_uint8(address, reg::AUXID) & 0b00001111;
revid = i2c->reg_read_uint8(address, reg::REVID) & 0b00000111;
hwid = i2c->reg_read_uint8(address, reg::ID);
bank_select(0);
}
void AS7343::set_gain(float gain) {
if(gain == 0.5f) {
i2c->reg_write_uint8(address, reg::CFG1, 0);
} else {
uint16_t ugain = (uint16_t)gain;
uint16_t bitlength = 0;
while(ugain > 0) {
bitlength++;
ugain >>= 1;
}
i2c->reg_write_uint8(address, reg::CFG1, bitlength & 0x1f);
}
}
void AS7343::set_channels(channel_count channel_count) {
this->read_cycles = uint8_t(channel_count) / 6;
this->ch_count = (uint8_t)channel_count;
uint8_t temp = i2c->reg_read_uint8(address, reg::CFG20) & ~CFG20_18_CH;
switch(channel_count) {
case channel_count::SIX_CHANNEL:
temp |= CFG20_6_CH;
break;
case channel_count::TWELVE_CHANNEL:
temp |= CFG20_12_CH;
break;
case channel_count::EIGHTEEN_CHANNEL:
temp |= CFG20_18_CH;
break;
}
i2c->reg_write_uint8(address, reg::CFG20, temp);
}
void AS7343::set_illumination_current(float current) {
current -= 4;
current /= 2.0f;
uint8_t temp = i2c->reg_read_uint8(address, reg::LED) & 0b10000000;
temp |= (uint8_t)current;
i2c->reg_write_uint8(address, reg::LED, temp);
}
void AS7343::set_illumination_led(bool state) {
uint8_t temp = i2c->reg_read_uint8(address, reg::LED) & 0b01111111;
temp |= state ? 0x80 : 0x00;
i2c->reg_write_uint8(address, reg::LED, temp);
}
void AS7343::set_measurement_time(float measurement_time_ms) {
constexpr float resolution = 2.78f;
i2c->reg_write_uint8(address, reg::WTIME, (uint8_t)((measurement_time_ms - resolution) / resolution));
}
void AS7343::set_integration_time(float integration_time_us, uint8_t repeat) {
constexpr float resolution = 2.78f;
constexpr float max_astep = (65534 + 1) * resolution;
if (integration_time_us <= max_astep) {
i2c->reg_write_uint8(address, reg::ATIME, repeat - 1);
i2c->reg_write_uint16(address, reg::ASTEP, (uint16_t)((integration_time_us - resolution) / resolution) & 0xfffe);
} else {
// Time out of range...
}
}
void AS7343::read_fifo(uint16_t *buf) {
uint16_t expected_results = read_cycles * 7;
uint16_t result_slot = 0;
while (i2c->reg_read_uint8(address, reg::FIFO_LVL) < expected_results) {
sleep_ms(1);
}
while (i2c->reg_read_uint8(address, reg::FIFO_LVL) > 0 && expected_results > 0) {
buf[result_slot] = i2c->reg_read_uint16(address, reg::FDATA);
expected_results--;
result_slot++;
}
}
AS7343::reading AS7343::read() {
reading result;
read_fifo((uint16_t *)&result);
return result;
}
}

Wyświetl plik

@ -0,0 +1,139 @@
#pragma once
#include <string>
#include "hardware/i2c.h"
#include "hardware/gpio.h"
#include "common/pimoroni_common.hpp"
#include "common/pimoroni_i2c.hpp"
#include "as7343_regs.hpp"
namespace pimoroni {
class AS7343 {
//--------------------------------------------------
// Constants
//--------------------------------------------------
public:
static const uint8_t DEFAULT_I2C_ADDRESS = 0x39;
//--------------------------------------------------
// Enums
//--------------------------------------------------
public:
enum class channel_count : uint8_t {
SIX_CHANNEL = 6,
TWELVE_CHANNEL = 12,
EIGHTEEN_CHANNEL = 18
};
/*
enum class COMPENSATION_GAIN : float {
F1 = 1.84f,
F2 = 6.03f,
FZ = 4.88f,
F3 = 13.74f,
F4 = 3.37f,
FY = 2.82f,
F5 = 6.72f,
FXL = 2.22f,
F6 = 3.17f,
F7 = 1.95f,
F8 = 12.25f,
NIR = 1.00f,
};
*/
//--------------------------------------------------
// Substructures
//--------------------------------------------------
public:
struct reading {
// Cycle 1
uint16_t FZ = 0; // 428-480 nm
uint16_t FY = 0; // 534-593 nm
uint16_t FXL = 0; // 593-628 nm
uint16_t NIR = 0; // 849-903 nm
uint16_t c1_vis_tl = 0; // Visible top-left
uint16_t c1_vis_br = 0; // Visible bottom-right
uint16_t c1_astatus = 0; // (c1_astatus >> 8) & 0b10001111
// 0b10000000 = saturated
// 0b00001111 = gain lowest nibble
// Cycle 2
uint16_t F2 = 0; // 408-448 nm
uint16_t F3 = 0; // 448-500 mn
uint16_t F4 = 0; // 500-534 nm
uint16_t F6 = 0; // 618-665 nm
uint16_t c2_vis_tl = 0;
uint16_t c2_vis_br = 0;
uint16_t c2_astatus = 0;
// Cycle 3
uint16_t F1 = 0; // 396-408 nm
uint16_t F5 = 0; // 531-594 nm
uint16_t F7 = 0; // 685-715 nm
uint16_t F8 = 0; // 715-766 nm
uint16_t c3_vis_tl = 0;
uint16_t c3_vis_br = 0;
uint16_t c3_astatus = 0;
};
//--------------------------------------------------
// Variables
//--------------------------------------------------
private:
I2C *i2c;
// interface pins with our standard defaults where appropriate
int8_t address = DEFAULT_I2C_ADDRESS;
uint interrupt = PIN_UNUSED;
uint8_t read_cycles = 1;
uint8_t ch_count = (uint8_t)channel_count::SIX_CHANNEL;
//--------------------------------------------------
// Constructors/Destructor
//--------------------------------------------------
public:
AS7343(uint interrupt = PIN_UNUSED) : AS7343(new I2C(), interrupt) {};
AS7343(I2C *i2c, uint interrupt = PIN_UNUSED) : i2c(i2c), interrupt(interrupt) {}
//--------------------------------------------------
// Methods
//--------------------------------------------------
public:
bool init();
void reset();
// For print access in micropython
i2c_inst_t* get_i2c() const;
int get_sda() const;
int get_scl() const;
int get_int() const;
void get_version(uint8_t &auxid, uint8_t &revid, uint8_t &hwid);
reading read();
void read_fifo(uint16_t *buf);
void set_gain(float gain);
void set_illumination_current(float current);
void set_illumination_led(bool state);
void set_measurement_time(float measurement_time_ms);
void set_integration_time(float integration_time_us, uint8_t repeat=1);
void set_channels(channel_count channel_count);
private:
void bank_select(uint8_t bank=0);
};
}

Wyświetl plik

@ -0,0 +1,157 @@
#pragma once
#include <stdint.h>
namespace pimoroni {
/***** Device registers and masks here *****/
enum reg {
// Bank 1
AUXID = 0x58, // AUXID = 0b00001111
REVID = 0x59, // REVID = 0b00000111
ID = 0x5A, // ID = 0b11111111
CFG12 = 0x66, // SP_TH_CH = 0b00000111
// Bank 0
ENABLE = 0x80, // FDEN = 0b01000000
// SMUXEN = 0b00010000
// WEN = 0b00001000
// SP_EN = 0b00000010
// PON = 0b00000001
ATIME = 0x81, // ATIME = 0b11111111
// Integration Time Step Size
// 0 = 2.87us
// n 2.87us x (n + 1)
ASTEP = 0xD4, // STEP = 0xFFFF
// Spectral Measurement Wait Time
// 0 = 1 cycle = 2.78ms
// n = 2.78ms x (n + 1)
WTIME = 0x83, // WTIME = 0b11111111
SP_TH = 0x84, // SP_TH_L = 0xFFFF0000 Spectral Low Threshold
// SP_TH_H = 0x0000FFFF Spectral High Threshold
STATUS = 0x93, // ASAT = 0b10000000 Spectral Saturation (if ASIEN set)
// AINT = 0b00001000 Spectral Channel Interrupt (if SP_IEN set)
// FINT = 0b00000100 FIFO Buffer Interrupt
// SINT = 0b00000001 System Interrupt
ASTATUS = 0x94,// ASAT = 0b10000000 Saturation Status
// AGAIN = 0b00000111 Gain Status
DATA = 0x95, // 36 bytes, fields 0 to 17 (2 bytes eac)
STATUS2 = 0x90,// AVALID = 0b01000000 Spectral Data Valid
// ASAT_DIG = 0b00010000 Digital Saturation
// ASAT_ANA = 0b00001000 Analog Saturation
// FDSAT_ANA= 0b00000010 Flicker Analog Saturation
// FDSAT_DIG= 0b00000001 Flicker Digital Saturation
STATUS3 = 0x91,// INT_SP_H = 0b00100000 Spectral Above High Threshold
// INT_SP_L = 0b00010000 Spectral Below Low Threshold
STATUS5 = 0xBB,// SINT_FD = 0b00001000 Flicker Detect Interrupt (if SIEN_FD set)
// SINT_SMUX= 0b00000100 SMUS Operation Interrupt (SMUX exec finished)
STATUS4 = 0xBC,// FIFO_OV = 0b10000000 FIFO Buffer Overflow
// OVTEMP = 0b00100000 Over Temperature
// FD_TRIG = 0b00010000 Flicker Detect Trigger Error
// SD_TRIG = 0b00000100 Spectral Trigger Error
// SAI_ACT = 0b00000010 Sleep After Interrupt Active
// INT_BUSY = 0b00000001 Initialization busy (1 for ~300us after power on)
CFG0 = 0xBF, // LOW_POWER= 0b00100000
// REG_BANK = 0b00010000 0 - Register 0x80 and above
// 1 - Register 0x20 to 0x7f
// WLONG = 0b00000100 Increase WTIME by factor of 16
// Spectral Engines Gain Setting
// 0 = 0.5x, # 1 = 1x, 2 = 2x, 12 = 2048x
// GAINx = 1 << (n - 1)
CFG1 = 0xC6,
CFG3 = 0xC7, // SAI = 0b00100000 Sleep after interrupt
CFG6 = 0xF5, // SMUS_CMD = 0b00011000 0 - ROM_init
// 1 - Read_SMUX
// 2 - Write_SMUX
CFG8 = 0xC9, // FIFO_TH = 0b11000000 0b00, 0b01, 0b10, 0b11
CFG9 = 0xCA, // SIEN_FD = 0b01000000 System Interrupt Flicker Detection
// SIEN_SMUX= 0b00010000 System Interrupt SMUX Operation
CFG10 = 0x65, // FD_PERS = 0b00000111 Flicker Detect Persistence
// Number of results that must differ before status change
PERS = 0xCF, // APERS = 0b00001111
GPIO = 0x6B, // GPIO_INV = 0b00001000 Invert GPIO output
// GPIO_IN_EN=0b00000100 Enable GPIO input
// GPIO_OUT = 0b00000010 GPIO Output
// GPIO_IN = 0b00000001 GPIO Input
CFG20 = 0xD6, // FD_FIFO_8b=0b10000000 Enable 8bit FIFO mode for Flicker Detect (FD_TIME < 256)
// auto_SMUX= 0b01100000 Auto channel read-out
LED = 0xCD, // LED_ACT = 0b10000000 External LED (LDR) Control
// LED_DRIVE= 0b01111111 External LED drive strength (N - 4) >> 1
// Flicker Detection AGC Gain Max
// Max = 2^N (0 = 0.5x)
AGC_GAIN_MAX = 0xD7, // ADC_FD_GAIN_MAX = 0b11110000
AZ_CONFIG = 0xDE, // AT_NTH_ITERATION = 0b11111111 Auto-zero Frequency
// 0 - Never (Not Recommended)
// n - Every n integration cycles
// 255 - only before first measurement cycle
FD_TIME_1 = 0xE0, // FD_TIME=0b11111111 Flicker Detection Integration Time (Do not change if FDEN = 1 & PON = 1)
FD_TIME_2 = 0xE2, // FD_GAIN=0b11111000 Flicker Detection Gain (0 = 0.5x, 1 = 1x, 2 = 2x, 12 = 2048x)
// FD_TIME=0b00000111 Flicker Detection Time (Do not change if FDEN = 1 & PON = 1)
FD_CFG0 = 0xDF, // FIFO_WRITE_FD = 0b10000000 Write flicker raw data to FIFO (1 byte per sample)
FD_STATUS = 0xE3, // FD_VALID=0b00100000
// FD_SAT = 0b00010000
// FD_120HZ_VALID = 0b00001000
// FD_100HZ_VALID = 0b00000100
// FD_120HZ = 0b00000010
// FD_100HZ = 0b00000001
INTERNAB = 0xF9, // ASIEN = 0b10000000 Saturation Interrupt Enable
// SP_IEN = 0b00001000 Spectral Interrupt Enable
// FIEN = 0b00000100 FIFO Buffer Interrupt Enable
// SIEN = 0b00000001 System Interrupt Enable
CONTROL = 0xFA, // SW_RESET = 0b00001000 Software Reset
// SP_MAN_AZ= 0b00000100 Spectral Manual Auto-zero
// FIFO_CLR = 0b00000010 FIFO Buffer Clear
// CLEAR_SAI_ACT = 0b00000001 Clear sleep-after-interrupt
FIFO_MAP = 0xFC, // CH5 = 0b01000000
// CH4 = 0b00100000
// CH3 = 0b00010000
// CH2 = 0b00001000
// CH1 = 0b00000100
// CH0 = 0b00000010
// ASTATUS = 0b00000001
FIFO_LVL = 0xFD,
FDATA = 0xFE // 0xFFFF
};
constexpr uint8_t HARDWARE_ID = 0b10000001;
constexpr uint8_t CFG0_LOW_POWER = 0b00100000;
constexpr uint8_t CFG0_BANK = 0b00010000;
constexpr uint8_t CFG0_WLONG = 0b00000100;
constexpr uint8_t CFG20_6_CH = 0b00000000;
constexpr uint8_t CFG20_12_CH = 0b01000000;
constexpr uint8_t CFG20_18_CH = 0b01100000;
constexpr uint8_t ENABLE_FDEN = 0b01000000;
constexpr uint8_t ENABLE_SMUXEN = 0b00010000;
constexpr uint8_t ENABLE_WEN = 0b00001000;
constexpr uint8_t ENABLE_SP_EN = 0b00000010;
constexpr uint8_t ENABLE_PON = 0b00000001;
constexpr uint8_t FD_CFG0_FIFO_WRITE = 0b10000000;
constexpr uint8_t FD_VALID = 0b00100000;
constexpr uint8_t FD_SAT = 0b00010000;
constexpr uint8_t FD_120HZ_VALID = 0b00001000;
constexpr uint8_t FD_100HZ_VALID = 0b00000100;
constexpr uint8_t FD_120HZ = 0b00000010;
constexpr uint8_t FD_100HZ = 0b00000001;
constexpr uint8_t INTERNAB_ASIEN = 0b10000000;
constexpr uint8_t INTERNAB_SP_IEN = 0b00001000;
constexpr uint8_t INTERNAB_FIEN = 0b00000100;
constexpr uint8_t INTERNAB_SIEN = 0b00000001;
constexpr uint8_t CONTROL_SW_RESET = 0b00001000;
constexpr uint8_t CONTROL_SP_MAN_AZ = 0b00000100;
constexpr uint8_t CONTROL_FIFO_CLR = 0b00000010;
constexpr uint8_t CONTROL_CLEAR_SAI_ACT = 0b00000001;
constexpr uint8_t FIFO_MAP_CH5 = 0b01000000;
constexpr uint8_t FIFO_MAP_CH4 = 0b00100000;
constexpr uint8_t FIFO_MAP_CH3 = 0b00010000;
constexpr uint8_t FIFO_MAP_CH2 = 0b00001000;
constexpr uint8_t FIFO_MAP_CH1 = 0b00000100;
constexpr uint8_t FIFO_MAP_CH0 = 0b00000010;
constexpr uint8_t FIFO_MAP_ASTATUS = 0b00000001;
}

Wyświetl plik

@ -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)

Wyświetl plik

@ -113,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();
}
@ -139,7 +133,7 @@ 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);
@ -148,15 +142,13 @@ void Hub75::start(irq_handler_t handler) {
// 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_irq0_enabled(dma_channel, true);
irq_set_enabled(pio_get_dreq(pio, sm_data, true), true);
irq_set_enabled(DMA_IRQ_0, true);
row = 0;
bit = 0;
@ -169,10 +161,9 @@ void Hub75::start(irq_handler_t handler) {
void Hub75::stop(irq_handler_t handler) {
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);
@ -184,17 +175,21 @@ void Hub75::stop(irq_handler_t handler) {
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);

Wyświetl plik

@ -5,7 +5,10 @@
#include "hardware/dma.h"
#include "hardware/irq.h"
#include "libraries/pico_graphics/pico_graphics.hpp"
#ifndef NO_QSTR
#include "hub75.pio.h"
#endif
namespace pimoroni {
const uint DATA_BASE_PIN = 0;
@ -70,7 +73,7 @@ class Hub75 {
Pixel background = 0;
// DMA & PIO
uint dma_channel = 0;
int dma_channel = -1;
uint bit = 0;
uint row = 0;

Wyświetl plik

@ -4,7 +4,10 @@
#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;

Wyświetl plik

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

Wyświetl plik

@ -47,8 +47,9 @@ namespace pimoroni {
return !(sr.read() & 128);
}
void Inky73::busy_wait() {
while(is_busy()) {
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();
}
}

Wyświetl plik

@ -70,7 +70,7 @@ namespace pimoroni {
// Methods
//--------------------------------------------------
public:
void busy_wait();
void busy_wait(uint timeout_ms=45000);
void reset();
void power_off();

Wyświetl plik

@ -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)

Wyświetl plik

@ -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)

Wyświetl plik

@ -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"

Wyświetl plik

@ -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"

Wyświetl plik

@ -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

Wyświetl plik

@ -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;

Wyświetl plik

@ -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)

Wyświetl plik

@ -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)

Wyświetl plik

@ -89,7 +89,6 @@ 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");
}
@ -134,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);
}
@ -186,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
@ -208,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;
}
@ -218,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

Wyświetl plik

@ -11,7 +11,9 @@
#include "libraries/pico_graphics/pico_graphics.hpp"
#ifndef NO_QSTR
#include "st7789_parallel.pio.h"
#endif
#include <algorithm>

Wyświetl plik

@ -19,6 +19,7 @@ add_subdirectory(breakout_bme688)
add_subdirectory(breakout_bmp280)
add_subdirectory(breakout_bme280)
add_subdirectory(breakout_as7262)
add_subdirectory(as7343)
add_subdirectory(breakout_bh1745)
add_subdirectory(breakout_icp10125)
add_subdirectory(breakout_scd41)
@ -61,3 +62,4 @@ add_subdirectory(encoder)
add_subdirectory(galactic_unicorn)
add_subdirectory(gfx_pack)
add_subdirectory(cosmic_unicorn)
add_subdirectory(stellar_unicorn)

Wyświetl plik

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

Wyświetl plik

@ -0,0 +1,16 @@
set(OUTPUT_NAME as7343_demo)
add_executable(
${OUTPUT_NAME}
as7343_demo.cpp
)
# enable usb output, disable uart output
pico_enable_stdio_usb(${OUTPUT_NAME} 1)
pico_enable_stdio_uart(${OUTPUT_NAME} 1)
# Pull in pico libraries that we need
target_link_libraries(${OUTPUT_NAME} pico_stdlib as7343)
# create map/bin/hex file etc.
pico_add_extra_outputs(${OUTPUT_NAME})

Wyświetl plik

@ -0,0 +1,69 @@
#include "pico/stdlib.h"
#include "common/pimoroni_common.hpp"
#include "as7343.hpp"
using namespace pimoroni;
I2C i2c(6, 7);
AS7343 as7343(&i2c);
int main() {
stdio_init_all();
printf("AS7343 Demo\n");
as7343.init();
printf("Init done...\n");
uint8_t aux_id;
uint8_t revision_id;
uint8_t hardware_id;
as7343.get_version(aux_id, revision_id, hardware_id);
printf("Aux: %d, Rev: %d, HW: %d\n", aux_id, revision_id, hardware_id);
printf("set_channels\n");
as7343.set_channels(AS7343::channel_count::EIGHTEEN_CHANNEL);
printf("set_gain\n");
as7343.set_gain(1024);
printf("set_measurement_time\n");
as7343.set_measurement_time(500);
printf("set_integration_time\n");
as7343.set_integration_time(27800);
printf("set_illumination_current\n");
as7343.set_illumination_current(4);
printf("set_illumination_led\n");
as7343.set_illumination_led(true);
printf("start...\n");
while(true) {
AS7343::reading reading = as7343.read();
printf("FZ: %d FY: %d FXL: %d NIR: %d F2 %d F3: %d F4: %d F5: %d F1: %d F5: %d F7: %d F8: %d \n",
reading.FZ,
reading.FY,
reading.FXL,
reading.NIR,
reading.F2,
reading.F3,
reading.F4,
reading.F6,
reading.F1,
reading.F5,
reading.F7,
reading.F8
);
sleep_ms(1000);
}
return 0;
}

Wyświetl plik

@ -25,7 +25,7 @@ int main() {
while (1) {
BME280::bme280_reading result = bme280.read_forced();
printf("%s %0.2lf deg C, %0.2lf hPa, %0.2lf%%\n", result.status == BME280_OK ? "OK" : "ER", result.temperature, result.pressure, result.humidity);
printf("%s %0.2lf deg C, %0.2lf hPa, %0.2lf%%\n", result.status ? "OK" : "ER", result.temperature, result.pressure, result.humidity);
sleep_ms(1000);
}

Wyświetl plik

@ -30,7 +30,7 @@ int main() {
// }
// }
graphics.set_pen(1);
graphics.set_pen(15);
graphics.clear();
float s = (sin(i / 10.0f) * 1.0f) + 1.5f;

Wyświetl plik

@ -3,7 +3,11 @@
#include "pico_explorer.hpp"
#include "pico/stdlib.h"
#include "encoder.hpp"
#ifndef NO_QSTR
#include "quadrature_out.pio.h"
#endif
#include "drivers/st7789/st7789.hpp"
#include "libraries/pico_graphics/pico_graphics.hpp"
#include "button.hpp"

Wyświetl plik

@ -34,10 +34,15 @@ int main() {
while(true) {
offset += float(SPEED) / 2000.0f;
if (offset > 1.0) {
offset -= 1.0;
}
for(auto i = 0u; i < NUM_LEDS; ++i) {
float hue = float(i) / NUM_LEDS;
led_strip.set_hsv(i, hue + offset, 1.0f, 1.0f);
hue += offset;
hue -= floor(hue);
led_strip.set_hsv(i, hue, 1.0f, 1.0f);
}
sleep_ms(1000 / UPDATES);

Wyświetl plik

@ -45,7 +45,7 @@ int main() {
while(true) {
BME280::bme280_reading result = bme.read_forced();
printf("%s %0.2lf deg C, %0.2lf hPa, %0.2lf%%\n", result.status == BME280_OK ? "OK" : "ER", result.temperature, result.pressure, result.humidity);
printf("%s %0.2lf deg C, %0.2lf hPa, %0.2lf%%\n", result.status ? "OK" : "ER", result.temperature, result.pressure, result.humidity);
// calculates a colour
float hue = HUE_START + ((float)(result.temperature - MIN) * (float)(HUE_END - HUE_START) / (float)(MAX - MIN));

Wyświetl plik

@ -0,0 +1,84 @@
add_executable(
stellar_rainbow_text
stellar_rainbow_text.cpp
)
# Pull in pico libraries that we need
target_link_libraries(stellar_rainbow_text pico_stdlib hardware_pio hardware_adc hardware_dma pico_graphics stellar_unicorn)
pico_enable_stdio_usb(stellar_rainbow_text 1)
# create map/bin/hex file etc.
pico_add_extra_outputs(stellar_rainbow_text)
add_executable(
stellar_rainbow
stellar_rainbow.cpp
)
# Pull in pico libraries that we need
target_link_libraries(stellar_rainbow pico_stdlib hardware_pio hardware_adc hardware_dma pico_graphics stellar_unicorn)
pico_enable_stdio_usb(stellar_rainbow 1)
# create map/bin/hex file etc.
pico_add_extra_outputs(stellar_rainbow)
add_executable(
stellar_eighties_super_computer
stellar_eighties_super_computer.cpp
)
# Pull in pico libraries that we need
target_link_libraries(stellar_eighties_super_computer pico_stdlib hardware_pio hardware_adc hardware_dma pico_graphics stellar_unicorn)
pico_enable_stdio_usb(stellar_eighties_super_computer 1)
# create map/bin/hex file etc.
pico_add_extra_outputs(stellar_eighties_super_computer)
add_executable(
stellar_fire_effect
stellar_fire_effect.cpp
)
# Pull in pico libraries that we need
target_link_libraries(stellar_fire_effect pico_stdlib hardware_pio hardware_adc hardware_dma pico_graphics stellar_unicorn)
pico_enable_stdio_usb(stellar_fire_effect 1)
# create map/bin/hex file etc.
pico_add_extra_outputs(stellar_fire_effect)
add_executable(
stellar_scroll_text
stellar_scroll_text.cpp
)
# Pull in pico libraries that we need
target_link_libraries(stellar_scroll_text pico_stdlib hardware_pio hardware_adc hardware_dma pico_graphics stellar_unicorn)
pico_enable_stdio_usb(stellar_scroll_text 1)
# create map/bin/hex file etc.
pico_add_extra_outputs(stellar_scroll_text)
add_executable(
stellar_lava_lamp
stellar_lava_lamp.cpp
)
# Pull in pico libraries that we need
target_link_libraries(stellar_lava_lamp pico_stdlib hardware_pio hardware_adc hardware_dma pico_graphics stellar_unicorn)
pico_enable_stdio_usb(stellar_lava_lamp 1)
# create map/bin/hex file etc.
pico_add_extra_outputs(stellar_lava_lamp)

Wyświetl plik

@ -0,0 +1,67 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "pico/stdlib.h"
#include "libraries/pico_graphics/pico_graphics.hpp"
#include "stellar_unicorn.hpp"
using namespace pimoroni;
PicoGraphics_PenRGB888 graphics(16, 16, nullptr);
StellarUnicorn stellar_unicorn;
float lifetime[16][16];
float age[16][16];
int main() {
stdio_init_all();
for(int y = 0; y < 16; y++) {
for(int x = 0; x < 16; x++) {
lifetime[x][y] = 1.0f + ((rand() % 10) / 100.0f);
age[x][y] = ((rand() % 100) / 100.0f) * lifetime[x][y];
}
}
stellar_unicorn.init();
while(true) {
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_BRIGHTNESS_UP)) {
stellar_unicorn.adjust_brightness(+0.01);
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_BRIGHTNESS_DOWN)) {
stellar_unicorn.adjust_brightness(-0.01);
}
graphics.set_pen(0, 0, 0);
graphics.clear();
for(int y = 0; y < 16; y++) {
for(int x = 0; x < 16; x++) {
if(age[x][y] < lifetime[x][y] * 0.3f) {
graphics.set_pen(230, 150, 0);
graphics.pixel(Point(x, y));
}else if(age[x][y] < lifetime[x][y] * 0.5f) {
float decay = (lifetime[x][y] * 0.5f - age[x][y]) * 5.0f;
graphics.set_pen(decay * 230, decay * 150, 0);
graphics.pixel(Point(x, y));
}
if(age[x][y] >= lifetime[x][y]) {
age[x][y] = 0.0f;
lifetime[x][y] = 1.0f + ((rand() % 10) / 100.0f);
}
age[x][y] += 0.01f;
}
}
stellar_unicorn.update(&graphics);
sleep_ms(10);
}
return 0;
}

Wyświetl plik

@ -0,0 +1,115 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "pico/stdlib.h"
#include "libraries/pico_graphics/pico_graphics.hpp"
#include "stellar_unicorn.hpp"
using namespace pimoroni;
PicoGraphics_PenRGB888 graphics(16, 16, nullptr);
StellarUnicorn stellar_unicorn;
// extra row of pixels for sourcing flames and averaging
int width = 16;
int height = 17;
// a buffer that's at least big enough to store 55 x 15 values (to allow for both orientations)
float heat[2000] = {0.0f};
void set(int x, int y, float v) {
heat[x + y * width] = v;
}
float get(int x, int y) {
/*if(x < 0 || x >= width || y < 0 || y >= height) {
return 0.0f;
}*/
x = x < 0 ? 0 : x;
x = x >= width ? width - 1 : x;
return heat[x + y * width];
}
int main() {
stdio_init_all();
stellar_unicorn.init();
stellar_unicorn.set_brightness(0.2);
bool landscape = true;
/*
while(true) {
stellar_unicorn.set_pixel(0, 0, 255, 0, 0);
stellar_unicorn.set_pixel(1, 1, 0, 255, 0);
stellar_unicorn.set_pixel(2, 2, 0, 0, 255);
}*/
while(true) {
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_BRIGHTNESS_UP)) {
stellar_unicorn.adjust_brightness(+0.01);
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_BRIGHTNESS_DOWN)) {
stellar_unicorn.adjust_brightness(-0.01);
}
for(int y = 0; y < height; y++) {
for(int x = 0; x < width; x++) {
float value = get(x, y);
graphics.set_pen(0, 0, 0);
if(value > 0.5f) {
graphics.set_pen(255, 255, 180);
}else if(value > 0.4f) {
graphics.set_pen(220, 160, 0);
}else if(value > 0.3f) {
graphics.set_pen(180, 30, 0);
}else if(value > 0.22f) {
graphics.set_pen(20, 20, 20);
}
if(landscape) {
graphics.pixel(Point(x, y));
}else{
graphics.pixel(Point(y, x));
}
// update this pixel by averaging the below pixels
float average = (get(x, y) + get(x, y + 2) + get(x, y + 1) + get(x - 1, y + 1) + get(x + 1, y + 1)) / 5.0f;
// damping factor to ensure flame tapers out towards the top of the displays
average *= 0.95f;
// update the heat map with our newly averaged value
set(x, y, average);
}
}
stellar_unicorn.update(&graphics);
// clear the bottom row and then add a new fire seed to it
for(int x = 0; x < width; x++) {
set(x, height - 1, 0.0f);
}
// add a new random heat source
int source_count = landscape ? 5 : 1;
for(int c = 0; c < source_count; c++) {
int px = (rand() % (width - 4)) + 2;
set(px , height - 2, 1.0f);
set(px + 1, height - 2, 1.0f);
set(px - 1, height - 2, 1.0f);
set(px , height - 1, 1.0f);
set(px + 1, height - 1, 1.0f);
set(px - 1, height - 1, 1.0f);
}
sleep_ms(20);
}
return 0;
}

Wyświetl plik

@ -0,0 +1,148 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "pico/stdlib.h"
#include "libraries/pico_graphics/pico_graphics.hpp"
#include "stellar_unicorn.hpp"
using namespace pimoroni;
PicoGraphics_PenRGB888 graphics(16, 16, nullptr);
StellarUnicorn stellar_unicorn;
// HSV Conversion expects float inputs in the range of 0.00-1.00 for each channel
// Outputs are rgb in the range 0-255 for each channel
void from_hsv(float h, float s, float v, uint8_t &r, uint8_t &g, uint8_t &b) {
float i = floor(h * 6.0f);
float f = h * 6.0f - i;
v *= 255.0f;
uint8_t p = v * (1.0f - s);
uint8_t q = v * (1.0f - f * s);
uint8_t t = v * (1.0f - (1.0f - f) * s);
switch (int(i) % 6) {
case 0: r = v; g = t; b = p; break;
case 1: r = q; g = v; b = p; break;
case 2: r = p; g = v; b = t; break;
case 3: r = p; g = q; b = v; break;
case 4: r = t; g = p; b = v; break;
case 5: r = v; g = p; b = q; break;
}
}
struct blob_t {
float x, y;
float r;
float dx, dy;
};
constexpr int blob_count = 20;
int main() {
stdio_init_all();
stellar_unicorn.init();
stellar_unicorn.set_brightness(0.5);
// randomise blob start positions, directions, and size
std::array<blob_t, blob_count> blobs;
for(auto &blob : blobs) {
blob.x = rand() % 16;
blob.y = rand() % 16;
blob.r = ((rand() % 40) / 10.0f) + 5.0f;
blob.dx = ((rand() % 2) / 10.0f) - 0.05f;
blob.dy = ((rand() % 3) / 10.0f) - 0.1f;
}
float hue = 0.0f;
while(true) {
// allow user to adjust brightness
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_BRIGHTNESS_UP)) {
stellar_unicorn.adjust_brightness(+0.01);
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_BRIGHTNESS_DOWN)) {
stellar_unicorn.adjust_brightness(-0.01);
}
uint start_ms = to_ms_since_boot(get_absolute_time());
// calculate the influence of each blob on the liquid based
// on their distance to each pixel. this causes blobs to
// "merge" into each other when we use fixed thresholds to
// determine which colour to draw with
float liquid[16][16] = {0.0f};
for(auto &blob : blobs) {
float r_sq = blob.r * blob.r;
for(int y = 0; y < 16; y++) {
for(int x = 0; x < 16; x++) {
float d_sq = (x - blob.x) * (x - blob.x) + (y - blob.y) * (y - blob.y);
if(d_sq <= r_sq) {
// add this blobs influence to this pixel
liquid[x][y] += 1.0f - (d_sq / r_sq);
}
}
}
}
// update the blob positions
for(auto &blob : blobs) {
blob.x += blob.dx;
blob.y += blob.dy;
// if we hit the edge then bounce!
if(blob.x < 0.0f || blob.x >= 11.0f) {
blob.dx *= -1.0f;
}
if(blob.y < 0.0f || blob.y >= 53.0f) {
blob.dy *= -1.0f;
}
}
// rotate the hue
hue += 0.001f;
// calculate dark, medium, and bright shades for rendering the
// lava
uint8_t dark_r, dark_g, dark_b;
from_hsv(hue, 1.0f, 0.3f, dark_r, dark_g, dark_b);
uint8_t mid_r, mid_g, mid_b;
from_hsv(hue, 1.0f, 0.6f, mid_r, mid_g, mid_b);
uint8_t bright_r, bright_g, bright_b;
from_hsv(hue, 1.0f, 1.0f, bright_r, bright_g, bright_b);
// clear the canvas
graphics.set_pen(0, 0, 0);
graphics.clear();
// render the lava
for(int y = 0; y < 16; y++) {
for(int x = 0; x < 16; x++) {
float v = liquid[x][y];
// select a colour for this pixel based on how much
// "blobfluence" there is at this position in the liquid
if(v >= 1.5f) {
graphics.set_pen(bright_r, bright_g, bright_b);
graphics.pixel(Point(y, x));
}else if(v >= 1.25f) {
graphics.set_pen(mid_r, mid_g, mid_b);
graphics.pixel(Point(y, x));
}else if(v >= 1.0f) {
graphics.set_pen(dark_r, dark_g, dark_b);
graphics.pixel(Point(y, x));
}
}
}
uint end_ms = to_ms_since_boot(get_absolute_time());
printf("rendering took %dms\n", end_ms - start_ms);
stellar_unicorn.update(&graphics);
}
return 0;
}

Wyświetl plik

@ -0,0 +1,184 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "pico/stdlib.h"
#include "libraries/pico_graphics/pico_graphics.hpp"
#include "stellar_unicorn.hpp"
using namespace pimoroni;
PicoGraphics_PenRGB888 graphics(16, 16, nullptr);
StellarUnicorn stellar_unicorn;
// HSV Conversion expects float inputs in the range of 0.00-1.00 for each channel
// Outputs are rgb in the range 0-255 for each channel
void from_hsv(float h, float s, float v, uint8_t &r, uint8_t &g, uint8_t &b) {
float i = floor(h * 6.0f);
float f = h * 6.0f - i;
v *= 255.0f;
uint8_t p = v * (1.0f - s);
uint8_t q = v * (1.0f - f * s);
uint8_t t = v * (1.0f - (1.0f - f) * s);
switch (int(i) % 6) {
case 0: r = v; g = t; b = p; break;
case 1: r = q; g = v; b = p; break;
case 2: r = p; g = v; b = t; break;
case 3: r = p; g = q; b = v; break;
case 4: r = t; g = p; b = v; break;
case 5: r = v; g = p; b = q; break;
}
}
void text(std::string t, Point p, float s = 1.0f, float a = 1.0f) {
int w = graphics.measure_text(t, s);
p.x += (53 / 2) - (w / 2);
p.y += (11 / 2);
graphics.text(t, Point(p.x, p.y), -1, s, a);
//graphics.text(t, Point(p.x + 1, p.y), -1, s, a);
//graphics.text(t, Point(p.x + 1, p.y + 1), -1, s, a);
//graphics.text(t, Point(p.x, p.y + 1), -1, s, a);
}
struct star_t {
float dx, dy, x, y, a;
uint8_t brightness() {
int b = a / 5;
return b > 15 ? 15 : b;
}
};
void init_star(star_t &s) {
s.x = ((rand() % 100) / 5.0f) - 10.0f;
s.y = ((rand() % 100) / 10.0f) - 5.0f;
s.dx = s.x / 10.0f;
s.dy = s.y / 10.0f;
s.a = 0;
}
void step_star(star_t &s) {
s.x += s.dx;
s.y += s.dy;
s.a++;
if(s.a > 100) {
init_star(s);
}
}
int main() {
stdio_init_all();
uint8_t hue_map[16][3];
for(int i = 0; i < 16; i++) {
from_hsv(i / 16.0f, 1.0f, 1.0f, hue_map[i][0], hue_map[i][1], hue_map[i][2]);
}
star_t stars[100];
for(int i = 0; i < 100; i++) {
init_star(stars[i]);
stars[i].a = i;
}
gpio_set_function(28, GPIO_FUNC_SIO);
gpio_set_dir(28, GPIO_OUT);
for(int i = 0; i < 10; i++) {
gpio_put(28, !gpio_get(28));
sleep_ms(100);
}
sleep_ms(1000);
gpio_put(28,true);
stellar_unicorn.init();
float i = 0;
float hue_offset = 0.0f;
bool animate = true;
float stripe_width = 3.0f;
float speed = 1.0f;
float curve = 0.0f;
while(true) {
if(animate) {
i += speed;
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_VOLUME_UP)) {
curve += 0.05;
if(hue_offset > 1.0f) hue_offset = 1.0f;
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_VOLUME_DOWN)) {
curve -= 0.05;
if(hue_offset < 0.0f) hue_offset = 0.0f;
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_BRIGHTNESS_UP)) {
stellar_unicorn.adjust_brightness(+0.01);
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_BRIGHTNESS_DOWN)) {
stellar_unicorn.adjust_brightness(-0.01);
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_SLEEP)) {
animate = false;
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_A)) {
speed += 0.05f;
speed = speed >= 10.0f ? 10.0f : speed;
animate = true;
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_B)) {
speed -= 0.05f;
speed = speed <= 0.0f ? 0.0f : speed;
animate = true;
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_C)) {
stripe_width += 0.05f;
stripe_width = stripe_width >= 10.0f ? 10.0f : stripe_width;
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_D)) {
stripe_width -= 0.05f;
stripe_width = stripe_width <= 1.0f ? 1.0f : stripe_width;
}
for(int x = 0; x < 16; x++) {
for(int y = 0; y < 16; y++) {
int v = ((sin((x + y) / stripe_width + (sin((y * 3.1415927f * 2.0f) / 11.0f) * curve) + i / 15.0f) + 1.5f) / 2.5f) * 255.0f;
uint8_t r = (hue_map[x][0] * v) / 256;
uint8_t g = (hue_map[x][1] * v) / 256;
uint8_t b = (hue_map[x][2] * v) / 256;
graphics.set_pen(r, g, b);
graphics.pixel(Point(x, y));
}
}
stellar_unicorn.update(&graphics);
printf("%d\n", stellar_unicorn.light());
sleep_ms(20);
}
printf("done\n");
return 0;
}

Wyświetl plik

@ -0,0 +1,102 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "pico/stdlib.h"
#include "libraries/pico_graphics/pico_graphics.hpp"
#include "stellar_unicorn.hpp"
using namespace pimoroni;
PicoGraphics_PenRGB888 graphics(16, 16, nullptr);
StellarUnicorn stellar_unicorn;
// HSV Conversion expects float inputs in the range of 0.00-1.00 for each channel
// Outputs are rgb in the range 0-255 for each channel
void from_hsv(float h, float s, float v, uint8_t &r, uint8_t &g, uint8_t &b) {
float i = floor(h * 6.0f);
float f = h * 6.0f - i;
v *= 255.0f;
uint8_t p = v * (1.0f - s);
uint8_t q = v * (1.0f - f * s);
uint8_t t = v * (1.0f - (1.0f - f) * s);
switch (int(i) % 6) {
case 0: r = v; g = t; b = p; break;
case 1: r = q; g = v; b = p; break;
case 2: r = p; g = v; b = t; break;
case 3: r = p; g = q; b = v; break;
case 4: r = t; g = p; b = v; break;
case 5: r = v; g = p; b = q; break;
}
}
void text(std::string t, Point p, float s = 1.0f, float a = 1.0f) {
int w = graphics.measure_text(t, s);
p.x += (16 / 2) - (w / 2);
p.y += (16 / 2);
graphics.text(t, Point(p.x, p.y), -1, s, a);
graphics.text(t, Point(p.x + 1, p.y), -1, s, a);
graphics.text(t, Point(p.x + 1, p.y + 1), -1, s, a);
graphics.text(t, Point(p.x, p.y + 1), -1, s, a);
}
int main() {
uint8_t hue_map[16][3];
for(int i = 0; i < 16; i++) {
from_hsv(i / 16.0f, 1.0f, 0.5f, hue_map[i][0], hue_map[i][1], hue_map[i][2]);
}
stellar_unicorn.init();
graphics.set_font("sans");
uint i = 0;
while(true) {
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_BRIGHTNESS_UP)) {
stellar_unicorn.adjust_brightness(+0.01);
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_BRIGHTNESS_DOWN)) {
stellar_unicorn.adjust_brightness(-0.01);
}
i++;
graphics.set_pen(0, 0, 0);
graphics.clear();
float s = 0.4f;//0.65f + (sin(i / 25.0f) * 0.15f);
float a = 1.0f;// (sin(i / 25.0f) * 100.0f);
float x = (sin((i) / 50.0f) * 45.0f);
float y = (cos((i) / 40.0f) * 2.5f);
graphics.set_pen(255, 255, 255);
text("Galactic Unicorn", Point(x, y), s, a);
uint8_t *p = (uint8_t *)graphics.frame_buffer;
for(size_t i = 0; i < 16 * 16; i++) {
int x = i % 16;
int y = i / 16;
uint r = *p++;
uint g = *p++;
uint b = *p++;
p++;
if(r > 0) {
r = hue_map[x][0];
g = hue_map[x][1];
b = hue_map[x][2];
}
graphics.set_pen(r, g, b);
graphics.pixel(Point(x, y));
}
stellar_unicorn.update(&graphics);
}
printf("done\n");
return 0;
}

Wyświetl plik

@ -0,0 +1,76 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "pico/stdlib.h"
#include "libraries/pico_graphics/pico_graphics.hpp"
#include "stellar_unicorn.hpp"
using namespace pimoroni;
PicoGraphics_PenRGB888 graphics(16, 16, nullptr);
StellarUnicorn stellar_unicorn;
std::string message = "Pirate. Monkey. Robot. Ninja.";
// HSV Conversion expects float inputs in the range of 0.00-1.00 for each channel
// Outputs are rgb in the range 0-255 for each channel
void from_hsv(float h, float s, float v, uint8_t &r, uint8_t &g, uint8_t &b) {
float i = floor(h * 6.0f);
float f = h * 6.0f - i;
v *= 255.0f;
uint8_t p = v * (1.0f - s);
uint8_t q = v * (1.0f - f * s);
uint8_t t = v * (1.0f - (1.0f - f) * s);
switch (int(i) % 6) {
case 0: r = v; g = t; b = p; break;
case 1: r = q; g = v; b = p; break;
case 2: r = p; g = v; b = t; break;
case 3: r = p; g = q; b = v; break;
case 4: r = t; g = p; b = v; break;
case 5: r = v; g = p; b = q; break;
}
}
int main() {
stdio_init_all();
stellar_unicorn.init();
float scroll = -16.0f;
while(true) {
//uint time_ms = to_ms_since_boot(get_absolute_time());
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_BRIGHTNESS_UP)) {
stellar_unicorn.adjust_brightness(+0.01);
}
if(stellar_unicorn.is_pressed(stellar_unicorn.SWITCH_BRIGHTNESS_DOWN)) {
stellar_unicorn.adjust_brightness(-0.01);
}
int width = graphics.measure_text(message, 1);
scroll += 0.125f;
if(scroll > width) {
scroll = -16.0f;
}
graphics.set_pen(0, 0, 0);
graphics.clear();
uint8_t r = 0, g = 0, b = 0;
from_hsv(scroll / 100.0f, 1.0f, 0.5f, r, g, b);
graphics.set_pen(r, g, b);
graphics.text(message, Point(0 - scroll, 5), -1, 0.55);
stellar_unicorn.update(&graphics);
sleep_ms(10);
}
return 0;
}

Wyświetl plik

@ -32,11 +32,11 @@ ST7789 st7789(
PicoGraphics_PenRGB332 graphics(st7789.width, st7789.height, nullptr);
Button button_a(Tufty2040::A);
Button button_b(Tufty2040::B);
Button button_c(Tufty2040::C);
Button button_up(Tufty2040::UP);
Button button_down(Tufty2040::DOWN);
Button button_a(Tufty2040::A, Polarity::ACTIVE_HIGH);
Button button_b(Tufty2040::B, Polarity::ACTIVE_HIGH);
Button button_c(Tufty2040::C, Polarity::ACTIVE_HIGH);
Button button_up(Tufty2040::UP, Polarity::ACTIVE_HIGH);
Button button_down(Tufty2040::DOWN, Polarity::ACTIVE_HIGH);
uint32_t time() {
absolute_time_t t = get_absolute_time();

Wyświetl plik

@ -36,9 +36,11 @@ add_subdirectory(motor2040)
add_subdirectory(inventor2040w)
add_subdirectory(adcfft)
add_subdirectory(jpegdec)
add_subdirectory(pngdec)
add_subdirectory(inky_frame)
add_subdirectory(inky_frame_7)
add_subdirectory(galactic_unicorn)
add_subdirectory(gfx_pack)
add_subdirectory(interstate75)
add_subdirectory(cosmic_unicorn)
add_subdirectory(stellar_unicorn)

Wyświetl plik

@ -47,7 +47,7 @@ void ADCFFT::init() {
// Initialize the ADC harware
// (resets it, enables the clock, spins until the hardware is ready)
adc_init();
if (!(adc_hw->cs & ADC_CS_EN_BITS)) adc_init();
// Select analog mux input (0...3 are GPIO 26, 27, 28, 29; 4 is temp sensor)
adc_select_input(adc_channel);

Wyświetl plik

@ -1,12 +1,14 @@
add_library(automation INTERFACE)
target_sources(automation INTERFACE
${CMAKE_CURRENT_LIST_DIR}/automation.cpp
)
target_include_directories(automation INTERFACE ${CMAKE_CURRENT_LIST_DIR})
#include(${PIMORONI_PICO_PATH}/drivers/analog/analog.cmake)
# Pull in pico libraries that we need
target_link_libraries(automation INTERFACE pico_stdlib hardware_pwm hardware_i2c pimoroni_i2c analog)
if(NOT TARGET analog)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/analog/analog.cmake)
endif()
add_library(automation INTERFACE)
target_sources(automation INTERFACE
${CMAKE_CURRENT_LIST_DIR}/automation.cpp
)
target_include_directories(automation INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(automation INTERFACE pico_stdlib hardware_pwm hardware_i2c pimoroni_i2c analog)

Wyświetl plik

@ -1,11 +1,23 @@
set(LIB_NAME badger2040)
add_library(${LIB_NAME} INTERFACE)
target_sources(${LIB_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}.cpp
)
target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(${LIB_NAME} INTERFACE bitmap_fonts hershey_fonts pico_stdlib hardware_pwm uc8151_legacy)
if(NOT TARGET uc8151_legacy)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/uc8151_legacy/uc8151_legacy.cmake)
endif()
if(NOT TARGET bitmap_fonts)
include(${CMAKE_CURRENT_LIST_DIR}/../bitmap_fonts/bitmap_fonts.cmake)
endif()
if(NOT TARGET hershey_fonts)
include(${CMAKE_CURRENT_LIST_DIR}/../hershey_fonts/hershey_fonts.cmake)
endif()
set(LIB_NAME badger2040)
add_library(${LIB_NAME} INTERFACE)
target_sources(${LIB_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}.cpp
)
target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(${LIB_NAME} INTERFACE bitmap_fonts hershey_fonts uc8151_legacy pico_stdlib hardware_pwm)

Wyświetl plik

@ -1,11 +1,15 @@
#include "bitmap_fonts.hpp"
namespace bitmap {
int32_t measure_character(const font_t *font, const char c, const uint8_t scale, unicode_sorta::codepage_t codepage) {
int32_t measure_character(const font_t *font, const char c, const uint8_t scale, unicode_sorta::codepage_t codepage, bool fixed_width) {
if(c < 32 || c > 127 + 64) { // + 64 char remappings defined in unicode_sorta.hpp
return 0;
}
if(fixed_width) {
return font->max_width * scale;
}
uint8_t char_index = c;
if(char_index > 127) {
@ -21,7 +25,7 @@ namespace bitmap {
return font->widths[char_index] * scale;
}
int32_t measure_text(const font_t *font, const std::string_view &t, const uint8_t scale, const uint8_t letter_spacing) {
int32_t measure_text(const font_t *font, const std::string_view &t, const uint8_t scale, const uint8_t letter_spacing, bool fixed_width) {
int32_t text_width = 0;
unicode_sorta::codepage_t codepage = unicode_sorta::PAGE_195;
for(auto c : t) {
@ -31,14 +35,14 @@ namespace bitmap {
} else if (c == unicode_sorta::PAGE_195_START) {
continue;
}
text_width += measure_character(font, c, scale, codepage);
text_width += measure_character(font, c, scale, codepage, fixed_width);
text_width += letter_spacing * scale;
codepage = unicode_sorta::PAGE_195; // Reset back to default
}
return text_width;
}
void character(const font_t *font, rect_func rectangle, const char c, const int32_t x, const int32_t y, const uint8_t scale, unicode_sorta::codepage_t codepage) {
void character(const font_t *font, rect_func rectangle, const char c, const int32_t x, const int32_t y, const uint8_t scale, int32_t rotation, unicode_sorta::codepage_t codepage) {
if(c < 32 || c > 127 + 64) { // + 64 char remappings defined in unicode_sorta.hpp
return;
}
@ -85,7 +89,8 @@ namespace bitmap {
uint8_t accent_offset = char_index < 65 ? offset_upper : offset_lower;
// Offset our y position to account for our column canvas being 32 pixels
int y_offset = y - (8 * scale);
// this gives us 8 "pixels" of headroom above the letters for diacritic marks
int font_offset = (8 * scale);
// Iterate through each horizontal column of font (and accent) data
for(uint8_t cx = 0; cx < font->widths[char_index]; cx++) {
@ -94,6 +99,8 @@ namespace bitmap {
// We shift the char down 8 pixels to make room for an accent above.
uint32_t data = *d << 8;
int32_t o_x = cx * scale;
// For fonts that are taller than 8 pixels (up to 16) they need two bytes
if(two_bytes_per_column) {
d++;
@ -109,7 +116,28 @@ namespace bitmap {
// Draw the 32 pixel column
for(uint8_t cy = 0; cy < 32; cy++) {
if((1U << cy) & data) {
rectangle(x + (cx * scale), y_offset + (cy * scale), scale, scale);
int32_t o_y = cy * scale;
int32_t px = 0;
int32_t py = 0;
switch (rotation) {
case 0:
px = x + o_x;
py = y - font_offset + o_y;
break;
case 90:
px = x + font_offset - o_y;
py = y + o_x;
break;
case 180:
px = x - o_x;
py = y + font_offset - o_y;
break;
case 270:
px = x - font_offset + o_y;
py = y - o_x;
break;
}
rectangle(px, py, scale, scale);
}
}
@ -119,10 +147,14 @@ namespace bitmap {
}
}
void text(const font_t *font, rect_func rectangle, const std::string_view &t, const int32_t x, const int32_t y, const int32_t wrap, const uint8_t scale, const uint8_t letter_spacing) {
uint32_t co = 0, lo = 0; // character and line (if wrapping) offset
void text(const font_t *font, rect_func rectangle, const std::string_view &t, const int32_t x, const int32_t y, const int32_t wrap, const uint8_t scale, const uint8_t letter_spacing, bool fixed_width, int32_t rotation) {
uint32_t char_offset = 0;
uint32_t line_offset = 0; // line (if wrapping) offset
unicode_sorta::codepage_t codepage = unicode_sorta::PAGE_195;
int32_t space_width = measure_character(font, ' ', scale, codepage, fixed_width);
space_width += letter_spacing * scale;
size_t i = 0;
while(i < t.length()) {
// find length of current word
@ -148,38 +180,53 @@ namespace bitmap {
} else if (t[j] == unicode_sorta::PAGE_195_START) {
continue;
}
word_width += measure_character(font, t[j], scale, codepage);
word_width += measure_character(font, t[j], scale, codepage, fixed_width);
word_width += letter_spacing * scale;
codepage = unicode_sorta::PAGE_195;
}
// if this word would exceed the wrap limit then
// move to the next line
if(co != 0 && co + word_width > (uint32_t)wrap) {
co = 0;
lo += (font->height + 1) * scale;
if(char_offset != 0 && char_offset + word_width > (uint32_t)wrap) {
char_offset = 0;
line_offset += (font->height + 1) * scale;
}
// draw word
for(size_t j = i; j < next_break; j++) {
for(size_t j = i; j < std::min(next_break + 1, t.length()); j++) {
if (t[j] == unicode_sorta::PAGE_194_START) {
codepage = unicode_sorta::PAGE_194;
continue;
} else if (t[j] == unicode_sorta::PAGE_195_START) {
continue;
}
if (t[j] == '\n') {
lo += (font->height + 1) * scale;
co = 0;
if (t[j] == '\n') { // Linebreak
line_offset += (font->height + 1) * scale;
char_offset = 0;
} else if (t[j] == ' ') { // Space
char_offset += space_width;
} else {
character(font, rectangle, t[j], x + co, y + lo, scale, codepage);
co += measure_character(font, t[j], scale, codepage);
co += letter_spacing * scale;
switch(rotation) {
case 0:
character(font, rectangle, t[j], x + char_offset, y + line_offset, scale, rotation, codepage);
break;
case 90:
character(font, rectangle, t[j], x - line_offset, y + char_offset, scale, rotation, codepage);
break;
case 180:
character(font, rectangle, t[j], x - char_offset, y - line_offset, scale, rotation, codepage);
break;
case 270:
character(font, rectangle, t[j], x + line_offset, y - char_offset, scale, rotation, codepage);
break;
}
char_offset += measure_character(font, t[j], scale, codepage, fixed_width);
char_offset += letter_spacing * scale;
}
codepage = unicode_sorta::PAGE_195;
}
// move character offset to end of word and add a space
co += font->widths[0] * scale;
// move character offset
i = next_break += 1;
}
}

Wyświetl plik

@ -19,9 +19,9 @@ namespace bitmap {
typedef std::function<void(int32_t x, int32_t y, int32_t w, int32_t h)> rect_func;
int32_t measure_character(const font_t *font, const char c, const uint8_t scale, unicode_sorta::codepage_t codepage = unicode_sorta::PAGE_195);
int32_t measure_text(const font_t *font, const std::string_view &t, const uint8_t scale = 2, const uint8_t letter_spacing = 1);
int32_t measure_character(const font_t *font, const char c, const uint8_t scale, unicode_sorta::codepage_t codepage = unicode_sorta::PAGE_195, bool fixed_width = false);
int32_t measure_text(const font_t *font, const std::string_view &t, const uint8_t scale = 2, const uint8_t letter_spacing = 1, bool fixed_width = false);
void character(const font_t *font, rect_func rectangle, const char c, const int32_t x, const int32_t y, const uint8_t scale = 2, unicode_sorta::codepage_t codepage = unicode_sorta::PAGE_195);
void text(const font_t *font, rect_func rectangle, const std::string_view &t, const int32_t x, const int32_t y, const int32_t wrap, const uint8_t scale = 2, const uint8_t letter_spacing = 1);
void character(const font_t *font, rect_func rectangle, const char c, const int32_t x, const int32_t y, const uint8_t scale = 2, int32_t rotation = 0, unicode_sorta::codepage_t codepage = unicode_sorta::PAGE_195);
void text(const font_t *font, rect_func rectangle, const std::string_view &t, const int32_t x, const int32_t y, const int32_t wrap, const uint8_t scale = 2, const uint8_t letter_spacing = 1, bool fixed_width = false, int32_t rotation = 0);
}

Wyświetl plik

@ -4,7 +4,7 @@
const bitmap::font_t font8 {
.height = 8,
.max_width = 6,
.max_width = 5,
.widths = {
3, 1, 3, 5, 4, 4, 4, 1, 3, 3, 3, 3, 2, 3, 2, 4,
4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 1, 2, 3, 3, 3, 4,
@ -17,123 +17,123 @@ const bitmap::font_t font8 {
5, 4, 4, 5, 4, 4, 4, 4, 3
},
.data = {
0x00,0x00,0x00,0x00,0x00,0x00, //
0x5f,0x00,0x00,0x00,0x00,0x00, // !
0x03,0x00,0x03,0x00,0x00,0x00, // "
0x28,0x7c,0x28,0x7c,0x28,0x00, // #
0x24,0x7a,0x2f,0x12,0x00,0x00, // $
0x66,0x10,0x08,0x66,0x00,0x00, // %
0x36,0x49,0x49,0x7c,0x00,0x00, // &
0x03,0x00,0x00,0x00,0x00,0x00, // '
0x1c,0x22,0x41,0x00,0x00,0x00, // (
0x41,0x22,0x1c,0x00,0x00,0x00, // )
0x54,0x38,0x54,0x00,0x00,0x00, // *
0x10,0x38,0x10,0x00,0x00,0x00, // +
0x80,0x60,0x00,0x00,0x00,0x00, // ,
0x10,0x10,0x10,0x00,0x00,0x00, // -
0x60,0x60,0x00,0x00,0x00,0x00, // .
0x60,0x18,0x06,0x01,0x00,0x00, // /
0x3e,0x41,0x41,0x3e,0x00,0x00, // 0
0x42,0x7f,0x40,0x00,0x00,0x00, // 1
0x62,0x51,0x49,0x46,0x00,0x00, // 2
0x21,0x49,0x4d,0x33,0x00,0x00, // 3
0x18,0x16,0x11,0x7f,0x00,0x00, // 4
0x4f,0x49,0x49,0x31,0x00,0x00, // 5
0x3c,0x4a,0x49,0x30,0x00,0x00, // 6
0x01,0x61,0x19,0x07,0x00,0x00, // 7
0x36,0x49,0x49,0x36,0x00,0x00, // 8
0x06,0x49,0x29,0x1e,0x00,0x00, // 9
0x33,0x00,0x00,0x00,0x00,0x00, // :
0x80,0x6c,0x00,0x00,0x00,0x00, // ;
0x10,0x28,0x44,0x00,0x00,0x00, // <
0x28,0x28,0x28,0x00,0x00,0x00, // =
0x44,0x28,0x10,0x00,0x00,0x00, // >
0x02,0x51,0x09,0x06,0x00,0x00, // ?
0x3e,0x49,0x55,0x5e,0x00,0x00, // @
0x7e,0x09,0x09,0x7e,0x00,0x00, // A
0x7f,0x49,0x49,0x36,0x00,0x00, // B
0x3e,0x41,0x41,0x22,0x00,0x00, // C
0x7f,0x41,0x41,0x3e,0x00,0x00, // D
0x7f,0x49,0x49,0x41,0x00,0x00, // E
0x7f,0x09,0x09,0x01,0x00,0x00, // F
0x3e,0x41,0x49,0x79,0x00,0x00, // G
0x7f,0x08,0x08,0x7f,0x00,0x00, // H
0x41,0x7f,0x41,0x00,0x00,0x00, // I
0x30,0x40,0x40,0x3f,0x00,0x00, // J
0x7f,0x08,0x14,0x63,0x00,0x00, // K
0x7f,0x40,0x40,0x40,0x00,0x00, // L
0x7f,0x02,0x04,0x02,0x7f,0x00, // M
0x7f,0x02,0x04,0x7f,0x00,0x00, // N
0x3e,0x41,0x41,0x3e,0x00,0x00, // O
0x7f,0x09,0x09,0x06,0x00,0x00, // P
0x3e,0x41,0x21,0x5e,0x00,0x00, // Q
0x7f,0x09,0x19,0x66,0x00,0x00, // R
0x46,0x49,0x49,0x31,0x00,0x00, // S
0x01,0x01,0x7f,0x01,0x01,0x00, // T
0x3f,0x40,0x40,0x3f,0x00,0x00, // U
0x7f,0x40,0x20,0x1f,0x00,0x00, // V
0x3f,0x40,0x20,0x40,0x3f,0x00, // W
0x77,0x08,0x08,0x77,0x00,0x00, // X
0x47,0x48,0x48,0x3f,0x00,0x00, // Y
0x71,0x49,0x45,0x43,0x00,0x00, // Z
0x7f,0x41,0x00,0x00,0x00,0x00, // [
0x01,0x06,0x18,0x60,0x00,0x00, // "\"
0x41,0x7f,0x00,0x00,0x00,0x00, // ]
0x04,0x02,0x04,0x00,0x00,0x00, // ^
0x40,0x40,0x40,0x00,0x00,0x00, // _
0x01,0x01,0x00,0x00,0x00,0x00, // `
0x20,0x54,0x54,0x78,0x00,0x00, // a
0x7f,0x44,0x44,0x38,0x00,0x00, // b
0x38,0x44,0x44,0x28,0x00,0x00, // c
0x38,0x44,0x44,0x7f,0x00,0x00, // d
0x38,0x54,0x54,0x58,0x00,0x00, // e
0x7e,0x09,0x09,0x02,0x00,0x00, // f
0x18,0xa4,0xa4,0x7c,0x00,0x00, // g
0x7f,0x04,0x04,0x78,0x00,0x00, // h
0x04,0x7d,0x40,0x00,0x00,0x00, // i
0x60,0x80,0x80,0x7d,0x00,0x00, // j
0x7f,0x10,0x28,0x44,0x00,0x00, // k
0x01,0x7f,0x40,0x00,0x00,0x00, // l
0x7c,0x04,0x78,0x04,0x78,0x00, // m
0x7c,0x04,0x04,0x78,0x00,0x00, // n
0x38,0x44,0x44,0x38,0x00,0x00, // o
0xfc,0x24,0x24,0x18,0x00,0x00, // p
0x18,0x24,0x24,0xfc,0x00,0x00, // q
0x7c,0x08,0x04,0x04,0x00,0x00, // r
0x48,0x54,0x54,0x24,0x00,0x00, // s
0x3e,0x44,0x44,0x20,0x00,0x00, // t
0x3c,0x40,0x40,0x7c,0x00,0x00, // u
0x7c,0x40,0x20,0x1c,0x00,0x00, // v
0x3c,0x40,0x20,0x40,0x3c,0x00, // w
0x6c,0x10,0x10,0x6c,0x00,0x00, // x
0x1c,0xa0,0xa0,0x7c,0x00,0x00, // y
0x64,0x54,0x4c,0x00,0x00,0x00, // z
0x08,0x3e,0x41,0x00,0x00,0x00, // {
0x7f,0x00,0x00,0x00,0x00,0x00, // |
0x41,0x3e,0x08,0x00,0x00,0x00, // }
0x08,0x04,0x08,0x04,0x00,0x00, // ~
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00, //
0x5f,0x00,0x00,0x00,0x00, // !
0x03,0x00,0x03,0x00,0x00, // "
0x28,0x7c,0x28,0x7c,0x28, // #
0x24,0x7a,0x2f,0x12,0x00, // $
0x66,0x10,0x08,0x66,0x00, // %
0x36,0x49,0x49,0x7c,0x00, // &
0x03,0x00,0x00,0x00,0x00, // '
0x1c,0x22,0x41,0x00,0x00, // (
0x41,0x22,0x1c,0x00,0x00, // )
0x54,0x38,0x54,0x00,0x00, // *
0x10,0x38,0x10,0x00,0x00, // +
0x80,0x60,0x00,0x00,0x00, // ,
0x10,0x10,0x10,0x00,0x00, // -
0x60,0x60,0x00,0x00,0x00, // .
0x60,0x18,0x06,0x01,0x00, // /
0x3e,0x41,0x41,0x3e,0x00, // 0
0x42,0x7f,0x40,0x00,0x00, // 1
0x62,0x51,0x49,0x46,0x00, // 2
0x21,0x49,0x4d,0x33,0x00, // 3
0x18,0x16,0x11,0x7f,0x00, // 4
0x4f,0x49,0x49,0x31,0x00, // 5
0x3c,0x4a,0x49,0x30,0x00, // 6
0x01,0x61,0x19,0x07,0x00, // 7
0x36,0x49,0x49,0x36,0x00, // 8
0x06,0x49,0x29,0x1e,0x00, // 9
0x33,0x00,0x00,0x00,0x00, // :
0x80,0x6c,0x00,0x00,0x00, // ;
0x10,0x28,0x44,0x00,0x00, // <
0x28,0x28,0x28,0x00,0x00, // =
0x44,0x28,0x10,0x00,0x00, // >
0x02,0x51,0x09,0x06,0x00, // ?
0x3e,0x49,0x55,0x5e,0x00, // @
0x7e,0x09,0x09,0x7e,0x00, // A
0x7f,0x49,0x49,0x36,0x00, // B
0x3e,0x41,0x41,0x22,0x00, // C
0x7f,0x41,0x41,0x3e,0x00, // D
0x7f,0x49,0x49,0x41,0x00, // E
0x7f,0x09,0x09,0x01,0x00, // F
0x3e,0x41,0x49,0x79,0x00, // G
0x7f,0x08,0x08,0x7f,0x00, // H
0x41,0x7f,0x41,0x00,0x00, // I
0x30,0x40,0x40,0x3f,0x00, // J
0x7f,0x08,0x14,0x63,0x00, // K
0x7f,0x40,0x40,0x40,0x00, // L
0x7f,0x02,0x04,0x02,0x7f, // M
0x7f,0x02,0x04,0x7f,0x00, // N
0x3e,0x41,0x41,0x3e,0x00, // O
0x7f,0x09,0x09,0x06,0x00, // P
0x3e,0x41,0x21,0x5e,0x00, // Q
0x7f,0x09,0x19,0x66,0x00, // R
0x46,0x49,0x49,0x31,0x00, // S
0x01,0x01,0x7f,0x01,0x01, // T
0x3f,0x40,0x40,0x3f,0x00, // U
0x7f,0x40,0x20,0x1f,0x00, // V
0x3f,0x40,0x20,0x40,0x3f, // W
0x77,0x08,0x08,0x77,0x00, // X
0x47,0x48,0x48,0x3f,0x00, // Y
0x71,0x49,0x45,0x43,0x00, // Z
0x7f,0x41,0x00,0x00,0x00, // [
0x01,0x06,0x18,0x60,0x00, // "\"
0x41,0x7f,0x00,0x00,0x00, // ]
0x04,0x02,0x04,0x00,0x00, // ^
0x40,0x40,0x40,0x00,0x00, // _
0x01,0x01,0x00,0x00,0x00, // `
0x20,0x54,0x54,0x78,0x00, // a
0x7f,0x44,0x44,0x38,0x00, // b
0x38,0x44,0x44,0x28,0x00, // c
0x38,0x44,0x44,0x7f,0x00, // d
0x38,0x54,0x54,0x58,0x00, // e
0x7e,0x09,0x09,0x02,0x00, // f
0x18,0xa4,0xa4,0x7c,0x00, // g
0x7f,0x04,0x04,0x78,0x00, // h
0x04,0x7d,0x40,0x00,0x00, // i
0x60,0x80,0x80,0x7d,0x00, // j
0x7f,0x10,0x28,0x44,0x00, // k
0x01,0x7f,0x40,0x00,0x00, // l
0x7c,0x04,0x78,0x04,0x78, // m
0x7c,0x04,0x04,0x78,0x00, // n
0x38,0x44,0x44,0x38,0x00, // o
0xfc,0x24,0x24,0x18,0x00, // p
0x18,0x24,0x24,0xfc,0x00, // q
0x7c,0x08,0x04,0x04,0x00, // r
0x48,0x54,0x54,0x24,0x00, // s
0x3e,0x44,0x44,0x20,0x00, // t
0x3c,0x40,0x40,0x7c,0x00, // u
0x7c,0x40,0x20,0x1c,0x00, // v
0x3c,0x40,0x20,0x40,0x3c, // w
0x6c,0x10,0x10,0x6c,0x00, // x
0x1c,0xa0,0xa0,0x7c,0x00, // y
0x64,0x54,0x4c,0x00,0x00, // z
0x08,0x3e,0x41,0x00,0x00, // {
0x7f,0x00,0x00,0x00,0x00, // |
0x41,0x3e,0x08,0x00,0x00, // }
0x08,0x04,0x08,0x04,0x00, // ~
0x00,0x00,0x00,0x00,0x00,
// Extra
0x7e,0x09,0x7f,0x49,0x49,0x00, // Æ
0x7e,0x24,0x24,0x18,0x00,0x00, // Þ
0x7e,0x09,0x49,0x36,0x00,0x00, // ß
0x20,0x54,0x78,0x54,0x58,0x00, // æ
0x7f,0x24,0x24,0x18,0x00,0x00, // þ
0x08,0x7e,0x49,0x41,0x00,0x00, // £
0x47,0x48,0x48,0x3f,0x00,0x00, // ¥
0x38,0x44,0x44,0x28,0x00,0x00, // ©
0x02,0x05,0x02,0x00,0x00,0x00, // °
0x7e,0x09,0x7f,0x49,0x49, // Æ
0x7e,0x24,0x24,0x18,0x00, // Þ
0x7e,0x09,0x49,0x36,0x00, // ß
0x20,0x54,0x78,0x54,0x58, // æ
0x7f,0x24,0x24,0x18,0x00, // þ
0x08,0x7e,0x49,0x41,0x00, // £
0x47,0x48,0x48,0x3f,0x00, // ¥
0x38,0x44,0x44,0x28,0x00, // ©
0x02,0x05,0x02,0x00,0x00, // °
// Accents + Offsets
// All chars are shifted 8px down into a 32 pixel canvas for combining with accents.
// Accent shift values (the first two numbers in each line below) move the accent down to meet them.
// These are the shift values for lower and UPPER case letters respectively.
6,4, 0x00,0x00,0x01,0x02,0x00,0x00, // Grave
6,4, 0x00,0x00,0x02,0x01,0x00,0x00, // Acute
6,4, 0x00,0x02,0x01,0x02,0x00,0x00, // Circumflex
6,4, 0x00,0x01,0x02,0x01,0x02,0x00, // Tilde
6,4, 0x00,0x01,0x00,0x01,0x00,0x00, // Diaresis
6,4, 0x00,0x02,0x05,0x02,0x00,0x00, // Ring Above
6,4, 0x00,0x80,0x40,0x00,0x00,0x00, // Stroke
9,9, 0x00,0x00,0xa0,0x40,0x00,0x00 // Cedilla
6,4, 0x00,0x00,0x01,0x02,0x00, // Grave
6,4, 0x00,0x00,0x02,0x01,0x00, // Acute
6,4, 0x00,0x02,0x01,0x02,0x00, // Circumflex
6,4, 0x00,0x01,0x02,0x01,0x02, // Tilde
6,4, 0x00,0x01,0x00,0x01,0x00, // Diaresis
6,4, 0x00,0x02,0x05,0x02,0x00, // Ring Above
6,4, 0x00,0x80,0x40,0x00,0x00, // Stroke
9,9, 0x00,0x00,0xa0,0x40,0x00 // Cedilla
}
};

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET as7262)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/as7262/as7262.cmake)
endif()
set(LIB_NAME breakout_as7262)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET bh1745)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/bh1745/bh1745.cmake)
endif()
set(LIB_NAME breakout_bh1745)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET ltp305)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/ltp305/ltp305.cmake)
endif()
set(LIB_NAME breakout_dotmatrix)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET ioexpander)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/ioexpander/ioexpander.cmake)
endif()
set(LIB_NAME breakout_encoder)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,11 @@
if(NOT TARGET ioexpander)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/ioexpander/ioexpander.cmake)
endif()
if(NOT TARGET is31fl3731)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/is31fl3731/is31fl3731.cmake)
endif()
set(LIB_NAME breakout_encoder_wheel)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET ioexpander)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/ioexpander/ioexpander.cmake)
endif()
set(LIB_NAME breakout_ioexpander)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET ltr559)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/ltr559/ltr559.cmake)
endif()
set(LIB_NAME breakout_ltr559)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET is31fl3731)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/is31fl3731/is31fl3731.cmake)
endif()
set(LIB_NAME breakout_matrix11x7)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET ioexpander)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/ioexpander/ioexpander.cmake)
endif()
set(LIB_NAME breakout_mics6814)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -20,9 +20,9 @@ namespace pimoroni {
static const uint8_t LED_B = 2;
static const uint8_t MICS_VREF = 14;
static const uint8_t MICS_RED = 12;
static const uint8_t MICS_RED = 13;
static const uint8_t MICS_NH3 = 11;
static const uint8_t MICS_OX = 13;
static const uint8_t MICS_OX = 12;
static const uint8_t MICS_HEATER_EN = 1;
static const bool INVERT_OUTPUT = true; //true for common cathode, false for common anode

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET msa301)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/msa301/msa301.cmake)
endif()
set(LIB_NAME breakout_msa301)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET pmw3901)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/pmw3901/pmw3901.cmake)
endif()
set(LIB_NAME breakout_paa5100)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET pmw3901)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/pmw3901/pmw3901.cmake)
endif()
set(LIB_NAME breakout_pmw3901)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET ioexpander)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/ioexpander/ioexpander.cmake)
endif()
set(LIB_NAME breakout_potentiometer)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET is31fl3731)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/is31fl3731/is31fl3731.cmake)
endif()
set(LIB_NAME breakout_rgbmatrix5x5)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET rv3028)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/rv3028/rv3028.cmake)
endif()
set(LIB_NAME breakout_rtc)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET sgp30)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/sgp30/sgp30.cmake)
endif()
set(LIB_NAME breakout_sgp30)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET trackball)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/trackball/trackball.cmake)
endif()
set(LIB_NAME breakout_trackball)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET pico_graphics)
include(${CMAKE_CURRENT_LIST_DIR}/../pico_graphics/pico_graphics.cmake)
endif()
add_library(cosmic_unicorn INTERFACE)
pico_generate_pio_header(cosmic_unicorn ${CMAKE_CURRENT_LIST_DIR}/cosmic_unicorn.pio)

Wyświetl plik

@ -6,8 +6,10 @@
#include "hardware/clocks.h"
#ifndef NO_QSTR
#include "cosmic_unicorn.pio.h"
#include "audio_i2s.pio.h"
#endif
#include "cosmic_unicorn.hpp"
@ -38,10 +40,6 @@
//
// .. and back to the start
static uint16_t r_gamma_lut[256] = {0};
static uint16_t g_gamma_lut[256] = {0};
static uint16_t b_gamma_lut[256] = {0};
static uint32_t dma_channel;
static uint32_t dma_ctrl_channel;
static uint32_t audio_dma_channel;
@ -122,19 +120,6 @@ namespace pimoroni {
// Tear down the old GU instance's hardware resources
partial_teardown();
}
// create 14-bit gamma luts
for(uint16_t v = 0; v < 256; v++) {
// gamma correct the provided 0-255 brightness value onto a
// 0-65535 range for the pwm counter
float r_gamma = 1.8f;
r_gamma_lut[v] = (uint16_t)(powf((float)(v) / 255.0f, r_gamma) * (float(1U << (BCD_FRAME_COUNT)) - 1.0f) + 0.5f);
float g_gamma = 1.8f;
g_gamma_lut[v] = (uint16_t)(powf((float)(v) / 255.0f, g_gamma) * (float(1U << (BCD_FRAME_COUNT)) - 1.0f) + 0.5f);
float b_gamma = 1.8f;
b_gamma_lut[v] = (uint16_t)(powf((float)(v) / 255.0f, b_gamma) * (float(1U << (BCD_FRAME_COUNT)) - 1.0f) + 0.5f);
}
// for each row:
// for each bcd frame:
@ -166,7 +151,7 @@ namespace pimoroni {
}
// setup light sensor adc
adc_init();
if (!(adc_hw->cs & ADC_CS_EN_BITS)) adc_init();
adc_gpio_init(LIGHT_SENSOR);
gpio_init(COLUMN_CLOCK); gpio_set_dir(COLUMN_CLOCK, GPIO_OUT); gpio_put(COLUMN_CLOCK, false);
@ -476,9 +461,9 @@ namespace pimoroni {
g = (g * this->brightness) >> 8;
b = (b * this->brightness) >> 8;
uint16_t gamma_r = r_gamma_lut[r];
uint16_t gamma_g = g_gamma_lut[g];
uint16_t gamma_b = b_gamma_lut[b];
uint16_t gamma_r = GAMMA_14BIT[r];
uint16_t gamma_g = GAMMA_14BIT[g];
uint16_t gamma_b = GAMMA_14BIT[b];
// for each row:
// for each bcd frame:
@ -509,11 +494,14 @@ namespace pimoroni {
void CosmicUnicorn::set_brightness(float value) {
value = value < 0.0f ? 0.0f : value;
value = value > 1.0f ? 1.0f : value;
// Max brightness is - in fact - 256 since it's applied with:
// result = (channel * brightness) >> 8
// eg: (255 * 256) >> 8 == 255
this->brightness = floor(value * 256.0f);
}
float CosmicUnicorn::get_brightness() {
return this->brightness / 255.0f;
return this->brightness / 256.0f;
}
void CosmicUnicorn::adjust_brightness(float delta) {

Wyświetl plik

@ -2,6 +2,7 @@
#include "hardware/pio.h"
#include "pico_graphics.hpp"
#include "common/pimoroni_common.hpp"
#include "../pico_synth/pico_synth.hpp"
namespace pimoroni {

Wyświetl plik

@ -1,3 +1,7 @@
if(NOT TARGET pico_graphics)
include(${CMAKE_CURRENT_LIST_DIR}/../pico_graphics/pico_graphics.cmake)
endif()
add_library(galactic_unicorn INTERFACE)
pico_generate_pio_header(galactic_unicorn ${CMAKE_CURRENT_LIST_DIR}/galactic_unicorn.pio)

Wyświetl plik

@ -6,8 +6,10 @@
#include "hardware/clocks.h"
#ifndef NO_QSTR
#include "galactic_unicorn.pio.h"
#include "audio_i2s.pio.h"
#endif
#include "galactic_unicorn.hpp"
@ -38,10 +40,6 @@
//
// .. and back to the start
static uint16_t r_gamma_lut[256] = {0};
static uint16_t g_gamma_lut[256] = {0};
static uint16_t b_gamma_lut[256] = {0};
static uint32_t dma_channel;
static uint32_t dma_ctrl_channel;
static uint32_t audio_dma_channel;
@ -122,19 +120,6 @@ namespace pimoroni {
// Tear down the old GU instance's hardware resources
partial_teardown();
}
// create 14-bit gamma luts
for(uint16_t v = 0; v < 256; v++) {
// gamma correct the provided 0-255 brightness value onto a
// 0-65535 range for the pwm counter
float r_gamma = 1.8f;
r_gamma_lut[v] = (uint16_t)(powf((float)(v) / 255.0f, r_gamma) * (float(1U << (BCD_FRAME_COUNT)) - 1.0f) + 0.5f);
float g_gamma = 1.8f;
g_gamma_lut[v] = (uint16_t)(powf((float)(v) / 255.0f, g_gamma) * (float(1U << (BCD_FRAME_COUNT)) - 1.0f) + 0.5f);
float b_gamma = 1.8f;
b_gamma_lut[v] = (uint16_t)(powf((float)(v) / 255.0f, b_gamma) * (float(1U << (BCD_FRAME_COUNT)) - 1.0f) + 0.5f);
}
// for each row:
// for each bcd frame:
@ -166,7 +151,7 @@ namespace pimoroni {
}
// setup light sensor adc
adc_init();
if (!(adc_hw->cs & ADC_CS_EN_BITS)) adc_init();
adc_gpio_init(LIGHT_SENSOR);
gpio_init(COLUMN_CLOCK); gpio_set_dir(COLUMN_CLOCK, GPIO_OUT); gpio_put(COLUMN_CLOCK, false);
@ -470,9 +455,9 @@ namespace pimoroni {
g = (g * this->brightness) >> 8;
b = (b * this->brightness) >> 8;
uint16_t gamma_r = r_gamma_lut[r];
uint16_t gamma_g = g_gamma_lut[g];
uint16_t gamma_b = b_gamma_lut[b];
uint16_t gamma_r = GAMMA_14BIT[r];
uint16_t gamma_g = GAMMA_14BIT[g];
uint16_t gamma_b = GAMMA_14BIT[b];
// for each row:
// for each bcd frame:
@ -503,11 +488,14 @@ namespace pimoroni {
void GalacticUnicorn::set_brightness(float value) {
value = value < 0.0f ? 0.0f : value;
value = value > 1.0f ? 1.0f : value;
// Max brightness is - in fact - 256 since it's applied with:
// result = (channel * brightness) >> 8
// eg: (255 * 256) >> 8 == 255
this->brightness = floor(value * 256.0f);
}
float GalacticUnicorn::get_brightness() {
return this->brightness / 255.0f;
return this->brightness / 256.0f;
}
void GalacticUnicorn::adjust_brightness(float delta) {

Wyświetl plik

@ -2,6 +2,7 @@
#include "hardware/pio.h"
#include "pico_graphics.hpp"
#include "common/pimoroni_common.hpp"
#include "../pico_synth/pico_synth.hpp"
namespace pimoroni {

Wyświetl plik

@ -1,3 +1,19 @@
if(NOT TARGET st7567)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/st7567/st7567.cmake)
endif()
if(NOT TARGET button)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/button/button.cmake)
endif()
if(NOT TARGET rgbled)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/rgbled/rgbled.cmake)
endif()
if(NOT TARGET pico_graphics)
include(${CMAKE_CURRENT_LIST_DIR}/../pico_graphics/pico_graphics.cmake)
endif()
set(LIB_NAME gfx_pack)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,11 +1,35 @@
set(LIB_NAME inky_frame)
add_library(${LIB_NAME} INTERFACE)
target_sources(${LIB_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}.cpp
)
target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(${LIB_NAME} INTERFACE hardware_i2c pico_graphics hardware_spi hardware_pwm bitmap_fonts hershey_fonts pico_stdlib sdcard fatfs pcf85063a uc8159 jpegdec)
if(NOT TARGET sdcard)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/sdcard/sdcard.cmake)
endif()
if(NOT TARGET fatfs)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/fatfs/fatfs.cmake)
endif()
if(NOT TARGET pcf85063a)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/pcf85063a/pcf85063a.cmake)
endif()
if(NOT TARGET uc8159)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/uc8159/uc8159.cmake)
endif()
if(NOT TARGET jpegdec)
include(${CMAKE_CURRENT_LIST_DIR}/../jpegdec/jpegdec.cmake)
endif()
if(NOT TARGET pico_graphics)
include(${CMAKE_CURRENT_LIST_DIR}/../pico_graphics/pico_graphics.cmake)
endif()
set(LIB_NAME inky_frame)
add_library(${LIB_NAME} INTERFACE)
target_sources(${LIB_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}.cpp
)
target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(${LIB_NAME} INTERFACE hardware_i2c pico_graphics hardware_spi hardware_pwm bitmap_fonts hershey_fonts pico_stdlib sdcard fatfs pcf85063a uc8159 jpegdec)

Wyświetl plik

@ -1,13 +1,41 @@
set(LIB_NAME inky_frame_7)
add_library(${LIB_NAME} INTERFACE)
target_sources(${LIB_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}.cpp
)
target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(${LIB_NAME} INTERFACE hardware_i2c pico_graphics hardware_spi hardware_pwm bitmap_fonts hershey_fonts pico_stdlib sdcard fatfs pcf85063a psram_display inky73 jpegdec)
if(NOT TARGET sdcard)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/sdcard/sdcard.cmake)
endif()
if(NOT TARGET fatfs)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/fatfs/fatfs.cmake)
endif()
if(NOT TARGET pcf85063a)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/pcf85063a/pcf85063a.cmake)
endif()
if(NOT TARGET psram_display)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/psram_display/psram_display.cmake)
endif()
if(NOT TARGET inky73)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/inky73/inky73.cmake)
endif()
if(NOT TARGET jpegdec)
include(${CMAKE_CURRENT_LIST_DIR}/../jpegdec/jpegdec.cmake)
endif()
if(NOT TARGET pico_graphics)
include(${CMAKE_CURRENT_LIST_DIR}/../pico_graphics/pico_graphics.cmake)
endif()
set(LIB_NAME inky_frame_7)
add_library(${LIB_NAME} INTERFACE)
target_sources(${LIB_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}.cpp
)
target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(${LIB_NAME} INTERFACE hardware_i2c pico_graphics hardware_spi hardware_pwm bitmap_fonts hershey_fonts pico_stdlib sdcard fatfs pcf85063a psram_display inky73 jpegdec)
target_compile_options(${LIB_NAME} INTERFACE -Wno-error=reorder)

Wyświetl plik

@ -1,3 +1,19 @@
if(NOT TARGET hub75)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/hub75/hub75.cmake)
endif()
if(NOT TARGET button)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/button/button.cmake)
endif()
if(NOT TARGET rgbled)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/rgbled/rgbled.cmake)
endif()
if(NOT TARGET pico_graphics)
include(${CMAKE_CURRENT_LIST_DIR}/../pico_graphics/pico_graphics.cmake)
endif()
set(LIB_NAME interstate75)
add_library(${LIB_NAME} INTERFACE)

Wyświetl plik

@ -1,3 +1,19 @@
if(NOT TARGET motor)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/motor/motor.cmake)
endif()
if(NOT TARGET servo)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/servo/servo.cmake)
endif()
if(NOT TARGET encoder)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/encoder/encoder.cmake)
endif()
if(NOT TARGET plasma)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/plasma/plasma.cmake)
endif()
add_library(inventor INTERFACE)
target_sources(inventor INTERFACE
@ -7,4 +23,4 @@ target_sources(inventor INTERFACE
target_include_directories(inventor INTERFACE ${CMAKE_CURRENT_LIST_DIR})
# Pull in pico libraries that we need
target_link_libraries(inventor INTERFACE pico_stdlib hardware_pwm hardware_pio hardware_i2c pimoroni_i2c motor servo encoder plasma pimoroni_i2c)
target_link_libraries(inventor INTERFACE pico_stdlib hardware_pwm hardware_pio hardware_i2c pimoroni_i2c motor servo encoder plasma)

Wyświetl plik

@ -68,6 +68,7 @@
enum {
RGB565_LITTLE_ENDIAN = 0,
RGB565_BIG_ENDIAN,
RGB888_LITTLE_ENDIAN,
EIGHT_BIT_GRAYSCALE,
FOUR_BIT_DITHERED,
TWO_BIT_DITHERED,

Wyświetl plik

@ -182,138 +182,82 @@ static const uint16_t usGrayTo565[] = {0x0000,0x0000,0x0000,0x0000,0x0020,0x0020
//
// Clip and convert red value into 5-bits for RGB565
//
static const uint16_t usRangeTableR[] = {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 0
0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,
0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
0x1800,0x1800,0x1800,0x1800,0x1800,0x1800,0x1800,0x1800,
0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,
0x2800,0x2800,0x2800,0x2800,0x2800,0x2800,0x2800,0x2800,
0x3000,0x3000,0x3000,0x3000,0x3000,0x3000,0x3000,0x3000,
0x3800,0x3800,0x3800,0x3800,0x3800,0x3800,0x3800,0x3800,
0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,
0x4800,0x4800,0x4800,0x4800,0x4800,0x4800,0x4800,0x4800,
0x5000,0x5000,0x5000,0x5000,0x5000,0x5000,0x5000,0x5000,
0x5800,0x5800,0x5800,0x5800,0x5800,0x5800,0x5800,0x5800,
0x6000,0x6000,0x6000,0x6000,0x6000,0x6000,0x6000,0x6000,
0x6800,0x6800,0x6800,0x6800,0x6800,0x6800,0x6800,0x6800,
0x7000,0x7000,0x7000,0x7000,0x7000,0x7000,0x7000,0x7000,
0x7800,0x7800,0x7800,0x7800,0x7800,0x7800,0x7800,0x7800,
0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,
0x8800,0x8800,0x8800,0x8800,0x8800,0x8800,0x8800,0x8800,
0x9000,0x9000,0x9000,0x9000,0x9000,0x9000,0x9000,0x9000,
0x9800,0x9800,0x9800,0x9800,0x9800,0x9800,0x9800,0x9800,
0xa000,0xa000,0xa000,0xa000,0xa000,0xa000,0xa000,0xa000,
0xa800,0xa800,0xa800,0xa800,0xa800,0xa800,0xa800,0xa800,
0xb000,0xb000,0xb000,0xb000,0xb000,0xb000,0xb000,0xb000,
0xb800,0xb800,0xb800,0xb800,0xb800,0xb800,0xb800,0xb800,
0xc000,0xc000,0xc000,0xc000,0xc000,0xc000,0xc000,0xc000,
0xc800,0xc800,0xc800,0xc800,0xc800,0xc800,0xc800,0xc800,
0xd000,0xd000,0xd000,0xd000,0xd000,0xd000,0xd000,0xd000,
0xd800,0xd800,0xd800,0xd800,0xd800,0xd800,0xd800,0xd800,
0xe000,0xe000,0xe000,0xe000,0xe000,0xe000,0xe000,0xe000,
0xe800,0xe800,0xe800,0xe800,0xe800,0xe800,0xe800,0xe800,
0xf000,0xf000,0xf000,0xf000,0xf000,0xf000,0xf000,0xf000,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800, // 256
static const uint16_t usRangeTableR[] = {0x0000, // 0
0x0800,
0x1000,
0x1800,
0x2000,
0x2800,
0x3000,
0x3800,
0x4000,
0x4800,
0x5000,
0x5800,
0x6000,
0x6800,
0x7000,
0x7800,
0x8000,
0x8800,
0x9000,
0x9800,
0xa000,
0xa800,
0xb000,
0xb800,
0xc000,
0xc800,
0xd000,
0xd800,
0xe000,
0xe800,
0xf000,
0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800, // 32
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 512
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 768
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 64
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 96
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
//
// Clip and convert green value into 5-bits for RGB565
// Clip and convert green value into 6-bits for RGB565
//
static const uint16_t usRangeTableG[] = {0x0000,0x0000,0x0000,0x0000,0x0020,0x0020,0x0020,0x0020, // 0
0x0040,0x0040,0x0040,0x0040,0x0060,0x0060,0x0060,0x0060,
0x0080,0x0080,0x0080,0x0080,0x00a0,0x00a0,0x00a0,0x00a0,
0x00c0,0x00c0,0x00c0,0x00c0,0x00e0,0x00e0,0x00e0,0x00e0,
0x0100,0x0100,0x0100,0x0100,0x0120,0x0120,0x0120,0x0120,
0x0140,0x0140,0x0140,0x0140,0x0160,0x0160,0x0160,0x0160,
0x0180,0x0180,0x0180,0x0180,0x01a0,0x01a0,0x01a0,0x01a0,
0x01c0,0x01c0,0x01c0,0x01c0,0x01e0,0x01e0,0x01e0,0x01e0,
0x0200,0x0200,0x0200,0x0200,0x0220,0x0220,0x0220,0x0220,
0x0240,0x0240,0x0240,0x0240,0x0260,0x0260,0x0260,0x0260,
0x0280,0x0280,0x0280,0x0280,0x02a0,0x02a0,0x02a0,0x02a0,
0x02c0,0x02c0,0x02c0,0x02c0,0x02e0,0x02e0,0x02e0,0x02e0,
0x0300,0x0300,0x0300,0x0300,0x0320,0x0320,0x0320,0x0320,
0x0340,0x0340,0x0340,0x0340,0x0360,0x0360,0x0360,0x0360,
0x0380,0x0380,0x0380,0x0380,0x03a0,0x03a0,0x03a0,0x03a0,
0x03c0,0x03c0,0x03c0,0x03c0,0x03e0,0x03e0,0x03e0,0x03e0,
0x0400,0x0400,0x0400,0x0400,0x0420,0x0420,0x0420,0x0420,
0x0440,0x0440,0x0440,0x0440,0x0460,0x0460,0x0460,0x0460,
0x0480,0x0480,0x0480,0x0480,0x04a0,0x04a0,0x04a0,0x04a0,
0x04c0,0x04c0,0x04c0,0x04c0,0x04e0,0x04e0,0x04e0,0x04e0,
0x0500,0x0500,0x0500,0x0500,0x0520,0x0520,0x0520,0x0520,
0x0540,0x0540,0x0540,0x0540,0x0560,0x0560,0x0560,0x0560,
0x0580,0x0580,0x0580,0x0580,0x05a0,0x05a0,0x05a0,0x05a0,
0x05c0,0x05c0,0x05c0,0x05c0,0x05e0,0x05e0,0x05e0,0x05e0,
0x0600,0x0600,0x0600,0x0600,0x0620,0x0620,0x0620,0x0620,
0x0640,0x0640,0x0640,0x0640,0x0660,0x0660,0x0660,0x0660,
0x0680,0x0680,0x0680,0x0680,0x06a0,0x06a0,0x06a0,0x06a0,
0x06c0,0x06c0,0x06c0,0x06c0,0x06e0,0x06e0,0x06e0,0x06e0,
0x0700,0x0700,0x0700,0x0700,0x0720,0x0720,0x0720,0x0720,
0x0740,0x0740,0x0740,0x0740,0x0760,0x0760,0x0760,0x0760,
0x0780,0x0780,0x0780,0x0780,0x07a0,0x07a0,0x07a0,0x07a0,
0x07c0,0x07c0,0x07c0,0x07c0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0, // 256
static const uint16_t usRangeTableG[] = {0x0000,0x0020, // 0
0x0040,0x0060,
0x0080,0x00a0,
0x00c0,0x00e0,
0x0100,0x0120,
0x0140,0x0160,
0x0180,0x01a0,
0x01c0,0x01e0,
0x0200,0x0220,
0x0240,0x0260,
0x0280,0x02a0,
0x02c0,0x02e0,
0x0300,0x0320,
0x0340,0x0360,
0x0380,0x03a0,
0x03c0,0x03e0,
0x0400,0x0420,
0x0440,0x0460,
0x0480,0x04a0,
0x04c0,0x04e0,
0x0500,0x0520,
0x0540,0x0560,
0x0580,0x05a0,
0x05c0,0x05e0,
0x0600,0x0620,
0x0640,0x0660,
0x0680,0x06a0,
0x06c0,0x06e0,
0x0700,0x0720,
0x0740,0x0760,
0x0780,0x07a0,
0x07c0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0, // 64
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
@ -321,160 +265,56 @@ static const uint16_t usRangeTableG[] = {0x0000,0x0000,0x0000,0x0000,0x0020,0x00
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 512
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 768
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 128
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 196
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
//
// Clip and convert blue value into 5-bits for RGB565
//
static const uint16_t usRangeTableB[] = {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 0
0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,
0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,
0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,
0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,
0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,
0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,
0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,
0x000a,0x000a,0x000a,0x000a,0x000a,0x000a,0x000a,0x000a,
0x000b,0x000b,0x000b,0x000b,0x000b,0x000b,0x000b,0x000b,
0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,
0x000d,0x000d,0x000d,0x000d,0x000d,0x000d,0x000d,0x000d,
0x000e,0x000e,0x000e,0x000e,0x000e,0x000e,0x000e,0x000e,
0x000f,0x000f,0x000f,0x000f,0x000f,0x000f,0x000f,0x000f,
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,
0x0011,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011,
0x0012,0x0012,0x0012,0x0012,0x0012,0x0012,0x0012,0x0012,
0x0013,0x0013,0x0013,0x0013,0x0013,0x0013,0x0013,0x0013,
0x0014,0x0014,0x0014,0x0014,0x0014,0x0014,0x0014,0x0014,
0x0015,0x0015,0x0015,0x0015,0x0015,0x0015,0x0015,0x0015,
0x0016,0x0016,0x0016,0x0016,0x0016,0x0016,0x0016,0x0016,
0x0017,0x0017,0x0017,0x0017,0x0017,0x0017,0x0017,0x0017,
0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,
0x0019,0x0019,0x0019,0x0019,0x0019,0x0019,0x0019,0x0019,
0x001a,0x001a,0x001a,0x001a,0x001a,0x001a,0x001a,0x001a,
0x001b,0x001b,0x001b,0x001b,0x001b,0x001b,0x001b,0x001b,
0x001c,0x001c,0x001c,0x001c,0x001c,0x001c,0x001c,0x001c,
0x001d,0x001d,0x001d,0x001d,0x001d,0x001d,0x001d,0x001d,
0x001e,0x001e,0x001e,0x001e,0x001e,0x001e,0x001e,0x001e,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f, // 256
static const uint16_t usRangeTableB[] = {0x0000, // 0
0x0001,
0x0002,
0x0003,
0x0004,
0x0005,
0x0006,
0x0007,
0x0008,
0x0009,
0x000a,
0x000b,
0x000c,
0x000d,
0x000e,
0x000f,
0x0010,
0x0011,
0x0012,
0x0013,
0x0014,
0x0015,
0x0016,
0x0017,
0x0018,
0x0019,
0x001a,
0x001b,
0x001c,
0x001d,
0x001e,
0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f, // 32
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 512
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 768
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 64
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 96
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
#if defined (__MACH__) || defined( __LINUX__ ) || defined( __MCUXPRESSO )
//
@ -2288,9 +2128,9 @@ static void JPEGPixelLE(uint16_t *pDest, int iY, int iCb, int iCr)
iCBG = -1409 * (iCb-0x80);
iCRG = -2925 * (iCr-0x80);
iCRR = 5742 * (iCr-0x80);
usPixel = usRangeTableB[((iCBB + iY) >> 12) & 0x3ff]; // blue pixel
usPixel |= usRangeTableG[((iCBG + iCRG + iY) >> 12) & 0x3ff]; // green pixel
usPixel |= usRangeTableR[((iCRR + iY) >> 12) & 0x3ff]; // red pixel
usPixel = usRangeTableB[((iCBB + iY) >> 15) & 0x7f]; // blue pixel
usPixel |= usRangeTableG[((iCBG + iCRG + iY) >> 14) & 0xff]; // green pixel
usPixel |= usRangeTableR[((iCRR + iY) >> 15) & 0x7f]; // red pixel
pDest[0] = usPixel;
#endif
} /* JPEGPixelLE() */
@ -2304,9 +2144,9 @@ static void JPEGPixelBE(uint16_t *pDest, int iY, int iCb, int iCr)
iCBG = -1409 * (iCb-0x80);
iCRG = -2925 * (iCr-0x80);
iCRR = 5742 * (iCr-0x80);
usPixel = usRangeTableB[((iCBB + iY) >> 12) & 0x3ff]; // blue pixel
usPixel |= usRangeTableG[((iCBG + iCRG + iY) >> 12) & 0x3ff]; // green pixel
usPixel |= usRangeTableR[((iCRR + iY) >> 12) & 0x3ff]; // red pixel
usPixel = usRangeTableB[((iCBB + iY) >> 15) & 0x7f]; // blue pixel
usPixel |= usRangeTableG[((iCBG + iCRG + iY) >> 14) & 0xff]; // green pixel
usPixel |= usRangeTableR[((iCRR + iY) >> 15) & 0x7f]; // red pixel
pDest[0] = __builtin_bswap16(usPixel);
} /* JPEGPixelBE() */
@ -2340,13 +2180,13 @@ static void JPEGPixel2LE(uint16_t *pDest, int iY1, int iY2, int iCb, int iCr)
iCBG = -1409 * (iCb-0x80);
iCRG = -2925 * (iCr-0x80);
iCRR = 5742 * (iCr-0x80);
ulPixel1 = usRangeTableB[((iCBB + iY1) >> 12) & 0x3ff]; // blue pixel
ulPixel1 |= usRangeTableG[((iCBG + iCRG + iY1) >> 12) & 0x3ff]; // green pixel
ulPixel1 |= usRangeTableR[((iCRR + iY1) >> 12) & 0x3ff]; // red pixel
ulPixel1 = usRangeTableB[((iCBB + iY1) >> 15) & 0x7f]; // blue pixel
ulPixel1 |= usRangeTableG[((iCBG + iCRG + iY1) >> 14) & 0xff]; // green pixel
ulPixel1 |= usRangeTableR[((iCRR + iY1) >> 15) & 0x7f]; // red pixel
ulPixel2 = usRangeTableB[((iCBB + iY2) >> 12) & 0x3ff]; // blue pixel
ulPixel2 |= usRangeTableG[((iCBG + iCRG + iY2) >> 12) & 0x3ff]; // green pixel
ulPixel2 |= usRangeTableR[((iCRR + iY2) >> 12) & 0x3ff]; // red pixel
ulPixel2 = usRangeTableB[((iCBB + iY2) >> 15) & 0x7f]; // blue pixel
ulPixel2 |= usRangeTableG[((iCBG + iCRG + iY2) >> 14) & 0xff]; // green pixel
ulPixel2 |= usRangeTableR[((iCRR + iY2) >> 15) & 0x7f]; // red pixel
*(uint32_t *)&pDest[0] = (ulPixel1 | (ulPixel2<<16));
#endif
} /* JPEGPixel2LE() */
@ -2360,16 +2200,42 @@ static void JPEGPixel2BE(uint16_t *pDest, int32_t iY1, int32_t iY2, int32_t iCb,
iCBG = -1409L * (iCb-0x80);
iCRG = -2925L * (iCr-0x80);
iCRR = 5742L * (iCr-0x80);
ulPixel1 = usRangeTableB[((iCBB + iY1) >> 12) & 0x3ff]; // blue pixel
ulPixel1 |= usRangeTableG[((iCBG + iCRG + iY1) >> 12) & 0x3ff]; // green pixel
ulPixel1 |= usRangeTableR[((iCRR + iY1) >> 12) & 0x3ff]; // red pixel
ulPixel1 = usRangeTableB[((iCBB + iY1) >> 15) & 0x7f]; // blue pixel
ulPixel1 |= usRangeTableG[((iCBG + iCRG + iY1) >> 14) & 0xff]; // green pixel
ulPixel1 |= usRangeTableR[((iCRR + iY1) >> 15) & 0x7f]; // red pixel
ulPixel2 = usRangeTableB[((iCBB + iY2) >> 12) & 0x3ff]; // blue pixel
ulPixel2 |= usRangeTableG[((iCBG + iCRG + iY2) >> 12) & 0x3ff]; // green pixel
ulPixel2 |= usRangeTableR[((iCRR + iY2) >> 12) & 0x3ff]; // red pixel
ulPixel2 = usRangeTableB[((iCBB + iY2) >> 15) & 0x7f]; // blue pixel
ulPixel2 |= usRangeTableG[((iCBG + iCRG + iY2) >> 14) & 0xff]; // green pixel
ulPixel2 |= usRangeTableR[((iCRR + iY2) >> 15) & 0x7f]; // red pixel
*(uint32_t *)&pDest[0] = __builtin_bswap16(ulPixel1) | ((uint32_t)__builtin_bswap16(ulPixel2)<<16);
} /* JPEGPixel2BE() */
static void JPEGPixelLE888(uint8_t *pDest, int iY, int iCb, int iCr)
{
int32_t iCBB, iCBG, iCRG, iCRR;
uint32_t uVal;
iCBB = 7258 * (iCb-0x80);
iCBG = -1409 * (iCb-0x80);
iCRG = -2925 * (iCr-0x80);
iCRR = 5742 * (iCr-0x80);
// Red
uVal = ((iCRR + iY) >> 13) & 0x1FF;
if (uVal & 0x100) uVal = 0;
*pDest++ = uVal;
// Green
uVal = ((iCBG + iCRG + iY) >> 13) & 0x1FF;
if (uVal & 0x100) uVal = 0;
*pDest++ = uVal;
// Blue
uVal = ((iCBB + iY) >> 13) & 0x1FF;
if (uVal & 0x100) uVal = 0;
*pDest++ = uVal;
}
static void JPEGPutMCU11(JPEGIMAGE *pJPEG, int x, int iPitch)
{
int iCr, iCb;
@ -2378,6 +2244,7 @@ static void JPEGPutMCU11(JPEGIMAGE *pJPEG, int x, int iPitch)
int iRow;
uint8_t *pY, *pCr, *pCb;
uint16_t *pOutput = &pJPEG->usPixels[x];
uint8_t *pOutput8 = ((uint8_t*)pJPEG->usPixels) + x * 3;
pY = (unsigned char *)&pJPEG->sMCUs[0*DCTSIZE];
pCb = (unsigned char *)&pJPEG->sMCUs[1*DCTSIZE];
@ -2474,6 +2341,17 @@ static void JPEGPutMCU11(JPEGIMAGE *pJPEG, int x, int iPitch)
JPEGPixelLE(pOutput+iCol, Y, iCb, iCr);
} // for col
}
else if (pJPEG->ucPixelType == RGB888_LITTLE_ENDIAN)
{
for (iCol=0; iCol<8; iCol++) // up to 4x2 cols to do
{
iCr = *pCr++;
iCb = *pCb++;
Y = (int)(*pY++) << 12;
JPEGPixelLE888(pOutput8+iCol*3, Y, iCb, iCr);
} // for col
pOutput8 += iPitch * 3;
}
else
{
for (iCol=0; iCol<8; iCol++) // up to 4x2 cols to do
@ -2829,6 +2707,7 @@ static void JPEGPutMCU12(JPEGIMAGE *pJPEG, int x, int iPitch)
int iRow, iCol, iXCount, iYCount;
uint8_t *pY, *pCr, *pCb;
uint16_t *pOutput = &pJPEG->usPixels[x];
uint8_t *pOutput8 = ((uint8_t*)pJPEG->usPixels) + x * 3;
pY = (uint8_t *)&pJPEG->sMCUs[0*DCTSIZE];
pCb = (uint8_t *)&pJPEG->sMCUs[2*DCTSIZE];
@ -2960,6 +2839,11 @@ static void JPEGPutMCU12(JPEGIMAGE *pJPEG, int x, int iPitch)
JPEGPixelLE(pOutput + iCol, Y1, Cb, Cr);
JPEGPixelLE(pOutput + iPitch + iCol, Y2, Cb, Cr);
}
else if (pJPEG->ucPixelType == RGB888_LITTLE_ENDIAN)
{
JPEGPixelLE888(pOutput8 + iCol*3, Y1, Cb, Cr);
JPEGPixelLE888(pOutput8 + (iPitch + iCol)*3, Y2, Cb, Cr);
}
else
{
JPEGPixelBE(pOutput + iCol, Y1, Cb, Cr);
@ -2972,6 +2856,7 @@ static void JPEGPutMCU12(JPEGIMAGE *pJPEG, int x, int iPitch)
pCb += 8;
pCr += 8;
pOutput += iPitch*2; // next 2 lines of dest pixels
pOutput8 += iPitch*6;
}
} /* JPEGPutMCU12() */
static void JPEGPutMCU21(JPEGIMAGE *pJPEG, int x, int iPitch)
@ -3229,6 +3114,8 @@ static int DecodeJPEG(JPEGIMAGE *pJPEG)
cDCTable2 = pJPEG->JPCI[2].dc_tbl_no;
cACTable2 = pJPEG->JPCI[2].ac_tbl_no;
iDCPred0 = iDCPred1 = iDCPred2 = mcuCX = mcuCY = 0;
printf("SubSample mode: 0x%x\n", pJPEG->ucSubSample);
switch (pJPEG->ucSubSample) // set up the parameters for the different subsampling options
{
@ -3287,6 +3174,8 @@ static int DecodeJPEG(JPEGIMAGE *pJPEG)
iMCUCount = MAX_BUFFERED_PIXELS / (mcuCX * mcuCY);
if (pJPEG->ucPixelType == EIGHT_BIT_GRAYSCALE)
iMCUCount *= 2; // each pixel is only 1 byte
else if (pJPEG->ucPixelType == RGB888_LITTLE_ENDIAN)
iMCUCount = (iMCUCount >> 1) + (iMCUCount >> 3); // each picel is 3 bytes
if (iMCUCount > cx)
iMCUCount = cx; // don't go wider than the image
if (iMCUCount > pJPEG->iMaxMCUs) // did the user set an upper bound on how many pixels per JPEGDraw callback?
@ -3296,6 +3185,9 @@ static int DecodeJPEG(JPEGIMAGE *pJPEG)
jd.iBpp = 16;
switch (pJPEG->ucPixelType)
{
case RGB888_LITTLE_ENDIAN:
jd.iBpp = 24;
break;
case EIGHT_BIT_GRAYSCALE:
jd.iBpp = 8;
break;

Wyświetl plik

@ -1,3 +1,19 @@
if(NOT TARGET plasma)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/plasma/plasma.cmake)
endif()
if(NOT TARGET motor)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/motor/motor.cmake)
endif()
if(NOT TARGET motor_cluster)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/motor/motor_cluster.cmake)
endif()
if(NOT TARGET encoder)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/encoder/encoder.cmake)
endif()
add_library(motor2040 INTERFACE)
target_include_directories(motor2040 INTERFACE ${CMAKE_CURRENT_LIST_DIR})

Wyświetl plik

@ -47,6 +47,10 @@ namespace motor {
const uint LED_DATA = 18;
const uint NUM_LEDS = 1;
const uint I2C_INT = 19;
const uint I2C_SDA = 20;
const uint I2C_SCL = 21;
const uint USER_SW = 23;
const uint ADC_ADDR_0 = 22;

Wyświetl plik

@ -1,6 +1,6 @@
# Pico Display 2.0" Pack <!-- omit in toc -->
Our Pico Display Pack offers a vibrant 1.14" (240x135) IPS LCD screen for your Raspberry Pi Pico it also includes four switches and and an RGB LED!
Our Pico Display Pack offers a vibrant 2.0" (320x240) IPS LCD screen for your Raspberry Pi Pico it also includes four switches and and an RGB LED!
- [Example Program](#example-program)
- [Function Reference](#function-reference)
@ -81,4 +81,4 @@ Pico Display uses our Pico Graphics library to draw graphics and text. For more
### ST7789
Pico Display uses the ST7789 display driver to handle the LCD. For more information [read the ST7789 README.](../../drivers/st7789/README.md).
Pico Display uses the ST7789 display driver to handle the LCD. For more information [read the ST7789 README.](../../drivers/st7789/README.md).

Wyświetl plik

@ -1,5 +1,10 @@
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/st7789/st7789.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../pico_graphics/pico_graphics.cmake)
if(NOT TARGET st7789)
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/st7789/st7789.cmake)
endif()
if(NOT TARGET pico_graphics)
include(${CMAKE_CURRENT_LIST_DIR}/../pico_graphics/pico_graphics.cmake)
endif()
add_library(pico_explorer INTERFACE)

Wyświetl plik

@ -8,6 +8,7 @@ namespace pimoroni {
int PicoGraphics::reset_pen(uint8_t i) {return -1;};
int PicoGraphics::create_pen(uint8_t r, uint8_t g, uint8_t b) {return -1;};
int PicoGraphics::create_pen_hsv(float h, float s, float v){return -1;};
void PicoGraphics::set_pixel_alpha(const Point &p, const uint8_t a) {};
void PicoGraphics::set_pixel_dither(const Point &p, const RGB &c) {};
void PicoGraphics::set_pixel_dither(const Point &p, const RGB565 &c) {};
void PicoGraphics::set_pixel_dither(const Point &p, const uint8_t &c) {};
@ -16,6 +17,7 @@ namespace pimoroni {
int PicoGraphics::get_palette_size() {return 0;}
RGB* PicoGraphics::get_palette() {return nullptr;}
bool PicoGraphics::supports_alpha_blend() {return false;}
void PicoGraphics::set_dimensions(int width, int height) {
bounds = clip = {0, 0, width, height};
@ -132,7 +134,7 @@ namespace pimoroni {
if (bitmap_font) {
bitmap::character(bitmap_font, [this](int32_t x, int32_t y, int32_t w, int32_t h) {
rectangle(Rect(x, y, w, h));
}, c, p.x, p.y, std::max(1.0f, s));
}, c, p.x, p.y, std::max(1.0f, s), int32_t(a) % 360);
return;
}
@ -144,11 +146,11 @@ namespace pimoroni {
}
}
void PicoGraphics::text(const std::string_view &t, const Point &p, int32_t wrap, float s, float a, uint8_t letter_spacing) {
void PicoGraphics::text(const std::string_view &t, const Point &p, int32_t wrap, float s, float a, uint8_t letter_spacing, bool fixed_width) {
if (bitmap_font) {
bitmap::text(bitmap_font, [this](int32_t x, int32_t y, int32_t w, int32_t h) {
rectangle(Rect(x, y, w, h));
}, t, p.x, p.y, wrap, std::max(1.0f, s), letter_spacing);
}, t, p.x, p.y, wrap, std::max(1.0f, s), letter_spacing, fixed_width, int32_t(a) % 360);
return;
}
@ -166,8 +168,8 @@ namespace pimoroni {
}
}
int32_t PicoGraphics::measure_text(const std::string_view &t, float s, uint8_t letter_spacing) {
if (bitmap_font) return bitmap::measure_text(bitmap_font, t, std::max(1.0f, s), letter_spacing);
int32_t PicoGraphics::measure_text(const std::string_view &t, float s, uint8_t letter_spacing, bool fixed_width) {
if (bitmap_font) return bitmap::measure_text(bitmap_font, t, std::max(1.0f, s), letter_spacing, fixed_width);
if (hershey_font) return hershey::measure_text(hershey_font, t, s);
return 0;
}
@ -266,7 +268,7 @@ namespace pimoroni {
int32_t ex = points[j].x;
int32_t px = int32_t(sx + float(fy - sy) / float(ey - sy) * float(ex - sx));
nodes[n++] = px < clip.x ? clip.x : (px >= clip.x + clip.w ? clip.x + clip.w - 1 : px);// clamp(int32_t(sx + float(fy - sy) / float(ey - sy) * float(ex - sx)), clip.x, clip.x + clip.w);
nodes[n++] = px;
}
}

Wyświetl plik

@ -26,6 +26,7 @@
namespace pimoroni {
typedef uint8_t RGB332;
typedef uint16_t RGB565;
typedef uint16_t RGB555;
typedef uint32_t RGB888;
@ -46,7 +47,19 @@ namespace pimoroni {
g((c >> 8) & 0xff),
b(c & 0xff) {}
constexpr RGB(int16_t r, int16_t g, int16_t b) : r(r), g(g), b(b) {}
constexpr uint8_t blend(uint8_t s, uint8_t d, uint8_t a) {
return d + ((a * (s - d) + 127) >> 8);
}
constexpr RGB blend(RGB with, const uint8_t alpha) {
return RGB(
blend(with.r, r, alpha),
blend(with.g, g, alpha),
blend(with.b, b, alpha)
);
}
static RGB from_hsv(float h, float s, float v) {
float i = floor(h * 6.0f);
float f = h * 6.0f - i;
@ -108,6 +121,14 @@ namespace pimoroni {
return __builtin_bswap16(p);
}
constexpr RGB555 to_rgb555() {
uint16_t p = ((r & 0b11111000) << 7) |
((g & 0b11111000) << 2) |
((b & 0b11111000) >> 3);
return p;
}
constexpr RGB565 to_rgb332() {
return (r & 0b11100000) | ((g & 0b11100000) >> 3) | ((b & 0b11000000) >> 6);
}
@ -192,7 +213,10 @@ namespace pimoroni {
PEN_RGB332,
PEN_RGB565,
PEN_RGB888,
PEN_INKY7
PEN_INKY7,
PEN_DV_RGB555,
PEN_DV_P5,
PEN_DV_RGB888,
};
void *frame_buffer;
@ -256,6 +280,7 @@ namespace pimoroni {
virtual int get_palette_size();
virtual RGB* get_palette();
virtual bool supports_alpha_blend();
virtual int create_pen(uint8_t r, uint8_t g, uint8_t b);
virtual int create_pen_hsv(float h, float s, float v);
@ -264,9 +289,12 @@ namespace pimoroni {
virtual void set_pixel_dither(const Point &p, const RGB &c);
virtual void set_pixel_dither(const Point &p, const RGB565 &c);
virtual void set_pixel_dither(const Point &p, const uint8_t &c);
virtual void set_pixel_alpha(const Point &p, const uint8_t a);
virtual void frame_convert(PenType type, conversion_callback_func callback);
virtual void sprite(void* data, const Point &sprite, const Point &dest, const int scale, const int transparent);
virtual bool render_pico_vector_tile(const Rect &bounds, uint8_t* alpha_data, uint32_t stride, uint8_t alpha_type) { return false; }
void set_font(const bitmap::font_t *font);
void set_font(const hershey::font_t *font);
void set_font(std::string_view name);
@ -286,8 +314,8 @@ namespace pimoroni {
void rectangle(const Rect &r);
void circle(const Point &p, int32_t r);
void character(const char c, const Point &p, float s = 2.0f, float a = 0.0f);
void text(const std::string_view &t, const Point &p, int32_t wrap, float s = 2.0f, float a = 0.0f, uint8_t letter_spacing = 1);
int32_t measure_text(const std::string_view &t, float s = 2.0f, uint8_t letter_spacing = 1);
void text(const std::string_view &t, const Point &p, int32_t wrap, float s = 2.0f, float a = 0.0f, uint8_t letter_spacing = 1, bool fixed_width = false);
int32_t measure_text(const std::string_view &t, float s = 2.0f, uint8_t letter_spacing = 1, bool fixed_width = false);
void polygon(const std::vector<Point> &points);
void triangle(Point p1, Point p2, Point p3);
void line(Point p1, Point p2);
@ -459,6 +487,9 @@ namespace pimoroni {
void set_pixel_span(const Point &p, uint l) override;
void set_pixel_dither(const Point &p, const RGB &c) override;
void set_pixel_dither(const Point &p, const RGB565 &c) override;
void set_pixel_alpha(const Point &p, const uint8_t a) override;
bool supports_alpha_blend() override {return true;}
void sprite(void* data, const Point &sprite, const Point &dest, const int scale, const int transparent) override;
@ -528,6 +559,12 @@ namespace pimoroni {
virtual void read_pixel_span(const Point &p, uint l, T *data) {};
};
class IPaletteDisplayDriver {
public:
virtual void write_palette_pixel(const Point &p, uint8_t colour) = 0;
virtual void write_palette_pixel_span(const Point &p, uint l, uint8_t colour) = 0;
virtual void set_palette_colour(uint8_t entry, RGB888 colour) = 0;
};
class PicoGraphics_PenInky7 : public PicoGraphics {
public:

Wyświetl plik

@ -15,7 +15,7 @@ namespace pimoroni {
}
void PicoGraphics_Pen1BitY::set_pen(uint8_t r, uint8_t g, uint8_t b) {
color = std::max(r, std::max(g, b));
color = std::max(r, std::max(g, b)) >> 4;
}
void PicoGraphics_Pen1BitY::set_pixel(const Point &p) {

Wyświetl plik

@ -34,6 +34,15 @@ namespace pimoroni {
*buf++ = color;
}
}
void PicoGraphics_PenRGB332::set_pixel_alpha(const Point &p, const uint8_t a) {
if(!bounds.contains(p)) return;
uint8_t *buf = (uint8_t *)frame_buffer;
RGB332 blended = RGB(buf[p.y * bounds.w + p.x]).blend(RGB(color), a).to_rgb332();
buf[p.y * bounds.w + p.x] = blended;
};
void PicoGraphics_PenRGB332::set_pixel_dither(const Point &p, const RGB &c) {
if(!bounds.contains(p)) return;
uint8_t _dmv = dither16_pattern[(p.x & 0b11) | ((p.y & 0b11) << 2)];

Wyświetl plik

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

Wyświetl plik

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

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