diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 527c7f7..c8f3802 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -562,7 +562,21 @@ namespace oopsy { } #endif - // CLEAR DISPLAY + // ST7735 COLOR THEMES - Set different colors for each mode + #ifdef OOPSY_TARGET_ST7735 + { + using Driver = daisy::ST7735_4WireSpi128x160Driver; + switch(mode) { + case MODE_MENU: hardware.display.GetDriver().SetTheme(Driver::COLOR_CYAN, Driver::COLOR_DARKBLUE, Driver::COLOR_MAGENTA); break; + case MODE_PARAMS: hardware.display.GetDriver().SetTheme(Driver::COLOR_GREEN, Driver::COLOR_BLACK, Driver::COLOR_LIME); break; + case MODE_SCOPE: hardware.display.GetDriver().SetTheme(Driver::COLOR_ORANGE, Driver::COLOR_PURPLE, Driver::COLOR_YELLOW); break; + case MODE_CONSOLE: hardware.display.GetDriver().SetTheme(Driver::COLOR_MAGENTA, Driver::COLOR_BLACK, Driver::COLOR_CYAN); break; + default: hardware.display.GetDriver().SetTheme(Driver::COLOR_WHITE, Driver::COLOR_BLACK, Driver::COLOR_CYAN); break; + } + } + #endif + + // CLEAR DISPLAY #ifdef OOPSY_TARGET_HAS_OLED hardware.display.Fill(false); #endif diff --git a/source/oopsy.js b/source/oopsy.js index cead987..6c318c8 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -324,13 +324,11 @@ function generate_target_struct(target) { target.defines.OOPSY_OLED_DISPLAY_HEIGHT = target.display.dim[1] } - return ` + return ` #include "daisy_seed.h" -${target.display ? `#include "dev/oled_ssd130x.h"` : ""} +${target.display ? (target.display.driver.includes("ST7735") ? `#include "dev/st7735.h"` : `#include "dev/oled_ssd130x.h"`) : ""} // name: ${target.name} -struct Daisy { - - void Init(bool boost = false) { +struct Daisy { void Init(bool boost = false) { seed.Configure(); seed.Init(boost); ${components.filter((e) => e.init) @@ -469,6 +467,10 @@ function run() { case "versio": target = arg; break; case "bluemchen": target_path = path.join(__dirname, "seed.bluemchen.json"); break; case "nehcmeulb": target_path = path.join(__dirname, "seed.nehcmeulb.json"); break; + case "seed_st7735": target_path = path.join(__dirname, "seed.st7735.json"); break; + case "seed_st7735_128x128": target_path = path.join(__dirname, "seed.st7735_128x128.json"); break; + case "seed_st7735_80x160": target_path = path.join(__dirname, "seed.st7735_80x160.json"); break; + case "seed_st7735_128x64": target_path = path.join(__dirname, "seed.st7735_128x64.json"); break; case "watch": watch=true; break; diff --git a/source/seed.st7735.json b/source/seed.st7735.json new file mode 100644 index 0000000..a05f8b5 --- /dev/null +++ b/source/seed.st7735.json @@ -0,0 +1,69 @@ +{ + "name": "seed_st7735", + "max_apps": 8, + "defines": { + "OOPSY_TARGET_HAS_OLED": 1, + "OOPSY_TARGET_ST7735": 1, + "OOPSY_OLED_DISPLAY_WIDTH": 128, + "OOPSY_OLED_DISPLAY_HEIGHT": 160 + }, + "display": { + "driver": "daisy::ST7735_4WireSpi128x160Driver", + "dim": [128, 160], + "config": [] + }, + "inserts": [], + "components": { + "knob1": { + "component": "AnalogControl", + "pin": 15 + }, + "knob2": { + "component": "AnalogControl", + "pin": 16 + }, + "knob3": { + "component": "AnalogControl", + "pin": 21 + }, + "knob4": { + "component": "AnalogControl", + "pin": 18 + }, + "encoder": { + "component": "Encoder", + "pin": {"a": 12, "b": 11, "click": 0}, + "meta": [ + "menu_hold = ${name}.TimeHeldMs();", + "menu_click = ${name}.FallingEdge();", + "menu_rotate = ${name}.Increment();" + ] + }, + "gate1": { + "component": "GateIn", + "pin": 20 + }, + "gate2": { + "component": "GateIn", + "pin": 19 + } + }, + "labels": { + "params": { + "knob1": "knob1", + "knob2": "knob2", + "knob3": "knob3", + "knob4": "knob4", + "cv1": "knob1", + "cv2": "knob2", + "cv3": "knob3", + "cv4": "knob4", + "gate1": "gate1", + "gate2": "gate2", + "gate": "gate1" + }, + "outs": {}, + "datas": {} + }, + "aliases": {} +}