-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMorse.cpp
62 lines (56 loc) · 865 Bytes
/
Morse.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <iostream>
#include <fstream>
#include <array>
#include <vector>
#include <cctype>
#include "Morse.hpp"
#include "MorseTable.tbl"
Morse::Morse()
{
shortSig=60;
std::cout << sizeof(MorseTable) << std::endl;
return;
}
bool Morse::Clear()
{
inBuffer = 1;
return true;
}
bool Morse::End()
{
Clear();
return true;
}
bool Morse::keyIn()
{
return true;
}
bool Morse::keyOff()
{
return true;
}
char Morse::Detect(int s)
{
std::cout << "Sig:" << s << std::endl;
switch (s) {
case 0:
std::cout << "Complete:" << (int)inBuffer << std::endl;
inBuffer=1;
return 'c';
break;
case 1:
inBuffer <<= 1;
inBuffer += 0;
break;
case 2:
inBuffer <<= 1;
inBuffer += 1;
break;
case -1:
inBuffer = 1;
return -1;
break;
}
std::cout << inBuffer << std::endl;
return 0;
}