From 47e1ad3ae8458f6c13b917daf780c0c78bf51cc2 Mon Sep 17 00:00:00 2001 From: helgibbons <50950368+helgibbons@users.noreply.github.com> Date: Tue, 8 Mar 2022 16:58:51 +0000 Subject: [PATCH 1/7] Add button & LED example for Pimoroni Pico LiPo --- .../examples/pimoroni_pico_lipo/button_blink.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 micropython/examples/pimoroni_pico_lipo/button_blink.py diff --git a/micropython/examples/pimoroni_pico_lipo/button_blink.py b/micropython/examples/pimoroni_pico_lipo/button_blink.py new file mode 100644 index 00000000..48a45860 --- /dev/null +++ b/micropython/examples/pimoroni_pico_lipo/button_blink.py @@ -0,0 +1,13 @@ +# This example blinks the user LED on Pimoroni Pico Lipo whilst the BOOT button is pressed. +# The button is active low, which is why we're using an if not statement! + +from machine import Pin +import time + +led = Pin(25, Pin.OUT) +button = Pin(23, Pin.IN, Pin.PULL_DOWN) + +while True: + if not button.value(): + led.toggle() + time.sleep(0.5) From a5451f726fa8adcf3e277df7156490347901a4cb Mon Sep 17 00:00:00 2001 From: helgibbons <50950368+helgibbons@users.noreply.github.com> Date: Tue, 8 Mar 2022 17:23:30 +0000 Subject: [PATCH 2/7] Update README.md --- micropython/modules/badger2040/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/micropython/modules/badger2040/README.md b/micropython/modules/badger2040/README.md index a73a9e6b..e3d7b964 100644 --- a/micropython/modules/badger2040/README.md +++ b/micropython/modules/badger2040/README.md @@ -1,6 +1,6 @@ # Badger 2040 -Badger 2040 is an RP2040 powered EInk badge. +Badger 2040 is an RP2040 powered E Ink badge. - [Summary](#summary) - [Getting Started](#getting-started) @@ -9,7 +9,7 @@ Badger 2040 is an RP2040 powered EInk badge. - [Other Functions](#other-functions) - [Other Constants](#other-constants) - [Screen Size](#screen-size) - - [EInk Pins](#eink-pins) + - [E Ink Pins](#e-ink-pins) - [Power Pins](#power-pins) - [Activity LED Pin](#activity-led-pin) - [Function Reference](#function-reference) @@ -49,7 +49,7 @@ This will create a `Badger2040` class called `badger` that will be used in the r ## Update Speed -The EInk display on Badger 2040 supports several update speeds. These can be set using `update_speed(speed)` where `speed` is a value from `0` to `3`. For convenience these speeds have been given the following constants: +The E Ink display on Badger 2040 supports several update speeds. These can be set using `update_speed(speed)` where `speed` is a value from `0` to `3`. For convenience these speeds have been given the following constants: * `UPDATE_NORMAL` = `0` * `UPDATE_MEDIUM` = `1` @@ -107,7 +107,7 @@ Below is a list of other constants that have been made available, to help with t * `WIDTH` = `296` * `HEIGHT` = `128` -### EInk Pins +### E Ink Pins * `PIN_CS` = `17` * `PIN_CLK` = `18` * `PIN_MOSI` = `19` @@ -271,9 +271,9 @@ screen.update() We've supplied a script - `convert.py` - which will help you get your images converted. -Ideally you should pick something already 298x128 pixels or smaller, and in monochrome, but it will dither and convert images for you. +Ideally you should pick something already 296x128 pixels or smaller, and in monochrome, but it will dither and convert images for you. -Find it in [examples/badger2040/image_converter](examples/badger2040/image_converter). +Find it in [examples/badger2040/image_converter](/../../../examples/badger2040/image_converter). To convert an oversized image use: @@ -281,7 +281,7 @@ To convert an oversized image use: python3 convert.py --resize --binary my_image.png ``` -This will output `my_image.bin`, which you can save to your Badger2040 via Thonny and display with the code above. +This will output `my_image.bin`, which you can save to your Badger 2040 via Thonny and display with the code above. For smaller images such as icons you can omit the `--resize` flag: @@ -369,7 +369,7 @@ partial_update( ### Invert (aka Dark Mode) -Badger2040 can invert all your display data for a quick and easy dark mode: +Badger 2040 can invert all your display data for a quick and easy dark mode: ```python invert( @@ -379,7 +379,7 @@ invert( ### Update Speed -Badger2040 is capable of updating the display at multiple different speeds. +Badger 2040 is capable of updating the display at multiple different speeds. These offer a tradeoff between the quality of the final image and the speed of the update. From 6d1a902adc5cf43742a750f9c5c554f5574ef4a1 Mon Sep 17 00:00:00 2001 From: helgibbons <50950368+helgibbons@users.noreply.github.com> Date: Tue, 8 Mar 2022 17:25:46 +0000 Subject: [PATCH 3/7] Update README.md --- micropython/modules/badger2040/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micropython/modules/badger2040/README.md b/micropython/modules/badger2040/README.md index e3d7b964..32e8c3b2 100644 --- a/micropython/modules/badger2040/README.md +++ b/micropython/modules/badger2040/README.md @@ -273,7 +273,7 @@ We've supplied a script - `convert.py` - which will help you get your images con Ideally you should pick something already 296x128 pixels or smaller, and in monochrome, but it will dither and convert images for you. -Find it in [examples/badger2040/image_converter](/../../../examples/badger2040/image_converter). +Find it in [examples/badger2040/image_converter](/../../examples/badger2040/image_converter). To convert an oversized image use: From 613625776ba9c99f899a717a5868d213a0fcd4f3 Mon Sep 17 00:00:00 2001 From: Hel Gibbons <50950368+helgibbons@users.noreply.github.com> Date: Tue, 8 Mar 2022 17:28:57 +0000 Subject: [PATCH 4/7] Update README.md --- micropython/modules/badger2040/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micropython/modules/badger2040/README.md b/micropython/modules/badger2040/README.md index 32e8c3b2..a31d84c1 100644 --- a/micropython/modules/badger2040/README.md +++ b/micropython/modules/badger2040/README.md @@ -273,7 +273,7 @@ We've supplied a script - `convert.py` - which will help you get your images con Ideally you should pick something already 296x128 pixels or smaller, and in monochrome, but it will dither and convert images for you. -Find it in [examples/badger2040/image_converter](/../../examples/badger2040/image_converter). +Find it in [examples/badger2040/image_converter](/../../examples/badger2040/image_converter/). To convert an oversized image use: From b01afbaac82b26d562cf7d1c365ddff1a6b297cb Mon Sep 17 00:00:00 2001 From: Hel Gibbons <50950368+helgibbons@users.noreply.github.com> Date: Tue, 8 Mar 2022 17:36:35 +0000 Subject: [PATCH 5/7] Update README.md --- micropython/modules/badger2040/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micropython/modules/badger2040/README.md b/micropython/modules/badger2040/README.md index a31d84c1..1baf06e8 100644 --- a/micropython/modules/badger2040/README.md +++ b/micropython/modules/badger2040/README.md @@ -273,7 +273,7 @@ We've supplied a script - `convert.py` - which will help you get your images con Ideally you should pick something already 296x128 pixels or smaller, and in monochrome, but it will dither and convert images for you. -Find it in [examples/badger2040/image_converter](/../../examples/badger2040/image_converter/). +Find it in [examples/badger2040/image_converter](/examples/badger2040/image_converter/). To convert an oversized image use: From 117c842fc0b3e80be7990dd385b4688cfd867bf9 Mon Sep 17 00:00:00 2001 From: helgibbons <50950368+helgibbons@users.noreply.github.com> Date: Tue, 8 Mar 2022 17:39:53 +0000 Subject: [PATCH 6/7] Update README.md --- micropython/modules/badger2040/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micropython/modules/badger2040/README.md b/micropython/modules/badger2040/README.md index 1baf06e8..62c088ae 100644 --- a/micropython/modules/badger2040/README.md +++ b/micropython/modules/badger2040/README.md @@ -273,7 +273,7 @@ We've supplied a script - `convert.py` - which will help you get your images con Ideally you should pick something already 296x128 pixels or smaller, and in monochrome, but it will dither and convert images for you. -Find it in [examples/badger2040/image_converter](/examples/badger2040/image_converter/). +Find it in [/examples/badger2040/image_converter](/examples/badger2040/image_converter). To convert an oversized image use: From dae16ea7775e2ef67d17abac22fc2da4c53970c0 Mon Sep 17 00:00:00 2001 From: helgibbons <50950368+helgibbons@users.noreply.github.com> Date: Tue, 8 Mar 2022 17:47:10 +0000 Subject: [PATCH 7/7] Update README.md --- micropython/modules/badger2040/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/micropython/modules/badger2040/README.md b/micropython/modules/badger2040/README.md index 62c088ae..5b2f9f26 100644 --- a/micropython/modules/badger2040/README.md +++ b/micropython/modules/badger2040/README.md @@ -89,7 +89,7 @@ font(font) led(brightness) -image(data, w=298, h=128, x=0, y=0) +image(data, w=296, h=128, x=0, y=0) icon(data, icon_index, sheet_size, icon_size) clear() @@ -296,7 +296,7 @@ In all cases your images should be a multiple of 8 pixels wide. ```python image( data, # bytearray: raw image data 1bpp - w=298, # int: width in pixels + w=296, # int: width in pixels h=128, # int: height in pixels x=0, # int: destination x y=0, # int: destination y