added clock for daisychaining

This commit is contained in:
2023-08-13 00:23:51 +03:00
parent adc80bd626
commit f6ba128ab8
2 changed files with 16 additions and 9 deletions

View File

@ -5,7 +5,7 @@
#include <U8g2lib.h> #include <U8g2lib.h>
#include <avr/wdt.h> #include <avr/wdt.h>
#define VERSION "0.9b" const char version[5] = "V:0.9";
#define SCREEN_ADDRESS 0x3C #define SCREEN_ADDRESS 0x3C
@ -24,6 +24,7 @@
#define ANALOGUE_INPUT_1_PIN A7 #define ANALOGUE_INPUT_1_PIN A7
#define ANALOGUE_INPUT_2_PIN A6 #define ANALOGUE_INPUT_2_PIN A6
const byte outsPins[6] = { 7, 8, 10, 6, 9, 11 }; const byte outsPins[6] = { 7, 8, 10, 6, 9, 11 };
const byte clockOutPin = 3;
int CV1Calibration = 0; int CV1Calibration = 0;
int CV2Calibration = 0; int CV2Calibration = 0;
@ -188,6 +189,8 @@ void setup() {
pinMode(outsPins[i], OUTPUT); pinMode(outsPins[i], OUTPUT);
} }
pinMode(clockOutPin, OUTPUT);
loadState(); loadState();
u8g2.begin(); u8g2.begin();
@ -211,6 +214,7 @@ void clock() {
// Action on each pulse // Action on each pulse
if (tickCount == 0) { if (tickCount == 0) {
sendTriggers(); sendTriggers();
digitalWrite(clockOutPin, HIGH);
} }
//this part gets the Pulse and Ticks ticking //this part gets the Pulse and Ticks ticking
@ -235,6 +239,7 @@ void clock() {
for (byte i = 0; i < 6; i++) { for (byte i = 0; i < 6; i++) {
digitalWrite(outsPins[i], LOW); digitalWrite(outsPins[i], LOW);
} }
digitalWrite(clockOutPin, LOW);
} }
} }
} }

View File

@ -312,30 +312,32 @@ void updateScreen() {
} }
if (isRecording) { if (isRecording) {
//u8g2.drawUTF8(43, 60, "RECORDING");
u8g2.drawButtonUTF8(64, 62, U8G2_BTN_BW1|U8G2_BTN_HCENTER|U8G2_BTN_INV, 50, 0, 2, "RECORDING" ); u8g2.drawButtonUTF8(64, 62, U8G2_BTN_BW1|U8G2_BTN_HCENTER|U8G2_BTN_INV, 50, 0, 2, "RECORDING" );
} }
} }
//Settings Screen //Settings Screen
else if (displayScreen == 2) { else if (displayScreen == 2) {
u8g2.drawButtonUTF8(64, 5, U8G2_BTN_BW1|U8G2_BTN_HCENTER, 128, 0, 2, "SETTINGS" ); //u8g2.drawButtonUTF8(64, 5, U8G2_BTN_BW1|U8G2_BTN_HCENTER, 128, 0, 2, "SETTINGS" );
u8g2.drawStr(8, 5,"SETTINGS" );
u8g2.drawStr(102, 5, version );
u8g2.drawHLine(0, 8, 128);
lastMenuItem = 2; lastMenuItem = 2;
byte width = 112; byte width = 112;
if (menuItem == 0) { if (menuItem == 0) {
u8g2.drawButtonUTF8(8, 18, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "CALIBRATE CV INS" ); u8g2.drawButtonUTF8(8, 19, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 3, "CALIBRATE CV INS" );
} else { } else {
u8g2.drawButtonUTF8(8, 18, U8G2_BTN_BW0, width, 2, 2, "CALIBRATE CV INS" ); u8g2.drawButtonUTF8(8, 19, U8G2_BTN_BW0, width, 2, 3, "CALIBRATE CV INS" );
} }
if (menuItem == 1) { if (menuItem == 1) {
u8g2.drawButtonUTF8(8, 32, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "ROTATE SCREEN" ); u8g2.drawButtonUTF8(8, 31, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 3, "ROTATE SCREEN" );
} else { } else {
u8g2.drawButtonUTF8(8, 32, U8G2_BTN_BW0, width, 2, 2, "ROTATE SCREEN" ); u8g2.drawButtonUTF8(8, 31, U8G2_BTN_BW0, width, 2, 3, "ROTATE SCREEN" );
} }
if (menuItem == 2) { if (menuItem == 2) {
u8g2.drawButtonUTF8(8, 46, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 2, "FACTORY RESET" ); u8g2.drawButtonUTF8(8, 43, U8G2_BTN_BW0|U8G2_BTN_INV, width, 2, 3, "FACTORY RESET" );
} else { } else {
u8g2.drawButtonUTF8(8, 46, U8G2_BTN_BW0, width, 2, 2, "FACTORY RESET" ); u8g2.drawButtonUTF8(8, 43, U8G2_BTN_BW0, width, 2, 3, "FACTORY RESET" );
} }
} }