Author Topic:  (Read 301 times)


  • Newbie
  • *
  • Posts: 7
    • View Profile
« on: October 05, 2021, 08:01:44 AM »
Much thanks to T2Elektroteknik who's been mentoring me through this project for writing an updated! He said you're free to use it

Code: [Select]
# T2Elektroteknik Pi-Stomp TFT Hello-World

import digitalio
import board
from PIL import Image, ImageDraw, ImageFont
import adafruit_rgb_display.ili9341 as ili9341

# First define some constants to allow easy resizing of shapes.

# Configuration for CS and DC pins (these are PiTFT defaults):
# cs_pin = digitalio.DigitalInOut(board.CE0)
# dc_pin = digitalio.DigitalInOut(board.D25)
# reset_pin = digitalio.DigitalInOut(board.D24)

# Pin Configuration Stomp T2Elektroteknik
cs_pin = digitalio.DigitalInOut(board.CE0)
dc_pin = digitalio.DigitalInOut(board.D6)
reset_pin = digitalio.DigitalInOut(board.D5)

# Config for display baudrate (default max is 24mhz):
BAUDRATE = 24000000

# Setup SPI bus using hardware SPI:
spi = board.SPI()

# pylint: disable=line-too-long
# Create the display:
disp = ili9341.ILI9341(
    rotation=270,  # 2.2", 2.4", 2.8", 3.2" ILI9341
# pylint: enable=line-too-long

# Create blank image for drawing.
# Make sure to create image with mode 'RGB' for full color.
if disp.rotation % 180 == 90:
    height = disp.width  # we swap height/width to rotate it to landscape!
    width = disp.height
    width = disp.width  # we swap height/width to rotate it to landscape!
    height = disp.height

image ="RGB", (width, height))

# Get drawing object to draw on image.
draw = ImageDraw.Draw(image)

# Draw a green filled box as the background
draw.rectangle((0, 0, width, height), fill=(0, 255, 0))

# Draw a smaller inner purple rectangle
    (BORDER, BORDER, width - BORDER - 1, height - BORDER - 1), fill=(170, 0, 136)

# Load a TTF Font
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", FONTSIZE)

# Draw Some Text
text = "Hello Stomp World!"
(font_width, font_height) = font.getsize(text)
    (width // 2 - font_width // 2, height // 2 - font_height // 2),
    fill=(255, 255, 0),

# Display image.
« Last Edit: October 05, 2021, 08:12:01 AM by swill »

Randall (Admin)

  • Administrator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
« Reply #1 on: October 05, 2021, 03:09:48 PM »
Awesome.  If either of you is so inclined, please feel free to submit a pull request to add it to the util dir of the repo:

Otherwise, I'll add it eventually.


  • Newbie
  • *
  • Posts: 2
    • View Profile
« Reply #2 on: October 05, 2021, 04:03:31 PM »
Hi There,

I will have a quick look and see if I have the time to do it. I was also thinking that maybe it would be good to add to this test a few button/LED halo tests. I know "swill" is trying out some new GPIO pins for the addition button/LED halo using MiDi interface pins. Also, was thinking other peripherals could be identified during the test.

By the way Great!!!!!!!!!!!!!!!!!!!!!!!!!!!! Job on this open source application. 
« Last Edit: October 05, 2021, 04:12:08 PM by T2Elektroteknik »

Randall (Admin)

  • Administrator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
« Reply #3 on: October 06, 2021, 03:08:47 PM »
Thanks T2!

Yeah, testing other hardware could be useful.

The original pi-Stomp had a defined set of controls (3 footswitch, one tweak knob, two encoders) and thus I did include a hardware self test which would run during first boot.  The display would prompt the user to manipulate each control, then wait or timeout if the control was/wasn't manipulated:

I didn't include anything similar for pi-Stomp Core because we can't require/expect each peripheral to exist.  But maybe the test could enter a loop where any inputs detected (knob tweaks, footswitch toggles, etc. ) could be shown on the display for validation that they are functioning correctly.  gpio_output statements found in default_config.yml could be used to assert the corresponding GPIO.

Ideally, the test wouldn't duplicate pi-Stomp code or make assumptions about hardware, it would just be an optional running mode of or new "main" executable which imports the pistomp python module.



  • Newbie
  • *
  • Posts: 2
    • View Profile
« Reply #4 on: October 06, 2021, 09:05:44 PM »
You are Welcome,

Sounds like a good plan moving forward. Coming from my experience give the users every possible chance of ruling out bad connections etc. I will look at what you had sent me in the link. I will try to whip something up and appreciate the head start. Will post when I can. So far this open source project is the best I have seen. I am a somewhat retired Embedded Software developer. Most open source projects I have worked with require a lot of understanding. You have simplified it to the point where it is not a struggle for someone to understand.