Skip to content

Commit

Permalink
Merge branch 'main' into feat/grid-mirror
Browse files Browse the repository at this point in the history
  • Loading branch information
Dewb committed Sep 17, 2023
2 parents e94837a + a745e86 commit 27d3eee
Show file tree
Hide file tree
Showing 53 changed files with 3,144 additions and 977 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- '.github/workflows/deploy-pages.yaml'

env:
rack-sdk-version: 2.3.0
rack-sdk-version: 2.4.0
rack-plugin-toolchain-dir: /home/build/rack-plugin-toolchain

defaults:
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
options: --user root
strategy:
matrix:
platform: [win-x64, linux-x64]
platform: [win-x64, lin-x64]
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -59,6 +59,9 @@ jobs:
run: |
export PLUGIN_DIR=$GITHUB_WORKSPACE
pushd ${{ env.rack-plugin-toolchain-dir }}
sed -i 's/\(RACK_SDK_VERSION \:\= \)[0-9\.]\+$/\1${{ env.rack-sdk-version }}/' Makefile
make rack-sdk-clean
make rack-sdk-${{ matrix.platform }}
make plugin-build-${{ matrix.platform }}
- name: Upload artifact
uses: actions/upload-artifact@v3
Expand Down
11 changes: 10 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
url = https://github.com/Dewb/whitewhale
branch = vcvrack_pr
[submodule "firmware/teletype"]
path = firmware/teletype
path = firmware/teletype4
url = https://github.com/Dewb/teletype
branch = vcvrack-4.0.0
[submodule "firmware/meadowphysics"]
Expand All @@ -17,3 +17,12 @@
[submodule "firmware/ansible"]
path = firmware/ansible
url = https://github.com/Dewb/ansible
branch = vcvrack
[submodule "firmware/firmware/teletype-5"]
path = firmware/teletype5
url = https://github.com/Dewb/teletype
branch = vcvrack-5
[submodule "firmware/whitewhale-kria"]
path = firmware/whitewhale-kria
url = https://github.com/Dewb/kria
branch = vcvrack
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"focus": false,
"panel": "shared"
},
"command": "make clean; rm -rf firmware/build; rm -rf res/firmware/*.*",
"command": "make clean",
"options": {
"cwd": "${workspaceRoot}",
"env": {
Expand Down
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,18 @@ $(ragel):
firmware-build: export PATH := $(PWD)/dep/bin:$(PATH)
firmware-build: export RACK_DIR := $(realpath $(RACK_DIR))
firmware-build: firmware/*.mk firmware/**/*.c firmware/**/*.h firmware/**/**/*.rl
cd firmware && $(MAKE) -f whitewhale.mk
cd firmware && $(MAKE) -f whitewhale.mk TARGET_NAME=whitewhale
cd firmware && $(MAKE) -f whitewhale.mk TARGET_NAME=whitewhale-kria
cd firmware && $(MAKE) -f meadowphysics.mk
cd firmware && $(MAKE) -f earthsea.mk
cd firmware && $(MAKE) -f teletype.mk
cd firmware && $(MAKE) -f teletype.mk TARGET_NAME=teletype4
cd firmware && $(MAKE) -f teletype.mk TARGET_NAME=teletype5
cd firmware && $(MAKE) -f ansible.mk

firmware-clean:
rm -rfv firmware/build
rm -fv res/firmware/*.so
rm -fv res/firmware/*.dll
rm -fv res/firmware/*.dylib
rm -fv res/firmware/*.dylib
rm -fv res/firmware/*.so

DISTRIBUTABLES += $(wildcard res)
DISTRIBUTABLES += $(wildcard LICENSE*)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This plugin currently includes:
* [white whale](https://monome.org/docs/whitewhale/), a probabilistic step sequencer
* [meadowphysics](https://monome.org/docs/meadowphysics/), an event sequencer for polyrhythms and rule-based evolving patterns
* [earthsea](https://monome.org/docs/earthsea/), a live keyboard that can sequence melodies and recall CV with shape memory gestures
* Support for [monome grid](https://monome.org/docs/grid/) and [monome arc](https://monome.org/docs/arc/) hardware controllers, both current editions and older models, plus virtual versions of the controllers within VCV Rack, in 64, 128, and 256-key flavors.
* Support for [monome grid](https://monome.org/docs/grid/) and [monome arc](https://monome.org/docs/arc/) hardware controllers, both current editions and older models, plus virtual versions of the grid controller within VCV Rack, in 64, 128, and 256-key flavors.

All of the modules can connect to either a virtual grid or a real hardware grid controller. ([Serialosc](https://monome.org/docs/setup/) is required to use real hardware, but no drivers are required for the virtual grids.)

Expand All @@ -35,7 +35,7 @@ To install the latest library release:
* Right-click the `white whale` module and select your virtual grid from the list of devices. It should light up.
* If you have a hardware grid connected, right-click the module and select your hardware grid from the list. The virtual grid should go dark and your physical grid should light up.

### Deeping learning and getting help
### Deeper learning and getting help

See the [online manual](https://dewb.github.io/monome-rack), specifically the [Getting Help section](https://dewb.github.io/monome-rack/help/).

Expand Down
8 changes: 8 additions & 0 deletions docs/content/modules/teletype.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ For advanced scripting techniques, see `@scanner-darkly`'s [GRID INTEGRATION stu

You can use either a physical or virtual grid to take advantage of the grid operators or Grid Control Mode. Hardware versions of Teletype can't use both the grid and the keyboard at the same time, and there are [some precautions to follow](https://monome.org/docs/grid/grid-modular/#teletype) regarding power loads, but thankfully the software version has none of these restrictions, making it an excellent environment for developing complex grid scenes that you can later transfer to hardware.

# Alternate firmware

Choose **Firmware Tools > Switch Firmware** to see alternate firmware options for Teletype.

Currently there are firmware builds for the teletype 4.0 and 5.0-beta release streams. 4.0 is the default; at some point after 5.0 is out of beta, it will become the default for newly placed modules, but modules already placed in your patch will remain 4.0.

Switching firmware will reset the VRAM and NVRAM for the module, so export any scenes you want to keep before to text files before switching firmware editions.

# Further reading

* Teletype [hardware documentation](http://monome.org/docs/teletype/)
Expand Down
8 changes: 8 additions & 0 deletions docs/content/modules/whitewhale.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ This quickstart example uses White Whale alongside modules from VCV's [Free coll
- Hold *ALT* on the grid and enter the **CV B** region on grid -- this will show put **CV B** into a [Scale Map](https://monome.org/docs/whitewhale/#cv-map), which quantizes **CV B**'s output to a musical note range.
- As the pattern plays, enter new notes for each step in the *Scale Map*.

# Alternate firmware

Choose **Firmware Tools > Switch Firmware** to see alternate firmware options for White Whale.

White Whale offers the standard firmware plus the Kria alternate firmware, an early form of the Kria sequencer mode in Ansible. [Read about the original version of Kria here](https://llllllll.co/t/kria-0-3-initial-release/2409).

# Further reading

* White Whale [hardware documentation](http://monome.org/docs/whitewhale/)
Expand All @@ -79,3 +85,5 @@ This quickstart example uses White Whale alongside modules from VCV's [Free coll
* [white whale tutorial part 2](https://vimeo.com/105368874)
* [white whale tutorial part 3](https://vimeo.com/105408057)
* [white whale tutorial part 4](https://vimeo.com/105408747)
* [kria demo](https://vimeo.com/152756139)
* [kria lesson](https://vimeo.com/153923660)
3 changes: 2 additions & 1 deletion firmware/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ SHELL := /bin/bash -O extglob
RACK_DIR ?= ../../..

TARGET_DIR := ../res/firmware/
BUILD_DIR := ../build/firmware/$(TARGET_NAME)

FLAGS += \
-DDEBUG \
Expand Down Expand Up @@ -33,7 +34,7 @@ ifeq ($(ARCH_WIN), 1)
TARGET = $(TARGET_DIR)$(TARGET_NAME).dll
endif

include $(RACK_DIR)/compile.mk
include compile.mk

all: $(TARGET)

Expand Down
114 changes: 114 additions & 0 deletions firmware/compile.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Rack SDK compile.mk modified to support configurable build products folder

ifndef RACK_DIR
$(error RACK_DIR is not defined)
endif

include $(RACK_DIR)/arch.mk

BUILD_DIR ?= build
OBJCOPY ?= objcopy
STRIP ?= strip
INSTALL_NAME_TOOL ?= install_name_tool
OTOOL ?= otool

# Generate dependency files alongside the object files
FLAGS += -MMD -MP
# Debugger symbols. These are removed with `strip`.
FLAGS += -g
# Optimization
FLAGS += -O3 -funsafe-math-optimizations -fno-omit-frame-pointer
# Warnings
FLAGS += -Wall -Wextra -Wno-unused-parameter
# C++ standard
CXXFLAGS += -std=c++11

# Define compiler/linker target if cross-compiling
ifdef CROSS_COMPILE
FLAGS += --target=$(MACHINE)
LDFLAGS += --target=$(MACHINE)
endif

# Architecture-independent flags
ifdef ARCH_X64
FLAGS += -DARCH_X64
FLAGS += -march=nehalem
endif
ifdef ARCH_ARM64
FLAGS += -DARCH_ARM64
FLAGS += -march=armv8-a+fp+simd
endif

ifdef ARCH_LIN
FLAGS += -DARCH_LIN
CXXFLAGS += -Wsuggest-override
endif
ifdef ARCH_MAC
FLAGS += -DARCH_MAC
CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
MAC_SDK_FLAGS := -mmacosx-version-min=10.9
FLAGS += $(MAC_SDK_FLAGS)
LDFLAGS += $(MAC_SDK_FLAGS)
endif
ifdef ARCH_WIN
FLAGS += -DARCH_WIN
FLAGS += -D_USE_MATH_DEFINES
FLAGS += -municode
CXXFLAGS += -Wsuggest-override
endif

# Allow *appending* rather than prepending to common flags.
# This is useful to force-redefine compiler settings instead of merely setting defaults that may be overwritten.
FLAGS += $(EXTRA_FLAGS)
CFLAGS += $(EXTRA_CFLAGS)
CXXFLAGS += $(EXTRA_CXXFLAGS)
LDFLAGS += $(EXTRA_LDFLAGS)

# Apply FLAGS to language-specific flags
CFLAGS += $(FLAGS)
CXXFLAGS += $(FLAGS)

# Derive object files from sources and place them before user-defined objects
OBJECTS := $(patsubst %, $(BUILD_DIR)/%.o, $(SOURCES)) $(OBJECTS)
OBJECTS += $(patsubst %, $(BUILD_DIR)/%.bin.o, $(BINARIES))
DEPENDENCIES := $(patsubst %, $(BUILD_DIR)/%.d, $(SOURCES))

# Final targets

$(TARGET): $(OBJECTS)
$(CXX) -o $@ $^ $(LDFLAGS)

-include $(DEPENDENCIES)

$(BUILD_DIR)/%.c.o: %.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -o $@ $<

$(BUILD_DIR)/%.cpp.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(BUILD_DIR)/%.cc.o: %.cc
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(BUILD_DIR)/%.m.o: %.m
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -o $@ $<

$(BUILD_DIR)/%.bin.o: %
@mkdir -p $(@D)
ifdef ARCH_LIN
$(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 --rename-section .data=.rodata,alloc,load,readonly,data,contents $< $@
endif
ifdef ARCH_WIN
$(OBJCOPY) -I binary -O pe-x86-64 -B i386:x86-64 --rename-section .data=.rodata,alloc,load,readonly,data,contents $< $@
endif
ifdef ARCH_MAC
@# Apple makes this needlessly complicated, so just generate a C file with an array.
xxd -i $< | $(CC) $(MAC_SDK_FLAGS) -c -o $@ -xc -
endif

$(BUILD_DIR)/%.html: %.md
markdown $< > $@
2 changes: 1 addition & 1 deletion firmware/mock_hardware/mock_hardware_api.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef MOCK_API_SKIP_TYPES
#include "../teletype/src/serializer.h"
#include "../teletype4/src/serializer.h"
#include <stdint.h>
#include <stdbool.h>
#endif
Expand Down
29 changes: 27 additions & 2 deletions firmware/mock_hardware/modules/teletype/adapter_teletype.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
#include "mock_hardware_api.h"
#include "mock_hardware_api_private.h"
#include "flashc.h"

#include "module/edit_mode.h"
#include "module/flash.h"
#include "module/gitversion.h"
#include "module/globals.h"
#include "module/live_mode.h"
#include "module/preset_w_mode.h"
#include "src/serialize.h"
#include "src/scene_serialization.h"
#include "src/teletype_io.h"
#include "types.h"

extern nvram_data_t f;
extern scene_state_t scene_state;

#ifdef DECLARE_NVRAM
DECLARE_NVRAM(&f, sizeof(nvram_data_t))
#endif
#ifdef DECLARE_VRAM
DECLARE_VRAM(&scene_state, sizeof(scene_state))
#endif

void clock_null(uint8_t phase) { }
typedef void (*clock_pulse_t)(uint8_t phase);
volatile uint8_t clock_external;
Expand Down Expand Up @@ -51,8 +62,16 @@ void fake_flash_read(scene_state_t* src_scene, scene_state_t* dest_scene,
uint8_t init_i2c_op_address)
{
memcpy(ss_scripts_ptr(dest_scene), ss_scripts_ptr(src_scene),

// handle difference in macros between TT 5 and 4
#ifdef EDITABLE_SCRIPT_COUNT
ss_scripts_size(EDITABLE_SCRIPT_COUNT)
#else
// Exclude size of TEMP script as above
ss_scripts_size() - sizeof(scene_script_t));
ss_scripts_size() - sizeof(scene_script_t)
#endif

);

if (init_pattern)
{
Expand All @@ -66,7 +85,13 @@ void fake_flash_read(scene_state_t* src_scene, scene_state_t* dest_scene,
memcpy(dest_text, src_text, SCENE_TEXT_LINES * SCENE_TEXT_CHARS);
// need to reset timestamps
uint32_t ticks = tele_get_ticks();

// handle difference in macros between TT 5 and 4
#ifdef TOTAL_SCRIPT_COUNT
for (size_t i = 0; i < TOTAL_SCRIPT_COUNT; i++)
#else
for (size_t i = 0; i < TEMP_SCRIPT; i++)
#endif
dest_scene->scripts[i].last_time = ticks;
dest_scene->variables.time = 0;

Expand Down
10 changes: 10 additions & 0 deletions firmware/mock_hardware/modules/teletype/usb_disk_mode.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <stdint.h>

void handler_usb_PollADC(int32_t data) {
}

void handler_usb_Front(int32_t data) {
}

void handler_usb_ScreenRefresh(int32_t data) {
}
1 change: 0 additions & 1 deletion firmware/teletype
Submodule teletype deleted from efd650
Loading

0 comments on commit 27d3eee

Please sign in to comment.