-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
169 lines (160 loc) · 6.45 KB
/
index.html
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>sx127x setup</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.4.0/styles/default.min.css"
integrity="sha512-hasIneQUHlh06VNBe7f6ZcHmeRTLIaQWFd43YriJ0UND19bvYRauxthDg8E4eVNPm9bRUhr5JGeqH7FRFXQu5g=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.4.0/highlight.min.js"
integrity="sha512-IaaKO80nPNs5j+VLxd42eK/7sYuXQmr+fyywCNA0e+C6gtQnuCXNtORe9xR4LqGPz5U9VpH+ff41wKs/ZmC3iA=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="./index.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-mobile/1.4.1/jquery.mobile.min.css"
integrity="sha512-o3x4nST+KCWWUxaA1oneL8MOaOz8EEG+r6IUASMYlYd+ehohuxEr6Tv3XxZNkwHZgn3rw4r2D8N868O099HgyQ=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"
integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mobile/1.4.1/jquery.mobile.min.js"
integrity="sha512-wSacGPS/KRyVB67O4xD+Eh1OX4/dq4juZj9DKTokRt81BzLbfsSMtNgR9Pu8FLr4kLbk5oNr9Hq+5PeWLCX8mA=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>
<body>
<div class="ui-field-contain">
<fieldset data-role="controlgroup">
<h1>RegModemConfig1</h1>
<label for="myBW">BW</label>
<select onChange="computeRegisters();" id="myBW">
<option>BW 7.8 kHz</option>
<option>BW 10.4 kHz</option>
<option>BW 15.6 kHz</option>
<option>BW 20.8kHz</option>
<option>BW 31.25 kHz</option>
<option>BW 41.7 kHz</option>
<option selected>BW 62.5 kHz</option>
<option>125 kHz</option>
<option>BW 250 kHz</option>
<option>BW 500 kHz</option>
</select>
<label for="myCR">C/R</label>
<select onChange="computeRegisters();" id="myCR">
<option selected>4/5</option>
<option>C/R 4/6</option>
<option>C/R 4/7</option>
<option>C/R 4/8</option>
</select>
<label for="myHM">Header</label>
<select onChange="computeRegisters();" id="myHM">
<option selected>Explicit Header</option>
<option>Implicit Header</option>
</select>
</fieldset>
<fieldset data-role="controlgroup">
<h1>RegModemConfig2</h1>
<label for="mySF">SF</label>
<select onChange="computeRegisters();" id="mySF">
<option>SF 6</option>
<option>SF 7</option>
<option>SF 8</option>
<option>SF 9</option>
<option>SF 10</option>
<option>SF 11</option>
<option selected>SF 12</option>
</select>
<label for="myCRC">CRC</label>
<select onChange="computeRegisters();" id="myCRC">
<option selected>CRC OFF</option>
<option>CRC ON</option>
</select>
</fieldset>
<fieldset data-role="controlgroup">
<h1>RegModemConfig3</h1>
<label for="myLowData">LowData</label>
<select onChange="computeRegisters();" id="myLowData">
<option>LowDataRateOptimize Disabled</option>
<option selected>LowDataRateOptimize Enabled</option>
</select>
<label for="myAGC">AGC</label>
<select onChange="computeRegisters();" id="myAGC">
<option>LNA gain set by LnaGain</option>
<option selected>LNA gain set by AGC loop</option>
</select>
</fieldset>
<fieldset data-role="controlgroup">
<h1>RegPaConfig</h1>
<label for="myPaSelect">PaSelect</label>
<select onChange="computeRegisters();" id="myPaSelect">
<option>RFO pin (+14 dBm max)</option>
<option selected>PA_BOOST pin (+20 dBm max)</option>
</select>
<label for="myMaxPower">MaxPower</label>
<select onChange="computeRegisters();" id="myMaxPower">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option selected>7</option>
</select>
<label for="myOutputPower">OutputPower</label>
<select onChange="computeRegisters();" id="myOutputPower">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option selected>15</option>
</select>
</fieldset>
</div>
<pre>
<code class="language-c" id="TAresult">
// BW = 7: 125 kHz, CR = 1: 4/5, HM = 0
uint8_t reg1 = 0x72;
// SF = 12: 12, CRC = 0
uint8_t reg2 = 0xC0;
// LDRO = 1, AGCAutoOn = 1
uint8_t reg3 = 0x0C;
// PaSelect = 1, MaxPower = 7: 15 dBm, OutputPower = 15: 17 dBm
uint8_t regpaconfig = 0xFF;
#define REG_OCP 0x0B
#define REG_PA_CONFIG 0x09
#define REG_LNA 0x0c
#define REG_OP_MODE 0x01
#define REG_MODEM_CONFIG_1 0x1d
#define REG_MODEM_CONFIG_2 0x1e
#define REG_MODEM_CONFIG_3 0x26
#define REG_PA_DAC 0x4D
#define PA_DAC_HIGH 0x87
#define MODE_LONG_RANGE_MODE 0x80
#define MODE_SLEEP 0x00
#define MODE_STDBY 0x01
#define MODE_TX 0x03
#define MODE_RX_CONTINUOUS 0x05
#define MODE_RX_SINGLE 0x06
LoRa.writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_SLEEP);
delay(10);
LoRa.writeRegister(REG_PA_CONFIG, regpaconfig);
LoRa.writeRegister(REG_MODEM_CONFIG_1, reg1);
LoRa.writeRegister(REG_MODEM_CONFIG_2, reg2);
LoRa.writeRegister(REG_MODEM_CONFIG_3, reg3);
delay(10);
LoRa.writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_STDBY);
</code>
</pre>
<script>computeRegisters();</script>
</body>
</html>