-
Notifications
You must be signed in to change notification settings - Fork 0
/
1loracomm.ino
71 lines (58 loc) · 2.18 KB
/
1loracomm.ino
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
63
64
65
66
67
68
69
70
71
#include <DES.h>
#include <Keypad.h>
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
//****************START USER SETTINGS****************//
// configure 3DES
DES des;
byte desKey[] = {
// PLACEHOLDER; PLEASE CHANGE ME!!!
0x3b, 0x38, 0x98, 0x37, 0x15, 0x20, 0xf7, 0x5e, // key A
0x92, 0x2f, 0xb5, 0x1F, 0xc7, 0x1f, 0x43, 0x6e, // key B
0x3b, 0x38, 0x98, 0x37, 0x15, 0x20, 0xf7, 0x5e, // key C
};
//****************END USER SETTINGS****************//
//****************START KEYPAD****************//
// define keypad matrix
const byte ROWS = 4; // four rows
const byte COLS = 4; // four columns
const char keys[ROWS][COLS] = {
{ 'A', 'D', 'G', 'a' },
{ 'J', 'M', 'P', 'n' },
{ 'S', 'V', 'Y', '^' },
{ ':', '.', '>', ' ' }
};
// define keypad pins
const byte rowPins[ROWS] = { 13, 12, 11, 10 }; // connect to the row pinouts of the keypad
const byte colPins[COLS] = { 9, 8, 7, 6 }; // connect to the column pinouts of the keypad
// create keypad object
const Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
// declare variable to store latest keypress
char key;
// declare variables for tracking multipresses
bool capitalShift; // tracks whether the shift key was pressed
bool numeric; // tracks whether to use numeric keyboard mode
bool typeKey; // tracks whether the current keypress should be visually typed
char MPkey;
uint8_t multipress[2] = { 17, 0 }; // {key #, press count}
//****************END KEYPAD****************//
//****************START LCD****************//
// define LCD pins
LiquidCrystal lcd(14, 15, 16, 17, 18, 19);
// declare variable tracking cursor position
uint8_t cursor = 1; // set to 1 for easy non-zero based position tracking
// track if using docked mode
bool docked = false;
//****************END LCD****************//
//****************START LORA****************//
// declare outgoing message buffer
unsigned char messageBuffer[33];
// configure software serial
const byte SloraRX = 2;
const byte SloraTX = 3;
SoftwareSerial Slora = SoftwareSerial(SloraRX, SloraTX);
// declare misc. variables/constants
String incomingPrev;
uint8_t peerAddress;
const uint8_t LED = 4;
//****************END LORA****************//