Skip to content

Commit

Permalink
experimenting with clock into tempo cv #13
Browse files Browse the repository at this point in the history
By only detecting values that are above LOGIC_HIGH, I think that the tempo input can perform double duty. Thankfully, play/pause/reset signals that may potentially be sent via an original firmware tri-ger all related to tempo anyway. Made a new github issue.
  • Loading branch information
wraybowling committed Sep 9, 2020
1 parent 5a576fb commit 5eb3746
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ This repository has a [GNU General Public License v3.0](https://github.com/Micro
- [Tri+ger Muffwiggler Forum thread](https://www.muffwiggler.com/forum/viewtopic.php?f=16&t=231526&p=3258064#p3258064)
- [Richland Synth Fest 2020 talk](https://www.twitch.tv/videos/664368287) in which I explain my firmware hacking process
- [Jason H. J. Lim](https://github.com/jhjlim) designed the original Tri-ger
- [Qu-Bit Electronics](https://github.com/Qu-Bit-Electronix) manufactured the original Tri-ger
- [Qu-Bit Electronix](https://github.com/Qu-Bit-Electronix) manufactured the original Tri-ger
20 changes: 17 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "DebouncedBoolean.h"

// state
uint16_t prev_clock_div_knob__val = 1;
uint16_t clock_input_multiplier = 1;
Clock clock;
unsigned long clock_until = 0;
uint16_t step = 0;
Expand Down Expand Up @@ -64,20 +66,32 @@ void loop() {
topPressed |= digitalRead(top_button);
leftPressed |= digitalRead(left_button);
rightPressed |= digitalRead(right_button);

record_button_value.set( getTrigerMux(record_button) > LOGIC_HIGH );
if(record_button_value.isRising()){
isRecording = !isRecording;
}





// local vars
uint16_t this_clock_in = getTrigerMux(clock_div_cv);
uint16_t clock_in_value = getTrigerMux(clock_div_cv);
uint16_t tempo_value = getTrigerMux(tempo);
uint16_t clock_div_knob__val = getTrigerMux(clock_div_knob);
uint8_t rollup = 3 - (getTrigerMux(roll_rate_knob) * 3 / 1024);
uint32_t time = millis();
const bool BUTTONS[3] = {topPressed, leftPressed, rightPressed};
bool isAltPressed = digitalRead(alt);

if(isAltPressed && (clock_div_knob__val != prev_clock_div_knob__val)) {
clock_input_multiplier = clock_div_knob__val;
}
prev_clock_div_knob__val = clock_div_knob__val;

// clock advancement
if( clock.isHigh(this_clock_in, clock_div_knob__val, time) ) {
if( clock.isHigh(tempo_value, clock_input_multiplier, time) ) {

// write state for previous step
if(isRecording) {
Expand Down Expand Up @@ -145,7 +159,7 @@ void loop() {
+ B00010000 * brightness[weights[1]] * (rollup > weights[1])
+ B00000100 * brightness[weights[2]] * (rollup > weights[2])
// alt
+ B00000010 * brightness[2]
+ B00000010 * isAltPressed
// record
+ B00000001 * isRecording
;
Expand Down

0 comments on commit 5eb3746

Please sign in to comment.