Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions examples/OLED_ST7735/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Example Makefile for Daisy ST7735 display
TARGET = OLED_ST7735
SRCS = OLED_ST7735.cpp
OBJS = $(SRCS:.cpp=.o)

CFLAGS = -I../.. -I../../src/ -O2 -Wall
LDFLAGS =

all: $(TARGET).bin

$(TARGET).bin: $(OBJS)
@echo Linking $@
arm-none-eabi-g++ $(OBJS) $(LDFLAGS) -o $@

%.o: %.cpp
@echo Compiling $<
arm-none-eabi-g++ $(CFLAGS) -c $< -o $@

clean:
rm -f *.o *.bin
24 changes: 24 additions & 0 deletions examples/OLED_ST7735/OLED_ST7735.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Example main for Daisy ST7735 display
#include "daisy_seed.h"
#include "st7735.h"

using namespace daisy;

OledDisplay<ST7735_4WireSpi128x160Driver> display;

int main(void)
{
daisy::DaisySeed seed;
seed.Configure();
OledDisplay<ST7735_4WireSpi128x160Driver>::Config display_cfg;
display_cfg.driver_config.transport_config.Defaults();
display.Init(display_cfg);
while(1)
{
display.Fill(false);
display.DrawRect(2, 2, 125, 157, true);
display.SetCursor(10, 20);
display.WriteString("ST7735 + Oopsy", Font_6x8, true);
display.Update();
}
}
184 changes: 184 additions & 0 deletions examples/OLED_ST7735/ST7735_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# ST7735 TFT Display Support for Oopsy

This adds support for **ST7735 RGB TFT displays** (65K colors) to Oopsy, as a drop-in replacement for the standard SSD130x OLED displays.

## Features

- 🌈 **Full RGB565 Color Support** - 65,536 colors
- 🎨 **Colorful UI Themes** - Different color schemes for each display mode
- 📐 **Multiple Resolutions** - Support for 128x160, 128x128, and 80x160 displays
- 🔌 **Daisy Patch Compatible Pinout** - Works with standard Daisy Patch wiring
- 📦 **Drop-in Replacement** - Same API as SSD130x, just change the target

## Supported Screen Sizes

| Target Name | Resolution | Screen Type |
|-------------|------------|-------------|
| `seed_st7735` | 128×160 | Standard 1.8" TFT |
| `seed_st7735_128x128` | 128×128 | Square 1.44" TFT |
| `seed_st7735_80x160` | 80×160 | Mini 0.96" TFT |

## Color Themes by Mode

| Mode | Foreground | Background | Style |
|------|------------|------------|-------|
| **MENU** | Cyan | Dark Blue | Cyberpunk |
| **PARAMS** | Green | Black | Matrix |
| **SCOPE** | Orange | Purple | Sunset |
| **CONSOLE** | Magenta | Black | Neon |

## Hardware Wiring

### ST7735 Display Pinout (Daisy Seed)

| ST7735 Pin | Daisy Seed Pin | Function |
|------------|----------------|----------|
| VCC | 3V3 | Power (3.3V) |
| GND | GND | Ground |
| SCL/SCK | D8 (PG11) | SPI Clock |
| SDA/MOSI | D10 (PB5) | SPI Data |
| DC | D9 (PB4) | Data/Command |
| CS | D7 (PA2) | Chip Select |
| RST/RES | D30 (PB15) | Reset |
| BLK | 3V3 or PWM | Backlight |

### Encoder Pinout (Daisy Patch Compatible)

| Encoder Pin | Daisy Seed Pin |
|-------------|----------------|
| A | D12 |
| B | D11 |
| Click/SW | D0 |

### Knob Pinout

| Knob | Daisy Seed Pin |
|------|----------------|
| Knob 1 | D15 |
| Knob 2 | D16 |
| Knob 3 | D21 |
| Knob 4 | D18 |

## Usage with Oopsy

### 1. Select the ST7735 Target

In `oopsy.maxpat`, select your display size from the Target dropdown menu:
- **seed_st7735** - for 128x160 displays
- **seed_st7735_128x128** - for 128x128 displays
- **seed_st7735_80x160** - for 80x160 displays

### 2. Create Your gen~ Patch

Use standard gen~ with `Param` objects:

```
// Example gen~ code
Param gain(0.5, min=0, max=1);
Param frequency(440, min=20, max=2000);

in 1 left;
out 1 output;

output = left * gain;
```

### 3. Flash to Daisy

Click the **Flash** button in Oopsy. The display will show your parameters with colorful themes!

## Display Controls

- **Long Press Encoder** (>0.5s) - Open mode selection menu
- **Rotate Encoder** - Navigate / Select
- **Short Press Encoder** - Confirm selection

## Available Colors

The driver provides these predefined colors:

```cpp
COLOR_BLACK, COLOR_WHITE, COLOR_RED, COLOR_GREEN, COLOR_BLUE,
COLOR_CYAN, COLOR_MAGENTA, COLOR_YELLOW, COLOR_ORANGE, COLOR_GRAY,
COLOR_PINK, COLOR_PURPLE, COLOR_LIME, COLOR_NAVY, COLOR_TEAL,
COLOR_BROWN, COLOR_DARKGREEN, COLOR_DARKBLUE, COLOR_SKYBLUE, COLOR_GOLD
```

### Custom Colors

Use `RGB565(r, g, b)` to create custom colors:

```cpp
uint16_t myColor = Driver::RGB565(255, 128, 0); // Orange
```

## Files Added/Modified

### New Files
- `source/st7735.h` - ST7735 driver with color support
- `source/seed.st7735.json` - Target config for 128x160
- `source/seed.st7735_128x128.json` - Target config for 128x128
- `source/seed.st7735_80x160.json` - Target config for 80x160
- `source/ST7735_README.md` - This documentation

### Modified Files
- `source/oopsy.js` - Added ST7735 header detection and target paths
- `source/genlib_daisy.h` - Added color theme switching

## Customizing Themes

Edit `genlib_daisy.h` to change color themes:

```cpp
#ifdef OOPSY_TARGET_ST7735
{
using Driver = daisy::ST7735_4WireSpi128x160Driver;
switch(mode) {
case MODE_MENU:
hardware.display.GetDriver().SetTheme(
Driver::COLOR_CYAN, // Foreground
Driver::COLOR_DARKBLUE, // Background
Driver::COLOR_MAGENTA // Accent
);
break;
// ... other modes
}
}
#endif
```

## Display Specifications

| Property | Value |
|----------|-------|
| Color Depth | 16-bit RGB565 (65K colors) |
| Interface | SPI (4-wire) |
| Controller | ST7735S |
| Refresh Rate | ~30 FPS |

## Troubleshooting

### Display is blank
- Check wiring connections
- Verify RST pin is connected to D30
- Check backlight connection (BLK to 3V3)

### Wrong colors
- Ensure ST7735S variant (not ST7735R)
- Check MADCTL setting in driver if colors are inverted

### Encoder not working
- Verify encoder pins: A=D12, B=D11, Click=D0
- Check if D0 conflicts with other hardware

### Screen offset issues
- Different ST7735 modules may need offset adjustment
- Edit `st7735.h` CASET/RASET values if needed

## Author

Created by **noisehoho** for the Daisy/Oopsy community.

## License

MIT License - Same as Oopsy
15 changes: 15 additions & 0 deletions examples/OLED_ST7735/seed.st7735.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "seed.st7735",
"display": {
"width": 128,
"height": 160,
"driver": "ST7735_4WireSpi128x160Driver"
},
"pins": {
"sck": "D8",
"mosi": "D10",
"dc": "D9",
"cs": "D7",
"rst": "D30"
}
}
Loading