Skip to content

Commit

Permalink
Merge pull request #149 from 4ms/nlc-port
Browse files Browse the repository at this point in the history
Port Nonlinear Circuits modules
  • Loading branch information
danngreen authored Nov 18, 2023
2 parents 37587e3 + 828b87c commit bec3021
Show file tree
Hide file tree
Showing 103 changed files with 13,922 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@
[submodule "firmware/src/wifi/flat"]
path = firmware/src/wifi/flat
url = https://github.com/4ms/metamodule-bridge-protocol.git
[submodule "firmware/vcv_ports/nonlinearcircuits"]
path = firmware/vcv_ports/nonlinearcircuits
url = https://github.com/mhetrick/nonlinearcircuits
25 changes: 17 additions & 8 deletions firmware/src/VCV_adaptor/app/Menu.hpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
#pragma once
#include "VCV_adaptor/events.hh"
#include "VCV_adaptor/widget/Widget.hh"
#include <string>

namespace rack::ui
{
struct Menu {
void addChild(Menu *) {
}

struct Menu : widget::OpaqueWidget {

virtual Menu *createChildMenu() {
return nullptr;
}
virtual void onAction(const event::Action &e) {
}
};

struct MenuSeparator : Menu {};
struct MenuEntry : widget::OpaqueWidget {};

struct MenuLabel : Menu {};
struct MenuItem : Menu {};
struct MenuSeparator : MenuEntry {};

struct MenuLabel : MenuEntry {
std::string text;
};

struct MenuItem : MenuEntry {
std::string text;
std::string rightText;
bool disabled = false;
};
} // namespace rack::ui
3 changes: 1 addition & 2 deletions firmware/src/VCV_adaptor/app/SvgPanel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ struct SvgPanel : widget::Widget {
PanelBorder *panelBorder;
window::Svg *svg;

void step() override;
void setBackground(window::Svg *svg) {
void setBackground(std::shared_ptr<window::Svg> svg) {
}
};

Expand Down
16 changes: 10 additions & 6 deletions firmware/src/VCV_adaptor/app/Widget.hh
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ struct ThemedSvgPort : SvgPort {
struct ModuleLightWidget : widget::Widget {
int firstLightId = -1;
NVGcolor bgColor = nvgRGBA(0, 0, 0, 0);
// NVGcolor color = nvgRGBA(0, 0, 0, 0);
// NVGcolor borderColor = nvgRGBA(0, 0, 0, 0);
NVGcolor color = nvgRGBA(0, 0, 0, 0);
NVGcolor borderColor = nvgRGBA(0, 0, 0, 0);

// std::vector<NVGcolor> baseColors;
// int getNumColors(){ return 0;}
// void addBaseColor(NVGcolor baseColor){}
// void setBrightnesses(const std::vector<float>& brightnesses){}
std::vector<NVGcolor> baseColors;
int getNumColors() {
return 0;
}
void addBaseColor(NVGcolor baseColor) {
}
void setBrightnesses(const std::vector<float> &brightnesses) {
}
};

// Params
Expand Down
4 changes: 1 addition & 3 deletions firmware/src/VCV_adaptor/widget/Widget.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace widget
{
struct Widget {
math::Rect box;
MetaModule::Element element;

virtual ~Widget() = default;

Expand Down Expand Up @@ -63,9 +64,6 @@ struct Widget {
}
void clearChildren() {
}

MetaModule::Element element;

void hide() {
}
};
Expand Down
5 changes: 5 additions & 0 deletions firmware/src/VCV_adaptor/widget_convert/Rack.hh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ inline Element make_element<rack::componentlibrary::SmallLight<rack::componentli
return MonoLight{{b, "SmallLight.png"}, 0x07E0};
};

template<>
inline Element make_element<rack::componentlibrary::SmallLight<rack::componentlibrary::BlueLight>>(BaseElement b) {
return MonoLight{{b, "SmallLight.png"}, 0x07FF};
};

template<>
inline Element make_element<rack::componentlibrary::SmallLight<rack::componentlibrary::GreenRedLight>>(BaseElement b) {
return DualLight{{b, "SmallLight.png"}, {0x07E0, 0xF800}};
Expand Down
18 changes: 18 additions & 0 deletions firmware/src/VCV_adaptor/widget_convert/nlc.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once
#include "CoreModules/elements/base_element.hh"
#include "CoreModules/elements/elements.hh"
#include "VCV_adaptor/widget_convert/base.hh"
#include "VCV_adaptor/widgets.hh"

// Forward declare widgets
struct SlothRedGreenLightWidget;

namespace MetaModule
{

template<>
inline Element make_element<rack::componentlibrary::LargeLight<SlothRedGreenLightWidget>>(BaseElement b) {
return DualLight{{b, "LargeLight.png"}, {0xF800, 0x07E0}};
};

} // namespace MetaModule
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
#include "VCV_adaptor/widget_convert/Befaco.hh"
#include "VCV_adaptor/widget_convert/Rack.hh"
#include "VCV_adaptor/widget_convert/hetrickcv.hh"
#include "VCV_adaptor/widget_convert/nlc.hh"
14 changes: 11 additions & 3 deletions firmware/src/VCV_adaptor/widgets.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#include "VCV_adaptor/asset.hpp"
//TODO Replace this with Rack/include/componentlibrary.hpp

namespace rack::componentlibrary
namespace rack
{
namespace componentlibrary
{

////////////////////
Expand Down Expand Up @@ -145,8 +147,9 @@ using LEDBezel = VCVBezel;

// Lights

template<typename T> struct MediumLight : app::ModuleLightWidget {};
template<typename T> struct SmallLight : app::ModuleLightWidget {};
template<typename T> struct LargeLight : T {};
template<typename T> struct MediumLight : T {};
template<typename T> struct SmallLight : T {};
template <typename TBase> struct VCVBezelLight : TBase {};
template <typename TBase> using LEDBezelLight = VCVBezelLight<TBase>;

Expand All @@ -157,7 +160,12 @@ struct BlueLight : app::ModuleLightWidget {};
struct YellowLight : app::ModuleLightWidget {};
struct GreenLight : app::ModuleLightWidget {};
struct RedGreenBlueLight : app::ModuleLightWidget {};
struct GrayModuleLightWidget : app::ModuleLightWidget {};
// clang-format off

} // namespace componentlibrary

struct GrayModuleLightWidget : app::ModuleLightWidget {};

} // namespace rack

66 changes: 66 additions & 0 deletions firmware/src/gui/images/Rack/components/LargeLight.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#ifdef __has_include
#if __has_include("lvgl.h")
#ifndef LV_LVGL_H_INCLUDE_SIMPLE
#define LV_LVGL_H_INCLUDE_SIMPLE
#endif
#endif
#endif

#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif


#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif

#ifndef LV_ATTRIBUTE_IMG_LARGELIGHT
#define LV_ATTRIBUTE_IMG_LARGELIGHT
#endif

const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_LARGELIGHT uint8_t LargeLight_map[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49,
0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06,
0x00, 0x00, 0x00, 0xe0, 0x91, 0x06, 0x10, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48,
0x59, 0x73, 0x00, 0x00, 0x07, 0x4b, 0x00, 0x00, 0x07, 0x4b, 0x01, 0x5c, 0x9f,
0x52, 0xce, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66,
0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b,
0x73, 0x63, 0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, 0xee, 0x3c, 0x1a,
0x00, 0x00, 0x01, 0x1e, 0x49, 0x44, 0x41, 0x54, 0x18, 0x95, 0x4d, 0x8a, 0xb1,
0x4e, 0x83, 0x50, 0x18, 0x46, 0xbf, 0xff, 0xf6, 0x42, 0x0c, 0xc1, 0x18, 0xac,
0xb4, 0x69, 0x18, 0x58, 0x98, 0x18, 0xba, 0x38, 0x90, 0xa8, 0x75, 0xec, 0x04,
0xa3, 0x0f, 0xd0, 0xb7, 0x70, 0xed, 0x64, 0x27, 0x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 0xc2, 0x6e, 0xb7,
0xcb, 0x7a, 0xae, 0xeb, 0xbe, 0x9d, 0x4e, 0xa7, 0x89, 0x69, 0x9a, 0x6e, 0x59,
0x96, 0x00, 0x00, 0x29, 0x25, 0x4c, 0xd3, 0x44, 0x96, 0x65, 0xef, 0xab, 0xd5,
0x6a, 0xd6, 0x5b, 0x2e, 0x97, 0x6d, 0x92, 0x24, 0x29, 0x11, 0x5d, 0x32, 0xc6,
0x2e, 0x94, 0x52, 0x2d, 0x80, 0xcf, 0x3c, 0xcf, 0xd3, 0xf5, 0x7a, 0x3d, 0x8b,
0xe3, 0xb8, 0xfe, 0x01, 0x66, 0x0a, 0x78, 0x82, 0xe7, 0x9d, 0xd4, 0x42, 0x00,
0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};

const lv_img_dsc_t LargeLight = {
.header.cf = LV_IMG_CF_RAW_ALPHA,
.header.always_zero = 0,
.header.reserved = 0,
.header.w = 9,
.header.h = 9,
.data_size = 401,
.data = LargeLight_map,
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit bec3021

Please sign in to comment.