Merge branch 'main' of https://github.com/SpaceyKasey/trigor-mortse
This commit is contained in:
commit
928758c800
1 changed files with 20 additions and 17 deletions
|
@ -2,7 +2,7 @@
|
|||
#include <Arduino.h>
|
||||
#include "src/MortseUi.h"
|
||||
|
||||
const byte MorseTable[] = {0b00000000,0,0b00010010,0,0,0,0,0b00011110,0b10110110,0b00101101,0,0b10101010,0b00110011,0b00100001,0b00010101,0b10110010,0b10111111,0b10101111,0b10100111,0b10100011,0b10100001,0b10100000,0b10110000,0b10111000,0b10111100,0b10111111,0b00111000,0b00101010,0,0b10110001,0,0b00001100,0b00011010,0b01000001,0b10001000,0b10001010,0b01100100,0b00100000,0b10000010,0b01100110,0b10000000,0b01000000,0b10000111,0b01100101,0b10000100,0b01000011,0b01000010,0b01100111,0b10000110,0b10001101,0b01100010,0b01100000,0b00100001,0b01100001,0b10000001,0b01100011,0b10001001,0b10001011,0b10001100,0b10110110,0,0b00101101,0,0b00001101,0b00011110,0b01000001,0b10001000,0b10001010,0b01100100,0b00100000,0b10000010,0b01100110,0b10000000,0b01000000,0b10000111,0b01100101,0b10000100,0b01000011,0b01000010,0b01100111,0b10000110,0b10001101,0b01100010,0b01100000,0b00100001,0b01100001,0b10000001,0b01100011,0b10001001,0b10001011,0b10001100,0b10110110,0,0b00101101,0};
|
||||
const byte MorseTable[] = {0b00100000,0,0b00010010,0,0,0,0,0b00011110,0b10110110,0b00101101,0,0b10101010,0b00110011,0b00100001,0b00010101,0b10110010,0b10111111,0b10101111,0b10100111,0b10100011,0b10100001,0b10100000,0b10110000,0b10111000,0b10111100,0b10111111,0b00111000,0b00101010,0,0b10110001,0,0b00001100,0b00011010,0b01000001,0b10001000,0b10001010,0b01100100,0b00100000,0b10000010,0b01100110,0b10000000,0b01000000,0b10000111,0b01100101,0b10000100,0b01000011,0b01000010,0b01100111,0b10000110,0b10001101,0b01100010,0b01100000,0b00100001,0b01100001,0b10000001,0b01100011,0b10001001,0b10001011,0b10001100,0b10110110,0,0b00101101,0,0b00001101,0b00011110,0b01000001,0b10001000,0b10001010,0b01100100,0b00100000,0b10000010,0b01100110,0b10000000,0b01000000,0b10000111,0b01100101,0b10000100,0b01000011,0b01000010,0b01100111,0b10000110,0b10001101,0b01100010,0b01100000,0b00100001,0b01100001,0b10000001,0b01100011,0b10001001,0b10001011,0b10001100,0b10110110,0,0b00101101,0};
|
||||
|
||||
const int Channel1 = 9; //Output Channel 1
|
||||
const int Channel2 = 10; //Output Channel 2
|
||||
|
@ -39,8 +39,8 @@ bool E1Prev, E2Prev, CDPrev, E1Click, E2Click, CDIn = false, Channel1State = fal
|
|||
unsigned int E1Bounce, E2Bounce, CDBounce = 0, BeatBounce = 0;
|
||||
unsigned long ClockPrev = 0, ClockInPrev = 0, LastBeat = 0;
|
||||
byte Input = 0;
|
||||
int PpQN = 24;
|
||||
float Clock = 120;
|
||||
int PpQN = 1;
|
||||
float Clock = 15;
|
||||
float ClockTick = (1/((Clock * PpQN)/60)) * 1000;
|
||||
unsigned long ClockTime = 0;
|
||||
unsigned long LastStepTime = 0;
|
||||
|
@ -67,9 +67,9 @@ void setup() {
|
|||
E2Prev = E2Btn;
|
||||
ClockState = digitalRead(ClockIn);
|
||||
CDPrev = digitalRead(ClockDetect);
|
||||
digitalWrite(Channel1, 0);
|
||||
digitalWrite(Channel2, 0);
|
||||
digitalWrite(Channel2, 0);
|
||||
digitalWrite(Channel1, LOW);
|
||||
digitalWrite(Channel2, LOW);
|
||||
digitalWrite(Channel2, LOW);
|
||||
|
||||
// Timer0 is already used for millis() - we'll just interrupt somewhere
|
||||
// in the middle and call the "Compare A" function below
|
||||
|
@ -172,10 +172,12 @@ void loop() {
|
|||
|
||||
if (Beat){
|
||||
Beat = false;
|
||||
if (!BeatBounce){
|
||||
if (BeatBounce == 0){
|
||||
BeatBounce = DebounceTime;
|
||||
|
||||
//Insert Beat Output here!
|
||||
char outputChar = TestText[Channel1Index];
|
||||
Serial.println(outputChar);
|
||||
if (outputChar == '\0' ){
|
||||
Channel1Index = 0;
|
||||
outputChar = TestText[Channel1Index];
|
||||
|
@ -187,28 +189,29 @@ void loop() {
|
|||
if (MorseIndex == 0){
|
||||
Channel1Index++;
|
||||
outputChar = TestText[Channel1Index];
|
||||
MorseIndex = ((MorseTable[((int)outputChar - 32)]) >> 5) - 1;
|
||||
MorseIndex = (((MorseTable[((int)outputChar - 32)]) >> 5)) & 7;
|
||||
}
|
||||
|
||||
MorseIndex--;
|
||||
|
||||
if (trigger){
|
||||
digitalWrite(Channel1, true);
|
||||
Channel1Trig = 5;
|
||||
digitalWrite(Channel1, HIGH);
|
||||
Channel1Trig = DebounceTime;
|
||||
Channel1State = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Channel1State && !Channel1Trig){
|
||||
digitalWrite(Channel1, 0);
|
||||
if ((Channel1State) && (Channel1Trig == 0)){
|
||||
digitalWrite(Channel1, LOW);
|
||||
Channel1State = false;
|
||||
}
|
||||
if (Channel2State && !Channel2Trig){
|
||||
digitalWrite(Channel2, 0);
|
||||
digitalWrite(Channel2, LOW);
|
||||
Channel2State = false;
|
||||
}
|
||||
if (Channel3State && !Channel3Trig){
|
||||
digitalWrite(Channel3, 0);
|
||||
digitalWrite(Channel3, LOW);
|
||||
Channel3State = false;
|
||||
}
|
||||
|
||||
|
@ -223,8 +226,8 @@ SIGNAL(TIMER0_COMPA_vect)
|
|||
E1Bounce = (E1Bounce - 1) & 0b10000000;
|
||||
E2Bounce = (E2Bounce - 1) & 0b10000000;
|
||||
CDBounce = (CDBounce - 1) & 0b10000000;
|
||||
BeatBounce = (BeatBounce - 1) & 0b10000000;
|
||||
Channel1Trig = (Channel1Trig - 1) & 0b10000000;
|
||||
BeatBounce = (BeatBounce - 1) & 0b01111111;
|
||||
Channel1Trig = (Channel1Trig - 1) & 0b01111111;
|
||||
Channel2Trig = (Channel2Trig - 1) & 0b10000000;
|
||||
Channel3Trig = (Channel3Trig - 1) & 0b10000000;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue