mirror of
https://github.com/g4klx/MMDVM.git
synced 2026-10-16 16:54:12 +02:00
Compare commits
388
Commits
POCSAGmodePins
...
FM_Ext
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ea732780d | ||
|
|
1309ad9326 | ||
|
|
411d439d78 | ||
|
|
ec9428d63e | ||
|
|
2a4b28c35e | ||
|
|
4f060c0047 | ||
|
|
1ed3a4c9d5 | ||
|
|
f414288c9b | ||
|
|
72cd2ce03e | ||
|
|
9137af8e3f | ||
|
|
cdfe3d0ec9 | ||
|
|
4dfab06a50 | ||
|
|
47649171fc | ||
|
|
0bd79fa440 | ||
|
|
26d055a67b | ||
|
|
5db1adb5ea | ||
|
|
f86b5435bb | ||
|
|
31f0e24588 | ||
|
|
04d0b15545 | ||
|
|
f14222e77d | ||
|
|
5039dfbe68 | ||
|
|
f9f81b9b8e | ||
|
|
3cc5d67696 | ||
|
|
3f960f9fc5 | ||
|
|
489853f200 | ||
|
|
96e1a765f9 | ||
|
|
04982c25c0 | ||
|
|
a3ffa9ed36 | ||
|
|
e7a22482db | ||
|
|
625749a546 | ||
|
|
d75042dc4c | ||
|
|
296ac88842 | ||
|
|
48e863d1d0 | ||
|
|
7b915f9cac | ||
|
|
e330c9f52a | ||
|
|
9470b1d6d3 | ||
|
|
388620b182 | ||
|
|
72e45177f3 | ||
|
|
90b82621f2 | ||
|
|
cfcb7ed852 | ||
|
|
b245be464f | ||
|
|
139003d4c7 | ||
|
|
c47eacd010 | ||
|
|
6b01f12602 | ||
|
|
7169836621 | ||
|
|
c84d227242 | ||
|
|
4f93c6022c | ||
|
|
81f6b6be53 | ||
|
|
fa9f89700f | ||
|
|
9023b6ae13 | ||
|
|
df23e15c91 | ||
|
|
51e5e7b851 | ||
|
|
8e52bdcc5c | ||
|
|
1332c6544b | ||
|
|
703ed2628d | ||
|
|
f3943a7888 | ||
|
|
737454281a | ||
|
|
1aef42bb21 | ||
|
|
9550299e4d | ||
|
|
056dd908b3 | ||
|
|
62f239ccc9 | ||
|
|
f8879e1f25 | ||
|
|
994226e4b1 | ||
|
|
2cc6c1f68f | ||
|
|
8e8cf35b19 | ||
|
|
66de35b6d8 | ||
|
|
43e00bbe1d | ||
|
|
f31b682625 | ||
|
|
7dc420c8ff | ||
|
|
df0a9ebe72 | ||
|
|
66feb9d50b | ||
|
|
0b14b0b73f | ||
|
|
50706c6f09 | ||
|
|
e957f0154e | ||
|
|
b10c72fd78 | ||
|
|
496afcb40e | ||
|
|
9467b10e5c | ||
|
|
13c5f7b0b4 | ||
|
|
435544f7a1 | ||
|
|
b64712f657 | ||
|
|
d23c0900c1 | ||
|
|
a0a3080da2 | ||
|
|
0fad84b46d | ||
|
|
1b40044a23 | ||
|
|
a671263398 | ||
|
|
ca1cc7096a | ||
|
|
a5aabd8fac | ||
|
|
6d0e57ea88 | ||
|
|
1d04c1e903 | ||
|
|
042c26b3bb | ||
|
|
b4a125a759 | ||
|
|
8ecf80ff8f | ||
|
|
6786b9b6b1 | ||
|
|
86ffc69b30 | ||
|
|
5d4df6ffd9 | ||
|
|
eac2aa4ac1 | ||
|
|
8cbd52aa72 | ||
|
|
99b853a976 | ||
|
|
15bc1a4027 | ||
|
|
75e32e1b71 | ||
|
|
7ebc4044f9 | ||
|
|
1836ba928e | ||
|
|
c54c13c146 | ||
|
|
17a3743cd8 | ||
|
|
4a5a260c28 | ||
|
|
4bcc1e88c4 | ||
|
|
4cba5931f4 | ||
|
|
89458a2c93 | ||
|
|
c91a42f53d | ||
|
|
470a070d96 | ||
|
|
36537c981c | ||
|
|
c85978a4e3 | ||
|
|
d0062a55f8 | ||
|
|
66ea3ad0d1 | ||
|
|
3ad443dc2a | ||
|
|
da16ee277c | ||
|
|
85acdc7121 | ||
|
|
a2518e99f2 | ||
|
|
0f51ddd0bd | ||
|
|
aaa72e769f | ||
|
|
0e8fdb381a | ||
|
|
0b31c40c2b | ||
|
|
2b3df4e901 | ||
|
|
807f01ba72 | ||
|
|
03f18451f7 | ||
|
|
16c3d418eb | ||
|
|
55df5fe04c | ||
|
|
b0ba3b5dd8 | ||
|
|
05d21c0a14 | ||
|
|
26a703c68c | ||
|
|
6c3dd265ab | ||
|
|
c04e207821 | ||
|
|
67e0bf02e2 | ||
|
|
3bb7cde322 | ||
|
|
fa29a27695 | ||
|
|
7302dc8bd7 | ||
|
|
bb7383a301 | ||
|
|
61a69d8536 | ||
|
|
5a11fcea5b | ||
|
|
05775f0bfa | ||
|
|
973a1391d7 | ||
|
|
5d45649096 | ||
|
|
e91c4417cb | ||
|
|
ff3e6feeb6 | ||
|
|
0e2a83bc7b | ||
|
|
c84dbd02e5 | ||
|
|
c0aad5effa | ||
|
|
e0234dfc00 | ||
|
|
e30eb3adaf | ||
|
|
7c9385beab | ||
|
|
4c6601d778 | ||
|
|
e3a951b33b | ||
|
|
97192602d8 | ||
|
|
604957b3e2 | ||
|
|
bb731e7890 | ||
|
|
c81d13395b | ||
|
|
9b0fed975c | ||
|
|
18bc0a75b8 | ||
|
|
f1a43ee520 | ||
|
|
b73bca237d | ||
|
|
e7ff0d1898 | ||
|
|
880df2536d | ||
|
|
09b6929100 | ||
|
|
9afcf3acc9 | ||
|
|
5ca9313db8 | ||
|
|
feff1ee2c7 | ||
|
|
77e0deee76 | ||
|
|
d7cd7096d0 | ||
|
|
5d1b66dde3 | ||
|
|
96364dc189 | ||
|
|
a816818e3f | ||
|
|
61ae1fc83a | ||
|
|
eb9c0dfd93 | ||
|
|
79a09e61fa | ||
|
|
9978a75651 | ||
|
|
bd16d13531 | ||
|
|
f00d729264 | ||
|
|
a4ddc2a060 | ||
|
|
a938c8b708 | ||
|
|
aa7a484c7a | ||
|
|
915be8c279 | ||
|
|
87feadd451 | ||
|
|
419ab89ee9 | ||
|
|
fcdb582893 | ||
|
|
5e85565208 | ||
|
|
2d876b8d8e | ||
|
|
4feca3c5b7 | ||
|
|
f8e119c26b | ||
|
|
edddbedd4b | ||
|
|
baa4f7aa4c | ||
|
|
de3c257f79 | ||
|
|
b027e1d1bf | ||
|
|
0a5c496a3a | ||
|
|
5b32fecc0a | ||
|
|
92a4db9886 | ||
|
|
cc785e3225 | ||
|
|
be0690e587 | ||
|
|
69e39e36b0 | ||
|
|
b2f33fd4d2 | ||
|
|
200199c5d4 | ||
|
|
1465d6f91d | ||
|
|
373aed13c8 | ||
|
|
b23620ede3 | ||
|
|
da87afc8d4 | ||
|
|
626a280d27 | ||
|
|
4b267c2e1e | ||
|
|
cf18f95a92 | ||
|
|
dac0f26e5d | ||
|
|
13993891ec | ||
|
|
849c2a0f50 | ||
|
|
172ac615a8 | ||
|
|
30031d8e95 | ||
|
|
b2de5defa4 | ||
|
|
177c7548ae | ||
|
|
b9bfc36e6f | ||
|
|
980c529107 | ||
|
|
5156ca13b7 | ||
|
|
d08a3690b0 | ||
|
|
e8ed77241c | ||
|
|
82dcc44a2d | ||
|
|
93a8e63233 | ||
|
|
4ffaa62855 | ||
|
|
f9530ee82a | ||
|
|
d66c6d7f9c | ||
|
|
458a3d2d24 | ||
|
|
6f4c19c006 | ||
|
|
a31cf3d6f8 | ||
|
|
3fb0631953 | ||
|
|
028d0cf609 | ||
|
|
6824d5662a | ||
|
|
1bc8726046 | ||
|
|
05c8c130b6 | ||
|
|
5051a13711 | ||
|
|
103116e410 | ||
|
|
d973238596 | ||
|
|
4d664c4aa4 | ||
|
|
bd4096b6be | ||
|
|
f92d93772c | ||
|
|
b963b2b848 | ||
|
|
9dadb51f11 | ||
|
|
23cf22d87d | ||
|
|
d2d50e21e1 | ||
|
|
8c38fdb36d | ||
|
|
4fe1c11250 | ||
|
|
394ab8dfd1 | ||
|
|
5295e0bdc3 | ||
|
|
c638dbe55a | ||
|
|
6ac6deba10 | ||
|
|
d2ce76fe89 | ||
|
|
0b27ec5443 | ||
|
|
868d33ebd2 | ||
|
|
9fab1e0823 | ||
|
|
242bc7b322 | ||
|
|
e5c25f55fe | ||
|
|
33f88344c3 | ||
|
|
103d937152 | ||
|
|
e721dedf1e | ||
|
|
176e067ab9 | ||
|
|
2057ef5206 | ||
|
|
5c2659deaa | ||
|
|
4f9d5a8c70 | ||
|
|
8ecd8b67f4 | ||
|
|
22c40e1d96 | ||
|
|
a720ceeb54 | ||
|
|
f8d082e2dd | ||
|
|
507a4bf64c | ||
|
|
7a75db2aeb | ||
|
|
ce0aebce48 | ||
|
|
906de3ad11 | ||
|
|
bf5ad25609 | ||
|
|
f19009b132 | ||
|
|
526a53cd8c | ||
|
|
57730d7f81 | ||
|
|
f936bc6fe8 | ||
|
|
3f1f1d1586 | ||
|
|
7940025095 | ||
|
|
63847ebe62 | ||
|
|
03f5056236 | ||
|
|
23ff29c8f1 | ||
|
|
1b0229ca6c | ||
|
|
ae6cbcd9e7 | ||
|
|
1c599138ad | ||
|
|
9170c398be | ||
|
|
04fd9838b5 | ||
|
|
8d340cbfba | ||
|
|
87c3b57ae4 | ||
|
|
7befef2f4a | ||
|
|
b2dcbb2df8 | ||
|
|
0a51b4c34e | ||
|
|
3b653dca6a | ||
|
|
046a1de51a | ||
|
|
ae58f8eb64 | ||
|
|
e4c351d5d0 | ||
|
|
0b0a59497f | ||
|
|
939b019592 | ||
|
|
3d54519dbf | ||
|
|
94f566aacc | ||
|
|
a765e863c0 | ||
|
|
9e552ba1ab | ||
|
|
b03fead62d | ||
|
|
2825c25607 | ||
|
|
5ed8eeda6f | ||
|
|
1aef1a39f2 | ||
|
|
a310bf0547 | ||
|
|
116b51bd8d | ||
|
|
c05e7bf873 | ||
|
|
c14ae56e2d | ||
|
|
32a71bfbf6 | ||
|
|
7435074c0f | ||
|
|
ec202d7fb9 | ||
|
|
6575cba982 | ||
|
|
a17bd9cc1d | ||
|
|
f7e5c2436c | ||
|
|
85816d5bec | ||
|
|
ebdba2bdb9 | ||
|
|
6d5b864cba | ||
|
|
c8a450b00d | ||
|
|
61ccd79c5f | ||
|
|
c55002534e | ||
|
|
8ca756ec22 | ||
|
|
d1c106b3b8 | ||
|
|
564260b2f1 | ||
|
|
4a85122483 | ||
|
|
bc889f3d26 | ||
|
|
95e76f387c | ||
|
|
4a5f985d02 | ||
|
|
bbe56f5082 | ||
|
|
4b0c3d88f3 | ||
|
|
c103ac91b3 | ||
|
|
ebd87584da | ||
|
|
a9a985182f | ||
|
|
db6fde90e0 | ||
|
|
74228c506e | ||
|
|
bcd43006ac | ||
|
|
cf616caef9 | ||
|
|
7ab6e51c2c | ||
|
|
7a549e96ba | ||
|
|
3e4d709225 | ||
|
|
031563e727 | ||
|
|
3f80248477 | ||
|
|
c84d81d91c | ||
|
|
ef65268b45 | ||
|
|
9d725b9479 | ||
|
|
b4647d8d1b | ||
|
|
f28a22802d | ||
|
|
8a60fc1ecb | ||
|
|
dfad6d8409 | ||
|
|
b94b8afb77 | ||
|
|
0f37bfa20d | ||
|
|
d6d03158d0 | ||
|
|
7c863671c9 | ||
|
|
2a6db2ab52 | ||
|
|
c8a345a301 | ||
|
|
37efcb3d4f | ||
|
|
ff7a9fdd4e | ||
|
|
9ccbb842bf | ||
|
|
73d3bd5778 | ||
|
|
f785a5260a | ||
|
|
03716daca0 | ||
|
|
9987140790 | ||
|
|
6b00f7d27a | ||
|
|
98fffb9b77 | ||
|
|
000da1889f | ||
|
|
0a634b1223 | ||
|
|
5456f403a1 | ||
|
|
461182bf60 | ||
|
|
580ba0b536 | ||
|
|
5e3c4c91bb | ||
|
|
3875da80e7 | ||
|
|
6af252f315 | ||
|
|
e46ef4f9ce | ||
|
|
3bae422a8e | ||
|
|
d7526891c5 | ||
|
|
6563ee2fb2 | ||
|
|
c0952d73d1 | ||
|
|
4d780389bf | ||
|
|
5c9abf2eeb | ||
|
|
11997ca017 | ||
|
|
ed36d13c8f | ||
|
|
119eea161e | ||
|
|
d67809eda6 | ||
|
|
428d36da90 | ||
|
|
328e88856a | ||
|
|
99966e20ad | ||
|
|
1fef7772cb | ||
|
|
f8ab4fe9bd | ||
|
|
c2e785cdc4 | ||
|
|
5f19cfcb49 |
@@ -4,3 +4,6 @@
|
|||||||
[submodule "STM32F7XX_Lib"]
|
[submodule "STM32F7XX_Lib"]
|
||||||
path = STM32F7XX_Lib
|
path = STM32F7XX_Lib
|
||||||
url = https://github.com/juribeparada/STM32F7XX_Lib.git
|
url = https://github.com/juribeparada/STM32F7XX_Lib.git
|
||||||
|
[submodule "STM32F10X_Lib"]
|
||||||
|
path = STM32F10X_Lib
|
||||||
|
url = https://github.com/shawnchain/STM32F10X_Lib.git
|
||||||
|
|||||||
+1
-1
@@ -77,6 +77,7 @@ const struct {
|
|||||||
{',', 0xEEAEE000U, 22U},
|
{',', 0xEEAEE000U, 22U},
|
||||||
{'-', 0xEAAE0000U, 18U},
|
{'-', 0xEAAE0000U, 18U},
|
||||||
{'=', 0xEAB80000U, 16U},
|
{'=', 0xEAB80000U, 16U},
|
||||||
|
{'.', 0xBAEB8000U, 20U},
|
||||||
{' ', 0x00000000U, 4U},
|
{' ', 0x00000000U, 4U},
|
||||||
{0U, 0x00000000U, 0U}
|
{0U, 0x00000000U, 0U}
|
||||||
};
|
};
|
||||||
@@ -170,4 +171,3 @@ void CCWIdTX::reset()
|
|||||||
m_poPtr = 0U;
|
m_poPtr = 0U;
|
||||||
m_n = 0U;
|
m_n = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
|
* Copyright (C) 2020 by Phil Taylor M0VSE
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "CalFM.h"
|
||||||
|
|
||||||
|
|
||||||
|
const struct TONE_TABLE {
|
||||||
|
uint16_t frequency;
|
||||||
|
uint16_t length;
|
||||||
|
q31_t increment;
|
||||||
|
} TONE_TABLE_DATA[] = {
|
||||||
|
{2495U, 10U, 223248821},
|
||||||
|
{2079U, 12U, 186025772},
|
||||||
|
{1633U, 15U, 146118367},
|
||||||
|
{1247U, 19U, 111579672},
|
||||||
|
{1039U, 23U, 93012886},
|
||||||
|
{956U, 25U, 85541432}};
|
||||||
|
|
||||||
|
const uint8_t TONE_TABLE_DATA_LEN = 6U;
|
||||||
|
|
||||||
|
CCalFM::CCalFM() :
|
||||||
|
m_frequency(0),
|
||||||
|
m_length(0),
|
||||||
|
m_tone(NULL),
|
||||||
|
m_level(128 * 12),
|
||||||
|
m_transmit(false),
|
||||||
|
m_audioSeq(0),
|
||||||
|
m_lastState(STATE_IDLE)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCalFM::process()
|
||||||
|
{
|
||||||
|
const TONE_TABLE* entry = NULL;
|
||||||
|
|
||||||
|
if (m_modemState != m_lastState)
|
||||||
|
{
|
||||||
|
switch (m_modemState) {
|
||||||
|
case STATE_FMCAL10K:
|
||||||
|
m_frequency = 956U;
|
||||||
|
break;
|
||||||
|
case STATE_FMCAL12K:
|
||||||
|
m_frequency = 1039U;
|
||||||
|
break;
|
||||||
|
case STATE_FMCAL15K:
|
||||||
|
m_frequency = 1247U;
|
||||||
|
break;
|
||||||
|
case STATE_FMCAL20K:
|
||||||
|
m_frequency = 1633U;
|
||||||
|
break;
|
||||||
|
case STATE_FMCAL25K:
|
||||||
|
m_frequency = 2079U;
|
||||||
|
break;
|
||||||
|
case STATE_FMCAL30K:
|
||||||
|
m_frequency = 2495U;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_frequency = 0U;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; i < TONE_TABLE_DATA_LEN; i++) {
|
||||||
|
if (TONE_TABLE_DATA[i].frequency == m_frequency) {
|
||||||
|
entry = TONE_TABLE_DATA + i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_length = entry->length;
|
||||||
|
|
||||||
|
delete[] m_tone;
|
||||||
|
m_tone = new q15_t[m_length];
|
||||||
|
|
||||||
|
q31_t arg = 0;
|
||||||
|
for (uint16_t i = 0U; i < m_length; i++) {
|
||||||
|
q63_t value = ::arm_sin_q31(arg) * q63_t(m_level);
|
||||||
|
m_tone[i] = q15_t(__SSAT((value >> 31), 16));
|
||||||
|
|
||||||
|
arg += entry->increment;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_lastState=m_modemState;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_transmit)
|
||||||
|
{
|
||||||
|
uint16_t space = io.getSpace();
|
||||||
|
while (space > m_length)
|
||||||
|
{
|
||||||
|
io.write(m_modemState,m_tone,m_length);
|
||||||
|
space -= m_length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t CCalFM::write(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (length != 1U)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
m_transmit = data[0U] == 1U;
|
||||||
|
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
|
* Copyright (C) 2020 by Phil Taylor M0VSE
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CALFM_H)
|
||||||
|
#define CALFM_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
class CCalFM {
|
||||||
|
public:
|
||||||
|
CCalFM();
|
||||||
|
|
||||||
|
void process();
|
||||||
|
void fm10kcal();
|
||||||
|
void fm12k5cal();
|
||||||
|
void fm15kcal();
|
||||||
|
void fm20kcal();
|
||||||
|
void fm25kcal();
|
||||||
|
void fm30kcal();
|
||||||
|
|
||||||
|
uint8_t write(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint16_t m_frequency;
|
||||||
|
uint16_t m_length;
|
||||||
|
q15_t* m_tone;
|
||||||
|
q15_t m_level;
|
||||||
|
bool m_transmit;
|
||||||
|
uint8_t m_audioSeq;
|
||||||
|
uint8_t m_lastState;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 by Florian Wolters DF2ET
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "CalPOCSAG.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCalPOCSAG::CCalPOCSAG() :
|
||||||
|
m_state(POCSAGCAL_IDLE)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCalPOCSAG::process()
|
||||||
|
{
|
||||||
|
if (m_state == POCSAGCAL_IDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint16_t space = io.getSpace();
|
||||||
|
if (space <= 165U)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pocsagTX.writeByte(0xAAU);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CCalPOCSAG::write(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (length != 1U)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
m_state = data[0U] == 1U ? POCSAGCAL_TX : POCSAGCAL_IDLE;
|
||||||
|
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 by Florian Wolters DF2ET
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CALPOCSAG_H)
|
||||||
|
#define CALPOCSAG_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
enum POCSAGCAL {
|
||||||
|
POCSAGCAL_IDLE,
|
||||||
|
POCSAGCAL_TX
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCalPOCSAG {
|
||||||
|
public:
|
||||||
|
CCalPOCSAG();
|
||||||
|
|
||||||
|
void process();
|
||||||
|
|
||||||
|
uint8_t write(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
|
private:
|
||||||
|
POCSAGCAL m_state;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -35,20 +35,27 @@
|
|||||||
// For 19.2 MHz
|
// For 19.2 MHz
|
||||||
// #define EXTERNAL_OSC 19200000
|
// #define EXTERNAL_OSC 19200000
|
||||||
|
|
||||||
|
// Use a higher baudrate for host communication. Required for FM network !
|
||||||
|
#define SERIAL_SPEED 115200 //suitable for most older boards (Arduino, Due STM32F1_POG etc). External FM will NOT work with this !
|
||||||
|
// #define SERIAL_SPEED 230400 // Only works on newer board M4, M7, Teensy. External FM might work with this
|
||||||
|
// #define SERIAL_SPEED 460800 // Only works on newer board M4, M7, Teensy. External FM should work with this
|
||||||
|
|
||||||
// Allow the use of the COS line to lockout the modem
|
// Allow the use of the COS line to lockout the modem
|
||||||
// #define USE_COS_AS_LOCKOUT
|
// #define USE_COS_AS_LOCKOUT
|
||||||
|
|
||||||
// Use pins to output the current mode
|
// Use pins to output the current mode via LEDs
|
||||||
// #define MODE_PINS
|
// #define MODE_LEDS
|
||||||
|
|
||||||
// For the original Arduino Due pin layout
|
// For the original Arduino Due pin layout
|
||||||
// #define ARDUINO_DUE_PAPA
|
// #define ARDUINO_DUE_PAPA
|
||||||
|
|
||||||
|
#if defined(STM32F1)
|
||||||
|
// For the SQ6POG board
|
||||||
|
#define STM32F1_POG
|
||||||
|
#else
|
||||||
// For the ZUM V1.0 and V1.0.1 boards pin layout
|
// For the ZUM V1.0 and V1.0.1 boards pin layout
|
||||||
#define ARDUINO_DUE_ZUM_V10
|
#define ARDUINO_DUE_ZUM_V10
|
||||||
|
#endif
|
||||||
// For the SQ6POG board
|
|
||||||
// #define STM32F1_POG
|
|
||||||
|
|
||||||
// For the SP8NTH board
|
// For the SP8NTH board
|
||||||
// #define ARDUINO_DUE_NTH
|
// #define ARDUINO_DUE_NTH
|
||||||
@@ -57,8 +64,8 @@
|
|||||||
// #define STM32F4_NUCLEO_MORPHO_HEADER
|
// #define STM32F4_NUCLEO_MORPHO_HEADER
|
||||||
// #define STM32F4_NUCLEO_ARDUINO_HEADER
|
// #define STM32F4_NUCLEO_ARDUINO_HEADER
|
||||||
|
|
||||||
// Use separate mode pins to switch external filters/bandwidth for example
|
// Use separate mode pins to switch external channel/filters/bandwidth for example
|
||||||
// #define STM32F4_NUCLEO_MODE_PINS
|
// #define MODE_PINS
|
||||||
|
|
||||||
// For the VK6MST Pi3 Shield communicating over i2c. i2c address & speed defined in i2cTeensy.cpp
|
// For the VK6MST Pi3 Shield communicating over i2c. i2c address & speed defined in i2cTeensy.cpp
|
||||||
// #define VK6MST_TEENSY_PI3_SHIELD_I2C
|
// #define VK6MST_TEENSY_PI3_SHIELD_I2C
|
||||||
@@ -82,5 +89,7 @@
|
|||||||
// Use the D-Star and DMR LEDs for POCSAG
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
// #define USE_ALTERNATE_POCSAG_LEDS
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
#endif
|
// Use the D-Star and YSF LEDs for FM
|
||||||
|
#define USE_ALTERNATE_FM_LEDS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -74,7 +74,7 @@ void CDMRDMOTX::process()
|
|||||||
m_poLen = m_txDelay;
|
m_poLen = m_txDelay;
|
||||||
} else {
|
} else {
|
||||||
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++)
|
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++)
|
||||||
m_poBuffer[i] = m_fifo.get();
|
m_fifo.get(m_poBuffer[i]);
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < 39U; i++)
|
for (unsigned int i = 0U; i < 39U; i++)
|
||||||
m_poBuffer[i + DMR_FRAME_LENGTH_BYTES] = PR_FILL[i];
|
m_poBuffer[i + DMR_FRAME_LENGTH_BYTES] = PR_FILL[i];
|
||||||
|
|||||||
+2
-2
@@ -23,7 +23,7 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "DMRDefines.h"
|
#include "DMRDefines.h"
|
||||||
|
|
||||||
#include "SerialRB.h"
|
#include "RingBuffer.h"
|
||||||
|
|
||||||
class CDMRDMOTX {
|
class CDMRDMOTX {
|
||||||
public:
|
public:
|
||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
uint8_t getSpace() const;
|
uint8_t getSpace() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSerialRB m_fifo;
|
CRingBuffer<uint8_t> m_fifo;
|
||||||
arm_fir_interpolate_instance_q15 m_modFilter;
|
arm_fir_interpolate_instance_q15 m_modFilter;
|
||||||
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
||||||
uint8_t m_poBuffer[1200U];
|
uint8_t m_poBuffer[1200U];
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ void CDMRTX::createData(uint8_t slotIndex)
|
|||||||
{
|
{
|
||||||
if (m_fifo[slotIndex].getData() >= DMR_FRAME_LENGTH_BYTES && m_frameCount >= STARTUP_COUNT && m_abortCount[slotIndex] >= ABORT_COUNT) {
|
if (m_fifo[slotIndex].getData() >= DMR_FRAME_LENGTH_BYTES && m_frameCount >= STARTUP_COUNT && m_abortCount[slotIndex] >= ABORT_COUNT) {
|
||||||
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
|
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
|
||||||
m_poBuffer[i] = m_fifo[slotIndex].get();
|
m_fifo[slotIndex].get(m_poBuffer[i]);
|
||||||
m_markBuffer[i] = MARK_NONE;
|
m_markBuffer[i] = MARK_NONE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "DMRDefines.h"
|
#include "DMRDefines.h"
|
||||||
|
|
||||||
#include "SerialRB.h"
|
#include "RingBuffer.h"
|
||||||
|
|
||||||
enum DMRTXSTATE {
|
enum DMRTXSTATE {
|
||||||
DMRTXSTATE_IDLE,
|
DMRTXSTATE_IDLE,
|
||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
void setColorCode(uint8_t colorCode);
|
void setColorCode(uint8_t colorCode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSerialRB m_fifo[2U];
|
CRingBuffer<uint8_t> m_fifo[2U];
|
||||||
arm_fir_interpolate_instance_q15 m_modFilter;
|
arm_fir_interpolate_instance_q15 m_modFilter;
|
||||||
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
||||||
DMRTXSTATE m_state;
|
DMRTXSTATE m_state;
|
||||||
|
|||||||
+9
-6
@@ -216,12 +216,13 @@ void CDStarTX::process()
|
|||||||
for (uint16_t i = 0U; i < m_txDelay; i++)
|
for (uint16_t i = 0U; i < m_txDelay; i++)
|
||||||
m_poBuffer[m_poLen++] = BIT_SYNC;
|
m_poBuffer[m_poLen++] = BIT_SYNC;
|
||||||
} else {
|
} else {
|
||||||
|
uint8_t dummy;
|
||||||
// Pop the type byte off
|
// Pop the type byte off
|
||||||
m_buffer.get();
|
m_buffer.get(dummy);
|
||||||
|
|
||||||
uint8_t header[DSTAR_HEADER_LENGTH_BYTES];
|
uint8_t header[DSTAR_HEADER_LENGTH_BYTES];
|
||||||
for (uint8_t i = 0U; i < DSTAR_HEADER_LENGTH_BYTES; i++)
|
for (uint8_t i = 0U; i < DSTAR_HEADER_LENGTH_BYTES; i++)
|
||||||
header[i] = m_buffer.get();
|
m_buffer.get(header[i]);
|
||||||
|
|
||||||
uint8_t buffer[86U];
|
uint8_t buffer[86U];
|
||||||
txHeader(header, buffer + 2U);
|
txHeader(header, buffer + 2U);
|
||||||
@@ -239,17 +240,19 @@ void CDStarTX::process()
|
|||||||
|
|
||||||
if (type == DSTAR_DATA && m_poLen == 0U) {
|
if (type == DSTAR_DATA && m_poLen == 0U) {
|
||||||
// Pop the type byte off
|
// Pop the type byte off
|
||||||
m_buffer.get();
|
uint8_t dummy;
|
||||||
|
m_buffer.get(dummy);
|
||||||
|
|
||||||
for (uint8_t i = 0U; i < DSTAR_DATA_LENGTH_BYTES; i++)
|
for (uint8_t i = 0U; i < DSTAR_DATA_LENGTH_BYTES; i++)
|
||||||
m_poBuffer[m_poLen++] = m_buffer.get();
|
m_buffer.get(m_poBuffer[m_poLen++]);
|
||||||
|
|
||||||
m_poPtr = 0U;
|
m_poPtr = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == DSTAR_EOT && m_poLen == 0U) {
|
if (type == DSTAR_EOT && m_poLen == 0U) {
|
||||||
// Pop the type byte off
|
// Pop the type byte off
|
||||||
m_buffer.get();
|
uint8_t dummy;
|
||||||
|
m_buffer.get(dummy);
|
||||||
|
|
||||||
for (uint8_t j = 0U; j < 3U; j++) {
|
for (uint8_t j = 0U; j < 3U; j++) {
|
||||||
for (uint8_t i = 0U; i < DSTAR_EOT_LENGTH_BYTES; i++)
|
for (uint8_t i = 0U; i < DSTAR_EOT_LENGTH_BYTES; i++)
|
||||||
@@ -388,7 +391,7 @@ void CDStarTX::txHeader(const uint8_t* in, uint8_t* out) const
|
|||||||
if (i < 660U) {
|
if (i < 660U) {
|
||||||
if (d & 0x08U)
|
if (d & 0x08U)
|
||||||
out[INTERLEAVE_TABLE_TX[i * 2U]] |= (0x01U << INTERLEAVE_TABLE_TX[i * 2U + 1U]);
|
out[INTERLEAVE_TABLE_TX[i * 2U]] |= (0x01U << INTERLEAVE_TABLE_TX[i * 2U + 1U]);
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (d & 0x04U)
|
if (d & 0x04U)
|
||||||
out[INTERLEAVE_TABLE_TX[i * 2U]] |= (0x01U << INTERLEAVE_TABLE_TX[i * 2U + 1U]);
|
out[INTERLEAVE_TABLE_TX[i * 2U]] |= (0x01U << INTERLEAVE_TABLE_TX[i * 2U + 1U]);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
#include "SerialRB.h"
|
#include "RingBuffer.h"
|
||||||
|
|
||||||
class CDStarTX {
|
class CDStarTX {
|
||||||
public:
|
public:
|
||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
uint8_t getSpace() const;
|
uint8_t getSpace() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSerialRB m_buffer;
|
CRingBuffer<uint8_t> m_buffer;
|
||||||
arm_fir_interpolate_instance_q15 m_modFilter;
|
arm_fir_interpolate_instance_q15 m_modFilter;
|
||||||
q15_t m_modState[20U]; // blockSize + phaseLength - 1, 8 + 9 - 1 plus some spare
|
q15_t m_modState[20U]; // blockSize + phaseLength - 1, 8 + 9 - 1 plus some spare
|
||||||
uint8_t m_poBuffer[600U];
|
uint8_t m_poBuffer[600U];
|
||||||
|
|||||||
@@ -0,0 +1,782 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "FM.h"
|
||||||
|
|
||||||
|
|
||||||
|
const uint16_t FM_TX_BLOCK_SIZE = 100U;
|
||||||
|
const uint16_t FM_SERIAL_BLOCK_SIZE = 84U;//this is the number of sample pairs to send over serial. One sample pair is 3bytes.
|
||||||
|
//three times this value shall never exceed 252
|
||||||
|
const uint16_t FM_SERIAL_BLOCK_SIZE_BYTES = FM_SERIAL_BLOCK_SIZE * 3U;
|
||||||
|
|
||||||
|
CFM::CFM() :
|
||||||
|
m_callsign(),
|
||||||
|
m_rfAck(),
|
||||||
|
m_extAck(),
|
||||||
|
m_ctcssRX(),
|
||||||
|
m_ctcssTX(),
|
||||||
|
m_timeoutTone(),
|
||||||
|
m_state(FS_LISTENING),
|
||||||
|
m_callsignAtStart(false),
|
||||||
|
m_callsignAtEnd(false),
|
||||||
|
m_callsignAtLatch(false),
|
||||||
|
m_callsignTimer(),
|
||||||
|
m_timeoutTimer(),
|
||||||
|
m_holdoffTimer(),
|
||||||
|
m_kerchunkTimer(),
|
||||||
|
m_kerchunkTX(true),
|
||||||
|
m_ackMinTimer(),
|
||||||
|
m_ackDelayTimer(),
|
||||||
|
m_hangTimer(),
|
||||||
|
m_statusTimer(),
|
||||||
|
m_filterStage1( 724, 1448, 724, 32768, -37895, 21352),//3rd order Cheby Filter 300 to 2700Hz, 0.2dB passband ripple, sampling rate 24kHz
|
||||||
|
m_filterStage2(32768, 0,-32768, 32768, -50339, 19052),
|
||||||
|
m_filterStage3(32768, -65536, 32768, 32768, -64075, 31460),
|
||||||
|
m_blanking(),
|
||||||
|
m_useCOS(true),
|
||||||
|
m_cosInvert(false),
|
||||||
|
m_rfAudioBoost(1U),
|
||||||
|
m_extAudioBoost(1U),
|
||||||
|
m_downsampler(400U),// 100 ms of audio
|
||||||
|
m_extEnabled(false),
|
||||||
|
m_rxLevel(1),
|
||||||
|
m_inputRFRB(2401U), // 100ms of audio + 1 sample
|
||||||
|
m_outputRFRB(2400U), // 100ms of audio
|
||||||
|
m_inputExtRB()
|
||||||
|
{
|
||||||
|
m_statusTimer.setTimeout(1U, 0U);
|
||||||
|
|
||||||
|
insertDelay(100U);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::samples(bool cos, q15_t* samples, uint8_t length)
|
||||||
|
{
|
||||||
|
if (m_useCOS) {
|
||||||
|
if (m_cosInvert)
|
||||||
|
cos = !cos;
|
||||||
|
} else {
|
||||||
|
cos = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
clock(length);
|
||||||
|
|
||||||
|
uint8_t i = 0U;
|
||||||
|
for (; i < length; i++) {
|
||||||
|
// ARMv7-M has hardware integer division
|
||||||
|
q15_t currentRFSample = q15_t((q31_t(samples[i]) << 8) / m_rxLevel);
|
||||||
|
uint8_t ctcssState = m_ctcssRX.process(currentRFSample);
|
||||||
|
|
||||||
|
if (!m_useCOS) {
|
||||||
|
// Delay the audio by 100ms to better match the CTCSS detector output
|
||||||
|
m_inputRFRB.put(currentRFSample);
|
||||||
|
m_inputRFRB.get(currentRFSample);
|
||||||
|
}
|
||||||
|
|
||||||
|
q15_t currentExtSample;
|
||||||
|
bool inputExt = m_inputExtRB.getSample(currentExtSample);//always consume the external input data so it does not overflow
|
||||||
|
inputExt = inputExt && m_extEnabled;
|
||||||
|
|
||||||
|
if (!inputExt && (CTCSS_NOT_READY(ctcssState)) && m_modemState != STATE_FM) {
|
||||||
|
//Not enough samples to determine if you have CTCSS, just carry on. But only if we haven't any external data in the queue
|
||||||
|
continue;
|
||||||
|
} else if ((inputExt || CTCSS_READY(ctcssState)) && m_modemState != STATE_FM) {
|
||||||
|
//we had enough samples for CTCSS and we are in some other mode than FM
|
||||||
|
bool validCTCSS = CTCSS_VALID(ctcssState);
|
||||||
|
stateMachine(validCTCSS && cos, inputExt);
|
||||||
|
if (m_modemState != STATE_FM)
|
||||||
|
continue;
|
||||||
|
} else if ((inputExt || CTCSS_NOT_READY(ctcssState)) && m_modemState == STATE_FM && i == length - 1) {
|
||||||
|
//Not enough samples for CTCSS but we already are in FM, trigger the state machine
|
||||||
|
//but do not trigger the state machine on every single sample, save CPU!
|
||||||
|
bool validCTCSS = CTCSS_VALID(ctcssState);
|
||||||
|
stateMachine(validCTCSS && cos, inputExt);
|
||||||
|
}
|
||||||
|
|
||||||
|
q15_t currentSample = currentRFSample;
|
||||||
|
q15_t currentBoost = m_rfAudioBoost;
|
||||||
|
if (m_state == FS_RELAYING_EXT || m_state == FS_KERCHUNK_EXT) {
|
||||||
|
currentSample = currentExtSample;
|
||||||
|
currentBoost = m_extAudioBoost;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only let RF audio through when relaying RF audio
|
||||||
|
if (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF || m_state == FS_RELAYING_EXT || m_state == FS_KERCHUNK_EXT) {
|
||||||
|
currentSample = m_blanking.process(currentSample);
|
||||||
|
if (m_extEnabled && (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF))
|
||||||
|
m_downsampler.addSample(currentSample);
|
||||||
|
|
||||||
|
currentSample *= currentBoost;
|
||||||
|
} else {
|
||||||
|
currentSample = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_callsign.isRunning() && !m_extAck.isRunning())
|
||||||
|
currentSample += m_rfAck.getHighAudio();
|
||||||
|
|
||||||
|
if (!m_callsign.isRunning() && !m_rfAck.isRunning())
|
||||||
|
currentSample += m_extAck.getHighAudio();
|
||||||
|
|
||||||
|
if (!m_rfAck.isRunning() && !m_extAck.isRunning()) {
|
||||||
|
if (m_state == FS_LISTENING)
|
||||||
|
currentSample += m_callsign.getHighAudio();
|
||||||
|
else
|
||||||
|
currentSample += m_callsign.getLowAudio();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_callsign.isRunning() && !m_rfAck.isRunning() && !m_extAck.isRunning())
|
||||||
|
currentSample += m_timeoutTone.getAudio();
|
||||||
|
|
||||||
|
currentSample = m_filterStage3.filter(m_filterStage2.filter(m_filterStage1.filter(currentSample)));
|
||||||
|
|
||||||
|
currentSample += m_ctcssTX.getAudio();
|
||||||
|
|
||||||
|
m_outputRFRB.put(currentSample);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::process()
|
||||||
|
{
|
||||||
|
uint16_t space = io.getSpace();
|
||||||
|
uint16_t length = m_outputRFRB.getData();
|
||||||
|
|
||||||
|
if (space > 10U && length >= FM_TX_BLOCK_SIZE ) {
|
||||||
|
space -= 2U;
|
||||||
|
if (length > FM_TX_BLOCK_SIZE)
|
||||||
|
length = FM_TX_BLOCK_SIZE;
|
||||||
|
if (space > FM_TX_BLOCK_SIZE)
|
||||||
|
space = FM_TX_BLOCK_SIZE;
|
||||||
|
if (length > space)
|
||||||
|
length = space;
|
||||||
|
|
||||||
|
q15_t samples[FM_TX_BLOCK_SIZE];
|
||||||
|
|
||||||
|
for (uint16_t i = 0U; i < length; i++) {
|
||||||
|
q15_t sample = 0;
|
||||||
|
m_outputRFRB.get(sample);
|
||||||
|
samples[i] = sample;
|
||||||
|
}
|
||||||
|
|
||||||
|
io.write(STATE_FM, samples, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_extEnabled) {
|
||||||
|
uint16_t length = m_downsampler.getData();
|
||||||
|
|
||||||
|
if (length >= FM_SERIAL_BLOCK_SIZE) {
|
||||||
|
if (length > FM_SERIAL_BLOCK_SIZE)
|
||||||
|
length = FM_SERIAL_BLOCK_SIZE;
|
||||||
|
|
||||||
|
TSamplePairPack serialSamples[FM_SERIAL_BLOCK_SIZE];
|
||||||
|
|
||||||
|
for (uint16_t j = 0U; j < length; j++)
|
||||||
|
m_downsampler.getPackedData(serialSamples[j]);
|
||||||
|
|
||||||
|
serial.writeFMData((uint8_t*)serialSamples, length * sizeof(TSamplePairPack));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::reset()
|
||||||
|
{
|
||||||
|
m_state = FS_LISTENING;
|
||||||
|
|
||||||
|
m_callsignTimer.stop();
|
||||||
|
m_timeoutTimer.stop();
|
||||||
|
m_kerchunkTimer.stop();
|
||||||
|
m_ackMinTimer.stop();
|
||||||
|
m_ackDelayTimer.stop();
|
||||||
|
m_hangTimer.stop();
|
||||||
|
m_statusTimer.stop();
|
||||||
|
|
||||||
|
m_ctcssRX.reset();
|
||||||
|
m_rfAck.stop();
|
||||||
|
m_extAck.stop();
|
||||||
|
m_callsign.stop();
|
||||||
|
m_timeoutTone.stop();
|
||||||
|
|
||||||
|
m_outputRFRB.reset();
|
||||||
|
m_inputExtRB.reset();
|
||||||
|
|
||||||
|
m_downsampler.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CFM::setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t highLevel, uint8_t lowLevel, bool callsignAtStart, bool callsignAtEnd, bool callsignAtLatch)
|
||||||
|
{
|
||||||
|
m_callsignAtStart = callsignAtStart;
|
||||||
|
m_callsignAtEnd = callsignAtEnd;
|
||||||
|
m_callsignAtLatch = callsignAtLatch;
|
||||||
|
|
||||||
|
uint16_t holdoffTime = holdoff * 60U;
|
||||||
|
uint16_t callsignTime = time * 60U;
|
||||||
|
|
||||||
|
m_holdoffTimer.setTimeout(holdoffTime, 0U);
|
||||||
|
m_callsignTimer.setTimeout(callsignTime, 0U);
|
||||||
|
|
||||||
|
if (holdoffTime > 0U)
|
||||||
|
m_holdoffTimer.start();
|
||||||
|
|
||||||
|
return m_callsign.setParams(callsign, speed, frequency, highLevel, lowLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CFM::setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_t minTime, uint16_t delay, uint8_t level)
|
||||||
|
{
|
||||||
|
m_ackDelayTimer.setTimeout(0U, delay);
|
||||||
|
|
||||||
|
if (minTime > 0U)
|
||||||
|
m_ackMinTimer.setTimeout(minTime, delay);
|
||||||
|
|
||||||
|
return m_rfAck.setParams(rfAck, speed, frequency, level, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CFM::setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssHighThreshold, uint8_t ctcssLowThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, bool kerchunkTX, uint8_t hangTime, bool useCOS, bool cosInvert, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel)
|
||||||
|
{
|
||||||
|
m_useCOS = useCOS;
|
||||||
|
m_cosInvert = cosInvert;
|
||||||
|
|
||||||
|
m_rfAudioBoost = q15_t(rfAudioBoost);
|
||||||
|
|
||||||
|
m_timeoutTimer.setTimeout(timeout, 0U);
|
||||||
|
|
||||||
|
m_kerchunkTimer.setTimeout(kerchunkTime, 0U);
|
||||||
|
m_kerchunkTX = kerchunkTX;
|
||||||
|
|
||||||
|
m_hangTimer.setTimeout(hangTime, 0U);
|
||||||
|
|
||||||
|
m_timeoutTone.setParams(timeoutLevel);
|
||||||
|
m_blanking.setParams(maxDev, timeoutLevel);
|
||||||
|
|
||||||
|
m_rxLevel = rxLevel; //q15_t(255)/q15_t(rxLevel >> 1);
|
||||||
|
|
||||||
|
uint8_t ret = m_ctcssRX.setParams(ctcssFrequency, ctcssHighThreshold, ctcssLowThreshold);
|
||||||
|
if (ret != 0U)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return m_ctcssTX.setParams(ctcssFrequency, ctcssLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CFM::setExt(const char* ack, uint8_t audioBoost, uint8_t speed, uint16_t frequency, uint8_t level)
|
||||||
|
{
|
||||||
|
m_extEnabled = true;
|
||||||
|
|
||||||
|
m_extAudioBoost = q15_t(audioBoost);
|
||||||
|
|
||||||
|
return m_extAck.setParams(ack, speed, frequency, level, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::stateMachine(bool validRFSignal, bool validExtSignal)
|
||||||
|
{
|
||||||
|
switch (m_state) {
|
||||||
|
case FS_LISTENING:
|
||||||
|
listeningState(validRFSignal, validExtSignal);
|
||||||
|
break;
|
||||||
|
case FS_KERCHUNK_RF:
|
||||||
|
kerchunkRFState(validRFSignal);
|
||||||
|
break;
|
||||||
|
case FS_RELAYING_RF:
|
||||||
|
relayingRFState(validRFSignal);
|
||||||
|
break;
|
||||||
|
case FS_RELAYING_WAIT_RF:
|
||||||
|
relayingRFWaitState(validRFSignal);
|
||||||
|
break;
|
||||||
|
case FS_TIMEOUT_RF:
|
||||||
|
timeoutRFState(validRFSignal);
|
||||||
|
break;
|
||||||
|
case FS_TIMEOUT_WAIT_RF:
|
||||||
|
timeoutRFWaitState(validRFSignal);
|
||||||
|
break;
|
||||||
|
case FS_KERCHUNK_EXT:
|
||||||
|
kerchunkExtState(validExtSignal);
|
||||||
|
break;
|
||||||
|
case FS_RELAYING_EXT:
|
||||||
|
relayingExtState(validExtSignal);
|
||||||
|
break;
|
||||||
|
case FS_RELAYING_WAIT_EXT:
|
||||||
|
relayingExtWaitState(validExtSignal);
|
||||||
|
break;
|
||||||
|
case FS_TIMEOUT_EXT:
|
||||||
|
timeoutExtState(validExtSignal);
|
||||||
|
break;
|
||||||
|
case FS_TIMEOUT_WAIT_EXT:
|
||||||
|
timeoutExtWaitState(validExtSignal);
|
||||||
|
break;
|
||||||
|
case FS_HANG:
|
||||||
|
hangState(validRFSignal, validExtSignal);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_state == FS_LISTENING && !m_rfAck.isWanted() && !m_extAck.isWanted() && !m_callsign.isWanted()) {
|
||||||
|
m_outputRFRB.reset();
|
||||||
|
m_downsampler.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::clock(uint8_t length)
|
||||||
|
{
|
||||||
|
m_callsignTimer.clock(length);
|
||||||
|
m_timeoutTimer.clock(length);
|
||||||
|
m_holdoffTimer.clock(length);
|
||||||
|
m_kerchunkTimer.clock(length);
|
||||||
|
m_ackMinTimer.clock(length);
|
||||||
|
m_ackDelayTimer.clock(length);
|
||||||
|
m_hangTimer.clock(length);
|
||||||
|
m_statusTimer.clock(length);
|
||||||
|
|
||||||
|
if (m_statusTimer.isRunning() && m_statusTimer.hasExpired()) {
|
||||||
|
serial.writeFMStatus(m_state);
|
||||||
|
m_statusTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::listeningState(bool validRFSignal, bool validExtSignal)
|
||||||
|
{
|
||||||
|
if (validRFSignal) {
|
||||||
|
if (m_kerchunkTimer.getTimeout() > 0U) {
|
||||||
|
DEBUG1("State to KERCHUNK_RF");
|
||||||
|
m_state = FS_KERCHUNK_RF;
|
||||||
|
m_kerchunkTimer.start();
|
||||||
|
if (m_callsignAtStart && !m_callsignAtLatch)
|
||||||
|
sendCallsign();
|
||||||
|
} else {
|
||||||
|
DEBUG1("State to RELAYING_RF");
|
||||||
|
m_state = FS_RELAYING_RF;
|
||||||
|
if (m_callsignAtStart)
|
||||||
|
sendCallsign();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_state == FS_RELAYING_RF || (m_state == FS_KERCHUNK_RF && m_kerchunkTX)) {
|
||||||
|
insertSilence(50U);
|
||||||
|
|
||||||
|
beginRelaying();
|
||||||
|
|
||||||
|
m_callsignTimer.start();
|
||||||
|
|
||||||
|
io.setDecode(true);
|
||||||
|
io.setADCDetection(true);
|
||||||
|
|
||||||
|
m_statusTimer.start();
|
||||||
|
serial.writeFMStatus(m_state);
|
||||||
|
}
|
||||||
|
} else if (validExtSignal) {
|
||||||
|
if (m_kerchunkTimer.getTimeout() > 0U) {
|
||||||
|
DEBUG1("State to KERCHUNK_EXT");
|
||||||
|
m_state = FS_KERCHUNK_EXT;
|
||||||
|
m_kerchunkTimer.start();
|
||||||
|
if (m_callsignAtStart && !m_callsignAtLatch)
|
||||||
|
sendCallsign();
|
||||||
|
} else {
|
||||||
|
DEBUG1("State to RELAYING_EXT");
|
||||||
|
m_state = FS_RELAYING_EXT;
|
||||||
|
if (m_callsignAtStart)
|
||||||
|
sendCallsign();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_state == FS_RELAYING_EXT || (m_state == FS_KERCHUNK_EXT && m_kerchunkTX)) {
|
||||||
|
insertSilence(50U);
|
||||||
|
|
||||||
|
beginRelaying();
|
||||||
|
|
||||||
|
m_callsignTimer.start();
|
||||||
|
|
||||||
|
m_statusTimer.start();
|
||||||
|
serial.writeFMStatus(m_state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::kerchunkRFState(bool validSignal)
|
||||||
|
{
|
||||||
|
if (validSignal) {
|
||||||
|
if (m_kerchunkTimer.hasExpired()) {
|
||||||
|
DEBUG1("State to RELAYING_RF");
|
||||||
|
m_state = FS_RELAYING_RF;
|
||||||
|
m_kerchunkTimer.stop();
|
||||||
|
if (!m_kerchunkTX) {
|
||||||
|
insertSilence(50U);
|
||||||
|
|
||||||
|
beginRelaying();
|
||||||
|
|
||||||
|
m_callsignTimer.start();
|
||||||
|
|
||||||
|
io.setDecode(true);
|
||||||
|
io.setADCDetection(true);
|
||||||
|
|
||||||
|
m_statusTimer.start();
|
||||||
|
serial.writeFMStatus(m_state);
|
||||||
|
}
|
||||||
|
if (m_callsignAtStart && m_callsignAtLatch) {
|
||||||
|
sendCallsign();
|
||||||
|
m_callsignTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
io.setDecode(false);
|
||||||
|
io.setADCDetection(false);
|
||||||
|
|
||||||
|
DEBUG1("State to LISTENING");
|
||||||
|
m_state = FS_LISTENING;
|
||||||
|
m_kerchunkTimer.stop();
|
||||||
|
m_timeoutTimer.stop();
|
||||||
|
m_ackMinTimer.stop();
|
||||||
|
m_callsignTimer.stop();
|
||||||
|
m_statusTimer.stop();
|
||||||
|
|
||||||
|
if (m_extEnabled)
|
||||||
|
serial.writeFMEOT();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::relayingRFState(bool validSignal)
|
||||||
|
{
|
||||||
|
if (validSignal) {
|
||||||
|
if (m_timeoutTimer.isRunning() && m_timeoutTimer.hasExpired()) {
|
||||||
|
DEBUG1("State to TIMEOUT_RF");
|
||||||
|
m_state = FS_TIMEOUT_RF;
|
||||||
|
m_ackMinTimer.stop();
|
||||||
|
m_timeoutTimer.stop();
|
||||||
|
m_timeoutTone.start();
|
||||||
|
|
||||||
|
if (m_extEnabled)
|
||||||
|
serial.writeFMEOT();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
io.setDecode(false);
|
||||||
|
io.setADCDetection(false);
|
||||||
|
|
||||||
|
DEBUG1("State to RELAYING_WAIT_RF");
|
||||||
|
m_state = FS_RELAYING_WAIT_RF;
|
||||||
|
m_ackDelayTimer.start();
|
||||||
|
|
||||||
|
if (m_extEnabled)
|
||||||
|
serial.writeFMEOT();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_callsignTimer.isRunning() && m_callsignTimer.hasExpired()) {
|
||||||
|
sendCallsign();
|
||||||
|
m_callsignTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::relayingRFWaitState(bool validSignal)
|
||||||
|
{
|
||||||
|
if (validSignal) {
|
||||||
|
io.setDecode(true);
|
||||||
|
io.setADCDetection(true);
|
||||||
|
|
||||||
|
DEBUG1("State to RELAYING_RF");
|
||||||
|
m_state = FS_RELAYING_RF;
|
||||||
|
m_ackDelayTimer.stop();
|
||||||
|
} else {
|
||||||
|
if (m_ackDelayTimer.isRunning() && m_ackDelayTimer.hasExpired()) {
|
||||||
|
DEBUG1("State to HANG");
|
||||||
|
m_state = FS_HANG;
|
||||||
|
|
||||||
|
if (m_ackMinTimer.isRunning()) {
|
||||||
|
if (m_ackMinTimer.hasExpired()) {
|
||||||
|
DEBUG1("Send RF ack");
|
||||||
|
m_rfAck.start();
|
||||||
|
m_ackMinTimer.stop();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DEBUG1("Send RF ack");
|
||||||
|
m_rfAck.start();
|
||||||
|
m_ackMinTimer.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ackDelayTimer.stop();
|
||||||
|
m_timeoutTimer.stop();
|
||||||
|
m_hangTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_callsignTimer.isRunning() && m_callsignTimer.hasExpired()) {
|
||||||
|
sendCallsign();
|
||||||
|
m_callsignTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::kerchunkExtState(bool validSignal)
|
||||||
|
{
|
||||||
|
if (validSignal) {
|
||||||
|
if (m_kerchunkTimer.hasExpired()) {
|
||||||
|
DEBUG1("State to RELAYING_EXT");
|
||||||
|
m_state = FS_RELAYING_EXT;
|
||||||
|
m_kerchunkTimer.stop();
|
||||||
|
if (!m_kerchunkTX) {
|
||||||
|
insertSilence(50U);
|
||||||
|
|
||||||
|
beginRelaying();
|
||||||
|
|
||||||
|
m_callsignTimer.start();
|
||||||
|
|
||||||
|
m_statusTimer.start();
|
||||||
|
serial.writeFMStatus(m_state);
|
||||||
|
}
|
||||||
|
if (m_callsignAtStart && m_callsignAtLatch) {
|
||||||
|
sendCallsign();
|
||||||
|
m_callsignTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DEBUG1("State to LISTENING");
|
||||||
|
m_state = FS_LISTENING;
|
||||||
|
m_kerchunkTimer.stop();
|
||||||
|
m_timeoutTimer.stop();
|
||||||
|
m_ackMinTimer.stop();
|
||||||
|
m_callsignTimer.stop();
|
||||||
|
m_statusTimer.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::relayingExtState(bool validSignal)
|
||||||
|
{
|
||||||
|
if (validSignal) {
|
||||||
|
if (m_timeoutTimer.isRunning() && m_timeoutTimer.hasExpired()) {
|
||||||
|
DEBUG1("State to TIMEOUT_EXT");
|
||||||
|
m_state = FS_TIMEOUT_EXT;
|
||||||
|
m_ackMinTimer.stop();
|
||||||
|
m_timeoutTimer.stop();
|
||||||
|
m_timeoutTone.start();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DEBUG1("State to RELAYING_WAIT_EXT");
|
||||||
|
m_state = FS_RELAYING_WAIT_EXT;
|
||||||
|
m_ackDelayTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_callsignTimer.isRunning() && m_callsignTimer.hasExpired()) {
|
||||||
|
sendCallsign();
|
||||||
|
m_callsignTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::relayingExtWaitState(bool validSignal)
|
||||||
|
{
|
||||||
|
if (validSignal) {
|
||||||
|
DEBUG1("State to RELAYING_EXT");
|
||||||
|
m_state = FS_RELAYING_EXT;
|
||||||
|
m_ackDelayTimer.stop();
|
||||||
|
} else {
|
||||||
|
if (m_ackDelayTimer.isRunning() && m_ackDelayTimer.hasExpired()) {
|
||||||
|
DEBUG1("State to HANG");
|
||||||
|
m_state = FS_HANG;
|
||||||
|
|
||||||
|
if (m_ackMinTimer.isRunning()) {
|
||||||
|
if (m_ackMinTimer.hasExpired()) {
|
||||||
|
DEBUG1("Send Ext ack");
|
||||||
|
m_extAck.start();
|
||||||
|
m_ackMinTimer.stop();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DEBUG1("Send Ext ack");
|
||||||
|
m_extAck.start();
|
||||||
|
m_ackMinTimer.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ackDelayTimer.stop();
|
||||||
|
m_timeoutTimer.stop();
|
||||||
|
m_hangTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_callsignTimer.isRunning() && m_callsignTimer.hasExpired()) {
|
||||||
|
sendCallsign();
|
||||||
|
m_callsignTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::hangState(bool validRFSignal, bool validExtSignal)
|
||||||
|
{
|
||||||
|
if (validRFSignal) {
|
||||||
|
io.setDecode(true);
|
||||||
|
io.setADCDetection(true);
|
||||||
|
|
||||||
|
DEBUG1("State to RELAYING_RF");
|
||||||
|
m_state = FS_RELAYING_RF;
|
||||||
|
DEBUG1("Stop ack");
|
||||||
|
m_rfAck.stop();
|
||||||
|
m_extAck.stop();
|
||||||
|
beginRelaying();
|
||||||
|
} else if (validExtSignal) {
|
||||||
|
DEBUG1("State to RELAYING_EXT");
|
||||||
|
m_state = FS_RELAYING_EXT;
|
||||||
|
DEBUG1("Stop ack");
|
||||||
|
m_rfAck.stop();
|
||||||
|
m_extAck.stop();
|
||||||
|
beginRelaying();
|
||||||
|
} else {
|
||||||
|
if (m_hangTimer.isRunning() && m_hangTimer.hasExpired()) {
|
||||||
|
DEBUG1("State to LISTENING");
|
||||||
|
m_state = FS_LISTENING;
|
||||||
|
m_hangTimer.stop();
|
||||||
|
m_statusTimer.stop();
|
||||||
|
|
||||||
|
if (m_callsignAtEnd)
|
||||||
|
sendCallsign();
|
||||||
|
|
||||||
|
m_callsignTimer.stop();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_callsignTimer.isRunning() && m_callsignTimer.hasExpired()) {
|
||||||
|
sendCallsign();
|
||||||
|
m_callsignTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::timeoutRFState(bool validSignal)
|
||||||
|
{
|
||||||
|
if (!validSignal) {
|
||||||
|
io.setDecode(false);
|
||||||
|
io.setADCDetection(false);
|
||||||
|
|
||||||
|
DEBUG1("State to TIMEOUT_WAIT_RF");
|
||||||
|
m_state = FS_TIMEOUT_WAIT_RF;
|
||||||
|
|
||||||
|
if (m_callsignAtEnd)
|
||||||
|
sendCallsign();
|
||||||
|
|
||||||
|
m_ackDelayTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_callsignTimer.isRunning() && m_callsignTimer.hasExpired()) {
|
||||||
|
sendCallsign();
|
||||||
|
m_callsignTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::timeoutRFWaitState(bool validSignal)
|
||||||
|
{
|
||||||
|
if (validSignal) {
|
||||||
|
io.setDecode(true);
|
||||||
|
io.setADCDetection(true);
|
||||||
|
|
||||||
|
DEBUG1("State to TIMEOUT_RF");
|
||||||
|
m_state = FS_TIMEOUT_RF;
|
||||||
|
m_ackDelayTimer.stop();
|
||||||
|
} else {
|
||||||
|
if (m_ackDelayTimer.isRunning() && m_ackDelayTimer.hasExpired()) {
|
||||||
|
DEBUG1("State to HANG");
|
||||||
|
m_state = FS_HANG;
|
||||||
|
m_timeoutTone.stop();
|
||||||
|
DEBUG1("Send RF ack");
|
||||||
|
m_rfAck.start();
|
||||||
|
m_ackDelayTimer.stop();
|
||||||
|
m_ackMinTimer.stop();
|
||||||
|
m_timeoutTimer.stop();
|
||||||
|
m_hangTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_callsignTimer.isRunning() && m_callsignTimer.hasExpired()) {
|
||||||
|
sendCallsign();
|
||||||
|
m_callsignTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::timeoutExtState(bool validSignal)
|
||||||
|
{
|
||||||
|
if (!validSignal) {
|
||||||
|
DEBUG1("State to TIMEOUT_WAIT_EXT");
|
||||||
|
m_state = FS_TIMEOUT_WAIT_EXT;
|
||||||
|
m_ackDelayTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_callsignTimer.isRunning() && m_callsignTimer.hasExpired()) {
|
||||||
|
sendCallsign();
|
||||||
|
m_callsignTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::timeoutExtWaitState(bool validSignal)
|
||||||
|
{
|
||||||
|
if (validSignal) {
|
||||||
|
DEBUG1("State to TIMEOUT_EXT");
|
||||||
|
m_state = FS_TIMEOUT_EXT;
|
||||||
|
m_ackDelayTimer.stop();
|
||||||
|
} else {
|
||||||
|
if (m_ackDelayTimer.isRunning() && m_ackDelayTimer.hasExpired()) {
|
||||||
|
DEBUG1("State to HANG");
|
||||||
|
m_state = FS_HANG;
|
||||||
|
m_timeoutTone.stop();
|
||||||
|
DEBUG1("Send Ext ack");
|
||||||
|
m_extAck.start();
|
||||||
|
m_ackDelayTimer.stop();
|
||||||
|
m_ackMinTimer.stop();
|
||||||
|
m_timeoutTimer.stop();
|
||||||
|
m_hangTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_callsignTimer.isRunning() && m_callsignTimer.hasExpired()) {
|
||||||
|
sendCallsign();
|
||||||
|
m_callsignTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CFM::sendCallsign()
|
||||||
|
{
|
||||||
|
if (m_holdoffTimer.isRunning()) {
|
||||||
|
if (m_holdoffTimer.hasExpired()) {
|
||||||
|
DEBUG1("Send callsign");
|
||||||
|
m_callsign.start();
|
||||||
|
m_holdoffTimer.start();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DEBUG1("Send callsign");
|
||||||
|
m_callsign.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::beginRelaying()
|
||||||
|
{
|
||||||
|
m_timeoutTimer.start();
|
||||||
|
m_ackMinTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CFM::getSpace() const
|
||||||
|
{
|
||||||
|
// The amount of free space for receiving external audio, in frames.
|
||||||
|
return m_inputExtRB.getSpace() / FM_SERIAL_BLOCK_SIZE_BYTES;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CFM::writeData(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
//todo check if length is a multiple of 3
|
||||||
|
m_inputExtRB.addData(data, length);
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::insertDelay(uint16_t ms)
|
||||||
|
{
|
||||||
|
uint32_t nSamples = ms * 24U;
|
||||||
|
|
||||||
|
for (uint32_t i = 0U; i < nSamples; i++)
|
||||||
|
m_inputRFRB.put(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFM::insertSilence(uint16_t ms)
|
||||||
|
{
|
||||||
|
uint32_t nSamples = ms * 24U;
|
||||||
|
|
||||||
|
for (uint32_t i = 0U; i < nSamples; i++)
|
||||||
|
m_outputRFRB.put(0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(FM_H)
|
||||||
|
#define FM_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
#include "FMBlanking.h"
|
||||||
|
#include "FMCTCSSRX.h"
|
||||||
|
#include "FMCTCSSTX.h"
|
||||||
|
#include "FMTimeout.h"
|
||||||
|
#include "FMKeyer.h"
|
||||||
|
#include "FMTimer.h"
|
||||||
|
#include "RingBuffer.h"
|
||||||
|
#include "FMDirectForm1.h"
|
||||||
|
#include "FMDownsampler.h"
|
||||||
|
#include "FMUpSampler.h"
|
||||||
|
|
||||||
|
enum FM_STATE {
|
||||||
|
FS_LISTENING,
|
||||||
|
FS_KERCHUNK_RF,
|
||||||
|
FS_RELAYING_RF,
|
||||||
|
FS_RELAYING_WAIT_RF,
|
||||||
|
FS_TIMEOUT_RF,
|
||||||
|
FS_TIMEOUT_WAIT_RF,
|
||||||
|
FS_KERCHUNK_EXT,
|
||||||
|
FS_RELAYING_EXT,
|
||||||
|
FS_RELAYING_WAIT_EXT,
|
||||||
|
FS_TIMEOUT_EXT,
|
||||||
|
FS_TIMEOUT_WAIT_EXT,
|
||||||
|
FS_HANG
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CFM {
|
||||||
|
public:
|
||||||
|
CFM();
|
||||||
|
|
||||||
|
void samples(bool cos, q15_t* samples, uint8_t length);
|
||||||
|
|
||||||
|
void process();
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
uint8_t setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t highLevel, uint8_t lowLevel, bool callsignAtStart, bool callsignAtEnd, bool callsignAtLatch);
|
||||||
|
uint8_t setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_t minTime, uint16_t delay, uint8_t level);
|
||||||
|
uint8_t setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssHighThreshold, uint8_t ctcssLowThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, bool kerchunkTX, uint8_t hangTime, bool useCOS, bool cosInvert, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel);
|
||||||
|
uint8_t setExt(const char* ack, uint8_t audioBoost, uint8_t speed, uint16_t frequency, uint8_t level);
|
||||||
|
|
||||||
|
uint8_t getSpace() const;
|
||||||
|
|
||||||
|
uint8_t writeData(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CFMKeyer m_callsign;
|
||||||
|
CFMKeyer m_rfAck;
|
||||||
|
CFMKeyer m_extAck;
|
||||||
|
CFMCTCSSRX m_ctcssRX;
|
||||||
|
CFMCTCSSTX m_ctcssTX;
|
||||||
|
CFMTimeout m_timeoutTone;
|
||||||
|
FM_STATE m_state;
|
||||||
|
bool m_callsignAtStart;
|
||||||
|
bool m_callsignAtEnd;
|
||||||
|
bool m_callsignAtLatch;
|
||||||
|
CFMTimer m_callsignTimer;
|
||||||
|
CFMTimer m_timeoutTimer;
|
||||||
|
CFMTimer m_holdoffTimer;
|
||||||
|
CFMTimer m_kerchunkTimer;
|
||||||
|
bool m_kerchunkTX;
|
||||||
|
CFMTimer m_ackMinTimer;
|
||||||
|
CFMTimer m_ackDelayTimer;
|
||||||
|
CFMTimer m_hangTimer;
|
||||||
|
CFMTimer m_statusTimer;
|
||||||
|
CFMDirectFormI m_filterStage1;
|
||||||
|
CFMDirectFormI m_filterStage2;
|
||||||
|
CFMDirectFormI m_filterStage3;
|
||||||
|
CFMBlanking m_blanking;
|
||||||
|
bool m_useCOS;
|
||||||
|
bool m_cosInvert;
|
||||||
|
q15_t m_rfAudioBoost;
|
||||||
|
q15_t m_extAudioBoost;
|
||||||
|
CFMDownsampler m_downsampler;
|
||||||
|
bool m_extEnabled;
|
||||||
|
q15_t m_rxLevel;
|
||||||
|
CRingBuffer<q15_t> m_inputRFRB;
|
||||||
|
CRingBuffer<q15_t> m_outputRFRB;
|
||||||
|
CFMUpSampler m_inputExtRB;
|
||||||
|
|
||||||
|
void stateMachine(bool validRFSignal, bool validExtSignal);
|
||||||
|
void listeningState(bool validRFSignal, bool validExtSignal);
|
||||||
|
void kerchunkRFState(bool validSignal);
|
||||||
|
void relayingRFState(bool validSignal);
|
||||||
|
void relayingRFWaitState(bool validSignal);
|
||||||
|
void timeoutRFState(bool validSignal);
|
||||||
|
void timeoutRFWaitState(bool validSignal);
|
||||||
|
void kerchunkExtState(bool validSignal);
|
||||||
|
void relayingExtState(bool validSignal);
|
||||||
|
void relayingExtWaitState(bool validSignal);
|
||||||
|
void timeoutExtState(bool validSignal);
|
||||||
|
void timeoutExtWaitState(bool validSignal);
|
||||||
|
void hangState(bool validRFSignal, bool validExtSignal);
|
||||||
|
|
||||||
|
void clock(uint8_t length);
|
||||||
|
|
||||||
|
void sendCallsign();
|
||||||
|
void beginRelaying();
|
||||||
|
|
||||||
|
void insertDelay(uint16_t ms);
|
||||||
|
void insertSilence(uint16_t ms);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "FMBlanking.h"
|
||||||
|
|
||||||
|
// 2000 Hz sine wave at 24000 Hz sample rate
|
||||||
|
const q31_t TONE[] = {0, 16384, 28378, 32767, 28378, 16384, 0, -16383, -28377, -32767, -28377, -16383};
|
||||||
|
|
||||||
|
const uint8_t TONE_LEN = 12U;
|
||||||
|
|
||||||
|
const uint32_t BLEEP_LEN = 2400U; // 100ms
|
||||||
|
|
||||||
|
CFMBlanking::CFMBlanking() :
|
||||||
|
m_posValue(0),
|
||||||
|
m_negValue(0),
|
||||||
|
m_level(128 * 128),
|
||||||
|
m_running(false),
|
||||||
|
m_pos(0U),
|
||||||
|
m_n(0U)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMBlanking::setParams(uint8_t value, uint8_t level)
|
||||||
|
{
|
||||||
|
m_posValue = q15_t(value * 128);
|
||||||
|
m_negValue = -m_posValue;
|
||||||
|
|
||||||
|
m_level = q15_t(level * 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
q15_t CFMBlanking::process(q15_t sample)
|
||||||
|
{
|
||||||
|
if (m_posValue == 0)
|
||||||
|
return sample;
|
||||||
|
|
||||||
|
if (!m_running) {
|
||||||
|
if (sample >= m_posValue) {
|
||||||
|
m_running = true;
|
||||||
|
m_pos = 0U;
|
||||||
|
m_n = 0U;
|
||||||
|
} else if (sample <= m_negValue) {
|
||||||
|
m_running = true;
|
||||||
|
m_pos = 0U;
|
||||||
|
m_n = 0U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_running)
|
||||||
|
return sample;
|
||||||
|
|
||||||
|
if (m_pos <= BLEEP_LEN) {
|
||||||
|
q31_t value = TONE[m_n++] * m_level;
|
||||||
|
sample = q15_t(__SSAT((value >> 15), 16));
|
||||||
|
if (m_n >= TONE_LEN)
|
||||||
|
m_n = 0U;
|
||||||
|
} else {
|
||||||
|
sample = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pos++;
|
||||||
|
if (m_pos >= 12000U)
|
||||||
|
m_running = false;
|
||||||
|
|
||||||
|
return sample;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(FMBlanking_H)
|
||||||
|
#define FMBlanking_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
class CFMBlanking {
|
||||||
|
public:
|
||||||
|
CFMBlanking();
|
||||||
|
|
||||||
|
void setParams(uint8_t value, uint8_t level);
|
||||||
|
|
||||||
|
q15_t process(q15_t sample);
|
||||||
|
|
||||||
|
private:
|
||||||
|
q15_t m_posValue;
|
||||||
|
q15_t m_negValue;
|
||||||
|
q15_t m_level;
|
||||||
|
bool m_running;
|
||||||
|
uint32_t m_pos;
|
||||||
|
uint8_t m_n;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
+181
@@ -0,0 +1,181 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "FMCTCSSRX.h"
|
||||||
|
|
||||||
|
const struct RX_CTCSS_TABLE {
|
||||||
|
uint8_t frequency;
|
||||||
|
q63_t coeffDivTwo;
|
||||||
|
} RX_CTCSS_TABLE_DATA[] = {
|
||||||
|
{ 67U, 2147153298},
|
||||||
|
{ 69U, 2147130228},
|
||||||
|
{ 71U, 2147103212},
|
||||||
|
{ 74U, 2147076297},
|
||||||
|
{ 77U, 2147047330},
|
||||||
|
{ 79U, 2147016195},
|
||||||
|
{ 82U, 2146982775},
|
||||||
|
{ 85U, 2146946945},
|
||||||
|
{ 88U, 2146907275},
|
||||||
|
{ 91U, 2146867538},
|
||||||
|
{ 94U, 2146822298},
|
||||||
|
{ 97U, 2146785526},
|
||||||
|
{100U, 2146747759},
|
||||||
|
{103U, 2146695349},
|
||||||
|
{107U, 2146637984},
|
||||||
|
{110U, 2146578604},
|
||||||
|
{114U, 2146513835},
|
||||||
|
{118U, 2146445080},
|
||||||
|
{123U, 2146370355},
|
||||||
|
{127U, 2146291161},
|
||||||
|
{131U, 2146205372},
|
||||||
|
{136U, 2146112589},
|
||||||
|
{141U, 2146014479},
|
||||||
|
{146U, 2145910829},
|
||||||
|
{151U, 2145796971},
|
||||||
|
{156U, 2145676831},
|
||||||
|
{159U, 2145604646},
|
||||||
|
{162U, 2145547790},
|
||||||
|
{165U, 2145468230},
|
||||||
|
{167U, 2145409363},
|
||||||
|
{171U, 2145324517},
|
||||||
|
{173U, 2145261046},
|
||||||
|
{177U, 2145170643},
|
||||||
|
{179U, 2145102321},
|
||||||
|
{183U, 2145006080},
|
||||||
|
{186U, 2144932648},
|
||||||
|
{189U, 2144830280},
|
||||||
|
{192U, 2144748638},
|
||||||
|
{196U, 2144639788},
|
||||||
|
{199U, 2144555290},
|
||||||
|
{203U, 2144436713},
|
||||||
|
{206U, 2144346237},
|
||||||
|
{210U, 2144217348},
|
||||||
|
{218U, 2143983951},
|
||||||
|
{225U, 2143735870},
|
||||||
|
{229U, 2143622139},
|
||||||
|
{233U, 2143469001},
|
||||||
|
{241U, 2143182299},
|
||||||
|
{250U, 2142874683},
|
||||||
|
{254U, 2142733729}};
|
||||||
|
|
||||||
|
const uint8_t CTCSS_TABLE_DATA_LEN = 50U;
|
||||||
|
|
||||||
|
// 4Hz bandwidth
|
||||||
|
const uint16_t N = 24000U / 4U;
|
||||||
|
|
||||||
|
CFMCTCSSRX::CFMCTCSSRX() :
|
||||||
|
m_coeffDivTwo(0),
|
||||||
|
m_highThreshold(0),
|
||||||
|
m_lowThreshold(0),
|
||||||
|
m_count(0U),
|
||||||
|
m_q0(0),
|
||||||
|
m_q1(0),
|
||||||
|
m_result(CTS_NONE)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CFMCTCSSRX::setParams(uint8_t frequency, uint8_t highThreshold, uint8_t lowThreshold)
|
||||||
|
{
|
||||||
|
m_coeffDivTwo = 0;
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; i < CTCSS_TABLE_DATA_LEN; i++) {
|
||||||
|
if (RX_CTCSS_TABLE_DATA[i].frequency == frequency) {
|
||||||
|
m_coeffDivTwo = RX_CTCSS_TABLE_DATA[i].coeffDivTwo;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_coeffDivTwo == 0)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
m_highThreshold = q31_t(highThreshold);
|
||||||
|
m_lowThreshold = q31_t(lowThreshold);
|
||||||
|
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CFMCTCSSRX::process(q15_t sample)
|
||||||
|
{
|
||||||
|
//get more dynamic into the decoder by multiplying the sample by 1.5
|
||||||
|
q31_t sample31 = q31_t(sample) + (q31_t(sample) >> 1);
|
||||||
|
|
||||||
|
m_result &= ~CTS_READY;
|
||||||
|
|
||||||
|
q31_t q2 = m_q1;
|
||||||
|
m_q1 = m_q0;
|
||||||
|
|
||||||
|
// Q31 multiplication, t3 = m_coeffDivTwo * 2 * m_q1
|
||||||
|
q63_t t1 = m_coeffDivTwo * m_q1;
|
||||||
|
q31_t t2 = __SSAT((t1 >> 31), 31);
|
||||||
|
q31_t t3 = t2 * 2;
|
||||||
|
|
||||||
|
// m_q0 = m_coeffDivTwo * m_q1 * 2 - q2 + sample
|
||||||
|
m_q0 = t3 - q2 + sample31;
|
||||||
|
|
||||||
|
m_count++;
|
||||||
|
if (m_count == N) {
|
||||||
|
// Q31 multiplication, t2 = m_q0 * m_q0
|
||||||
|
q63_t t1 = q63_t(m_q0) * q63_t(m_q0);
|
||||||
|
q31_t t2 = __SSAT((t1 >> 31), 31);
|
||||||
|
|
||||||
|
// Q31 multiplication, t4 = m_q0 * m_q0
|
||||||
|
q63_t t3 = q63_t(m_q1) * q63_t(m_q1);
|
||||||
|
q31_t t4 = __SSAT((t3 >> 31), 31);
|
||||||
|
|
||||||
|
// Q31 multiplication, t9 = m_q0 * m_q1 * m_coeffDivTwo * 2
|
||||||
|
q63_t t5 = q63_t(m_q0) * q63_t(m_q1);
|
||||||
|
q31_t t6 = __SSAT((t5 >> 31), 31);
|
||||||
|
q63_t t7 = t6 * m_coeffDivTwo;
|
||||||
|
q31_t t8 = __SSAT((t7 >> 31), 31);
|
||||||
|
q31_t t9 = t8 * 2;
|
||||||
|
|
||||||
|
// value = m_q0 * m_q0 + m_q1 * m_q1 - m_q0 * m_q1 * m_coeffDivTwo * 2
|
||||||
|
q31_t value = t2 + t4 - t9;
|
||||||
|
|
||||||
|
bool previousCTCSSValid = CTCSS_VALID(m_result);
|
||||||
|
|
||||||
|
q31_t threshold = m_highThreshold;
|
||||||
|
if (previousCTCSSValid)
|
||||||
|
threshold = m_lowThreshold;
|
||||||
|
|
||||||
|
m_result |= CTS_READY;
|
||||||
|
if (value >= threshold)
|
||||||
|
m_result |= CTS_VALID;
|
||||||
|
else
|
||||||
|
m_result &= ~CTS_VALID;
|
||||||
|
|
||||||
|
if (previousCTCSSValid != CTCSS_VALID(m_result))
|
||||||
|
DEBUG4("CTCSS Value / Threshold / Valid", value, threshold, CTCSS_VALID(m_result));
|
||||||
|
|
||||||
|
m_count = 0U;
|
||||||
|
m_q0 = 0;
|
||||||
|
m_q1 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMCTCSSRX::reset()
|
||||||
|
{
|
||||||
|
m_q0 = 0;
|
||||||
|
m_q1 = 0;
|
||||||
|
m_result = CTS_NONE;
|
||||||
|
m_count = 0U;
|
||||||
|
}
|
||||||
+53
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(FMCTCSSRX_H)
|
||||||
|
#define FMCTCSSRX_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
const uint8_t CTS_NONE = 0U;
|
||||||
|
const uint8_t CTS_READY = 1U;
|
||||||
|
const uint8_t CTS_VALID = 2U;
|
||||||
|
|
||||||
|
#define CTCSS_READY(a) ((a & CTS_READY) != 0)
|
||||||
|
#define CTCSS_NOT_READY(a) ((a & CTS_READY) == 0)
|
||||||
|
#define CTCSS_VALID(a) ((a & CTS_VALID) != 0)
|
||||||
|
#define CTCSS_NOT_VALID(a) ((a & CTS_VALID) == 0)
|
||||||
|
|
||||||
|
class CFMCTCSSRX {
|
||||||
|
public:
|
||||||
|
CFMCTCSSRX();
|
||||||
|
|
||||||
|
uint8_t setParams(uint8_t frequency, uint8_t highThreshold, uint8_t lowThreshold);
|
||||||
|
|
||||||
|
uint8_t process(q15_t sample);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
q63_t m_coeffDivTwo;
|
||||||
|
q31_t m_highThreshold;
|
||||||
|
q31_t m_lowThreshold;
|
||||||
|
uint16_t m_count;
|
||||||
|
q31_t m_q0;
|
||||||
|
q31_t m_q1;
|
||||||
|
uint8_t m_result;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
+125
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "FMCTCSSTX.h"
|
||||||
|
|
||||||
|
const struct TX_CTCSS_TABLE {
|
||||||
|
uint8_t frequency;
|
||||||
|
uint16_t length;
|
||||||
|
q31_t increment;
|
||||||
|
} TX_CTCSS_TABLE_DATA[] = {
|
||||||
|
{ 67U, 358U, 5995059},
|
||||||
|
{ 69U, 346U, 6200860},
|
||||||
|
{ 71U, 334U, 6433504},
|
||||||
|
{ 74U, 323U, 6657200},
|
||||||
|
{ 77U, 312U, 6889844},
|
||||||
|
{ 79U, 301U, 7131436},
|
||||||
|
{ 82U, 291U, 7381976},
|
||||||
|
{ 85U, 281U, 7641463},
|
||||||
|
{ 88U, 271U, 7918846},
|
||||||
|
{ 91U, 262U, 8187282},
|
||||||
|
{ 94U, 253U, 8482561},
|
||||||
|
{ 97U, 246U, 8715205},
|
||||||
|
{100U, 240U, 8947849},
|
||||||
|
{103U, 232U, 9261024},
|
||||||
|
{107U, 224U, 9592094},
|
||||||
|
{110U, 216U, 9923165},
|
||||||
|
{114U, 209U, 10272131},
|
||||||
|
{118U, 202U, 10630045},
|
||||||
|
{123U, 195U, 11005854},
|
||||||
|
{127U, 189U, 11390612},
|
||||||
|
{131U, 182U, 11793265},
|
||||||
|
{136U, 176U, 12213814},
|
||||||
|
{141U, 170U, 12643310},
|
||||||
|
{146U, 164U, 13081755},
|
||||||
|
{151U, 159U, 13547043},
|
||||||
|
{156U, 153U, 14021279},
|
||||||
|
{159U, 150U, 14298662},
|
||||||
|
{162U, 148U, 14513411},
|
||||||
|
{165U, 145U, 14808690},
|
||||||
|
{167U, 143U, 15023438},
|
||||||
|
{171U, 140U, 15327665},
|
||||||
|
{173U, 138U, 15551361},
|
||||||
|
{177U, 135U, 15864536},
|
||||||
|
{179U, 133U, 16097180},
|
||||||
|
{183U, 131U, 16419303},
|
||||||
|
{186U, 129U, 16660894},
|
||||||
|
{189U, 126U, 16991965},
|
||||||
|
{192U, 124U, 17251452},
|
||||||
|
{196U, 122U, 17591471},
|
||||||
|
{199U, 120U, 17850958},
|
||||||
|
{203U, 118U, 18208872},
|
||||||
|
{206U, 116U, 18477308},
|
||||||
|
{210U, 114U, 18853117},
|
||||||
|
{218U, 110U, 19515258},
|
||||||
|
{225U, 106U, 20195295},
|
||||||
|
{229U, 105U, 20499521},
|
||||||
|
{233U, 103U, 20902175},
|
||||||
|
{241U, 99U, 21635898},
|
||||||
|
{250U, 96U, 22396465},
|
||||||
|
{254U, 94U, 22736484}};
|
||||||
|
|
||||||
|
const uint8_t CTCSS_TABLE_DATA_LEN = 50U;
|
||||||
|
|
||||||
|
CFMCTCSSTX::CFMCTCSSTX() :
|
||||||
|
m_values(NULL),
|
||||||
|
m_length(0U),
|
||||||
|
m_n(0U)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CFMCTCSSTX::setParams(uint8_t frequency, uint8_t level)
|
||||||
|
{
|
||||||
|
const TX_CTCSS_TABLE* entry = NULL;
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; i < CTCSS_TABLE_DATA_LEN; i++) {
|
||||||
|
if (TX_CTCSS_TABLE_DATA[i].frequency == frequency) {
|
||||||
|
entry = TX_CTCSS_TABLE_DATA + i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry == NULL)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
m_length = entry->length;
|
||||||
|
|
||||||
|
delete[] m_values;
|
||||||
|
m_values = new q15_t[m_length];
|
||||||
|
|
||||||
|
q31_t arg = 0;
|
||||||
|
for (uint16_t i = 0U; i < m_length; i++) {
|
||||||
|
q63_t value = ::arm_sin_q31(arg) * q63_t(level * 13);
|
||||||
|
m_values[i] = q15_t(__SSAT((value >> 31), 16));
|
||||||
|
|
||||||
|
arg += entry->increment;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
q15_t CFMCTCSSTX::getAudio()
|
||||||
|
{
|
||||||
|
q15_t sample = m_values[m_n++];
|
||||||
|
if(m_n >= m_length)
|
||||||
|
m_n = 0U;
|
||||||
|
|
||||||
|
return sample;
|
||||||
|
}
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(FMCTCSSTX_H)
|
||||||
|
#define FMCTCSSTX_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
class CFMCTCSSTX {
|
||||||
|
public:
|
||||||
|
CFMCTCSSTX();
|
||||||
|
|
||||||
|
uint8_t setParams(uint8_t frequency, uint8_t level);
|
||||||
|
|
||||||
|
q15_t getAudio();
|
||||||
|
|
||||||
|
private:
|
||||||
|
q15_t* m_values;
|
||||||
|
uint16_t m_length;
|
||||||
|
uint16_t m_n;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
+111
@@ -0,0 +1,111 @@
|
|||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
This header file has been taken from:
|
||||||
|
"A Collection of Useful C++ Classes for Digital Signal Processing"
|
||||||
|
By Vinnie Falco
|
||||||
|
Bernd Porr adapted it for Linux and turned it into a filter using
|
||||||
|
fixed point arithmetic.
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
License: MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
|
Copyright (c) 2009 by Vinnie Falco
|
||||||
|
Copyright (C) 2013-2017, Bernd Porr, [email protected]
|
||||||
|
Copyright (C) 2020 , Mario Molitor , [email protected]
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
// based on https://raw.githubusercontent.com/berndporr/iir_fixed_point/master/DirectFormI.h
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#ifndef DIRECTFORMI_H_
|
||||||
|
#define DIRECTFORMI_H_
|
||||||
|
class CFMDirectFormI
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// convenience function which takes the a0 argument but ignores it!
|
||||||
|
CFMDirectFormI(const q31_t b0, const q31_t b1, const q31_t b2,
|
||||||
|
const q31_t, const q31_t a1, const q31_t a2)
|
||||||
|
{
|
||||||
|
// FIR coefficients
|
||||||
|
c_b0 = b0;
|
||||||
|
c_b1 = b1;
|
||||||
|
c_b2 = b2;
|
||||||
|
// IIR coefficients
|
||||||
|
c_a1 = a1;
|
||||||
|
c_a2 = a2;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
CFMDirectFormI(const CFMDirectFormI &my)
|
||||||
|
{
|
||||||
|
// delay line
|
||||||
|
m_x2 = my.m_x2; // x[n-2]
|
||||||
|
m_y2 = my.m_y2; // y[n-2]
|
||||||
|
m_x1 = my.m_x1; // x[n-1]
|
||||||
|
m_y1 = my.m_y1; // y[n-1]
|
||||||
|
|
||||||
|
// coefficients
|
||||||
|
c_b0 = my.c_b0;
|
||||||
|
c_b1 = my.c_b1;
|
||||||
|
c_b2 = my.c_b2; // FIR
|
||||||
|
c_a1 = my.c_a1;
|
||||||
|
c_a2 = my.c_a2; // IIR
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset ()
|
||||||
|
{
|
||||||
|
m_x1 = 0;
|
||||||
|
m_x2 = 0;
|
||||||
|
m_y1 = 0;
|
||||||
|
m_y2 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// filtering operation: one sample in and one out
|
||||||
|
inline q15_t filter(const q15_t in)
|
||||||
|
{
|
||||||
|
// calculate the output
|
||||||
|
register q31_t out_upscaled = c_b0 * in
|
||||||
|
+ c_b1 * m_x1
|
||||||
|
+ c_b2 * m_x2
|
||||||
|
- c_a1 * m_y1
|
||||||
|
- c_a2 * m_y2;
|
||||||
|
|
||||||
|
q15_t out = __SSAT(out_upscaled >> 15, 15);
|
||||||
|
|
||||||
|
// update the delay lines
|
||||||
|
m_x2 = m_x1;
|
||||||
|
m_y2 = m_y1;
|
||||||
|
m_x1 = in;
|
||||||
|
m_y1 = out;
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// delay line
|
||||||
|
q31_t m_x2; // x[n-2]
|
||||||
|
q31_t m_y2; // y[n-2]
|
||||||
|
q31_t m_x1; // x[n-1]
|
||||||
|
q31_t m_y1; // y[n-1]
|
||||||
|
|
||||||
|
// coefficients
|
||||||
|
q31_t c_b0,c_b1,c_b2; // FIR
|
||||||
|
q31_t c_a1,c_a2; // IIR
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* DIRECTFORMI_H */
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2020 by Geoffrey Merck F4FXL - KC3FRA
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "FMDownsampler.h"
|
||||||
|
|
||||||
|
CFMDownsampler::CFMDownsampler(uint16_t length) :
|
||||||
|
m_ringBuffer(length),
|
||||||
|
m_samplePack(0U),
|
||||||
|
m_samplePackPointer(NULL),
|
||||||
|
m_sampleIndex(0U)
|
||||||
|
{
|
||||||
|
m_samplePackPointer = (uint8_t*)&m_samplePack;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMDownsampler::addSample(q15_t sample)
|
||||||
|
{
|
||||||
|
uint32_t usample = uint32_t(int32_t(sample) + 2048);
|
||||||
|
//only take one of three samples
|
||||||
|
switch(m_sampleIndex){
|
||||||
|
case 0:
|
||||||
|
m_samplePack = usample << 12;
|
||||||
|
break;
|
||||||
|
case 3:{
|
||||||
|
m_samplePack |= usample;
|
||||||
|
|
||||||
|
//we did not use MSB; skip it
|
||||||
|
TSamplePairPack pair{m_samplePackPointer[0U], m_samplePackPointer[1U], m_samplePackPointer[2U]};
|
||||||
|
|
||||||
|
m_ringBuffer.put(pair);
|
||||||
|
|
||||||
|
m_samplePack = 0U;//reset the sample pack
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//Just skip this sample
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sampleIndex++;
|
||||||
|
if(m_sampleIndex >= 6U)//did we pack two samples ?
|
||||||
|
m_sampleIndex = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFMDownsampler::getPackedData(TSamplePairPack& data)
|
||||||
|
{
|
||||||
|
return m_ringBuffer.get(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t CFMDownsampler::getData()
|
||||||
|
{
|
||||||
|
return m_ringBuffer.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMDownsampler::reset()
|
||||||
|
{
|
||||||
|
m_sampleIndex = 0U;
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2020 by Geoffrey Merck F4FXL - KC3FRA
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(FMDOWNSAMPLER_H)
|
||||||
|
#define FMDOWNSAMPLER_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "RingBuffer.h"
|
||||||
|
#include "FMSamplePairPack.h"
|
||||||
|
|
||||||
|
class CFMDownsampler {
|
||||||
|
public:
|
||||||
|
CFMDownsampler(uint16_t length);
|
||||||
|
void addSample(q15_t sample);
|
||||||
|
bool getPackedData(TSamplePairPack& data);
|
||||||
|
uint16_t getData();
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CRingBuffer<TSamplePairPack> m_ringBuffer;
|
||||||
|
uint32_t m_samplePack;
|
||||||
|
uint8_t* m_samplePackPointer;
|
||||||
|
uint8_t m_sampleIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
+216
@@ -0,0 +1,216 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "FMKeyer.h"
|
||||||
|
|
||||||
|
const struct {
|
||||||
|
char c;
|
||||||
|
uint32_t pattern;
|
||||||
|
uint8_t length;
|
||||||
|
} SYMBOL_LIST[] = {
|
||||||
|
{'A', 0xB8000000U, 8U},
|
||||||
|
{'B', 0xEA800000U, 12U},
|
||||||
|
{'C', 0xEBA00000U, 14U},
|
||||||
|
{'D', 0xEA000000U, 10U},
|
||||||
|
{'E', 0x80000000U, 4U},
|
||||||
|
{'F', 0xAE800000U, 12U},
|
||||||
|
{'G', 0xEE800000U, 12U},
|
||||||
|
{'H', 0xAA000000U, 10U},
|
||||||
|
{'I', 0xA0000000U, 6U},
|
||||||
|
{'J', 0xBBB80000U, 16U},
|
||||||
|
{'K', 0xEB800000U, 12U},
|
||||||
|
{'L', 0xBA800000U, 12U},
|
||||||
|
{'M', 0xEE000000U, 10U},
|
||||||
|
{'N', 0xE8000000U, 8U},
|
||||||
|
{'O', 0xEEE00000U, 14U},
|
||||||
|
{'P', 0xBBA00000U, 14U},
|
||||||
|
{'Q', 0xEEB80000U, 16U},
|
||||||
|
{'R', 0xBA000000U, 10U},
|
||||||
|
{'S', 0xA8000000U, 8U},
|
||||||
|
{'T', 0xE0000000U, 6U},
|
||||||
|
{'U', 0xAE000000U, 10U},
|
||||||
|
{'V', 0xAB800000U, 12U},
|
||||||
|
{'W', 0xBB800000U, 12U},
|
||||||
|
{'X', 0xEAE00000U, 14U},
|
||||||
|
{'Y', 0xEBB80000U, 16U},
|
||||||
|
{'Z', 0xEEA00000U, 14U},
|
||||||
|
{'1', 0xBBBB8000U, 20U},
|
||||||
|
{'2', 0xAEEE0000U, 18U},
|
||||||
|
{'3', 0xABB80000U, 16U},
|
||||||
|
{'4', 0xAAE00000U, 14U},
|
||||||
|
{'5', 0xAA800000U, 12U},
|
||||||
|
{'6', 0xEAA00000U, 14U},
|
||||||
|
{'7', 0xEEA80000U, 16U},
|
||||||
|
{'8', 0xEEEA0000U, 18U},
|
||||||
|
{'9', 0xEEEE8000U, 20U},
|
||||||
|
{'0', 0xEEEEE000U, 22U},
|
||||||
|
{'/', 0xEAE80000U, 16U},
|
||||||
|
{'?', 0xAEEA0000U, 18U},
|
||||||
|
{',', 0xEEAEE000U, 22U},
|
||||||
|
{'-', 0xEAAE0000U, 18U},
|
||||||
|
{'=', 0xEAB80000U, 16U},
|
||||||
|
{'.', 0xBAEB8000U, 20U},
|
||||||
|
{' ', 0x00000000U, 4U},
|
||||||
|
{0U, 0x00000000U, 0U}
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
||||||
|
|
||||||
|
#define WRITE_BIT_FM(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
||||||
|
#define READ_BIT_FM(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7])
|
||||||
|
|
||||||
|
CFMKeyer::CFMKeyer() :
|
||||||
|
m_wanted(false),
|
||||||
|
m_poBuffer(),
|
||||||
|
m_poLen(0U),
|
||||||
|
m_poPos(0U),
|
||||||
|
m_dotLen(0U),
|
||||||
|
m_dotPos(0U),
|
||||||
|
m_audio(NULL),
|
||||||
|
m_audioLen(0U),
|
||||||
|
m_audioPos(0U),
|
||||||
|
m_highLevel(0U),
|
||||||
|
m_lowLevel(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CFMKeyer::setParams(const char* text, uint8_t speed, uint16_t frequency, uint8_t highLevel, uint8_t lowLevel)
|
||||||
|
{
|
||||||
|
m_poLen = 0U;
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; text[i] != '\0'; i++) {
|
||||||
|
for (uint8_t j = 0U; SYMBOL_LIST[j].c != 0U; j++) {
|
||||||
|
if (SYMBOL_LIST[j].c == text[i]) {
|
||||||
|
uint32_t MASK = 0x80000000U;
|
||||||
|
for (uint8_t k = 0U; k < SYMBOL_LIST[j].length; k++, m_poLen++, MASK >>= 1) {
|
||||||
|
bool b = (SYMBOL_LIST[j].pattern & MASK) == MASK;
|
||||||
|
WRITE_BIT_FM(m_poBuffer, m_poLen, b);
|
||||||
|
|
||||||
|
if (m_poLen >= 995U) {
|
||||||
|
m_poLen = 0U;
|
||||||
|
return 4U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_highLevel = q15_t(highLevel);
|
||||||
|
m_lowLevel = q15_t(lowLevel);
|
||||||
|
|
||||||
|
m_dotLen = 24000U / speed; // In samples
|
||||||
|
|
||||||
|
m_audioLen = 24000U / frequency; // In samples
|
||||||
|
|
||||||
|
delete[] m_audio;
|
||||||
|
m_audio = new bool[m_audioLen];
|
||||||
|
|
||||||
|
for (uint16_t i = 0U; i < m_audioLen; i++) {
|
||||||
|
if (i < (m_audioLen / 2U))
|
||||||
|
m_audio[i] = true;
|
||||||
|
else
|
||||||
|
m_audio[i] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
q15_t CFMKeyer::getHighAudio()
|
||||||
|
{
|
||||||
|
q15_t output = 0U;
|
||||||
|
if (!m_wanted)
|
||||||
|
return 0U;
|
||||||
|
|
||||||
|
bool b = READ_BIT_FM(m_poBuffer, m_poPos);
|
||||||
|
if (b)
|
||||||
|
output = m_audio[m_audioPos] ? m_highLevel : -m_highLevel;
|
||||||
|
|
||||||
|
m_audioPos++;
|
||||||
|
if (m_audioPos >= m_audioLen)
|
||||||
|
m_audioPos = 0U;
|
||||||
|
m_dotPos++;
|
||||||
|
if (m_dotPos >= m_dotLen) {
|
||||||
|
m_dotPos = 0U;
|
||||||
|
m_poPos++;
|
||||||
|
if (m_poPos >= m_poLen) {
|
||||||
|
stop();
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
q15_t CFMKeyer::getLowAudio()
|
||||||
|
{
|
||||||
|
q15_t output = 0U;
|
||||||
|
if (!m_wanted)
|
||||||
|
return 0U;
|
||||||
|
|
||||||
|
bool b = READ_BIT_FM(m_poBuffer, m_poPos);
|
||||||
|
if (b)
|
||||||
|
output = m_audio[m_audioPos] ? m_lowLevel : -m_lowLevel;
|
||||||
|
|
||||||
|
m_audioPos++;
|
||||||
|
if (m_audioPos >= m_audioLen)
|
||||||
|
m_audioPos = 0U;
|
||||||
|
m_dotPos++;
|
||||||
|
if (m_dotPos >= m_dotLen) {
|
||||||
|
m_dotPos = 0U;
|
||||||
|
m_poPos++;
|
||||||
|
if (m_poPos >= m_poLen) {
|
||||||
|
stop();
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMKeyer::start()
|
||||||
|
{
|
||||||
|
if (isRunning())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_wanted = true;
|
||||||
|
m_poPos = 0U;
|
||||||
|
m_dotPos = 0U;
|
||||||
|
m_audioPos = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMKeyer::stop()
|
||||||
|
{
|
||||||
|
m_wanted = false;
|
||||||
|
m_poPos = 0U;
|
||||||
|
m_dotPos = 0U;
|
||||||
|
m_audioPos = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFMKeyer::isWanted() const
|
||||||
|
{
|
||||||
|
return m_wanted;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFMKeyer::isRunning() const
|
||||||
|
{
|
||||||
|
return m_poPos > 0U || m_dotPos > 0U || m_audioPos > 0U;
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(FMKeyer_H)
|
||||||
|
#define FMKeyer_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
class CFMKeyer {
|
||||||
|
public:
|
||||||
|
CFMKeyer();
|
||||||
|
|
||||||
|
uint8_t setParams(const char* text, uint8_t speed, uint16_t frequency, uint8_t highLevel, uint8_t lowLevel);
|
||||||
|
|
||||||
|
q15_t getHighAudio();
|
||||||
|
q15_t getLowAudio();
|
||||||
|
|
||||||
|
void start();
|
||||||
|
void stop();
|
||||||
|
|
||||||
|
bool isRunning() const;
|
||||||
|
|
||||||
|
bool isWanted() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_wanted;
|
||||||
|
uint8_t m_poBuffer[1000U];
|
||||||
|
uint16_t m_poLen;
|
||||||
|
uint16_t m_poPos;
|
||||||
|
uint16_t m_dotLen;
|
||||||
|
uint16_t m_dotPos;
|
||||||
|
bool* m_audio;
|
||||||
|
uint16_t m_audioLen;
|
||||||
|
uint16_t m_audioPos;
|
||||||
|
q15_t m_highLevel;
|
||||||
|
q15_t m_lowLevel;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2020 by Geoffrey Merck F4FXL - KC3FRA
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(TSAMPLEPACK_H)
|
||||||
|
#define TSAMPLEPACK_H
|
||||||
|
|
||||||
|
struct TSamplePairPack {
|
||||||
|
uint8_t byte0;
|
||||||
|
uint8_t byte1;
|
||||||
|
uint8_t byte2;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "FMTimeout.h"
|
||||||
|
|
||||||
|
// 400 Hz sine wave at 24000 Hz sample rate
|
||||||
|
const q15_t BUSY_AUDIO[] = {0, 3426, 6813, 10126, 13328, 16384, 19261, 21926, 24351, 26510, 28378, 29935, 31164, 32052, 32588, 32767, 32588, 32052, 31164, 29935, 28378, 26510, 24351,
|
||||||
|
21926, 19261, 16384, 13328, 10126, 6813, 3425, 0, -3425, -6813, -10126, -13328, -16384, -19261, -21926, -24351, -26510, -28378, -29935, -31164, -32052,
|
||||||
|
-32588, -32768, -32588, -32052, -31164, -29935, -28378, -26510, -24351, -21926, -19261, -16384, -13328, -10126, -6813, -3425};
|
||||||
|
const uint8_t BUSY_AUDIO_LEN = 60U;
|
||||||
|
|
||||||
|
CFMTimeout::CFMTimeout() :
|
||||||
|
m_level(128 * 128),
|
||||||
|
m_running(false),
|
||||||
|
m_pos(0U),
|
||||||
|
m_n(0U)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMTimeout::setParams(uint8_t level)
|
||||||
|
{
|
||||||
|
m_level = q15_t(level * 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
q15_t CFMTimeout::getAudio()
|
||||||
|
{
|
||||||
|
q15_t sample = 0U;
|
||||||
|
if (!m_running)
|
||||||
|
return sample;
|
||||||
|
|
||||||
|
if (m_pos > 12000U) {
|
||||||
|
q31_t sample = BUSY_AUDIO[m_n] * m_level;
|
||||||
|
sample = q15_t(__SSAT((sample >> 15), 16));
|
||||||
|
|
||||||
|
m_n++;
|
||||||
|
if (m_n >= BUSY_AUDIO_LEN)
|
||||||
|
m_n = 0U;
|
||||||
|
} else {
|
||||||
|
sample = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pos++;
|
||||||
|
if (m_pos >= 24000U)
|
||||||
|
m_pos = 0U;
|
||||||
|
|
||||||
|
return sample;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMTimeout::start()
|
||||||
|
{
|
||||||
|
m_running = true;
|
||||||
|
m_pos = 0U;
|
||||||
|
m_n = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMTimeout::stop()
|
||||||
|
{
|
||||||
|
m_running = false;
|
||||||
|
}
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(FMTimeout_H)
|
||||||
|
#define FMTimeout_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
class CFMTimeout {
|
||||||
|
public:
|
||||||
|
CFMTimeout();
|
||||||
|
|
||||||
|
void setParams(uint8_t level);
|
||||||
|
|
||||||
|
void start();
|
||||||
|
void stop();
|
||||||
|
|
||||||
|
q15_t getAudio();
|
||||||
|
|
||||||
|
private:
|
||||||
|
q15_t m_level;
|
||||||
|
bool m_running;
|
||||||
|
uint32_t m_pos;
|
||||||
|
uint8_t m_n;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
+70
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009,2010,2015,2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "FMTimer.h"
|
||||||
|
|
||||||
|
CFMTimer::CFMTimer() :
|
||||||
|
m_timeout(0U),
|
||||||
|
m_timer(0U)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMTimer::setTimeout(uint16_t secs, uint32_t msecs)
|
||||||
|
{
|
||||||
|
m_timeout = (secs * 24000U) + (msecs * 24U);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CFMTimer::getTimeout() const
|
||||||
|
{
|
||||||
|
return m_timeout / 24U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMTimer::start()
|
||||||
|
{
|
||||||
|
if (m_timeout > 0U)
|
||||||
|
m_timer = 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMTimer::stop()
|
||||||
|
{
|
||||||
|
m_timer = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMTimer::clock(uint8_t length)
|
||||||
|
{
|
||||||
|
if (m_timer > 0U && m_timeout > 0U)
|
||||||
|
m_timer += length;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFMTimer::isRunning() const
|
||||||
|
{
|
||||||
|
return m_timer > 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFMTimer::hasExpired() const
|
||||||
|
{
|
||||||
|
if (m_timeout == 0U || m_timer == 0U)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (m_timer > m_timeout)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009,2010,2015,2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(FMTimer_H)
|
||||||
|
#define FMTimer_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
class CFMTimer {
|
||||||
|
public:
|
||||||
|
CFMTimer();
|
||||||
|
|
||||||
|
void setTimeout(uint16_t secs, uint32_t msecs);
|
||||||
|
|
||||||
|
uint32_t getTimeout() const;
|
||||||
|
|
||||||
|
void start();
|
||||||
|
|
||||||
|
void stop();
|
||||||
|
|
||||||
|
void clock(uint8_t length);
|
||||||
|
|
||||||
|
bool isRunning() const;
|
||||||
|
|
||||||
|
bool hasExpired() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32_t m_timeout;
|
||||||
|
uint32_t m_timer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2020 by Geoffrey Merck F4FXL - KC3FRA
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "FMUpSampler.h"
|
||||||
|
|
||||||
|
const uint32_t FM_UPSAMPLE_MASK = 0x00000FFFU;
|
||||||
|
|
||||||
|
CFMUpSampler::CFMUpSampler() :
|
||||||
|
m_upSampleIndex(0),
|
||||||
|
m_pack(0U),
|
||||||
|
m_packPointer(NULL),
|
||||||
|
m_samples(3600U), //300ms of 12 bit 8kHz audio
|
||||||
|
m_running(false)
|
||||||
|
{
|
||||||
|
m_packPointer = (uint8_t*)&m_pack;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMUpSampler::reset()
|
||||||
|
{
|
||||||
|
m_upSampleIndex = 0U;
|
||||||
|
m_pack = 0U;
|
||||||
|
m_samples.reset();
|
||||||
|
m_running = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFMUpSampler::addData(const uint8_t* data, uint16_t length)
|
||||||
|
{
|
||||||
|
TSamplePairPack* packPointer = (TSamplePairPack*)data;
|
||||||
|
TSamplePairPack* packPointerEnd = packPointer + (length / 3U);
|
||||||
|
while(packPointer != packPointerEnd) {
|
||||||
|
m_samples.put(*packPointer);
|
||||||
|
packPointer++;
|
||||||
|
}
|
||||||
|
if(!m_running)
|
||||||
|
m_running = m_samples.getData() > 300U;//75ms of audio
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFMUpSampler::getSample(q15_t& sample)
|
||||||
|
{
|
||||||
|
if(!m_running)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch (m_upSampleIndex)
|
||||||
|
{
|
||||||
|
case 0: {
|
||||||
|
TSamplePairPack pairPack;
|
||||||
|
if(!m_samples.get(pairPack)) {
|
||||||
|
m_running = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pack = 0U;
|
||||||
|
m_packPointer = (uint8_t*)&m_pack;
|
||||||
|
|
||||||
|
m_packPointer[0U] = pairPack.byte0;
|
||||||
|
m_packPointer[1U] = pairPack.byte1;
|
||||||
|
m_packPointer[2U] = pairPack.byte2;
|
||||||
|
|
||||||
|
sample = q15_t(m_pack >> 12) - 2048;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
sample = q15_t(m_pack & FM_UPSAMPLE_MASK) - 2048;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sample = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_upSampleIndex++;
|
||||||
|
if(m_upSampleIndex >= 6U)
|
||||||
|
m_upSampleIndex = 0U;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t CFMUpSampler::getSpace() const
|
||||||
|
{
|
||||||
|
//return available space in bytes
|
||||||
|
return m_samples.getSpace() * sizeof(TSamplePairPack);
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2020 by Geoffrey Merck F4FXL - KC3FRA
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(FMUPSAMPLER_H)
|
||||||
|
#define FMUPSAMPLER_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "RingBuffer.h"
|
||||||
|
#include "FMSamplePairPack.h"
|
||||||
|
|
||||||
|
class CFMUpSampler {
|
||||||
|
public:
|
||||||
|
CFMUpSampler();
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
void addData(const uint8_t* data, uint16_t length);
|
||||||
|
|
||||||
|
bool getSample(q15_t& sample);
|
||||||
|
|
||||||
|
uint16_t getSpace() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t m_upSampleIndex;
|
||||||
|
uint32_t m_pack;
|
||||||
|
uint8_t * m_packPointer;
|
||||||
|
CRingBuffer<TSamplePairPack> m_samples;
|
||||||
|
bool m_running;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "STM32Utils.h"
|
#include "STM32Utils.h"
|
||||||
#else
|
#else
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#undef PI //Undefine PI to get rid of annoying warning as it is also defined in arm_math.h.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__SAM3X8E__) || defined(STM32F105xC)
|
#if defined(__SAM3X8E__) || defined(STM32F105xC)
|
||||||
@@ -50,6 +51,7 @@ enum MMDVM_STATE {
|
|||||||
STATE_P25 = 4,
|
STATE_P25 = 4,
|
||||||
STATE_NXDN = 5,
|
STATE_NXDN = 5,
|
||||||
STATE_POCSAG = 6,
|
STATE_POCSAG = 6,
|
||||||
|
STATE_FM = 10,
|
||||||
|
|
||||||
// Dummy states start at 90
|
// Dummy states start at 90
|
||||||
STATE_NXDNCAL1K = 91,
|
STATE_NXDNCAL1K = 91,
|
||||||
@@ -60,7 +62,15 @@ enum MMDVM_STATE {
|
|||||||
STATE_RSSICAL = 96,
|
STATE_RSSICAL = 96,
|
||||||
STATE_CWID = 97,
|
STATE_CWID = 97,
|
||||||
STATE_DMRCAL = 98,
|
STATE_DMRCAL = 98,
|
||||||
STATE_DSTARCAL = 99
|
STATE_DSTARCAL = 99,
|
||||||
|
STATE_INTCAL = 100,
|
||||||
|
STATE_POCSAGCAL = 101,
|
||||||
|
STATE_FMCAL10K = 102,
|
||||||
|
STATE_FMCAL12K = 103,
|
||||||
|
STATE_FMCAL15K = 104,
|
||||||
|
STATE_FMCAL20K = 105,
|
||||||
|
STATE_FMCAL25K = 106,
|
||||||
|
STATE_FMCAL30K = 107
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "SerialPort.h"
|
#include "SerialPort.h"
|
||||||
@@ -80,13 +90,16 @@ enum MMDVM_STATE {
|
|||||||
#include "POCSAGTX.h"
|
#include "POCSAGTX.h"
|
||||||
#include "CalDStarRX.h"
|
#include "CalDStarRX.h"
|
||||||
#include "CalDStarTX.h"
|
#include "CalDStarTX.h"
|
||||||
|
#include "CalFM.h"
|
||||||
#include "CalDMR.h"
|
#include "CalDMR.h"
|
||||||
#include "CalP25.h"
|
#include "CalP25.h"
|
||||||
#include "CalNXDN.h"
|
#include "CalNXDN.h"
|
||||||
|
#include "CalPOCSAG.h"
|
||||||
#include "CalRSSI.h"
|
#include "CalRSSI.h"
|
||||||
#include "CWIdTX.h"
|
#include "CWIdTX.h"
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
#include "IO.h"
|
#include "IO.h"
|
||||||
|
#include "FM.h"
|
||||||
|
|
||||||
const uint8_t MARK_SLOT1 = 0x08U;
|
const uint8_t MARK_SLOT1 = 0x08U;
|
||||||
const uint8_t MARK_SLOT2 = 0x04U;
|
const uint8_t MARK_SLOT2 = 0x04U;
|
||||||
@@ -97,6 +110,12 @@ const uint16_t RX_BLOCK_SIZE = 2U;
|
|||||||
const uint16_t TX_RINGBUFFER_SIZE = 500U;
|
const uint16_t TX_RINGBUFFER_SIZE = 500U;
|
||||||
const uint16_t RX_RINGBUFFER_SIZE = 600U;
|
const uint16_t RX_RINGBUFFER_SIZE = 600U;
|
||||||
|
|
||||||
|
#if defined(STM32F105xC) || defined(__MK20DX256__)
|
||||||
|
const uint16_t TX_BUFFER_LEN = 2000U;
|
||||||
|
#else
|
||||||
|
const uint16_t TX_BUFFER_LEN = 4000U;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern MMDVM_STATE m_modemState;
|
extern MMDVM_STATE m_modemState;
|
||||||
|
|
||||||
extern bool m_dstarEnable;
|
extern bool m_dstarEnable;
|
||||||
@@ -105,6 +124,7 @@ extern bool m_ysfEnable;
|
|||||||
extern bool m_p25Enable;
|
extern bool m_p25Enable;
|
||||||
extern bool m_nxdnEnable;
|
extern bool m_nxdnEnable;
|
||||||
extern bool m_pocsagEnable;
|
extern bool m_pocsagEnable;
|
||||||
|
extern bool m_fmEnable;
|
||||||
|
|
||||||
extern bool m_duplex;
|
extern bool m_duplex;
|
||||||
|
|
||||||
@@ -135,14 +155,17 @@ extern CNXDNTX nxdnTX;
|
|||||||
|
|
||||||
extern CPOCSAGTX pocsagTX;
|
extern CPOCSAGTX pocsagTX;
|
||||||
|
|
||||||
|
extern CFM fm;
|
||||||
|
|
||||||
extern CCalDStarRX calDStarRX;
|
extern CCalDStarRX calDStarRX;
|
||||||
extern CCalDStarTX calDStarTX;
|
extern CCalDStarTX calDStarTX;
|
||||||
extern CCalDMR calDMR;
|
extern CCalDMR calDMR;
|
||||||
|
extern CCalFM calFM;
|
||||||
extern CCalP25 calP25;
|
extern CCalP25 calP25;
|
||||||
extern CCalNXDN calNXDN;
|
extern CCalNXDN calNXDN;
|
||||||
|
extern CCalPOCSAG calPOCSAG;
|
||||||
extern CCalRSSI calRSSI;
|
extern CCalRSSI calRSSI;
|
||||||
|
|
||||||
extern CCWIdTX cwIdTX;
|
extern CCWIdTX cwIdTX;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2015 by Jim Mclaughlin KI6ZUM
|
* Copyright (C) 2015 by Jim Mclaughlin KI6ZUM
|
||||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
*
|
*
|
||||||
@@ -80,6 +80,7 @@ m_ysfTXLevel(128 * 128),
|
|||||||
m_p25TXLevel(128 * 128),
|
m_p25TXLevel(128 * 128),
|
||||||
m_nxdnTXLevel(128 * 128),
|
m_nxdnTXLevel(128 * 128),
|
||||||
m_pocsagTXLevel(128 * 128),
|
m_pocsagTXLevel(128 * 128),
|
||||||
|
m_fmTXLevel(128 * 128),
|
||||||
m_rxDCOffset(DC_OFFSET),
|
m_rxDCOffset(DC_OFFSET),
|
||||||
m_txDCOffset(DC_OFFSET),
|
m_txDCOffset(DC_OFFSET),
|
||||||
m_ledCount(0U),
|
m_ledCount(0U),
|
||||||
@@ -137,123 +138,75 @@ void CIO::selfTest()
|
|||||||
// We exclude PTT to avoid trigger the transmitter
|
// We exclude PTT to avoid trigger the transmitter
|
||||||
setLEDInt(ledValue);
|
setLEDInt(ledValue);
|
||||||
setCOSInt(ledValue);
|
setCOSInt(ledValue);
|
||||||
#if defined(MODE_PINS)
|
#if defined(MODE_LEDS)
|
||||||
setDStarInt(ledValue);
|
setDStarInt(ledValue);
|
||||||
setDMRInt(ledValue);
|
setDMRInt(ledValue);
|
||||||
setYSFInt(ledValue);
|
setYSFInt(ledValue);
|
||||||
setP25Int(ledValue);
|
setP25Int(ledValue);
|
||||||
setNXDNInt(ledValue);
|
setNXDNInt(ledValue);
|
||||||
setPOCSAGInt(ledValue);
|
setPOCSAGInt(ledValue);
|
||||||
|
setFMInt(ledValue);
|
||||||
#endif
|
#endif
|
||||||
delayInt(250);
|
delayInt(250);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MODE_PINS)
|
#if defined(MODE_LEDS)
|
||||||
setDStarInt(true);
|
setDStarInt(true);
|
||||||
setDMRInt(false);
|
setDMRInt(false);
|
||||||
setYSFInt(false);
|
setYSFInt(false);
|
||||||
setP25Int(false);
|
setP25Int(false);
|
||||||
setNXDNInt(false);
|
setNXDNInt(false);
|
||||||
setPOCSAGInt(false);
|
setPOCSAGInt(false);
|
||||||
|
setFMInt(false);
|
||||||
|
|
||||||
delayInt(250);
|
delayInt(250);
|
||||||
|
|
||||||
setDStarInt(true);
|
|
||||||
setDMRInt(true);
|
setDMRInt(true);
|
||||||
setYSFInt(false);
|
|
||||||
setP25Int(false);
|
|
||||||
setNXDNInt(false);
|
|
||||||
setPOCSAGInt(false);
|
|
||||||
|
|
||||||
delayInt(250);
|
delayInt(250);
|
||||||
|
|
||||||
setDStarInt(true);
|
|
||||||
setDMRInt(true);
|
|
||||||
setYSFInt(true);
|
setYSFInt(true);
|
||||||
setP25Int(false);
|
|
||||||
setNXDNInt(false);
|
|
||||||
setPOCSAGInt(false);
|
|
||||||
|
|
||||||
delayInt(250);
|
|
||||||
|
|
||||||
setDStarInt(true);
|
delayInt(250);
|
||||||
setDMRInt(true);
|
|
||||||
setYSFInt(true);
|
|
||||||
setP25Int(true);
|
setP25Int(true);
|
||||||
setNXDNInt(false);
|
|
||||||
setPOCSAGInt(false);
|
|
||||||
|
|
||||||
delayInt(250);
|
|
||||||
|
|
||||||
setDStarInt(true);
|
#if !defined(USE_ALTERNATE_NXDN_LEDS)
|
||||||
setDMRInt(true);
|
delayInt(250);
|
||||||
setYSFInt(true);
|
|
||||||
setP25Int(true);
|
|
||||||
setNXDNInt(true);
|
setNXDNInt(true);
|
||||||
setPOCSAGInt(false);
|
#endif
|
||||||
|
|
||||||
delayInt(250);
|
|
||||||
|
|
||||||
setDStarInt(true);
|
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
setDMRInt(true);
|
delayInt(250);
|
||||||
setYSFInt(true);
|
|
||||||
setP25Int(true);
|
|
||||||
setNXDNInt(true);
|
|
||||||
setPOCSAGInt(true);
|
setPOCSAGInt(true);
|
||||||
|
#endif
|
||||||
delayInt(250);
|
|
||||||
|
|
||||||
setDStarInt(true);
|
#if !defined(USE_ALTERNATE_FM_LEDS)
|
||||||
setDMRInt(true);
|
delayInt(250);
|
||||||
setYSFInt(true);
|
setFMInt(true);
|
||||||
setP25Int(true);
|
|
||||||
setNXDNInt(true);
|
delayInt(250);
|
||||||
|
setFMInt(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
|
delayInt(250);
|
||||||
setPOCSAGInt(false);
|
setPOCSAGInt(false);
|
||||||
|
#endif
|
||||||
delayInt(250);
|
|
||||||
|
|
||||||
setDStarInt(true);
|
#if !defined(USE_ALTERNATE_NXDN_LEDS)
|
||||||
setDMRInt(true);
|
delayInt(250);
|
||||||
setYSFInt(true);
|
|
||||||
setP25Int(true);
|
|
||||||
setNXDNInt(false);
|
setNXDNInt(false);
|
||||||
setPOCSAGInt(false);
|
#endif
|
||||||
|
|
||||||
delayInt(250);
|
delayInt(250);
|
||||||
|
|
||||||
setDStarInt(true);
|
|
||||||
setDMRInt(true);
|
|
||||||
setYSFInt(true);
|
|
||||||
setP25Int(false);
|
setP25Int(false);
|
||||||
setNXDNInt(false);
|
|
||||||
setPOCSAGInt(false);
|
|
||||||
|
|
||||||
delayInt(250);
|
delayInt(250);
|
||||||
|
|
||||||
setDStarInt(true);
|
|
||||||
setDMRInt(true);
|
|
||||||
setYSFInt(false);
|
setYSFInt(false);
|
||||||
setP25Int(false);
|
|
||||||
setNXDNInt(false);
|
|
||||||
setPOCSAGInt(false);
|
|
||||||
|
|
||||||
delayInt(250);
|
delayInt(250);
|
||||||
|
|
||||||
setDStarInt(true);
|
|
||||||
setDMRInt(false);
|
setDMRInt(false);
|
||||||
setYSFInt(false);
|
|
||||||
setP25Int(false);
|
|
||||||
setNXDNInt(false);
|
|
||||||
setPOCSAGInt(false);
|
|
||||||
|
|
||||||
delayInt(250);
|
delayInt(250);
|
||||||
|
|
||||||
setDStarInt(false);
|
setDStarInt(false);
|
||||||
setDMRInt(false);
|
|
||||||
setYSFInt(false);
|
|
||||||
setP25Int(false);
|
|
||||||
setNXDNInt(false);
|
|
||||||
setPOCSAGInt(false);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,6 +264,7 @@ void CIO::process()
|
|||||||
if (m_txBuffer.getData() == 0U && m_tx) {
|
if (m_txBuffer.getData() == 0U && m_tx) {
|
||||||
m_tx = false;
|
m_tx = false;
|
||||||
setPTTInt(m_pttInvert ? true : false);
|
setPTTInt(m_pttInvert ? true : false);
|
||||||
|
DEBUG1("TX OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_rxBuffer.getData() >= RX_BLOCK_SIZE) {
|
if (m_rxBuffer.getData() >= RX_BLOCK_SIZE) {
|
||||||
@@ -319,15 +273,16 @@ void CIO::process()
|
|||||||
uint16_t rssi[RX_BLOCK_SIZE];
|
uint16_t rssi[RX_BLOCK_SIZE];
|
||||||
|
|
||||||
for (uint16_t i = 0U; i < RX_BLOCK_SIZE; i++) {
|
for (uint16_t i = 0U; i < RX_BLOCK_SIZE; i++) {
|
||||||
uint16_t sample;
|
TSample sample;
|
||||||
m_rxBuffer.get(sample, control[i]);
|
m_rxBuffer.get(sample);
|
||||||
|
control[i] = sample.control;
|
||||||
m_rssiBuffer.get(rssi[i]);
|
m_rssiBuffer.get(rssi[i]);
|
||||||
|
|
||||||
// Detect ADC overflow
|
// Detect ADC overflow
|
||||||
if (m_detect && (sample == 0U || sample == 4095U))
|
if (m_detect && (sample.sample == 0U || sample.sample == 4095U))
|
||||||
m_adcOverflow++;
|
m_adcOverflow++;
|
||||||
|
|
||||||
q15_t res1 = q15_t(sample) - m_rxDCOffset;
|
q15_t res1 = q15_t(sample.sample) - m_rxDCOffset;
|
||||||
q31_t res2 = res1 * m_rxLevel;
|
q31_t res2 = res1 * m_rxLevel;
|
||||||
samples[i] = q15_t(__SSAT((res2 >> 15), 16));
|
samples[i] = q15_t(__SSAT((res2 >> 15), 16));
|
||||||
}
|
}
|
||||||
@@ -402,6 +357,15 @@ void CIO::process()
|
|||||||
dmrDMORX.samples(RRCVals, rssi, RX_BLOCK_SIZE);
|
dmrDMORX.samples(RRCVals, rssi, RX_BLOCK_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_fmEnable) {
|
||||||
|
bool cos = getCOSInt();
|
||||||
|
#if defined(USE_DCBLOCKER)
|
||||||
|
fm.samples(cos, dcSamples, RX_BLOCK_SIZE);
|
||||||
|
#else
|
||||||
|
fm.samples(cos, samples, RX_BLOCK_SIZE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
} else if (m_modemState == STATE_DSTAR) {
|
} else if (m_modemState == STATE_DSTAR) {
|
||||||
if (m_dstarEnable) {
|
if (m_dstarEnable) {
|
||||||
q15_t GMSKVals[RX_BLOCK_SIZE];
|
q15_t GMSKVals[RX_BLOCK_SIZE];
|
||||||
@@ -460,6 +424,13 @@ void CIO::process()
|
|||||||
|
|
||||||
nxdnRX.samples(NXDNVals, rssi, RX_BLOCK_SIZE);
|
nxdnRX.samples(NXDNVals, rssi, RX_BLOCK_SIZE);
|
||||||
}
|
}
|
||||||
|
} else if (m_modemState == STATE_FM) {
|
||||||
|
bool cos = getCOSInt();
|
||||||
|
#if defined(USE_DCBLOCKER)
|
||||||
|
fm.samples(cos, dcSamples, RX_BLOCK_SIZE);
|
||||||
|
#else
|
||||||
|
fm.samples(cos, samples, RX_BLOCK_SIZE);
|
||||||
|
#endif
|
||||||
} else if (m_modemState == STATE_DSTARCAL) {
|
} else if (m_modemState == STATE_DSTARCAL) {
|
||||||
q15_t GMSKVals[RX_BLOCK_SIZE];
|
q15_t GMSKVals[RX_BLOCK_SIZE];
|
||||||
::arm_fir_fast_q15(&m_gaussianFilter, samples, GMSKVals, RX_BLOCK_SIZE);
|
::arm_fir_fast_q15(&m_gaussianFilter, samples, GMSKVals, RX_BLOCK_SIZE);
|
||||||
@@ -483,6 +454,7 @@ void CIO::write(MMDVM_STATE mode, q15_t* samples, uint16_t length, const uint8_t
|
|||||||
if (!m_tx) {
|
if (!m_tx) {
|
||||||
m_tx = true;
|
m_tx = true;
|
||||||
setPTTInt(m_pttInvert ? false : true);
|
setPTTInt(m_pttInvert ? false : true);
|
||||||
|
DEBUG1("TX ON");
|
||||||
}
|
}
|
||||||
|
|
||||||
q15_t txLevel = 0;
|
q15_t txLevel = 0;
|
||||||
@@ -505,6 +477,9 @@ void CIO::write(MMDVM_STATE mode, q15_t* samples, uint16_t length, const uint8_t
|
|||||||
case STATE_POCSAG:
|
case STATE_POCSAG:
|
||||||
txLevel = m_pocsagTXLevel;
|
txLevel = m_pocsagTXLevel;
|
||||||
break;
|
break;
|
||||||
|
case STATE_FM:
|
||||||
|
txLevel = m_fmTXLevel;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
txLevel = m_cwIdTXLevel;
|
txLevel = m_cwIdTXLevel;
|
||||||
break;
|
break;
|
||||||
@@ -520,9 +495,9 @@ void CIO::write(MMDVM_STATE mode, q15_t* samples, uint16_t length, const uint8_t
|
|||||||
m_dacOverflow++;
|
m_dacOverflow++;
|
||||||
|
|
||||||
if (control == NULL)
|
if (control == NULL)
|
||||||
m_txBuffer.put(res3, MARK_NONE);
|
m_txBuffer.put({res3, MARK_NONE});
|
||||||
else
|
else
|
||||||
m_txBuffer.put(res3, control[i]);
|
m_txBuffer.put({res3, control[i]});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,17 +521,18 @@ void CIO::setADCDetection(bool detect)
|
|||||||
|
|
||||||
void CIO::setMode()
|
void CIO::setMode()
|
||||||
{
|
{
|
||||||
#if defined(MODE_PINS)
|
#if defined(MODE_LEDS)
|
||||||
setDStarInt(m_modemState == STATE_DSTAR);
|
setDStarInt(m_modemState == STATE_DSTAR);
|
||||||
setDMRInt(m_modemState == STATE_DMR);
|
setDMRInt(m_modemState == STATE_DMR);
|
||||||
setYSFInt(m_modemState == STATE_YSF);
|
setYSFInt(m_modemState == STATE_YSF);
|
||||||
setP25Int(m_modemState == STATE_P25);
|
setP25Int(m_modemState == STATE_P25);
|
||||||
setNXDNInt(m_modemState == STATE_NXDN);
|
setNXDNInt(m_modemState == STATE_NXDN);
|
||||||
setPOCSAGInt(m_modemState == STATE_POCSAG);
|
setPOCSAGInt(m_modemState == STATE_POCSAG);
|
||||||
|
setFMInt(m_modemState == STATE_FM);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, int16_t txDCOffset, int16_t rxDCOffset)
|
void CIO::setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, uint8_t fmTXLevel, int16_t txDCOffset, int16_t rxDCOffset)
|
||||||
{
|
{
|
||||||
m_pttInvert = pttInvert;
|
m_pttInvert = pttInvert;
|
||||||
|
|
||||||
@@ -568,6 +544,7 @@ void CIO::setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rx
|
|||||||
m_p25TXLevel = q15_t(p25TXLevel * 128);
|
m_p25TXLevel = q15_t(p25TXLevel * 128);
|
||||||
m_nxdnTXLevel = q15_t(nxdnTXLevel * 128);
|
m_nxdnTXLevel = q15_t(nxdnTXLevel * 128);
|
||||||
m_pocsagTXLevel = q15_t(pocsagTXLevel * 128);
|
m_pocsagTXLevel = q15_t(pocsagTXLevel * 128);
|
||||||
|
m_fmTXLevel = q15_t(fmTXLevel * 128);
|
||||||
|
|
||||||
m_rxDCOffset = DC_OFFSET + rxDCOffset;
|
m_rxDCOffset = DC_OFFSET + rxDCOffset;
|
||||||
m_txDCOffset = DC_OFFSET + txDCOffset;
|
m_txDCOffset = DC_OFFSET + txDCOffset;
|
||||||
@@ -618,4 +595,3 @@ bool CIO::hasLockout() const
|
|||||||
{
|
{
|
||||||
return m_lockout;
|
return m_lockout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,8 +21,12 @@
|
|||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
#include "SampleRB.h"
|
#include "RingBuffer.h"
|
||||||
#include "RSSIRB.h"
|
|
||||||
|
struct TSample {
|
||||||
|
volatile uint16_t sample;
|
||||||
|
volatile uint8_t control;
|
||||||
|
};
|
||||||
|
|
||||||
class CIO {
|
class CIO {
|
||||||
public:
|
public:
|
||||||
@@ -42,7 +46,7 @@ public:
|
|||||||
|
|
||||||
void interrupt();
|
void interrupt();
|
||||||
|
|
||||||
void setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, int16_t txDCOffset, int16_t rxDCOffset);
|
void setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, uint8_t fmTXLevel, int16_t txDCOffset, int16_t rxDCOffset);
|
||||||
|
|
||||||
void getOverflow(bool& adcOverflow, bool& dacOverflow);
|
void getOverflow(bool& adcOverflow, bool& dacOverflow);
|
||||||
|
|
||||||
@@ -57,11 +61,11 @@ public:
|
|||||||
void selfTest();
|
void selfTest();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_started;
|
bool m_started;
|
||||||
|
|
||||||
CSampleRB m_rxBuffer;
|
CRingBuffer<TSample> m_rxBuffer;
|
||||||
CSampleRB m_txBuffer;
|
CRingBuffer<TSample> m_txBuffer;
|
||||||
CRSSIRB m_rssiBuffer;
|
CRingBuffer<uint16_t> m_rssiBuffer;
|
||||||
|
|
||||||
arm_biquad_casd_df1_inst_q31 m_dcFilter;
|
arm_biquad_casd_df1_inst_q31 m_dcFilter;
|
||||||
q31_t m_dcState[4];
|
q31_t m_dcState[4];
|
||||||
@@ -86,6 +90,7 @@ private:
|
|||||||
q15_t m_p25TXLevel;
|
q15_t m_p25TXLevel;
|
||||||
q15_t m_nxdnTXLevel;
|
q15_t m_nxdnTXLevel;
|
||||||
q15_t m_pocsagTXLevel;
|
q15_t m_pocsagTXLevel;
|
||||||
|
q15_t m_fmTXLevel;
|
||||||
|
|
||||||
uint16_t m_rxDCOffset;
|
uint16_t m_rxDCOffset;
|
||||||
uint16_t m_txDCOffset;
|
uint16_t m_txDCOffset;
|
||||||
@@ -118,9 +123,9 @@ private:
|
|||||||
void setP25Int(bool on);
|
void setP25Int(bool on);
|
||||||
void setNXDNInt(bool on);
|
void setNXDNInt(bool on);
|
||||||
void setPOCSAGInt(bool on);
|
void setPOCSAGInt(bool on);
|
||||||
|
void setFMInt(bool on);
|
||||||
|
|
||||||
void delayInt(unsigned int dly);
|
void delayInt(unsigned int dly);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2015 by Jim Mclaughlin KI6ZUM
|
* Copyright (C) 2015 by Jim Mclaughlin KI6ZUM
|
||||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
*
|
*
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
#define PIN_P25 19
|
#define PIN_P25 19
|
||||||
#define PIN_NXDN 20
|
#define PIN_NXDN 20
|
||||||
#define PIN_POCSAG 4
|
#define PIN_POCSAG 4
|
||||||
|
#define PIN_FM 5
|
||||||
#define ADC_CHER_Chan (1<<7) // ADC on Due pin A0 - Due AD7 - (1 << 7)
|
#define ADC_CHER_Chan (1<<7) // ADC on Due pin A0 - Due AD7 - (1 << 7)
|
||||||
#define ADC_ISR_EOC_Chan ADC_ISR_EOC7
|
#define ADC_ISR_EOC_Chan ADC_ISR_EOC7
|
||||||
#define ADC_CDR_Chan 7
|
#define ADC_CDR_Chan 7
|
||||||
@@ -50,6 +51,7 @@
|
|||||||
#define PIN_P25 6
|
#define PIN_P25 6
|
||||||
#define PIN_NXDN 5
|
#define PIN_NXDN 5
|
||||||
#define PIN_POCSAG 4
|
#define PIN_POCSAG 4
|
||||||
|
#define PIN_FM 3
|
||||||
#define ADC_CHER_Chan (1<<13) // ADC on Due pin A11 - Due AD13 - (1 << 13)
|
#define ADC_CHER_Chan (1<<13) // ADC on Due pin A11 - Due AD13 - (1 << 13)
|
||||||
#define ADC_ISR_EOC_Chan ADC_ISR_EOC13
|
#define ADC_ISR_EOC_Chan ADC_ISR_EOC13
|
||||||
#define ADC_CDR_Chan 13
|
#define ADC_CDR_Chan 13
|
||||||
@@ -67,6 +69,7 @@
|
|||||||
#define PIN_P25 6
|
#define PIN_P25 6
|
||||||
#define PIN_NXDN 5
|
#define PIN_NXDN 5
|
||||||
#define PIN_POCSAG 4
|
#define PIN_POCSAG 4
|
||||||
|
#define PIN_FM 3
|
||||||
#define ADC_CHER_Chan (1<<7) // ADC on Due pin A0 - Due AD7 - (1 << 7)
|
#define ADC_CHER_Chan (1<<7) // ADC on Due pin A0 - Due AD7 - (1 << 7)
|
||||||
#define ADC_ISR_EOC_Chan ADC_ISR_EOC7
|
#define ADC_ISR_EOC_Chan ADC_ISR_EOC7
|
||||||
#define ADC_CDR_Chan 7
|
#define ADC_CDR_Chan 7
|
||||||
@@ -95,7 +98,7 @@ void CIO::initInt()
|
|||||||
pinMode(PIN_LED, OUTPUT);
|
pinMode(PIN_LED, OUTPUT);
|
||||||
pinMode(PIN_COS, INPUT);
|
pinMode(PIN_COS, INPUT);
|
||||||
|
|
||||||
#if defined(MODE_PINS)
|
#if defined(MODE_LEDS)
|
||||||
// Set up the mode output pins
|
// Set up the mode output pins
|
||||||
pinMode(PIN_DSTAR, OUTPUT);
|
pinMode(PIN_DSTAR, OUTPUT);
|
||||||
pinMode(PIN_DMR, OUTPUT);
|
pinMode(PIN_DMR, OUTPUT);
|
||||||
@@ -107,6 +110,9 @@ void CIO::initInt()
|
|||||||
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
pinMode(PIN_POCSAG, OUTPUT);
|
pinMode(PIN_POCSAG, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
|
pinMode(PIN_FM, OUTPUT);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,14 +185,13 @@ void CIO::startInt()
|
|||||||
void CIO::interrupt()
|
void CIO::interrupt()
|
||||||
{
|
{
|
||||||
if ((ADC->ADC_ISR & ADC_ISR_EOC_Chan) == ADC_ISR_EOC_Chan) { // Ensure there was an End-of-Conversion and we read the ISR reg
|
if ((ADC->ADC_ISR & ADC_ISR_EOC_Chan) == ADC_ISR_EOC_Chan) { // Ensure there was an End-of-Conversion and we read the ISR reg
|
||||||
uint8_t control = MARK_NONE;
|
TSample sample = {DC_OFFSET, MARK_NONE};
|
||||||
uint16_t sample = DC_OFFSET;
|
|
||||||
|
|
||||||
m_txBuffer.get(sample, control);
|
m_txBuffer.get(sample);
|
||||||
DACC->DACC_CDR = sample;
|
DACC->DACC_CDR = sample.sample;
|
||||||
|
|
||||||
sample = ADC->ADC_CDR[ADC_CDR_Chan];
|
sample.sample = ADC->ADC_CDR[ADC_CDR_Chan];
|
||||||
m_rxBuffer.put(sample, control);
|
m_rxBuffer.put(sample);
|
||||||
|
|
||||||
#if defined(SEND_RSSI_DATA)
|
#if defined(SEND_RSSI_DATA)
|
||||||
m_rssiBuffer.put(ADC->ADC_CDR[RSSI_CDR_Chan]);
|
m_rssiBuffer.put(ADC->ADC_CDR[RSSI_CDR_Chan]);
|
||||||
@@ -258,10 +263,19 @@ void CIO::setPOCSAGInt(bool on)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CIO::setFMInt(bool on)
|
||||||
|
{
|
||||||
|
#if defined(USE_ALTERNATE_FM_LEDS)
|
||||||
|
digitalWrite(PIN_DSTAR, on ? HIGH : LOW);
|
||||||
|
digitalWrite(PIN_YSF, on ? HIGH : LOW);
|
||||||
|
#else
|
||||||
|
digitalWrite(PIN_FM, on ? HIGH : LOW);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void CIO::delayInt(unsigned int dly)
|
void CIO::delayInt(unsigned int dly)
|
||||||
{
|
{
|
||||||
delay(dly);
|
delay(dly);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _IO_PINS_H
|
||||||
|
#define _IO_PINS_H
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#error "Requires Config.h to be included first!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(STM32F4_RPT_HAT_TGO)
|
||||||
|
#include "pins/pins_f4_rpt_tgo.h"
|
||||||
|
|
||||||
|
#elif defined(STM32F4_DISCOVERY)
|
||||||
|
#include "pins/pins_f4_discovery.h"
|
||||||
|
|
||||||
|
#elif defined(STM32F4_PI)
|
||||||
|
#include "pins/pins_f4_pi.h"
|
||||||
|
|
||||||
|
#elif defined(STM32F722_PI)
|
||||||
|
#include "pins/pins_f7_pi.h"
|
||||||
|
|
||||||
|
#elif defined(STM32F4_F4M)
|
||||||
|
#include "pins/pins_f4_f4m.h"
|
||||||
|
|
||||||
|
#elif defined(STM32F722_F7M)
|
||||||
|
#include "pins/pins_f7_f7m.h"
|
||||||
|
|
||||||
|
#elif defined(STM32F722_RPT_HAT)
|
||||||
|
#include "pins/pins_f7_rpt_hat.h"
|
||||||
|
|
||||||
|
#elif defined(STM32F4_NUCLEO)
|
||||||
|
#if defined(STM32F4_NUCLEO_MORPHO_HEADER)
|
||||||
|
#include "pins/pins_f4_nucleo_morpho.h"
|
||||||
|
#elif defined(STM32F4_NUCLEO_ARDUINO_HEADER)
|
||||||
|
#include "pins/pins_f4_nucleo_arduino.h"
|
||||||
|
#else
|
||||||
|
#error "Either STM32F4_NUCLEO_MORPHO_HEADER or STM32F4_NUCLEO_ARDUINO_HEADER need to be defined"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined(STM32F7_NUCLEO)
|
||||||
|
#include "pins/pins_f7_nucleo.h"
|
||||||
|
|
||||||
|
#elif defined(STM32F4_DVM)
|
||||||
|
#include "pins/pins_f4_stm32dvm_v3.h"
|
||||||
|
|
||||||
|
#elif defined(DRCC_DVM_NQF)
|
||||||
|
#include "pins/pins_f4_drcc_nqf.h"
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error "A valid board type macro need to be defined."
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //#ifndef _IO_PINS_H
|
||||||
+61
-20
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
* Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
||||||
* Copyright (C) 2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2017,2018,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2017 by Wojciech Krutnik N0CALL
|
* Copyright (C) 2017 by Wojciech Krutnik N0CALL
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -41,6 +41,7 @@ YSF PB8 output
|
|||||||
P25 PB9 output
|
P25 PB9 output
|
||||||
NXDN PB10 output
|
NXDN PB10 output
|
||||||
POCSAG PB11 output
|
POCSAG PB11 output
|
||||||
|
FM PB12 output
|
||||||
|
|
||||||
RX PB0 analog input (ADC1_8)
|
RX PB0 analog input (ADC1_8)
|
||||||
RSSI PB1 analog input (ADC2_9)
|
RSSI PB1 analog input (ADC2_9)
|
||||||
@@ -84,6 +85,9 @@ USART1_RXD PA10 input (AF)
|
|||||||
#define PIN_POCSAG 11
|
#define PIN_POCSAG 11
|
||||||
#define PORT_POCSAG GPIOB
|
#define PORT_POCSAG GPIOB
|
||||||
#define BB_POCSAG *((bitband_t)BITBAND_PERIPH(&PORT_POCSAG->ODR, PIN_POCSAG))
|
#define BB_POCSAG *((bitband_t)BITBAND_PERIPH(&PORT_POCSAG->ODR, PIN_POCSAG))
|
||||||
|
#define PIN_FM 14
|
||||||
|
#define PORT_FM GPIOB
|
||||||
|
#define BB_FM *((bitband_t)BITBAND_PERIPH(&PORT_FM->ODR, PIN_FM))
|
||||||
|
|
||||||
#define PIN_RX 0
|
#define PIN_RX 0
|
||||||
#define PIN_RX_ADC_CH 8
|
#define PIN_RX_ADC_CH 8
|
||||||
@@ -154,16 +158,35 @@ void GPIOConfigPin(GPIO_TypeDef *port_ptr, uint32_t pin, uint32_t mode_cnf_value
|
|||||||
#if defined(STM32F1_POG)
|
#if defined(STM32F1_POG)
|
||||||
void FancyLEDEffect()
|
void FancyLEDEffect()
|
||||||
{
|
{
|
||||||
bitband_t foo[] = {&BB_LED, &BB_COSLED, &BB_PTT, &BB_DMR, &BB_DSTAR, &BB_YSF, &BB_P25};
|
int ledCount = 10;
|
||||||
|
|
||||||
for(int i=0; i<7; i++){
|
bitband_t foo[] = {&BB_LED, &BB_COSLED, &BB_PTT, &BB_DMR, &BB_DSTAR, &BB_YSF, &BB_P25,
|
||||||
*foo[i] = 0x01;
|
#if defined(USE_ALTERNATE_NXDN_LEDS)
|
||||||
|
NULL,
|
||||||
|
#else
|
||||||
|
&BB_NXDN,
|
||||||
|
#endif
|
||||||
|
#if defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
|
NULL,
|
||||||
|
#else
|
||||||
|
&BB_POCSAG,
|
||||||
|
#endif
|
||||||
|
#if defined(USE_ALTERNATE_FM_LEDS)
|
||||||
|
NULL};
|
||||||
|
#else
|
||||||
|
&BB_FM};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for(int i=0; i<ledCount; i++){
|
||||||
|
if(foo[i] != NULL)
|
||||||
|
*foo[i] = 0x01;
|
||||||
}
|
}
|
||||||
GPIOConfigPin(PORT_USART1_TXD, PIN_USART1_TXD, GPIO_CRL_MODE0_1);
|
GPIOConfigPin(PORT_USART1_TXD, PIN_USART1_TXD, GPIO_CRL_MODE0_1);
|
||||||
*((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x00;
|
*((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x00;
|
||||||
delay(SystemCoreClock/1000*100);
|
delay(SystemCoreClock/1000*100);
|
||||||
for(int i=0; i<7; i++){
|
for(int i=0; i<ledCount; i++){
|
||||||
*foo[i] = 0x00;
|
if(foo[i] != NULL)
|
||||||
|
*foo[i] = 0x00;
|
||||||
}
|
}
|
||||||
*((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x01;
|
*((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x01;
|
||||||
delay(SystemCoreClock/1000*20);
|
delay(SystemCoreClock/1000*20);
|
||||||
@@ -172,18 +195,22 @@ void FancyLEDEffect()
|
|||||||
*((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x01;
|
*((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x01;
|
||||||
|
|
||||||
*foo[0] = 0x01;
|
*foo[0] = 0x01;
|
||||||
for(int i=1; i<7; i++){
|
for(int i=1; i<ledCount; i++){
|
||||||
delay(SystemCoreClock/1000*10);
|
delay(SystemCoreClock/1000*10);
|
||||||
*foo[i-1] = 0x00;
|
if (foo[i-1] != NULL)
|
||||||
*foo[i] = 0x01;
|
*foo[i-1] = 0x00;
|
||||||
|
if (foo[i] != NULL)
|
||||||
|
*foo[i] = 0x01;
|
||||||
}
|
}
|
||||||
for(int i=5; i>=0; i--){
|
for(int i=ledCount - 2; i>=0; i--) {
|
||||||
delay(SystemCoreClock/1000*10);
|
delay(SystemCoreClock/1000*10);
|
||||||
*foo[i+1] = 0x00;
|
if (foo[i+1] != NULL)
|
||||||
*foo[i] = 0x01;
|
*foo[i+1] = 0x00;
|
||||||
|
if (foo[i] != NULL)
|
||||||
|
*foo[i] = 0x01;
|
||||||
}
|
}
|
||||||
delay(SystemCoreClock/1000*10);
|
delay(SystemCoreClock/1000*10);
|
||||||
*foo[5+1-6] = 0x00;
|
*foo[0] = 0x00;
|
||||||
*((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x00;
|
*((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x00;
|
||||||
delay(SystemCoreClock/1000*10);
|
delay(SystemCoreClock/1000*10);
|
||||||
*((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x01;
|
*((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x01;
|
||||||
@@ -228,6 +255,9 @@ static inline void GPIOInit()
|
|||||||
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
GPIOConfigPin(PORT_POCSAG, PIN_POCSAG, GPIO_CRL_MODE0_1);
|
GPIOConfigPin(PORT_POCSAG, PIN_POCSAG, GPIO_CRL_MODE0_1);
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(USE_ALTERNATE_FM_LEDS)
|
||||||
|
GPIOConfigPin(PORT_FM, PIN_FM, GPIO_CRL_MODE0_1);
|
||||||
|
#endif
|
||||||
|
|
||||||
GPIOConfigPin(PORT_RX, PIN_RX, 0);
|
GPIOConfigPin(PORT_RX, PIN_RX, 0);
|
||||||
#if defined(SEND_RSSI_DATA)
|
#if defined(SEND_RSSI_DATA)
|
||||||
@@ -367,9 +397,10 @@ void CIO::startInt()
|
|||||||
|
|
||||||
void CIO::interrupt()
|
void CIO::interrupt()
|
||||||
{
|
{
|
||||||
uint8_t control = MARK_NONE;
|
TSample sample = {DC_OFFSET, MARK_NONE};
|
||||||
uint16_t sample = DC_OFFSET;
|
#if defined(SEND_RSSI_DATA)
|
||||||
uint16_t rawRSSI = 0U;
|
uint16_t rawRSSI = 0U;
|
||||||
|
#endif
|
||||||
bitband_t eoc = (bitband_t)BITBAND_PERIPH(&ADC1->SR, ADC_SR_EOS_Pos);
|
bitband_t eoc = (bitband_t)BITBAND_PERIPH(&ADC1->SR, ADC_SR_EOS_Pos);
|
||||||
bitband_t adon = (bitband_t)BITBAND_PERIPH(&ADC1->CR2, ADC_CR2_ADON_Pos);
|
bitband_t adon = (bitband_t)BITBAND_PERIPH(&ADC1->CR2, ADC_CR2_ADON_Pos);
|
||||||
#if defined(SEND_RSSI_DATA)
|
#if defined(SEND_RSSI_DATA)
|
||||||
@@ -383,12 +414,12 @@ void CIO::interrupt()
|
|||||||
*rssi_adon = 1;
|
*rssi_adon = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_txBuffer.get(sample, control);
|
m_txBuffer.get(sample);
|
||||||
DAC->DHR12R1 = sample; // Send the value to the DAC
|
DAC->DHR12R1 = sample.sample; // Send the value to the DAC
|
||||||
|
|
||||||
// Read value from ADC1 and ADC2
|
// Read value from ADC1 and ADC2
|
||||||
sample = ADC1->DR; // read conversion result; EOC is cleared by this read
|
sample.sample = ADC1->DR; // read conversion result; EOC is cleared by this read
|
||||||
m_rxBuffer.put(sample, control);
|
m_rxBuffer.put(sample);
|
||||||
#if defined(SEND_RSSI_DATA)
|
#if defined(SEND_RSSI_DATA)
|
||||||
rawRSSI = ADC2->DR;
|
rawRSSI = ADC2->DR;
|
||||||
m_rssiBuffer.put(rawRSSI);
|
m_rssiBuffer.put(rawRSSI);
|
||||||
@@ -458,6 +489,16 @@ void CIO::setPOCSAGInt(bool on)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CIO::setFMInt(bool on)
|
||||||
|
{
|
||||||
|
#if defined(USE_ALTERNATE_FM_LEDS)
|
||||||
|
BB_DSTAR = !!on;
|
||||||
|
BB_YSF = !!on;
|
||||||
|
#else
|
||||||
|
BB_FM = !!on;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void CIO::delayInt(unsigned int dly)
|
void CIO::delayInt(unsigned int dly)
|
||||||
{
|
{
|
||||||
delay(dly);
|
delay(dly);
|
||||||
|
|||||||
+22
-8
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -37,9 +37,11 @@
|
|||||||
#if defined(__MK20DX256__)
|
#if defined(__MK20DX256__)
|
||||||
#define PIN_NXDN 2
|
#define PIN_NXDN 2
|
||||||
#define PIN_POCSAG 3
|
#define PIN_POCSAG 3
|
||||||
|
#define PIN_FM 4
|
||||||
#else
|
#else
|
||||||
#define PIN_NXDN 24
|
#define PIN_NXDN 24
|
||||||
#define PIN_POCSAG 25
|
#define PIN_POCSAG 25
|
||||||
|
#define PIN_FM 26
|
||||||
#endif
|
#endif
|
||||||
#define PIN_ADC 5 // A0, Pin 14
|
#define PIN_ADC 5 // A0, Pin 14
|
||||||
#define PIN_RSSI 4 // Teensy 3.5/3.6, A16, Pin 35. Teensy 3.1/3.2, A17, Pin 28
|
#define PIN_RSSI 4 // Teensy 3.5/3.6, A16, Pin 35. Teensy 3.1/3.2, A17, Pin 28
|
||||||
@@ -64,7 +66,7 @@ void CIO::initInt()
|
|||||||
pinMode(PIN_LED, OUTPUT);
|
pinMode(PIN_LED, OUTPUT);
|
||||||
pinMode(PIN_COS, INPUT);
|
pinMode(PIN_COS, INPUT);
|
||||||
|
|
||||||
#if defined(MODE_PINS)
|
#if defined(MODE_LEDS)
|
||||||
// Set up the mode output pins
|
// Set up the mode output pins
|
||||||
pinMode(PIN_DSTAR, OUTPUT);
|
pinMode(PIN_DSTAR, OUTPUT);
|
||||||
pinMode(PIN_DMR, OUTPUT);
|
pinMode(PIN_DMR, OUTPUT);
|
||||||
@@ -76,6 +78,9 @@ void CIO::initInt()
|
|||||||
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
pinMode(PIN_POCSAG, OUTPUT);
|
pinMode(PIN_POCSAG, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(USE_ALTERNATE_FM_LEDS)
|
||||||
|
pinMode(PIN_FM, OUTPUT);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,15 +161,14 @@ void CIO::startInt()
|
|||||||
|
|
||||||
void CIO::interrupt()
|
void CIO::interrupt()
|
||||||
{
|
{
|
||||||
uint8_t control = MARK_NONE;
|
TSample sample = {DC_OFFSET, MARK_NONE};
|
||||||
uint16_t sample = DC_OFFSET;
|
|
||||||
|
|
||||||
m_txBuffer.get(sample, control);
|
m_txBuffer.get(sample);
|
||||||
*(int16_t *)&(DAC0_DAT0L) = sample;
|
*(int16_t *)&(DAC0_DAT0L) = sample.sample;
|
||||||
|
|
||||||
if ((ADC0_SC1A & ADC_SC1_COCO) == ADC_SC1_COCO) {
|
if ((ADC0_SC1A & ADC_SC1_COCO) == ADC_SC1_COCO) {
|
||||||
sample = ADC0_RA;
|
sample.sample = ADC0_RA;
|
||||||
m_rxBuffer.put(sample, control);
|
m_rxBuffer.put(sample);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SEND_RSSI_DATA)
|
#if defined(SEND_RSSI_DATA)
|
||||||
@@ -243,6 +247,16 @@ void CIO::setPOCSAGInt(bool on)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CIO::setFMInt(bool on)
|
||||||
|
{
|
||||||
|
#if defined(USE_ALTERNATE_FM_LEDS)
|
||||||
|
digitalWrite(PIN_DSTAR, on ? HIGH : LOW);
|
||||||
|
digitalWrite(PIN_YSF, on ? HIGH : LOW);
|
||||||
|
#else
|
||||||
|
digitalWrite(PIN_FM, on ? HIGH : LOW);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void CIO::delayInt(unsigned int dly)
|
void CIO::delayInt(unsigned int dly)
|
||||||
{
|
{
|
||||||
delay(dly);
|
delay(dly);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016 by Mathis Schmieder DB9MAT
|
* Copyright (C) 2016 by Mathis Schmieder DB9MAT
|
||||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
*
|
*
|
||||||
@@ -32,6 +32,7 @@ bool m_ysfEnable = true;
|
|||||||
bool m_p25Enable = true;
|
bool m_p25Enable = true;
|
||||||
bool m_nxdnEnable = true;
|
bool m_nxdnEnable = true;
|
||||||
bool m_pocsagEnable = true;
|
bool m_pocsagEnable = true;
|
||||||
|
bool m_fmEnable = true;
|
||||||
|
|
||||||
bool m_duplex = true;
|
bool m_duplex = true;
|
||||||
|
|
||||||
@@ -59,11 +60,15 @@ CNXDNTX nxdnTX;
|
|||||||
|
|
||||||
CPOCSAGTX pocsagTX;
|
CPOCSAGTX pocsagTX;
|
||||||
|
|
||||||
|
CFM fm;
|
||||||
|
|
||||||
CCalDStarRX calDStarRX;
|
CCalDStarRX calDStarRX;
|
||||||
CCalDStarTX calDStarTX;
|
CCalDStarTX calDStarTX;
|
||||||
CCalDMR calDMR;
|
CCalDMR calDMR;
|
||||||
CCalP25 calP25;
|
CCalP25 calP25;
|
||||||
CCalNXDN calNXDN;
|
CCalNXDN calNXDN;
|
||||||
|
CCalFM calFM;
|
||||||
|
CCalPOCSAG calPOCSAG;
|
||||||
CCalRSSI calRSSI;
|
CCalRSSI calRSSI;
|
||||||
|
|
||||||
CCWIdTX cwIdTX;
|
CCWIdTX cwIdTX;
|
||||||
@@ -105,6 +110,9 @@ void loop()
|
|||||||
if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy()))
|
if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy()))
|
||||||
pocsagTX.process();
|
pocsagTX.process();
|
||||||
|
|
||||||
|
if (m_fmEnable && m_modemState == STATE_FM)
|
||||||
|
fm.process();
|
||||||
|
|
||||||
if (m_modemState == STATE_DSTARCAL)
|
if (m_modemState == STATE_DSTARCAL)
|
||||||
calDStarTX.process();
|
calDStarTX.process();
|
||||||
|
|
||||||
@@ -117,6 +125,12 @@ void loop()
|
|||||||
if (m_modemState == STATE_NXDNCAL1K)
|
if (m_modemState == STATE_NXDNCAL1K)
|
||||||
calNXDN.process();
|
calNXDN.process();
|
||||||
|
|
||||||
|
if (m_modemState == STATE_POCSAGCAL)
|
||||||
|
calPOCSAG.process();
|
||||||
|
|
||||||
|
if (m_modemState == STATE_FMCAL10K || m_modemState == STATE_FMCAL12K || m_modemState == STATE_FMCAL15K || m_modemState == STATE_FMCAL20K || m_modemState == STATE_FMCAL25K ||m_modemState == STATE_FMCAL30K)
|
||||||
|
calFM.process();
|
||||||
|
|
||||||
if (m_modemState == STATE_IDLE)
|
if (m_modemState == STATE_IDLE)
|
||||||
cwIdTX.process();
|
cwIdTX.process();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -29,6 +29,7 @@ bool m_ysfEnable = true;
|
|||||||
bool m_p25Enable = true;
|
bool m_p25Enable = true;
|
||||||
bool m_nxdnEnable = true;
|
bool m_nxdnEnable = true;
|
||||||
bool m_pocsagEnable = true;
|
bool m_pocsagEnable = true;
|
||||||
|
bool m_fmEnable = true;
|
||||||
|
|
||||||
bool m_duplex = true;
|
bool m_duplex = true;
|
||||||
|
|
||||||
@@ -56,11 +57,15 @@ CNXDNTX nxdnTX;
|
|||||||
|
|
||||||
CPOCSAGTX pocsagTX;
|
CPOCSAGTX pocsagTX;
|
||||||
|
|
||||||
|
CFM fm;
|
||||||
|
|
||||||
CCalDStarRX calDStarRX;
|
CCalDStarRX calDStarRX;
|
||||||
CCalDStarTX calDStarTX;
|
CCalDStarTX calDStarTX;
|
||||||
CCalDMR calDMR;
|
CCalDMR calDMR;
|
||||||
|
CCalFM calFM;
|
||||||
CCalP25 calP25;
|
CCalP25 calP25;
|
||||||
CCalNXDN calNXDN;
|
CCalNXDN calNXDN;
|
||||||
|
CCalPOCSAG calPOCSAG;
|
||||||
CCalRSSI calRSSI;
|
CCalRSSI calRSSI;
|
||||||
|
|
||||||
CCWIdTX cwIdTX;
|
CCWIdTX cwIdTX;
|
||||||
@@ -102,19 +107,27 @@ void loop()
|
|||||||
if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy()))
|
if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy()))
|
||||||
pocsagTX.process();
|
pocsagTX.process();
|
||||||
|
|
||||||
|
if (m_fmEnable && m_modemState == STATE_FM)
|
||||||
|
fm.process();
|
||||||
|
|
||||||
if (m_modemState == STATE_DSTARCAL)
|
if (m_modemState == STATE_DSTARCAL)
|
||||||
calDStarTX.process();
|
calDStarTX.process();
|
||||||
|
|
||||||
if (m_modemState == STATE_DMRCAL || m_modemState == STATE_LFCAL || m_modemState == STATE_DMRCAL1K || m_modemState == STATE_DMRDMO1K)
|
if (m_modemState == STATE_DMRCAL || m_modemState == STATE_LFCAL || m_modemState == STATE_DMRCAL1K || m_modemState == STATE_DMRDMO1K)
|
||||||
calDMR.process();
|
calDMR.process();
|
||||||
|
|
||||||
|
if (m_modemState == STATE_FMCAL10K || m_modemState == STATE_FMCAL12K || m_modemState == STATE_FMCAL15K || m_modemState == STATE_FMCAL20K || m_modemState == STATE_FMCAL25K || m_modemState == STATE_FMCAL30K)
|
||||||
|
calFM.process();
|
||||||
|
|
||||||
if (m_modemState == STATE_P25CAL1K)
|
if (m_modemState == STATE_P25CAL1K)
|
||||||
calP25.process();
|
calP25.process();
|
||||||
|
|
||||||
if (m_modemState == STATE_NXDNCAL1K)
|
if (m_modemState == STATE_NXDNCAL1K)
|
||||||
calNXDN.process();
|
calNXDN.process();
|
||||||
|
|
||||||
|
if (m_modemState == STATE_POCSAGCAL)
|
||||||
|
calPOCSAG.process();
|
||||||
|
|
||||||
if (m_modemState == STATE_IDLE)
|
if (m_modemState == STATE_IDLE)
|
||||||
cwIdTX.process();
|
cwIdTX.process();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,338 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<Project version="2G - 1.7.8" name="MMDVM_STM32F4xx">
|
|
||||||
<Target name="MMDVM_Discovery_407" isCurrent="1">
|
|
||||||
<Device manufacturerId="9" manufacturerName="ST" chipId="344" chipName="STM32F407VG" boardId="" boardName=""/>
|
|
||||||
<BuildOption>
|
|
||||||
<Compile>
|
|
||||||
<Option name="OptimizationLevel" value="4"/>
|
|
||||||
<Option name="UseFPU" value="0"/>
|
|
||||||
<Option name="UserEditCompiler" value=""/>
|
|
||||||
<Option name="SupportCPlusplus" value="1"/>
|
|
||||||
<Option name="FPU" value="2"/>
|
|
||||||
<Includepaths>
|
|
||||||
<Includepath path="."/>
|
|
||||||
</Includepaths>
|
|
||||||
<DefinedSymbols>
|
|
||||||
<Define name="STM32F4XX"/>
|
|
||||||
<Define name="USE_STDPERIPH_DRIVER"/>
|
|
||||||
<Define name="__ASSEMBLY__"/>
|
|
||||||
<Define name="SUPPORT_CPLUSPLUS"/>
|
|
||||||
<Define name="STM32F40_41xxx"/>
|
|
||||||
<Define name="HSE_VALUE=8000000"/>
|
|
||||||
<Define name="STM32F4_DISCOVERY"/>
|
|
||||||
<Define name="__FPU_USED"/>
|
|
||||||
</DefinedSymbols>
|
|
||||||
</Compile>
|
|
||||||
<Link useDefault="0">
|
|
||||||
<Option name="DiscardUnusedSection" value="0"/>
|
|
||||||
<Option name="UserEditLinkder" value=""/>
|
|
||||||
<Option name="UseMemoryLayout" value="0"/>
|
|
||||||
<Option name="nostartfiles" value="1"/>
|
|
||||||
<Option name="LTO" value="0"/>
|
|
||||||
<Option name="IsNewStartupCode" value="1"/>
|
|
||||||
<Option name="Library" value="Semihosting"/>
|
|
||||||
<Option name="UserEditLinker" value="-lstdc++; --specs=nano.specs;"/>
|
|
||||||
<LinkedLibraries>
|
|
||||||
<Libset dir="stm32f4xx_lib\cmsis\lib\gcc\" libs="arm_cortexm4lf_math"/>
|
|
||||||
</LinkedLibraries>
|
|
||||||
<MemoryAreas debugInFlashNotRAM="1">
|
|
||||||
<Memory name="IROM1" type="ReadOnly" size="0x00100000" startValue="0x08000000"/>
|
|
||||||
<Memory name="IRAM1" type="ReadWrite" size="0x00020000" startValue="0x20000000"/>
|
|
||||||
<Memory name="IROM2" type="ReadOnly" size="" startValue=""/>
|
|
||||||
<Memory name="IRAM2" type="ReadWrite" size="0x00010000" startValue="0x10000000"/>
|
|
||||||
</MemoryAreas>
|
|
||||||
<LocateLinkFile path="./stm32f4xx_link.ld" type="0"/>
|
|
||||||
</Link>
|
|
||||||
<Output>
|
|
||||||
<Option name="OutputFileType" value="0"/>
|
|
||||||
<Option name="Path" value="./"/>
|
|
||||||
<Option name="Name" value="MMDVM_DIS"/>
|
|
||||||
<Option name="HEX" value="1"/>
|
|
||||||
<Option name="BIN" value="1"/>
|
|
||||||
</Output>
|
|
||||||
<User>
|
|
||||||
<UserRun name="Run#1" type="Before" checked="0" value=""/>
|
|
||||||
<UserRun name="Run#1" type="After" checked="0" value=""/>
|
|
||||||
</User>
|
|
||||||
</BuildOption>
|
|
||||||
<DebugOption>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.adapter" value="ST-Link"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.debugMode" value="SWD"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.clockDiv" value="1M"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.corerunToMain" value="1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.jlinkgdbserver" value=""/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.userDefineGDBScript" value=""/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.targetEndianess" value="0"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.jlinkResetMode" value="Type 0: Normal"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.resetMode" value="SYSRESETREQ"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.ifSemihost" value="0"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.ifCacheRom" value="1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.ipAddress" value="127.0.0.1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.portNumber" value="2009"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.autoDownload" value="1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.verify" value="1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.downloadFuction" value="Erase Effected"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.defaultAlgorithm" value="STM32F4xx_1024.elf"/>
|
|
||||||
</DebugOption>
|
|
||||||
<ExcludeFile/>
|
|
||||||
</Target>
|
|
||||||
<Target name="MMDVM_Pi_446" isCurrent="0">
|
|
||||||
<Device manufacturerId="9" manufacturerName="ST" chipId="344" chipName="STM32F407VG" boardId="" boardName=""/>
|
|
||||||
<BuildOption>
|
|
||||||
<Compile>
|
|
||||||
<Option name="OptimizationLevel" value="4"/>
|
|
||||||
<Option name="UseFPU" value="0"/>
|
|
||||||
<Option name="UserEditCompiler" value=""/>
|
|
||||||
<Option name="SupportCPlusplus" value="1"/>
|
|
||||||
<Option name="FPU" value="2"/>
|
|
||||||
<Includepaths>
|
|
||||||
<Includepath path="."/>
|
|
||||||
</Includepaths>
|
|
||||||
<DefinedSymbols>
|
|
||||||
<Define name="STM32F4XX"/>
|
|
||||||
<Define name="USE_STDPERIPH_DRIVER"/>
|
|
||||||
<Define name="__ASSEMBLY__"/>
|
|
||||||
<Define name="SUPPORT_CPLUSPLUS"/>
|
|
||||||
<Define name="__FPU_USED"/>
|
|
||||||
<Define name="STM32F446xx"/>
|
|
||||||
<Define name="HSE_VALUE=12000000"/>
|
|
||||||
<Define name="STM32F4_PI"/>
|
|
||||||
<Define name="MODE_PINS"/>
|
|
||||||
</DefinedSymbols>
|
|
||||||
</Compile>
|
|
||||||
<Link useDefault="0">
|
|
||||||
<Option name="DiscardUnusedSection" value="0"/>
|
|
||||||
<Option name="UserEditLinkder" value=""/>
|
|
||||||
<Option name="UseMemoryLayout" value="0"/>
|
|
||||||
<Option name="nostartfiles" value="1"/>
|
|
||||||
<Option name="LTO" value="0"/>
|
|
||||||
<Option name="IsNewStartupCode" value="1"/>
|
|
||||||
<Option name="Library" value="Semihosting"/>
|
|
||||||
<Option name="UserEditLinker" value="-lstdc++; --specs=nano.specs;"/>
|
|
||||||
<LinkedLibraries>
|
|
||||||
<Libset dir="stm32f4xx_lib\cmsis\lib\gcc\" libs="arm_cortexm4lf_math"/>
|
|
||||||
</LinkedLibraries>
|
|
||||||
<MemoryAreas debugInFlashNotRAM="1">
|
|
||||||
<Memory name="IROM1" type="ReadOnly" size="0x00100000" startValue="0x08000000"/>
|
|
||||||
<Memory name="IRAM1" type="ReadWrite" size="0x00020000" startValue="0x20000000"/>
|
|
||||||
<Memory name="IROM2" type="ReadOnly" size="" startValue=""/>
|
|
||||||
<Memory name="IRAM2" type="ReadWrite" size="0x00010000" startValue="0x10000000"/>
|
|
||||||
</MemoryAreas>
|
|
||||||
<LocateLinkFile path="./stm32f4xx_link.ld" type="0"/>
|
|
||||||
</Link>
|
|
||||||
<Output>
|
|
||||||
<Option name="OutputFileType" value="0"/>
|
|
||||||
<Option name="Path" value="./"/>
|
|
||||||
<Option name="Name" value="MMDVM_PI"/>
|
|
||||||
<Option name="HEX" value="1"/>
|
|
||||||
<Option name="BIN" value="1"/>
|
|
||||||
</Output>
|
|
||||||
<User>
|
|
||||||
<UserRun name="Run#1" type="Before" checked="0" value=""/>
|
|
||||||
<UserRun name="Run#1" type="After" checked="0" value=""/>
|
|
||||||
</User>
|
|
||||||
</BuildOption>
|
|
||||||
<DebugOption>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.adapter" value="ST-Link"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.debugMode" value="SWD"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.clockDiv" value="1M"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.corerunToMain" value="1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.jlinkgdbserver" value=""/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.userDefineGDBScript" value=""/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.targetEndianess" value="0"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.jlinkResetMode" value="Type 0: Normal"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.resetMode" value="SYSRESETREQ"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.ifSemihost" value="0"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.ifCacheRom" value="1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.ipAddress" value="127.0.0.1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.portNumber" value="2009"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.autoDownload" value="1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.verify" value="1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.downloadFuction" value="Erase Effected"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.defaultAlgorithm" value="STM32F4xx_1024.elf"/>
|
|
||||||
</DebugOption>
|
|
||||||
<ExcludeFile/>
|
|
||||||
</Target>
|
|
||||||
<Target name="MMDVM_Nucleo_446" isCurrent="0">
|
|
||||||
<Device manufacturerId="9" manufacturerName="ST" chipId="344" chipName="STM32F407VG" boardId="" boardName=""/>
|
|
||||||
<BuildOption>
|
|
||||||
<Compile>
|
|
||||||
<Option name="OptimizationLevel" value="4"/>
|
|
||||||
<Option name="UseFPU" value="0"/>
|
|
||||||
<Option name="UserEditCompiler" value=""/>
|
|
||||||
<Option name="SupportCPlusplus" value="1"/>
|
|
||||||
<Option name="FPU" value="2"/>
|
|
||||||
<Includepaths>
|
|
||||||
<Includepath path="."/>
|
|
||||||
</Includepaths>
|
|
||||||
<DefinedSymbols>
|
|
||||||
<Define name="STM32F4XX"/>
|
|
||||||
<Define name="USE_STDPERIPH_DRIVER"/>
|
|
||||||
<Define name="__ASSEMBLY__"/>
|
|
||||||
<Define name="SUPPORT_CPLUSPLUS"/>
|
|
||||||
<Define name="HSE_VALUE=8000000"/>
|
|
||||||
<Define name="__FPU_USED"/>
|
|
||||||
<Define name="STM32F4_NUCLEO"/>
|
|
||||||
<Define name="STM32F446xx"/>
|
|
||||||
</DefinedSymbols>
|
|
||||||
</Compile>
|
|
||||||
<Link useDefault="0">
|
|
||||||
<Option name="DiscardUnusedSection" value="0"/>
|
|
||||||
<Option name="UserEditLinkder" value=""/>
|
|
||||||
<Option name="UseMemoryLayout" value="0"/>
|
|
||||||
<Option name="nostartfiles" value="1"/>
|
|
||||||
<Option name="LTO" value="0"/>
|
|
||||||
<Option name="IsNewStartupCode" value="1"/>
|
|
||||||
<Option name="Library" value="Semihosting"/>
|
|
||||||
<Option name="UserEditLinker" value="-lstdc++; --specs=nano.specs;"/>
|
|
||||||
<LinkedLibraries>
|
|
||||||
<Libset dir="stm32f4xx_lib\cmsis\lib\gcc\" libs="arm_cortexm4lf_math"/>
|
|
||||||
</LinkedLibraries>
|
|
||||||
<MemoryAreas debugInFlashNotRAM="1">
|
|
||||||
<Memory name="IROM1" type="ReadOnly" size="0x00100000" startValue="0x08000000"/>
|
|
||||||
<Memory name="IRAM1" type="ReadWrite" size="0x00020000" startValue="0x20000000"/>
|
|
||||||
<Memory name="IROM2" type="ReadOnly" size="" startValue=""/>
|
|
||||||
<Memory name="IRAM2" type="ReadWrite" size="0x00010000" startValue="0x10000000"/>
|
|
||||||
</MemoryAreas>
|
|
||||||
<LocateLinkFile path="./stm32f4xx_link.ld" type="0"/>
|
|
||||||
</Link>
|
|
||||||
<Output>
|
|
||||||
<Option name="OutputFileType" value="0"/>
|
|
||||||
<Option name="Path" value="./"/>
|
|
||||||
<Option name="Name" value="MMDVM_NUCLEO"/>
|
|
||||||
<Option name="HEX" value="1"/>
|
|
||||||
<Option name="BIN" value="1"/>
|
|
||||||
</Output>
|
|
||||||
<User>
|
|
||||||
<UserRun name="Run#1" type="Before" checked="0" value=""/>
|
|
||||||
<UserRun name="Run#1" type="After" checked="0" value=""/>
|
|
||||||
</User>
|
|
||||||
</BuildOption>
|
|
||||||
<DebugOption>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.adapter" value="ST-Link"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.debugMode" value="SWD"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.clockDiv" value="1M"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.corerunToMain" value="1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.jlinkgdbserver" value=""/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.userDefineGDBScript" value=""/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.targetEndianess" value="0"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.jlinkResetMode" value="Type 0: Normal"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.resetMode" value="SYSRESETREQ"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.ifSemihost" value="0"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.ifCacheRom" value="1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.ipAddress" value="127.0.0.1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.portNumber" value="2009"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.autoDownload" value="1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.verify" value="1"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.downloadFuction" value="Erase Effected"/>
|
|
||||||
<Option name="org.coocox.codebugger.gdbjtag.core.defaultAlgorithm" value="STM32F4xx_1024.elf"/>
|
|
||||||
</DebugOption>
|
|
||||||
<ExcludeFile/>
|
|
||||||
</Target>
|
|
||||||
<Components path="./">
|
|
||||||
</Components>
|
|
||||||
<Files>
|
|
||||||
<File name="DMRIdleRX.h" path="DMRIdleRX.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/stm32f4xx_dac.c" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/stm32f4xx_dac.c" type="1"/>
|
|
||||||
<File name="DMRDMOTX.cpp" path="DMRDMOTX.cpp" type="1"/>
|
|
||||||
<File name="DMRRX.cpp" path="DMRRX.cpp" type="1"/>
|
|
||||||
<File name="YSFRX.cpp" path="YSFRX.cpp" type="1"/>
|
|
||||||
<File name="CalRSSI.cpp" path="CalRSSI.cpp" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/Device/stm32f4xx.h" path="STM32F4XX_Lib/Device/stm32f4xx.h" type="1"/>
|
|
||||||
<File name="SampleRB.cpp" path="SampleRB.cpp" type="1"/>
|
|
||||||
<File name="CalDStarTX.h" path="CalDStarTX.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS/Include/core_cm4.h" path="STM32F4XX_Lib/CMSIS/Include/core_cm4.h" type="1"/>
|
|
||||||
<File name="DMRSlotRX.h" path="DMRSlotRX.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/stm32f4xx_tim.c" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/stm32f4xx_tim.c" type="1"/>
|
|
||||||
<File name="YSFRX.h" path="YSFRX.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS/Include" path="" type="2"/>
|
|
||||||
<File name="IO.cpp" path="IO.cpp" type="1"/>
|
|
||||||
<File name="DMRDMORX.cpp" path="DMRDMORX.cpp" type="1"/>
|
|
||||||
<File name="P25RX.h" path="P25RX.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/misc.c" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/misc.c" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS" path="" type="2"/>
|
|
||||||
<File name="SerialArduino.cpp" path="SerialArduino.cpp" type="1"/>
|
|
||||||
<File name="SerialPort.cpp" path="SerialPort.cpp" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/Device/stm32f4xx_conf.h" path="STM32F4XX_Lib/Device/stm32f4xx_conf.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/stm32f4xx_adc.c" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/stm32f4xx_adc.c" type="1"/>
|
|
||||||
<File name="DStarTX.cpp" path="DStarTX.cpp" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/stm32f4xx_usart.c" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/stm32f4xx_usart.c" type="1"/>
|
|
||||||
<File name="SampleRB.h" path="SampleRB.h" type="1"/>
|
|
||||||
<File name="YSFTX.h" path="YSFTX.h" type="1"/>
|
|
||||||
<File name="DMRRX.h" path="DMRRX.h" type="1"/>
|
|
||||||
<File name="CalRSSI.h" path="CalRSSI.h" type="1"/>
|
|
||||||
<File name="IOTeensy.cpp" path="IOTeensy.cpp" type="1"/>
|
|
||||||
<File name="MMDVM.cpp" path="MMDVM.cpp" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS/Include/core_cmSimd.h" path="STM32F4XX_Lib/CMSIS/Include/core_cmSimd.h" type="1"/>
|
|
||||||
<File name="DMRDMORX.h" path="DMRDMORX.h" type="1"/>
|
|
||||||
<File name="SerialPort.h" path="SerialPort.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/stm32f4xx_dac.h" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/stm32f4xx_dac.h" type="1"/>
|
|
||||||
<File name="CWIdTX.h" path="CWIdTX.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/Device/system_stm32f4xx.h" path="STM32F4XX_Lib/Device/system_stm32f4xx.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS/Include/core_cmFunc.h" path="STM32F4XX_Lib/CMSIS/Include/core_cmFunc.h" type="1"/>
|
|
||||||
<File name="CalDStarTX.cpp" path="CalDStarTX.cpp" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source" path="" type="2"/>
|
|
||||||
<File name="CalDMR.h" path="CalDMR.h" type="1"/>
|
|
||||||
<File name="DMRDMOTX.h" path="DMRDMOTX.h" type="1"/>
|
|
||||||
<File name="IODue.cpp" path="IODue.cpp" type="1"/>
|
|
||||||
<File name="DMRTX.cpp" path="DMRTX.cpp" type="1"/>
|
|
||||||
<File name="P25RX.cpp" path="P25RX.cpp" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS/Lib/GCC" path="" type="2"/>
|
|
||||||
<File name="STM32F4XX_Lib" path="" type="2"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS/Include/core_cmInstr.h" path="STM32F4XX_Lib/CMSIS/Include/core_cmInstr.h" type="1"/>
|
|
||||||
<File name="DMRTX.h" path="DMRTX.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/Device/system_stm32f4xx.c" path="STM32F4XX_Lib/Device/system_stm32f4xx.c" type="1"/>
|
|
||||||
<File name="RSSIRB.h" path="RSSIRB.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/Device/startup/startup_stm32f4xx.c" path="STM32F4XX_Lib/Device/startup/startup_stm32f4xx.c" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/Device/startup" path="" type="2"/>
|
|
||||||
<File name="SerialRB.h" path="SerialRB.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/stm32f4xx_gpio.h" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/stm32f4xx_gpio.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver" path="" type="2"/>
|
|
||||||
<File name="DMRDefines.h" path="DMRDefines.h" type="1"/>
|
|
||||||
<File name="CalDMR.cpp" path="CalDMR.cpp" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/stm32f4xx_adc.h" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/stm32f4xx_adc.h" type="1"/>
|
|
||||||
<File name="SerialSTM.cpp" path="SerialSTM.cpp" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS/Lib/GCC/libarm_cortexM4lf_math.a" path="STM32F4XX_Lib/CMSIS/Lib/GCC/libarm_cortexM4lf_math.a" type="1"/>
|
|
||||||
<File name="DStarDefines.h" path="DStarDefines.h" type="1"/>
|
|
||||||
<File name="DStarRX.h" path="DStarRX.h" type="1"/>
|
|
||||||
<File name="Config.h" path="Config.h" type="1"/>
|
|
||||||
<File name="DMRSlotType.cpp" path="DMRSlotType.cpp" type="1"/>
|
|
||||||
<File name="Globals.h" path="Globals.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/Device" path="" type="2"/>
|
|
||||||
<File name="CalDStarRX.cpp" path="CalDStarRX.cpp" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/stm32f4xx_tim.h" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/stm32f4xx_tim.h" type="1"/>
|
|
||||||
<File name="CalDStarRX.h" path="CalDStarRX.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include" path="" type="2"/>
|
|
||||||
<File name="IO.h" path="IO.h" type="1"/>
|
|
||||||
<File name="Utils.cpp" path="Utils.cpp" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS/.DS_Store" path="STM32F4XX_Lib/CMSIS/.DS_Store" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS/Lib/.DS_Store" path="STM32F4XX_Lib/CMSIS/Lib/.DS_Store" type="1"/>
|
|
||||||
<File name="Utils.h" path="Utils.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS/Lib" path="" type="2"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/.DS_Store" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/.DS_Store" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS/Include/.DS_Store" path="STM32F4XX_Lib/CMSIS/Include/.DS_Store" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/CMSIS/Include/arm_math.h" path="STM32F4XX_Lib/CMSIS/Include/arm_math.h" type="1"/>
|
|
||||||
<File name="YSFDefines.h" path="YSFDefines.h" type="1"/>
|
|
||||||
<File name="DStarTX.h" path="DStarTX.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/stm32f4xx_rcc.c" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/stm32f4xx_rcc.c" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/Device/.DS_Store" path="STM32F4XX_Lib/Device/.DS_Store" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/stm32f4xx_rcc.h" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/stm32f4xx_rcc.h" type="1"/>
|
|
||||||
<File name="P25Defines.h" path="P25Defines.h" type="1"/>
|
|
||||||
<File name="DMRSlotType.h" path="DMRSlotType.h" type="1"/>
|
|
||||||
<File name="Debug.h" path="Debug.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/misc.h" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/misc.h" type="1"/>
|
|
||||||
<File name="P25TX.h" path="P25TX.h" type="1"/>
|
|
||||||
<File name="RSSIRB.cpp" path="RSSIRB.cpp" type="1"/>
|
|
||||||
<File name="DStarRX.cpp" path="DStarRX.cpp" type="1"/>
|
|
||||||
<File name="DMRSlotRX.cpp" path="DMRSlotRX.cpp" type="1"/>
|
|
||||||
<File name="IOSTM.cpp" path="IOSTM.cpp" type="1"/>
|
|
||||||
<File name="P25TX.cpp" path="P25TX.cpp" type="1"/>
|
|
||||||
<File name="SerialRB.cpp" path="SerialRB.cpp" type="1"/>
|
|
||||||
<File name="CWIdTX.cpp" path="CWIdTX.cpp" type="1"/>
|
|
||||||
<File name="DMRIdleRX.cpp" path="DMRIdleRX.cpp" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/stm32f4xx_usart.h" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/include/stm32f4xx_usart.h" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/.DS_Store" path="STM32F4XX_Lib/.DS_Store" type="1"/>
|
|
||||||
<File name="YSFTX.cpp" path="YSFTX.cpp" type="1"/>
|
|
||||||
<File name="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/stm32f4xx_gpio.c" path="STM32F4XX_Lib/STM32F4xx_StdPeriph_Driver/source/stm32f4xx_gpio.c" type="1"/>
|
|
||||||
</Files>
|
|
||||||
</Project>
|
|
||||||
@@ -25,6 +25,7 @@ F7_LIB_PATH=./STM32F7XX_Lib
|
|||||||
# MCU external clock frequency (Hz)
|
# MCU external clock frequency (Hz)
|
||||||
CLK_MMDVM_PI=12000000
|
CLK_MMDVM_PI=12000000
|
||||||
CLK_NUCLEO=8000000
|
CLK_NUCLEO=8000000
|
||||||
|
CLK_12MHZ=12000000
|
||||||
|
|
||||||
# Directory Structure
|
# Directory Structure
|
||||||
BINDIR=bin
|
BINDIR=bin
|
||||||
@@ -93,6 +94,8 @@ ifndef $(OSC)
|
|||||||
OSC=$(CLK_MMDVM_PI)
|
OSC=$(CLK_MMDVM_PI)
|
||||||
else ifeq ($(MAKECMDGOALS),pi-f722)
|
else ifeq ($(MAKECMDGOALS),pi-f722)
|
||||||
OSC=$(CLK_MMDVM_PI)
|
OSC=$(CLK_MMDVM_PI)
|
||||||
|
else ifeq ($(MAKECMDGOALS),drcc_nqf)
|
||||||
|
OSC=$(CLK_12MHZ)
|
||||||
else
|
else
|
||||||
OSC=$(CLK_NUCLEO)
|
OSC=$(CLK_NUCLEO)
|
||||||
endif
|
endif
|
||||||
@@ -128,10 +131,15 @@ DEFS_NUCLEO_F767=-DUSE_HAL_DRIVER -DSTM32F767xx -DSTM32F7XX -DSTM32F7_NUCLEO -DH
|
|||||||
DEFS_PI_F722=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_PI -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
DEFS_PI_F722=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_PI -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
# MMDVM-F7M F0DEI board:
|
# MMDVM-F7M F0DEI board:
|
||||||
DEFS_F7M=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_F7M -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
DEFS_F7M=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_F7M -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
# MMDVM-F7-Hat F0DEI, DB9MAT, DF2ET board:
|
# MMDVM_RPT_Hat F0DEI, DB9MAT, DF2ET board:
|
||||||
DEFS_F7HAT=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_F7HAT -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
DEFS_RPT_HAT=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_RPT_HAT -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
# STM32F4 DVM board:
|
# STM32F4 DVM board:
|
||||||
DEFS_DVM=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_DVM -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
DEFS_DVM=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_DVM -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
|
# MMDVM_RPT_Hat BG4TGO, BG5HHP board:
|
||||||
|
DEFS_RPT_HAT_TGO=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F40_41xxx -DSTM32F4_RPT_HAT_TGO -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
|
# DRCC_DVM BG7NQF board:
|
||||||
|
DEFS_DRCC_DVM=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DDRCC_DVM -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
|
|
||||||
|
|
||||||
# Build compiler flags
|
# Build compiler flags
|
||||||
CFLAGS_F4=-c $(MCFLAGS_F4) $(INCLUDES_F4)
|
CFLAGS_F4=-c $(MCFLAGS_F4) $(INCLUDES_F4)
|
||||||
@@ -150,7 +158,7 @@ CXXFLAGS=-Os -fno-exceptions -ffunction-sections -fdata-sections -fno-builtin -f
|
|||||||
LDFLAGS=-Os --specs=nano.specs
|
LDFLAGS=-Os --specs=nano.specs
|
||||||
|
|
||||||
# Build Rules
|
# Build Rules
|
||||||
.PHONY: all release dis pi pi-f722 f4m nucleo f767 dvm clean
|
.PHONY: all release dis pi pi-f722 f4m nucleo f767 dvm drcc_nqf clean
|
||||||
|
|
||||||
# Default target: Nucleo-64 F446RE board
|
# Default target: Nucleo-64 F446RE board
|
||||||
all: nucleo
|
all: nucleo
|
||||||
@@ -179,11 +187,17 @@ f7m: CXXFLAGS+=$(CXXFLAGS_F7) $(DEFS_F7M)
|
|||||||
f7m: LDFLAGS+=$(LDFLAGS_F722)
|
f7m: LDFLAGS+=$(LDFLAGS_F722)
|
||||||
f7m: release_f7
|
f7m: release_f7
|
||||||
|
|
||||||
f7hat: GitVersion.h
|
rpt_hat: GitVersion.h
|
||||||
f7hat: CFLAGS+=$(CFLAGS_F7) $(DEFS_F7HAT)
|
rpt_hat: CFLAGS+=$(CFLAGS_F7) $(DEFS_RPT_HAT)
|
||||||
f7hat: CXXFLAGS+=$(CXXFLAGS_F7) $(DEFS_F7HAT)
|
rpt_hat: CXXFLAGS+=$(CXXFLAGS_F7) $(DEFS_RPT_HAT)
|
||||||
f7hat: LDFLAGS+=$(LDFLAGS_F722)
|
rpt_hat: LDFLAGS+=$(LDFLAGS_F722)
|
||||||
f7hat: release_f7
|
rpt_hat: release_f7
|
||||||
|
|
||||||
|
rpt_hat_tgo: GitVersion.h
|
||||||
|
rpt_hat_tgo: CFLAGS+=$(CFLAGS_F4) $(DEFS_RPT_HAT_TGO)
|
||||||
|
rpt_hat_tgo: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_RPT_HAT_TGO)
|
||||||
|
rpt_hat_tgo: LDFLAGS+=$(LDFLAGS_F4)
|
||||||
|
rpt_hat_tgo: release_f4
|
||||||
|
|
||||||
nucleo: GitVersion.h
|
nucleo: GitVersion.h
|
||||||
nucleo: CFLAGS+=$(CFLAGS_F4) $(DEFS_NUCLEO)
|
nucleo: CFLAGS+=$(CFLAGS_F4) $(DEFS_NUCLEO)
|
||||||
@@ -209,6 +223,12 @@ dvm: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_DVM)
|
|||||||
dvm: LDFLAGS+=$(LDFLAGS_F4)
|
dvm: LDFLAGS+=$(LDFLAGS_F4)
|
||||||
dvm: release_f4
|
dvm: release_f4
|
||||||
|
|
||||||
|
drcc_nqf: GitVersion.h
|
||||||
|
drcc_nqf: CFLAGS+=$(CFLAGS_F4) $(DEFS_DRCC_DVM) -DDRCC_DVM_NQF
|
||||||
|
drcc_nqf: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_DRCC_DVM) -DDRCC_DVM_NQF
|
||||||
|
drcc_nqf: LDFLAGS+=$(LDFLAGS_F4)
|
||||||
|
drcc_nqf: release_f4
|
||||||
|
|
||||||
release_f4: $(BINDIR)
|
release_f4: $(BINDIR)
|
||||||
release_f4: $(OBJDIR_F4)
|
release_f4: $(OBJDIR_F4)
|
||||||
release_f4: $(BINDIR)/$(BINHEX_F4)
|
release_f4: $(BINDIR)/$(BINHEX_F4)
|
||||||
@@ -231,7 +251,7 @@ $(OBJDIR_F7):
|
|||||||
$(BINDIR)/$(BINHEX_F4): $(BINDIR)/$(BINELF_F4)
|
$(BINDIR)/$(BINHEX_F4): $(BINDIR)/$(BINELF_F4)
|
||||||
$(CP) -O ihex $< $@
|
$(CP) -O ihex $< $@
|
||||||
@echo "Objcopy from ELF to IHEX complete!\n"
|
@echo "Objcopy from ELF to IHEX complete!\n"
|
||||||
|
|
||||||
$(BINDIR)/$(BINBIN_F4): $(BINDIR)/$(BINELF_F4)
|
$(BINDIR)/$(BINBIN_F4): $(BINDIR)/$(BINELF_F4)
|
||||||
$(CP) -O binary $< $@
|
$(CP) -O binary $< $@
|
||||||
@echo "Objcopy from ELF to BINARY complete!\n"
|
@echo "Objcopy from ELF to BINARY complete!\n"
|
||||||
@@ -244,7 +264,7 @@ $(BINDIR)/$(BINELF_F4): $(OBJ_F4)
|
|||||||
$(BINDIR)/$(BINHEX_F7): $(BINDIR)/$(BINELF_F7)
|
$(BINDIR)/$(BINHEX_F7): $(BINDIR)/$(BINELF_F7)
|
||||||
$(CP) -O ihex $< $@
|
$(CP) -O ihex $< $@
|
||||||
@echo "Objcopy from ELF to IHEX complete!\n"
|
@echo "Objcopy from ELF to IHEX complete!\n"
|
||||||
|
|
||||||
$(BINDIR)/$(BINBIN_F7): $(BINDIR)/$(BINELF_F7)
|
$(BINDIR)/$(BINBIN_F7): $(BINDIR)/$(BINELF_F7)
|
||||||
$(CP) -O binary $< $@
|
$(CP) -O binary $< $@
|
||||||
@echo "Objcopy from ELF to BINARY complete!\n"
|
@echo "Objcopy from ELF to BINARY complete!\n"
|
||||||
@@ -334,18 +354,15 @@ deploy-dvm: deploy-pi
|
|||||||
deploy-pi-f7:
|
deploy-pi-f7:
|
||||||
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
||||||
-/usr/local/bin/stm32flash -i 20,-21,21:-20,21 /dev/ttyAMA0
|
-/usr/local/bin/stm32flash -i 20,-21,21:-20,21 /dev/ttyAMA0
|
||||||
-/usr/local/bin/stm32ld /dev/ttyAMA0 57600 bin/$(BINBIN_F7)
|
|
||||||
/usr/local/bin/stm32flash -v -w bin/$(BINBIN_F7) -g 0x0 -R -c /dev/ttyAMA0
|
/usr/local/bin/stm32flash -v -w bin/$(BINBIN_F7) -g 0x0 -R -c /dev/ttyAMA0
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(wildcard /usr/bin/stm32flash),)
|
else ifneq ($(wildcard /usr/bin/stm32flash),)
|
||||||
-/usr/bin/stm32flash -i 20,-21,21:-20,21 /dev/ttyAMA0
|
-/usr/bin/stm32flash -i 20,-21,21:-20,21 /dev/ttyAMA0
|
||||||
-/usr/bin/stm32ld /dev/ttyAMA0 57600 bin/$(BINBIN_F7)
|
|
||||||
/usr/bin/stm32flash -v -w bin/$(BINBIN_F7) -g 0x0 -R -c /dev/ttyAMA0
|
/usr/bin/stm32flash -v -w bin/$(BINBIN_F7) -g 0x0 -R -c /dev/ttyAMA0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
deploy-f7m: deploy-pi-f7
|
deploy-f7m: deploy-pi-f7
|
||||||
deploy-f7hat: deploy-pi-f7
|
deploy-rpt_hat: deploy-pi-f7
|
||||||
|
|
||||||
# Export the current git version if the index file exists, else 000...
|
# Export the current git version if the index file exists, else 000...
|
||||||
GitVersion.h:
|
GitVersion.h:
|
||||||
@@ -360,3 +377,7 @@ else
|
|||||||
echo "#define GITVERSION \"0000000\"" > $@
|
echo "#define GITVERSION \"0000000\"" > $@
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
flash_f4:
|
||||||
|
@echo "flashing firmware..."
|
||||||
|
st-flash write bin/$(BINBIN_F4) 0x8000000
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/make
|
#!/usr/bin/make
|
||||||
# makefile for the arduino due (works with arduino IDE 1.6.11)
|
# makefile for the arduino due (works with arduino IDE 1.6.12)
|
||||||
#
|
#
|
||||||
# The original file can be found at https://github.com/pauldreik/arduino-due-makefile
|
# The original file can be found at https://github.com/pauldreik/arduino-due-makefile
|
||||||
#
|
#
|
||||||
@@ -34,7 +34,7 @@ OBJCOPY:=$(ADIR)/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-n
|
|||||||
|
|
||||||
C:=$(CC)
|
C:=$(CC)
|
||||||
#SAM:=arduino/sam/
|
#SAM:=arduino/sam/
|
||||||
SAM:=$(ADIR)/packages/arduino/hardware/sam/1.6.11
|
SAM:=$(ADIR)/packages/arduino/hardware/sam/1.6.12
|
||||||
#CMSIS:=arduino/sam/system/CMSIS/
|
#CMSIS:=arduino/sam/system/CMSIS/
|
||||||
#LIBSAM:=arduino/sam/system/libsam
|
#LIBSAM:=arduino/sam/system/libsam
|
||||||
TMPDIR:=$(PWD)/build
|
TMPDIR:=$(PWD)/build
|
||||||
|
|||||||
+18
-4
@@ -25,7 +25,7 @@ STARTUP:=$(SYSDIR)/startup_stm32f105xc.S
|
|||||||
STARTUP_DEFS=
|
STARTUP_DEFS=
|
||||||
|
|
||||||
# Include directory for CMSIS
|
# Include directory for CMSIS
|
||||||
CMSISDIR:=/opt/STM32Cube_FW_F1_V1.4.0/Drivers/CMSIS
|
CMSISDIR:=STM32F10X_Lib/CMSIS
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
LIBDIR:=
|
LIBDIR:=
|
||||||
@@ -65,7 +65,7 @@ COMMON_FLAGS =-mthumb -mlittle-endian -mcpu=$(MCPU)
|
|||||||
COMMON_FLAGS+= -Wall
|
COMMON_FLAGS+= -Wall
|
||||||
COMMON_FLAGS+= -I. -I$(CMSISDIR)/Include -I$(CMSISDIR)/Device/ST/STM32F1xx/Include -I$(SYSDIR)
|
COMMON_FLAGS+= -I. -I$(CMSISDIR)/Include -I$(CMSISDIR)/Device/ST/STM32F1xx/Include -I$(SYSDIR)
|
||||||
COMMON_FLAGS+= $(addprefix -I,$(INCDIR))
|
COMMON_FLAGS+= $(addprefix -I,$(INCDIR))
|
||||||
COMMON_FLAGS+= -D$(MCU)
|
COMMON_FLAGS+= -D$(MCU) -DMADEBYMAKEFILE -DSTM32F1
|
||||||
COMMON_FLAGS+= -Os -flto -ffunction-sections -fdata-sections
|
COMMON_FLAGS+= -Os -flto -ffunction-sections -fdata-sections
|
||||||
COMMON_FLAGS+= -g
|
COMMON_FLAGS+= -g
|
||||||
# Assembler flags
|
# Assembler flags
|
||||||
@@ -91,7 +91,7 @@ DEPENDS:=$(CSRC:%.c=$(OBJDIR)/%.d) $(CXXSRC:%.cpp=$(OBJDIR)/%.d)
|
|||||||
|
|
||||||
# Targets
|
# Targets
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(DIS) $(HEX)
|
all: GitVersion.h $(DIS) $(HEX)
|
||||||
$(SIZE) $(ELF)
|
$(SIZE) $(ELF)
|
||||||
|
|
||||||
.PHONY: program
|
.PHONY: program
|
||||||
@@ -116,7 +116,7 @@ debug: $(ELF)
|
|||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(OBJ) $(HEX) $(ELF) $(DIS) $(MAP) $(DEPENDS)
|
$(RM) $(OBJ) $(HEX) $(ELF) $(DIS) $(MAP) $(DEPENDS) GitVersion.h
|
||||||
|
|
||||||
# implicit rules
|
# implicit rules
|
||||||
.elf.hex:
|
.elf.hex:
|
||||||
@@ -149,3 +149,17 @@ $(DIS): $(ELF)
|
|||||||
|
|
||||||
# include dependecies
|
# include dependecies
|
||||||
-include $(DEPENDS)
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
# Export the current git version if the index file exists, else 000...
|
||||||
|
GitVersion.h:
|
||||||
|
ifdef SYSTEMROOT
|
||||||
|
echo #define GITVERSION "0000000" > $@
|
||||||
|
else ifdef SystemRoot
|
||||||
|
echo #define GITVERSION "0000000" > $@
|
||||||
|
else
|
||||||
|
ifneq ("$(wildcard .git/index)","")
|
||||||
|
echo "#define GITVERSION \"$(shell git rev-parse --short HEAD)\"" > $@
|
||||||
|
else
|
||||||
|
echo "#define GITVERSION \"0000000\"" > $@
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|||||||
+40
-8
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2009-2018,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -45,7 +45,7 @@ const uint8_t NXDN_PREAMBLE[] = {0x57U, 0x75U, 0xFDU};
|
|||||||
const uint8_t NXDN_SYNC = 0x5FU;
|
const uint8_t NXDN_SYNC = 0x5FU;
|
||||||
|
|
||||||
CNXDNTX::CNXDNTX() :
|
CNXDNTX::CNXDNTX() :
|
||||||
m_buffer(4000U),
|
m_buffer(TX_BUFFER_LEN),
|
||||||
m_modFilter(),
|
m_modFilter(),
|
||||||
m_sincFilter(),
|
m_sincFilter(),
|
||||||
m_modState(),
|
m_modState(),
|
||||||
@@ -53,7 +53,9 @@ m_sincState(),
|
|||||||
m_poBuffer(),
|
m_poBuffer(),
|
||||||
m_poLen(0U),
|
m_poLen(0U),
|
||||||
m_poPtr(0U),
|
m_poPtr(0U),
|
||||||
m_txDelay(240U) // 200ms
|
m_txDelay(240U), // 200ms
|
||||||
|
m_txHang(3000U), // 5s
|
||||||
|
m_txCount(0U)
|
||||||
{
|
{
|
||||||
::memset(m_modState, 0x00U, 16U * sizeof(q15_t));
|
::memset(m_modState, 0x00U, 16U * sizeof(q15_t));
|
||||||
::memset(m_sincState, 0x00U, 70U * sizeof(q15_t));
|
::memset(m_sincState, 0x00U, 70U * sizeof(q15_t));
|
||||||
@@ -70,10 +72,7 @@ m_txDelay(240U) // 200ms
|
|||||||
|
|
||||||
void CNXDNTX::process()
|
void CNXDNTX::process()
|
||||||
{
|
{
|
||||||
if (m_buffer.getData() == 0U && m_poLen == 0U)
|
if (m_poLen == 0U && m_buffer.getData() > 0U) {
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_poLen == 0U) {
|
|
||||||
if (!m_tx) {
|
if (!m_tx) {
|
||||||
for (uint16_t i = 0U; i < m_txDelay; i++)
|
for (uint16_t i = 0U; i < m_txDelay; i++)
|
||||||
m_poBuffer[m_poLen++] = NXDN_SYNC;
|
m_poBuffer[m_poLen++] = NXDN_SYNC;
|
||||||
@@ -82,7 +81,8 @@ void CNXDNTX::process()
|
|||||||
m_poBuffer[m_poLen++] = NXDN_PREAMBLE[2U];
|
m_poBuffer[m_poLen++] = NXDN_PREAMBLE[2U];
|
||||||
} else {
|
} else {
|
||||||
for (uint8_t i = 0U; i < NXDN_FRAME_LENGTH_BYTES; i++) {
|
for (uint8_t i = 0U; i < NXDN_FRAME_LENGTH_BYTES; i++) {
|
||||||
uint8_t c = m_buffer.get();
|
uint8_t c = 0U;
|
||||||
|
m_buffer.get(c);
|
||||||
m_poBuffer[m_poLen++] = c;
|
m_poBuffer[m_poLen++] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,6 +98,8 @@ void CNXDNTX::process()
|
|||||||
writeByte(c);
|
writeByte(c);
|
||||||
|
|
||||||
space -= 4U * NXDN_RADIO_SYMBOL_LENGTH;
|
space -= 4U * NXDN_RADIO_SYMBOL_LENGTH;
|
||||||
|
if (m_duplex)
|
||||||
|
m_txCount = m_txHang;
|
||||||
|
|
||||||
if (m_poPtr >= m_poLen) {
|
if (m_poPtr >= m_poLen) {
|
||||||
m_poPtr = 0U;
|
m_poPtr = 0U;
|
||||||
@@ -105,6 +107,19 @@ void CNXDNTX::process()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (m_txCount > 0U) {
|
||||||
|
// Transmit silence until the hang timer has expired.
|
||||||
|
uint16_t space = io.getSpace();
|
||||||
|
|
||||||
|
while (space > (4U * NXDN_RADIO_SYMBOL_LENGTH)) {
|
||||||
|
writeSilence();
|
||||||
|
|
||||||
|
space -= 4U * NXDN_RADIO_SYMBOL_LENGTH;
|
||||||
|
m_txCount--;
|
||||||
|
|
||||||
|
if (m_txCount == 0U)
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,6 +170,19 @@ void CNXDNTX::writeByte(uint8_t c)
|
|||||||
io.write(STATE_NXDN, outBuffer, NXDN_RADIO_SYMBOL_LENGTH * 4U);
|
io.write(STATE_NXDN, outBuffer, NXDN_RADIO_SYMBOL_LENGTH * 4U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CNXDNTX::writeSilence()
|
||||||
|
{
|
||||||
|
q15_t inBuffer[4U] = {0x00U, 0x00U, 0x00U, 0x00U};
|
||||||
|
q15_t intBuffer[NXDN_RADIO_SYMBOL_LENGTH * 4U];
|
||||||
|
q15_t outBuffer[NXDN_RADIO_SYMBOL_LENGTH * 4U];
|
||||||
|
|
||||||
|
::arm_fir_interpolate_q15(&m_modFilter, inBuffer, intBuffer, 4U);
|
||||||
|
|
||||||
|
::arm_fir_fast_q15(&m_sincFilter, intBuffer, outBuffer, NXDN_RADIO_SYMBOL_LENGTH * 4U);
|
||||||
|
|
||||||
|
io.write(STATE_NXDN, outBuffer, NXDN_RADIO_SYMBOL_LENGTH * 4U);
|
||||||
|
}
|
||||||
|
|
||||||
void CNXDNTX::setTXDelay(uint8_t delay)
|
void CNXDNTX::setTXDelay(uint8_t delay)
|
||||||
{
|
{
|
||||||
m_txDelay = 300U + uint16_t(delay) * 6U; // 500ms + tx delay
|
m_txDelay = 300U + uint16_t(delay) * 6U; // 500ms + tx delay
|
||||||
@@ -168,3 +196,7 @@ uint8_t CNXDNTX::getSpace() const
|
|||||||
return m_buffer.getSpace() / NXDN_FRAME_LENGTH_BYTES;
|
return m_buffer.getSpace() / NXDN_FRAME_LENGTH_BYTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CNXDNTX::setParams(uint8_t txHang)
|
||||||
|
{
|
||||||
|
m_txHang = txHang * 600U;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
#include "SerialRB.h"
|
#include "RingBuffer.h"
|
||||||
|
|
||||||
class CNXDNTX {
|
class CNXDNTX {
|
||||||
public:
|
public:
|
||||||
@@ -35,8 +35,10 @@ public:
|
|||||||
|
|
||||||
uint8_t getSpace() const;
|
uint8_t getSpace() const;
|
||||||
|
|
||||||
|
void setParams(uint8_t txHang);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSerialRB m_buffer;
|
CRingBuffer<uint8_t> m_buffer;
|
||||||
arm_fir_interpolate_instance_q15 m_modFilter;
|
arm_fir_interpolate_instance_q15 m_modFilter;
|
||||||
arm_fir_instance_q15 m_sincFilter;
|
arm_fir_instance_q15 m_sincFilter;
|
||||||
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
||||||
@@ -45,9 +47,11 @@ private:
|
|||||||
uint16_t m_poLen;
|
uint16_t m_poLen;
|
||||||
uint16_t m_poPtr;
|
uint16_t m_poPtr;
|
||||||
uint16_t m_txDelay;
|
uint16_t m_txDelay;
|
||||||
|
uint32_t m_txHang;
|
||||||
|
uint32_t m_txCount;
|
||||||
|
|
||||||
void writeByte(uint8_t c);
|
void writeByte(uint8_t c);
|
||||||
|
void writeSilence();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ const unsigned int P25_TSDU_FRAME_LENGTH_BITS = P25_TSDU_FRAME_LENGTH_BYTES
|
|||||||
const unsigned int P25_TSDU_FRAME_LENGTH_SYMBOLS = P25_TSDU_FRAME_LENGTH_BYTES * 4U;
|
const unsigned int P25_TSDU_FRAME_LENGTH_SYMBOLS = P25_TSDU_FRAME_LENGTH_BYTES * 4U;
|
||||||
const unsigned int P25_TSDU_FRAME_LENGTH_SAMPLES = P25_TSDU_FRAME_LENGTH_SYMBOLS * P25_RADIO_SYMBOL_LENGTH;
|
const unsigned int P25_TSDU_FRAME_LENGTH_SAMPLES = P25_TSDU_FRAME_LENGTH_SYMBOLS * P25_RADIO_SYMBOL_LENGTH;
|
||||||
|
|
||||||
|
const unsigned int P25_PDU_HDR_FRAME_LENGTH_BYTES = 45U;
|
||||||
|
const unsigned int P25_PDU_HDR_FRAME_LENGTH_BITS = P25_PDU_HDR_FRAME_LENGTH_BYTES * 8U;
|
||||||
|
const unsigned int P25_PDU_HDR_FRAME_LENGTH_SYMBOLS = P25_PDU_HDR_FRAME_LENGTH_BYTES * 4U;
|
||||||
|
const unsigned int P25_PDU_HDR_FRAME_LENGTH_SAMPLES = P25_PDU_HDR_FRAME_LENGTH_SYMBOLS * P25_RADIO_SYMBOL_LENGTH;
|
||||||
|
|
||||||
const unsigned int P25_SYNC_LENGTH_BYTES = 6U;
|
const unsigned int P25_SYNC_LENGTH_BYTES = 6U;
|
||||||
const unsigned int P25_SYNC_LENGTH_BITS = P25_SYNC_LENGTH_BYTES * 8U;
|
const unsigned int P25_SYNC_LENGTH_BITS = P25_SYNC_LENGTH_BYTES * 8U;
|
||||||
const unsigned int P25_SYNC_LENGTH_SYMBOLS = P25_SYNC_LENGTH_BYTES * 4U;
|
const unsigned int P25_SYNC_LENGTH_SYMBOLS = P25_SYNC_LENGTH_BYTES * 4U;
|
||||||
|
|||||||
@@ -199,7 +199,19 @@ void CP25RX::processHdr(q15_t sample)
|
|||||||
serial.writeP25Hdr(frame, P25_HDR_FRAME_LENGTH_BYTES + 1U);
|
serial.writeP25Hdr(frame, P25_HDR_FRAME_LENGTH_BYTES + 1U);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case P25_DUID_TSDU: {
|
case P25_DUID_PDU: {
|
||||||
|
calculateLevels(m_hdrSyncPtr, P25_PDU_HDR_FRAME_LENGTH_SYMBOLS);
|
||||||
|
|
||||||
|
DEBUG4("P25RX: sync found in PDU pos/centre/threshold", m_hdrSyncPtr, m_centreVal, m_thresholdVal);
|
||||||
|
|
||||||
|
uint8_t frame[P25_PDU_HDR_FRAME_LENGTH_BYTES + 1U];
|
||||||
|
samplesToBits(m_hdrSyncPtr, P25_PDU_HDR_FRAME_LENGTH_SYMBOLS, frame, 8U, m_centreVal, m_thresholdVal);
|
||||||
|
|
||||||
|
frame[0U] = 0x01U;
|
||||||
|
serial.writeP25Hdr(frame, P25_PDU_HDR_FRAME_LENGTH_BYTES + 1U);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case P25_DUID_TSDU: {
|
||||||
calculateLevels(m_hdrStartPtr, P25_TSDU_FRAME_LENGTH_SYMBOLS);
|
calculateLevels(m_hdrStartPtr, P25_TSDU_FRAME_LENGTH_SYMBOLS);
|
||||||
|
|
||||||
DEBUG4("P25RX: sync found in TSDU pos/centre/threshold", m_hdrSyncPtr, m_centreVal, m_thresholdVal);
|
DEBUG4("P25RX: sync found in TSDU pos/centre/threshold", m_hdrSyncPtr, m_centreVal, m_thresholdVal);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2016,2017,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -43,7 +43,7 @@ const q15_t P25_LEVELD = -1260;
|
|||||||
const uint8_t P25_START_SYNC = 0x77U;
|
const uint8_t P25_START_SYNC = 0x77U;
|
||||||
|
|
||||||
CP25TX::CP25TX() :
|
CP25TX::CP25TX() :
|
||||||
m_buffer(4000U),
|
m_buffer(TX_BUFFER_LEN),
|
||||||
m_modFilter(),
|
m_modFilter(),
|
||||||
m_lpFilter(),
|
m_lpFilter(),
|
||||||
m_modState(),
|
m_modState(),
|
||||||
@@ -51,7 +51,9 @@ m_lpState(),
|
|||||||
m_poBuffer(),
|
m_poBuffer(),
|
||||||
m_poLen(0U),
|
m_poLen(0U),
|
||||||
m_poPtr(0U),
|
m_poPtr(0U),
|
||||||
m_txDelay(240U) // 200ms
|
m_txDelay(240U), // 200ms
|
||||||
|
m_txHang(6000U), // 5s
|
||||||
|
m_txCount(0U)
|
||||||
{
|
{
|
||||||
::memset(m_modState, 0x00U, 16U * sizeof(q15_t));
|
::memset(m_modState, 0x00U, 16U * sizeof(q15_t));
|
||||||
::memset(m_lpState, 0x00U, 60U * sizeof(q15_t));
|
::memset(m_lpState, 0x00U, 60U * sizeof(q15_t));
|
||||||
@@ -68,17 +70,16 @@ m_txDelay(240U) // 200ms
|
|||||||
|
|
||||||
void CP25TX::process()
|
void CP25TX::process()
|
||||||
{
|
{
|
||||||
if (m_buffer.getData() == 0U && m_poLen == 0U)
|
if (m_poLen == 0U && m_buffer.getData() > 0U) {
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_poLen == 0U) {
|
|
||||||
if (!m_tx) {
|
if (!m_tx) {
|
||||||
for (uint16_t i = 0U; i < m_txDelay; i++)
|
for (uint16_t i = 0U; i < m_txDelay; i++)
|
||||||
m_poBuffer[m_poLen++] = P25_START_SYNC;
|
m_poBuffer[m_poLen++] = P25_START_SYNC;
|
||||||
} else {
|
} else {
|
||||||
uint8_t length = m_buffer.get();
|
uint8_t length;
|
||||||
|
m_buffer.get(length);
|
||||||
for (uint8_t i = 0U; i < length; i++) {
|
for (uint8_t i = 0U; i < length; i++) {
|
||||||
uint8_t c = m_buffer.get();
|
uint8_t c = 0U;
|
||||||
|
m_buffer.get(c);
|
||||||
m_poBuffer[m_poLen++] = c;
|
m_poBuffer[m_poLen++] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,13 +95,28 @@ void CP25TX::process()
|
|||||||
writeByte(c);
|
writeByte(c);
|
||||||
|
|
||||||
space -= 4U * P25_RADIO_SYMBOL_LENGTH;
|
space -= 4U * P25_RADIO_SYMBOL_LENGTH;
|
||||||
|
if (m_duplex)
|
||||||
|
m_txCount = m_txHang;
|
||||||
|
|
||||||
if (m_poPtr >= m_poLen) {
|
if (m_poPtr >= m_poLen) {
|
||||||
m_poPtr = 0U;
|
m_poPtr = 0U;
|
||||||
m_poLen = 0U;
|
m_poLen = 0U;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (m_txCount > 0U) {
|
||||||
|
// Transmit silence until the hang timer has expired.
|
||||||
|
uint16_t space = io.getSpace();
|
||||||
|
|
||||||
|
while (space > (4U * P25_RADIO_SYMBOL_LENGTH)) {
|
||||||
|
writeSilence();
|
||||||
|
|
||||||
|
space -= 4U * P25_RADIO_SYMBOL_LENGTH;
|
||||||
|
m_txCount--;
|
||||||
|
|
||||||
|
if (m_txCount == 0U)
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,6 +168,19 @@ void CP25TX::writeByte(uint8_t c)
|
|||||||
io.write(STATE_P25, outBuffer, P25_RADIO_SYMBOL_LENGTH * 4U);
|
io.write(STATE_P25, outBuffer, P25_RADIO_SYMBOL_LENGTH * 4U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CP25TX::writeSilence()
|
||||||
|
{
|
||||||
|
q15_t inBuffer[4U] = {0x00U, 0x00U, 0x00U, 0x00U};
|
||||||
|
q15_t intBuffer[P25_RADIO_SYMBOL_LENGTH * 4U];
|
||||||
|
q15_t outBuffer[P25_RADIO_SYMBOL_LENGTH * 4U];
|
||||||
|
|
||||||
|
::arm_fir_interpolate_q15(&m_modFilter, inBuffer, intBuffer, 4U);
|
||||||
|
|
||||||
|
::arm_fir_fast_q15(&m_lpFilter, intBuffer, outBuffer, P25_RADIO_SYMBOL_LENGTH * 4U);
|
||||||
|
|
||||||
|
io.write(STATE_P25, outBuffer, P25_RADIO_SYMBOL_LENGTH * 4U);
|
||||||
|
}
|
||||||
|
|
||||||
void CP25TX::setTXDelay(uint8_t delay)
|
void CP25TX::setTXDelay(uint8_t delay)
|
||||||
{
|
{
|
||||||
m_txDelay = 600U + uint16_t(delay) * 12U; // 500ms + tx delay
|
m_txDelay = 600U + uint16_t(delay) * 12U; // 500ms + tx delay
|
||||||
@@ -164,3 +193,8 @@ uint8_t CP25TX::getSpace() const
|
|||||||
{
|
{
|
||||||
return m_buffer.getSpace() / P25_LDU_FRAME_LENGTH_BYTES;
|
return m_buffer.getSpace() / P25_LDU_FRAME_LENGTH_BYTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CP25TX::setParams(uint8_t txHang)
|
||||||
|
{
|
||||||
|
m_txHang = txHang * 1200U;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2016,2017,2020 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
#include "SerialRB.h"
|
#include "RingBuffer.h"
|
||||||
|
|
||||||
class CP25TX {
|
class CP25TX {
|
||||||
public:
|
public:
|
||||||
@@ -35,8 +35,10 @@ public:
|
|||||||
|
|
||||||
uint8_t getSpace() const;
|
uint8_t getSpace() const;
|
||||||
|
|
||||||
|
void setParams(uint8_t txHang);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSerialRB m_buffer;
|
CRingBuffer<uint8_t> m_buffer;
|
||||||
arm_fir_interpolate_instance_q15 m_modFilter;
|
arm_fir_interpolate_instance_q15 m_modFilter;
|
||||||
arm_fir_instance_q15 m_lpFilter;
|
arm_fir_instance_q15 m_lpFilter;
|
||||||
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
||||||
@@ -45,9 +47,11 @@ private:
|
|||||||
uint16_t m_poLen;
|
uint16_t m_poLen;
|
||||||
uint16_t m_poPtr;
|
uint16_t m_poPtr;
|
||||||
uint16_t m_txDelay;
|
uint16_t m_txDelay;
|
||||||
|
uint32_t m_txHang;
|
||||||
|
uint32_t m_txCount;
|
||||||
|
|
||||||
void writeByte(uint8_t c);
|
void writeByte(uint8_t c);
|
||||||
|
void writeSilence();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2009-2018,2020 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -61,7 +61,8 @@ void CPOCSAGTX::process()
|
|||||||
m_poBuffer[m_poLen++] = POCSAG_SYNC;
|
m_poBuffer[m_poLen++] = POCSAG_SYNC;
|
||||||
} else {
|
} else {
|
||||||
for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) {
|
for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) {
|
||||||
uint8_t c = m_buffer.get();
|
uint8_t c = 0U;
|
||||||
|
m_buffer.get(c);
|
||||||
m_poBuffer[m_poLen++] = c;
|
m_poBuffer[m_poLen++] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,4 +147,3 @@ uint8_t CPOCSAGTX::getSpace() const
|
|||||||
{
|
{
|
||||||
return m_buffer.getSpace() / POCSAG_FRAME_LENGTH_BYTES;
|
return m_buffer.getSpace() / POCSAG_FRAME_LENGTH_BYTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
#include "SerialRB.h"
|
#include "RingBuffer.h"
|
||||||
|
|
||||||
class CPOCSAGTX {
|
class CPOCSAGTX {
|
||||||
public:
|
public:
|
||||||
@@ -29,6 +29,8 @@ public:
|
|||||||
|
|
||||||
uint8_t writeData(const uint8_t* data, uint8_t length);
|
uint8_t writeData(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
|
void writeByte(uint8_t c);
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
void setTXDelay(uint8_t delay);
|
void setTXDelay(uint8_t delay);
|
||||||
@@ -38,15 +40,13 @@ public:
|
|||||||
bool busy();
|
bool busy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSerialRB m_buffer;
|
CRingBuffer<uint8_t> m_buffer;
|
||||||
arm_fir_instance_q15 m_modFilter;
|
arm_fir_instance_q15 m_modFilter;
|
||||||
q15_t m_modState[170U]; // NoTaps + BlockSize - 1, 6 + 160 - 1 plus some spare
|
q15_t m_modState[170U]; // NoTaps + BlockSize - 1, 6 + 160 - 1 plus some spare
|
||||||
uint8_t m_poBuffer[200U];
|
uint8_t m_poBuffer[200U];
|
||||||
uint16_t m_poLen;
|
uint16_t m_poLen;
|
||||||
uint16_t m_poPtr;
|
uint16_t m_poPtr;
|
||||||
uint16_t m_txDelay;
|
uint16_t m_txDelay;
|
||||||
|
|
||||||
void writeByte(uint8_t c);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
-102
@@ -1,102 +0,0 @@
|
|||||||
/*
|
|
||||||
TX fifo control - Copyright (C) KI6ZUM 2015
|
|
||||||
Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this library; if not, write to the
|
|
||||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "RSSIRB.h"
|
|
||||||
|
|
||||||
CRSSIRB::CRSSIRB(uint16_t length) :
|
|
||||||
m_length(length),
|
|
||||||
m_head(0U),
|
|
||||||
m_tail(0U),
|
|
||||||
m_full(false),
|
|
||||||
m_overflow(false)
|
|
||||||
{
|
|
||||||
m_rssi = new uint16_t[length];
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t CRSSIRB::getSpace() const
|
|
||||||
{
|
|
||||||
uint16_t n = 0U;
|
|
||||||
|
|
||||||
if (m_tail == m_head)
|
|
||||||
n = m_full ? 0U : m_length;
|
|
||||||
else if (m_tail < m_head)
|
|
||||||
n = m_length - m_head + m_tail;
|
|
||||||
else
|
|
||||||
n = m_tail - m_head;
|
|
||||||
|
|
||||||
if (n > m_length)
|
|
||||||
n = 0U;
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t CRSSIRB::getData() const
|
|
||||||
{
|
|
||||||
if (m_tail == m_head)
|
|
||||||
return m_full ? m_length : 0U;
|
|
||||||
else if (m_tail < m_head)
|
|
||||||
return m_head - m_tail;
|
|
||||||
else
|
|
||||||
return m_length - m_tail + m_head;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CRSSIRB::put(uint16_t rssi)
|
|
||||||
{
|
|
||||||
if (m_full) {
|
|
||||||
m_overflow = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rssi[m_head] = rssi;
|
|
||||||
|
|
||||||
m_head++;
|
|
||||||
if (m_head >= m_length)
|
|
||||||
m_head = 0U;
|
|
||||||
|
|
||||||
if (m_head == m_tail)
|
|
||||||
m_full = true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CRSSIRB::get(uint16_t& rssi)
|
|
||||||
{
|
|
||||||
if (m_head == m_tail && !m_full)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
rssi = m_rssi[m_tail];
|
|
||||||
|
|
||||||
m_full = false;
|
|
||||||
|
|
||||||
m_tail++;
|
|
||||||
if (m_tail >= m_length)
|
|
||||||
m_tail = 0U;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CRSSIRB::hasOverflowed()
|
|
||||||
{
|
|
||||||
bool overflow = m_overflow;
|
|
||||||
|
|
||||||
m_overflow = false;
|
|
||||||
|
|
||||||
return overflow;
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
Serial fifo control - Copyright (C) KI6ZUM 2015
|
|
||||||
Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this library; if not, write to the
|
|
||||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(RSSIRB_H)
|
|
||||||
#define RSSIRB_H
|
|
||||||
|
|
||||||
#if defined(STM32F4XX)
|
|
||||||
#include "stm32f4xx.h"
|
|
||||||
#elif defined(STM32F7XX)
|
|
||||||
#include "stm32f7xx.h"
|
|
||||||
#elif defined(STM32F105xC)
|
|
||||||
#include "stm32f1xx.h"
|
|
||||||
#include <cstddef>
|
|
||||||
#else
|
|
||||||
#include <Arduino.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class CRSSIRB {
|
|
||||||
public:
|
|
||||||
CRSSIRB(uint16_t length);
|
|
||||||
|
|
||||||
uint16_t getSpace() const;
|
|
||||||
|
|
||||||
uint16_t getData() const;
|
|
||||||
|
|
||||||
bool put(uint16_t rssi);
|
|
||||||
|
|
||||||
bool get(uint16_t& rssi);
|
|
||||||
|
|
||||||
bool hasOverflowed();
|
|
||||||
|
|
||||||
private:
|
|
||||||
uint16_t m_length;
|
|
||||||
volatile uint16_t* m_rssi;
|
|
||||||
volatile uint16_t m_head;
|
|
||||||
volatile uint16_t m_tail;
|
|
||||||
volatile bool m_full;
|
|
||||||
bool m_overflow;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2020 by Geoffrey Merck F4FXL - KC3FRA
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(RINGBUFFER_H)
|
||||||
|
#define RINGBUFFER_H
|
||||||
|
|
||||||
|
#if defined(STM32F4XX)
|
||||||
|
#include "stm32f4xx.h"
|
||||||
|
#elif defined(STM32F7XX)
|
||||||
|
#include "stm32f7xx.h"
|
||||||
|
#elif defined(STM32F105xC)
|
||||||
|
#include "stm32f1xx.h"
|
||||||
|
#include <cstddef>
|
||||||
|
#else
|
||||||
|
#include <Arduino.h>
|
||||||
|
#undef PI
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__SAM3X8E__) || defined(STM32F105xC)
|
||||||
|
#define ARM_MATH_CM3
|
||||||
|
#elif defined(STM32F7XX)
|
||||||
|
#define ARM_MATH_CM7
|
||||||
|
#elif defined(STM32F4XX) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||||
|
#define ARM_MATH_CM4
|
||||||
|
#else
|
||||||
|
#error "Unknown processor type"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <arm_math.h>
|
||||||
|
|
||||||
|
template <typename TDATATYPE>
|
||||||
|
class CRingBuffer {
|
||||||
|
public:
|
||||||
|
CRingBuffer(uint16_t length = 370U);
|
||||||
|
|
||||||
|
uint16_t getSpace() const;
|
||||||
|
|
||||||
|
uint16_t getData() const;
|
||||||
|
|
||||||
|
bool put(TDATATYPE item) volatile;
|
||||||
|
|
||||||
|
bool get(TDATATYPE& item) volatile;
|
||||||
|
|
||||||
|
TDATATYPE peek() const;
|
||||||
|
|
||||||
|
bool hasOverflowed();
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint16_t m_length;
|
||||||
|
TDATATYPE* m_buffer;
|
||||||
|
volatile uint16_t m_head;
|
||||||
|
volatile uint16_t m_tail;
|
||||||
|
volatile bool m_full;
|
||||||
|
bool m_overflow;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "RingBuffer.impl.h"
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2020 by Geoffrey Merck F4FXL - KC3FRA
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "RingBuffer.h"
|
||||||
|
|
||||||
|
template <typename TDATATYPE> CRingBuffer<TDATATYPE>::CRingBuffer(uint16_t length) :
|
||||||
|
m_length(length),
|
||||||
|
m_head(0U),
|
||||||
|
m_tail(0U),
|
||||||
|
m_full(false),
|
||||||
|
m_overflow(false)
|
||||||
|
{
|
||||||
|
m_buffer = new TDATATYPE[length];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename TDATATYPE> uint16_t CRingBuffer<TDATATYPE>::getSpace() const
|
||||||
|
{
|
||||||
|
uint16_t n = 0U;
|
||||||
|
|
||||||
|
if (m_tail == m_head)
|
||||||
|
n = m_full ? 0U : m_length;
|
||||||
|
else if (m_tail < m_head)
|
||||||
|
n = m_length - m_head + m_tail;
|
||||||
|
else
|
||||||
|
n = m_tail - m_head;
|
||||||
|
|
||||||
|
if (n > m_length)
|
||||||
|
n = 0U;
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename TDATATYPE> uint16_t CRingBuffer<TDATATYPE>::getData() const
|
||||||
|
{
|
||||||
|
if (m_tail == m_head)
|
||||||
|
return m_full ? m_length : 0U;
|
||||||
|
else if (m_tail < m_head)
|
||||||
|
return m_head - m_tail;
|
||||||
|
else
|
||||||
|
return m_length - m_tail + m_head;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename TDATATYPE> bool CRingBuffer<TDATATYPE>::put(TDATATYPE item) volatile
|
||||||
|
{
|
||||||
|
if (m_full) {
|
||||||
|
m_overflow = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_buffer[m_head] = item;
|
||||||
|
|
||||||
|
m_head++;
|
||||||
|
if (m_head >= m_length)
|
||||||
|
m_head = 0U;
|
||||||
|
|
||||||
|
if (m_head == m_tail)
|
||||||
|
m_full = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename TDATATYPE> TDATATYPE CRingBuffer<TDATATYPE>::peek() const
|
||||||
|
{
|
||||||
|
return m_buffer[m_tail];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename TDATATYPE> bool CRingBuffer<TDATATYPE>::get(TDATATYPE& item) volatile
|
||||||
|
{
|
||||||
|
if (m_head == m_tail && !m_full)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
item = m_buffer[m_tail];
|
||||||
|
|
||||||
|
m_full = false;
|
||||||
|
|
||||||
|
m_tail++;
|
||||||
|
if (m_tail >= m_length)
|
||||||
|
m_tail = 0U;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename TDATATYPE> bool CRingBuffer<TDATATYPE>::hasOverflowed()
|
||||||
|
{
|
||||||
|
bool overflow = m_overflow;
|
||||||
|
|
||||||
|
m_overflow = false;
|
||||||
|
|
||||||
|
return overflow;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename TDATATYPE> void CRingBuffer<TDATATYPE>::reset()
|
||||||
|
{
|
||||||
|
m_head = 0U;
|
||||||
|
m_tail = 0U;
|
||||||
|
m_full = false;
|
||||||
|
m_overflow = false;
|
||||||
|
}
|
||||||
Submodule
+1
Submodule STM32F10X_Lib added at 417e0c2f4a
+100
@@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (c) 2020 by Geoffrey Merck F4FXL - KC3FRA
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(STM32F4XX) || defined(STM32F7XX)
|
||||||
|
|
||||||
|
#include "STMUART.h"
|
||||||
|
|
||||||
|
CSTMUART::CSTMUART() :
|
||||||
|
m_usart(NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSTMUART::init(USART_TypeDef* usart)
|
||||||
|
{
|
||||||
|
m_usart = usart;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSTMUART::write(const uint8_t * data, uint16_t length)
|
||||||
|
{
|
||||||
|
if(length == 0U || m_usart == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
m_txFifo.put(data[0]);
|
||||||
|
USART_ITConfig(m_usart, USART_IT_TXE, ENABLE);//switch TX IRQ is on
|
||||||
|
|
||||||
|
for(uint16_t i = 1U; i < length; i++) {
|
||||||
|
m_txFifo.put(data[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
USART_ITConfig(m_usart, USART_IT_TXE, ENABLE);//make sure TX IRQ is on
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CSTMUART::read()
|
||||||
|
{
|
||||||
|
return m_rxFifo.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSTMUART::handleIRQ()
|
||||||
|
{
|
||||||
|
if(m_usart == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (USART_GetITStatus(m_usart, USART_IT_RXNE)) {
|
||||||
|
if(!m_rxFifo.isFull())
|
||||||
|
m_rxFifo.put((uint8_t) USART_ReceiveData(m_usart));
|
||||||
|
USART_ClearITPendingBit(USART1, USART_IT_RXNE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (USART_GetITStatus(m_usart, USART_IT_TXE)) {
|
||||||
|
if(!m_txFifo.isEmpty())
|
||||||
|
USART_SendData(m_usart, m_txFifo.get());
|
||||||
|
|
||||||
|
USART_ClearITPendingBit(m_usart, USART_IT_TXE);
|
||||||
|
|
||||||
|
if (m_txFifo.isEmpty()) // if there's no more data to transmit then turn off TX interrupts
|
||||||
|
USART_ITConfig(m_usart, USART_IT_TXE, DISABLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flushes the transmit shift register
|
||||||
|
// warning: this call is blocking
|
||||||
|
void CSTMUART::flush()
|
||||||
|
{
|
||||||
|
if(m_usart == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// wait until the TXE shows the shift register is empty
|
||||||
|
while (USART_GetITStatus(m_usart, USART_FLAG_TXE))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t CSTMUART::available()
|
||||||
|
{
|
||||||
|
return m_rxFifo.isEmpty() ? 0U : 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t CSTMUART::availableForWrite()
|
||||||
|
{
|
||||||
|
return m_txFifo.isFull() ? 0U : 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (c) 2020 by Geoffrey Merck F4FXL - KC3FRA
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(STM32F4XX) || defined(STM32F7XX)
|
||||||
|
#if !defined(STMUART_H)
|
||||||
|
#define STMUART_H
|
||||||
|
|
||||||
|
#if defined(STM32F4XX)
|
||||||
|
#include "stm32f4xx.h"
|
||||||
|
#elif defined(STM32F7XX)
|
||||||
|
#include "stm32f7xx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const uint16_t BUFFER_SIZE = 2048U; //needs to be a power of 2 !
|
||||||
|
const uint16_t BUFFER_MASK = BUFFER_SIZE - 1;
|
||||||
|
|
||||||
|
class CSTMUARTFIFO {
|
||||||
|
public:
|
||||||
|
CSTMUARTFIFO() :
|
||||||
|
m_head(0U),
|
||||||
|
m_tail(0U)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void put(uint8_t data)
|
||||||
|
{
|
||||||
|
m_buffer[BUFFER_MASK & (m_head++)] = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t get()
|
||||||
|
{
|
||||||
|
return m_buffer[BUFFER_MASK & (m_tail++)];
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
m_tail = 0U;
|
||||||
|
m_head = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isEmpty()
|
||||||
|
{
|
||||||
|
return m_tail == m_head;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isFull()
|
||||||
|
{
|
||||||
|
return ((m_head + 1U) & BUFFER_MASK) == (m_tail & BUFFER_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
volatile uint8_t m_buffer[BUFFER_SIZE];
|
||||||
|
volatile uint16_t m_head;
|
||||||
|
volatile uint16_t m_tail;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CSTMUART {
|
||||||
|
public:
|
||||||
|
CSTMUART();
|
||||||
|
void init(USART_TypeDef* usart);
|
||||||
|
void write(const uint8_t * data, uint16_t length);
|
||||||
|
uint8_t read();
|
||||||
|
void handleIRQ();
|
||||||
|
void flush();
|
||||||
|
uint16_t available();
|
||||||
|
uint16_t availableForWrite();
|
||||||
|
|
||||||
|
private:
|
||||||
|
USART_TypeDef * m_usart;
|
||||||
|
CSTMUARTFIFO m_rxFifo;
|
||||||
|
CSTMUARTFIFO m_txFifo;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
-106
@@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
TX fifo control - Copyright (C) KI6ZUM 2015
|
|
||||||
Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this library; if not, write to the
|
|
||||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "SampleRB.h"
|
|
||||||
|
|
||||||
CSampleRB::CSampleRB(uint16_t length) :
|
|
||||||
m_length(length),
|
|
||||||
m_head(0U),
|
|
||||||
m_tail(0U),
|
|
||||||
m_full(false),
|
|
||||||
m_overflow(false)
|
|
||||||
{
|
|
||||||
m_samples = new uint16_t[length];
|
|
||||||
m_control = new uint8_t[length];
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t CSampleRB::getSpace() const
|
|
||||||
{
|
|
||||||
uint16_t n = 0U;
|
|
||||||
|
|
||||||
if (m_tail == m_head)
|
|
||||||
n = m_full ? 0U : m_length;
|
|
||||||
else if (m_tail < m_head)
|
|
||||||
n = m_length - m_head + m_tail;
|
|
||||||
else
|
|
||||||
n = m_tail - m_head;
|
|
||||||
|
|
||||||
if (n > m_length)
|
|
||||||
n = 0U;
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t CSampleRB::getData() const
|
|
||||||
{
|
|
||||||
if (m_tail == m_head)
|
|
||||||
return m_full ? m_length : 0U;
|
|
||||||
else if (m_tail < m_head)
|
|
||||||
return m_head - m_tail;
|
|
||||||
else
|
|
||||||
return m_length - m_tail + m_head;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSampleRB::put(uint16_t sample, uint8_t control)
|
|
||||||
{
|
|
||||||
if (m_full) {
|
|
||||||
m_overflow = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_samples[m_head] = sample;
|
|
||||||
m_control[m_head] = control;
|
|
||||||
|
|
||||||
m_head++;
|
|
||||||
if (m_head >= m_length)
|
|
||||||
m_head = 0U;
|
|
||||||
|
|
||||||
if (m_head == m_tail)
|
|
||||||
m_full = true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSampleRB::get(uint16_t& sample, uint8_t& control)
|
|
||||||
{
|
|
||||||
if (m_head == m_tail && !m_full)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
sample = m_samples[m_tail];
|
|
||||||
control = m_control[m_tail];
|
|
||||||
|
|
||||||
m_full = false;
|
|
||||||
|
|
||||||
m_tail++;
|
|
||||||
if (m_tail >= m_length)
|
|
||||||
m_tail = 0U;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSampleRB::hasOverflowed()
|
|
||||||
{
|
|
||||||
bool overflow = m_overflow;
|
|
||||||
|
|
||||||
m_overflow = false;
|
|
||||||
|
|
||||||
return overflow;
|
|
||||||
}
|
|
||||||
|
|
||||||
-60
@@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
Serial fifo control - Copyright (C) KI6ZUM 2015
|
|
||||||
Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this library; if not, write to the
|
|
||||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(SAMPLERB_H)
|
|
||||||
#define SAMPLERB_H
|
|
||||||
|
|
||||||
#if defined(STM32F4XX)
|
|
||||||
#include "stm32f4xx.h"
|
|
||||||
#elif defined(STM32F7XX)
|
|
||||||
#include "stm32f7xx.h"
|
|
||||||
#elif defined(STM32F105xC)
|
|
||||||
#include "stm32f1xx.h"
|
|
||||||
#include <cstddef>
|
|
||||||
#else
|
|
||||||
#include <Arduino.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class CSampleRB {
|
|
||||||
public:
|
|
||||||
CSampleRB(uint16_t length);
|
|
||||||
|
|
||||||
uint16_t getSpace() const;
|
|
||||||
|
|
||||||
uint16_t getData() const;
|
|
||||||
|
|
||||||
bool put(uint16_t sample, uint8_t control);
|
|
||||||
|
|
||||||
bool get(uint16_t& sample, uint8_t& control);
|
|
||||||
|
|
||||||
bool hasOverflowed();
|
|
||||||
|
|
||||||
private:
|
|
||||||
uint16_t m_length;
|
|
||||||
volatile uint16_t* m_samples;
|
|
||||||
volatile uint8_t* m_control;
|
|
||||||
volatile uint16_t m_head;
|
|
||||||
volatile uint16_t m_tail;
|
|
||||||
volatile bool m_full;
|
|
||||||
bool m_overflow;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+307
-123
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2013,2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2013,2015-2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -65,12 +65,21 @@ const uint8_t MMDVM_NXDN_LOST = 0x41U;
|
|||||||
|
|
||||||
const uint8_t MMDVM_POCSAG_DATA = 0x50U;
|
const uint8_t MMDVM_POCSAG_DATA = 0x50U;
|
||||||
|
|
||||||
|
const uint8_t MMDVM_FM_PARAMS1 = 0x60U;
|
||||||
|
const uint8_t MMDVM_FM_PARAMS2 = 0x61U;
|
||||||
|
const uint8_t MMDVM_FM_PARAMS3 = 0x62U;
|
||||||
|
const uint8_t MMDVM_FM_PARAMS4 = 0x63U;
|
||||||
|
const uint8_t MMDVM_FM_DATA = 0x65U;
|
||||||
|
const uint8_t MMDVM_FM_STATUS = 0x66U;
|
||||||
|
const uint8_t MMDVM_FM_EOT = 0x67U;
|
||||||
|
|
||||||
const uint8_t MMDVM_ACK = 0x70U;
|
const uint8_t MMDVM_ACK = 0x70U;
|
||||||
const uint8_t MMDVM_NAK = 0x7FU;
|
const uint8_t MMDVM_NAK = 0x7FU;
|
||||||
|
|
||||||
const uint8_t MMDVM_SERIAL = 0x80U;
|
const uint8_t MMDVM_SERIAL = 0x80U;
|
||||||
|
|
||||||
const uint8_t MMDVM_TRANSPARENT = 0x90U;
|
const uint8_t MMDVM_TRANSPARENT = 0x90U;
|
||||||
|
const uint8_t MMDVM_QSO_INFO = 0x91U;
|
||||||
|
|
||||||
const uint8_t MMDVM_DEBUG1 = 0xF1U;
|
const uint8_t MMDVM_DEBUG1 = 0xF1U;
|
||||||
const uint8_t MMDVM_DEBUG2 = 0xF2U;
|
const uint8_t MMDVM_DEBUG2 = 0xF2U;
|
||||||
@@ -90,14 +99,22 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U;
|
|||||||
#define TCXO "NO TCXO"
|
#define TCXO "NO TCXO"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DESCRIPTION "MMDVM 20180723 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG)"
|
#if defined(DRCC_DVM_NQF)
|
||||||
|
#define HW_TYPE "MMDVM DRCC_DVM_NQF"
|
||||||
|
#elif defined(STM32F4_RPT_HAT_TGO)
|
||||||
|
#define HW_TYPE "MMDVM RPT_HAT_TGO"
|
||||||
|
#else
|
||||||
|
#define HW_TYPE "MMDVM"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DESCRIPTION "20200620 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)"
|
||||||
|
|
||||||
#if defined(GITVERSION)
|
#if defined(GITVERSION)
|
||||||
#define concat(a, b, c) a " " b " GitID #" c ""
|
#define concat(h, a, b, c) h " " a " " b " GitID #" c ""
|
||||||
const char HARDWARE[] = concat(DESCRIPTION, TCXO, GITVERSION);
|
const char HARDWARE[] = concat(HW_TYPE, DESCRIPTION, TCXO, GITVERSION);
|
||||||
#else
|
#else
|
||||||
#define concat(a, b, c, d) a " " b " (Build: " c " " d ")"
|
#define concat(h, a, b, c, d) h " " a " " b " (Build: " c " " d ")"
|
||||||
const char HARDWARE[] = concat(DESCRIPTION, TCXO, __TIME__, __DATE__);
|
const char HARDWARE[] = concat(HW_TYPE, DESCRIPTION, TCXO, __TIME__, __DATE__);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uint8_t PROTOCOL_VERSION = 1U;
|
const uint8_t PROTOCOL_VERSION = 1U;
|
||||||
@@ -145,7 +162,7 @@ void CSerialPort::getStatus()
|
|||||||
|
|
||||||
// Send all sorts of interesting internal values
|
// Send all sorts of interesting internal values
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
reply[1U] = 13U;
|
reply[1U] = 14U;
|
||||||
reply[2U] = MMDVM_GET_STATUS;
|
reply[2U] = MMDVM_GET_STATUS;
|
||||||
|
|
||||||
reply[3U] = 0x00U;
|
reply[3U] = 0x00U;
|
||||||
@@ -161,6 +178,8 @@ void CSerialPort::getStatus()
|
|||||||
reply[3U] |= 0x10U;
|
reply[3U] |= 0x10U;
|
||||||
if (m_pocsagEnable)
|
if (m_pocsagEnable)
|
||||||
reply[3U] |= 0x20U;
|
reply[3U] |= 0x20U;
|
||||||
|
if (m_fmEnable)
|
||||||
|
reply[3U] |= 0x40U;
|
||||||
|
|
||||||
reply[4U] = uint8_t(m_modemState);
|
reply[4U] = uint8_t(m_modemState);
|
||||||
|
|
||||||
@@ -225,7 +244,12 @@ void CSerialPort::getStatus()
|
|||||||
else
|
else
|
||||||
reply[12U] = 0U;
|
reply[12U] = 0U;
|
||||||
|
|
||||||
writeInt(1U, reply, 13);
|
if (m_fmEnable)
|
||||||
|
reply[13U] = fm.getSpace();
|
||||||
|
else
|
||||||
|
reply[13U] = 0U;
|
||||||
|
|
||||||
|
writeInt(1U, reply, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSerialPort::getVersion()
|
void CSerialPort::getVersion()
|
||||||
@@ -249,7 +273,7 @@ void CSerialPort::getVersion()
|
|||||||
|
|
||||||
uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
{
|
{
|
||||||
if (length < 18U)
|
if (length < 21U)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
||||||
bool rxInvert = (data[0U] & 0x01U) == 0x01U;
|
bool rxInvert = (data[0U] & 0x01U) == 0x01U;
|
||||||
@@ -266,6 +290,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||||||
bool p25Enable = (data[1U] & 0x08U) == 0x08U;
|
bool p25Enable = (data[1U] & 0x08U) == 0x08U;
|
||||||
bool nxdnEnable = (data[1U] & 0x10U) == 0x10U;
|
bool nxdnEnable = (data[1U] & 0x10U) == 0x10U;
|
||||||
bool pocsagEnable = (data[1U] & 0x20U) == 0x20U;
|
bool pocsagEnable = (data[1U] & 0x20U) == 0x20U;
|
||||||
|
bool fmEnable = (data[1U] & 0x40U) == 0x40U;
|
||||||
|
|
||||||
uint8_t txDelay = data[2U];
|
uint8_t txDelay = data[2U];
|
||||||
if (txDelay > 50U)
|
if (txDelay > 50U)
|
||||||
@@ -273,7 +298,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||||||
|
|
||||||
MMDVM_STATE modemState = MMDVM_STATE(data[3U]);
|
MMDVM_STATE modemState = MMDVM_STATE(data[3U]);
|
||||||
|
|
||||||
if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_RSSICAL && modemState != STATE_LFCAL && modemState != STATE_DMRCAL1K && modemState != STATE_P25CAL1K && modemState != STATE_DMRDMO1K && modemState != STATE_NXDNCAL1K)
|
if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_FM && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_RSSICAL && modemState != STATE_LFCAL && modemState != STATE_DMRCAL1K && modemState != STATE_P25CAL1K && modemState != STATE_DMRDMO1K && modemState != STATE_NXDNCAL1K && modemState != STATE_POCSAGCAL && modemState != STATE_FMCAL10K && modemState != STATE_FMCAL12K && modemState != STATE_FMCAL15K && modemState != STATE_FMCAL20K && modemState != STATE_FMCAL25K && modemState != STATE_FMCAL30K)
|
||||||
return 4U;
|
return 4U;
|
||||||
if (modemState == STATE_DSTAR && !dstarEnable)
|
if (modemState == STATE_DSTAR && !dstarEnable)
|
||||||
return 4U;
|
return 4U;
|
||||||
@@ -287,6 +312,8 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||||||
return 4U;
|
return 4U;
|
||||||
if (modemState == STATE_POCSAG && !pocsagEnable)
|
if (modemState == STATE_POCSAG && !pocsagEnable)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
if (modemState == STATE_FM && !fmEnable)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
uint8_t rxLevel = data[4U];
|
uint8_t rxLevel = data[4U];
|
||||||
|
|
||||||
@@ -311,7 +338,13 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||||||
|
|
||||||
uint8_t pocsagTXLevel = data[17U];
|
uint8_t pocsagTXLevel = data[17U];
|
||||||
|
|
||||||
m_modemState = modemState;
|
uint8_t fmTXLevel = data[18U];
|
||||||
|
|
||||||
|
uint8_t p25TXHang = data[19U];
|
||||||
|
|
||||||
|
uint8_t nxdnTXHang = data[20U];
|
||||||
|
|
||||||
|
setMode(modemState);
|
||||||
|
|
||||||
m_dstarEnable = dstarEnable;
|
m_dstarEnable = dstarEnable;
|
||||||
m_dmrEnable = dmrEnable;
|
m_dmrEnable = dmrEnable;
|
||||||
@@ -319,6 +352,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||||||
m_p25Enable = p25Enable;
|
m_p25Enable = p25Enable;
|
||||||
m_nxdnEnable = nxdnEnable;
|
m_nxdnEnable = nxdnEnable;
|
||||||
m_pocsagEnable = pocsagEnable;
|
m_pocsagEnable = pocsagEnable;
|
||||||
|
m_fmEnable = fmEnable;
|
||||||
m_duplex = !simplex;
|
m_duplex = !simplex;
|
||||||
|
|
||||||
dstarTX.setTXDelay(txDelay);
|
dstarTX.setTXDelay(txDelay);
|
||||||
@@ -335,14 +369,107 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||||||
dmrIdleRX.setColorCode(colorCode);
|
dmrIdleRX.setColorCode(colorCode);
|
||||||
|
|
||||||
ysfTX.setParams(ysfLoDev, ysfTXHang);
|
ysfTX.setParams(ysfLoDev, ysfTXHang);
|
||||||
|
p25TX.setParams(p25TXHang);
|
||||||
|
nxdnTX.setParams(nxdnTXHang);
|
||||||
|
|
||||||
io.setParameters(rxInvert, txInvert, pttInvert, rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, pocsagTXLevel, txDCOffset, rxDCOffset);
|
io.setParameters(rxInvert, txInvert, pttInvert, rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, pocsagTXLevel, fmTXLevel, txDCOffset, rxDCOffset);
|
||||||
|
|
||||||
io.start();
|
io.start();
|
||||||
|
|
||||||
return 0U;
|
return 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t CSerialPort::setFMParams1(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (length < 8U)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
uint8_t speed = data[0U];;
|
||||||
|
uint16_t frequency = data[1U] * 10U;
|
||||||
|
uint8_t time = data[2U];
|
||||||
|
uint8_t holdoff = data[3U];
|
||||||
|
uint8_t highLevel = data[4U];
|
||||||
|
uint8_t lowLevel = data[5U];
|
||||||
|
|
||||||
|
bool callAtStart = (data[6U] & 0x01U) == 0x01U;
|
||||||
|
bool callAtEnd = (data[6U] & 0x02U) == 0x02U;
|
||||||
|
bool callAtLatch = (data[6U] & 0x04U) == 0x04U;
|
||||||
|
|
||||||
|
char callsign[50U];
|
||||||
|
uint8_t n = 0U;
|
||||||
|
for (uint8_t i = 7U; i < length; i++, n++)
|
||||||
|
callsign[n] = data[i];
|
||||||
|
callsign[n] = '\0';
|
||||||
|
|
||||||
|
return fm.setCallsign(callsign, speed, frequency, time, holdoff, highLevel, lowLevel, callAtStart, callAtEnd, callAtLatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CSerialPort::setFMParams2(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (length < 6U)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
uint8_t speed = data[0U];
|
||||||
|
uint16_t frequency = data[1U] * 10U;
|
||||||
|
uint8_t minTime = data[2U];
|
||||||
|
uint16_t delay = data[3U] * 10U;
|
||||||
|
uint8_t level = data[4U];
|
||||||
|
|
||||||
|
char ack[50U];
|
||||||
|
uint8_t n = 0U;
|
||||||
|
for (uint8_t i = 5U; i < length; i++, n++)
|
||||||
|
ack[n] = data[i];
|
||||||
|
ack[n] = '\0';
|
||||||
|
|
||||||
|
return fm.setAck(ack, speed, frequency, minTime, delay, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CSerialPort::setFMParams3(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (length < 12U)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
uint16_t timeout = data[0U] * 5U;
|
||||||
|
uint8_t timeoutLevel = data[1U];
|
||||||
|
|
||||||
|
uint8_t ctcssFrequency = data[2U];
|
||||||
|
uint8_t ctcssHighThreshold = data[3U];
|
||||||
|
uint8_t ctcssLowThreshold = data[4U];
|
||||||
|
uint8_t ctcssLevel = data[5U];
|
||||||
|
|
||||||
|
uint8_t kerchunkTime = data[6U];
|
||||||
|
uint8_t hangTime = data[7U];
|
||||||
|
|
||||||
|
bool useCOS = (data[8U] & 0x01U) == 0x01U;
|
||||||
|
bool cosInvert = (data[8U] & 0x02U) == 0x02U;
|
||||||
|
bool kerchunkTX = (data[8U] & 0x04U) == 0x04U;
|
||||||
|
|
||||||
|
uint8_t rfAudioBoost = data[9U];
|
||||||
|
uint8_t maxDev = data[10U];
|
||||||
|
uint8_t rxLevel = data[11U];
|
||||||
|
|
||||||
|
return fm.setMisc(timeout, timeoutLevel, ctcssFrequency, ctcssHighThreshold, ctcssLowThreshold, ctcssLevel, kerchunkTime, kerchunkTX, hangTime, useCOS, cosInvert, rfAudioBoost, maxDev, rxLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CSerialPort::setFMParams4(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (length < 4U)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
uint8_t audioBoost = data[0U];
|
||||||
|
uint8_t speed = data[1U];
|
||||||
|
uint16_t frequency = data[2U] * 10U;
|
||||||
|
uint8_t level = data[3U];
|
||||||
|
|
||||||
|
char ack[50U];
|
||||||
|
uint8_t n = 0U;
|
||||||
|
for (uint8_t i = 4U; i < length; i++, n++)
|
||||||
|
ack[n] = data[i];
|
||||||
|
ack[n] = '\0';
|
||||||
|
|
||||||
|
return fm.setExt(ack, audioBoost, speed, frequency, level);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length)
|
uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length)
|
||||||
{
|
{
|
||||||
if (length < 1U)
|
if (length < 1U)
|
||||||
@@ -353,7 +480,7 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length)
|
|||||||
if (modemState == m_modemState)
|
if (modemState == m_modemState)
|
||||||
return 0U;
|
return 0U;
|
||||||
|
|
||||||
if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_RSSICAL && modemState != STATE_LFCAL && modemState != STATE_DMRCAL1K && modemState != STATE_P25CAL1K && modemState != STATE_DMRDMO1K && modemState != STATE_NXDNCAL1K)
|
if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_FM && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_RSSICAL && modemState != STATE_LFCAL && modemState != STATE_DMRCAL1K && modemState != STATE_P25CAL1K && modemState != STATE_DMRDMO1K && modemState != STATE_NXDNCAL1K && modemState != STATE_POCSAGCAL && modemState != STATE_FMCAL10K && modemState != STATE_FMCAL12K && modemState != STATE_FMCAL15K && modemState != STATE_FMCAL20K && modemState != STATE_FMCAL25K && modemState != STATE_FMCAL30K)
|
||||||
return 4U;
|
return 4U;
|
||||||
if (modemState == STATE_DSTAR && !m_dstarEnable)
|
if (modemState == STATE_DSTAR && !m_dstarEnable)
|
||||||
return 4U;
|
return 4U;
|
||||||
@@ -367,6 +494,8 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length)
|
|||||||
return 4U;
|
return 4U;
|
||||||
if (modemState == STATE_POCSAG && !m_pocsagEnable)
|
if (modemState == STATE_POCSAG && !m_pocsagEnable)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
if (modemState == STATE_FM && !m_fmEnable)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
setMode(modemState);
|
setMode(modemState);
|
||||||
|
|
||||||
@@ -378,157 +507,95 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
|
|||||||
switch (modemState) {
|
switch (modemState) {
|
||||||
case STATE_DMR:
|
case STATE_DMR:
|
||||||
DEBUG1("Mode set to DMR");
|
DEBUG1("Mode set to DMR");
|
||||||
dstarRX.reset();
|
|
||||||
ysfRX.reset();
|
|
||||||
p25RX.reset();
|
|
||||||
nxdnRX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
case STATE_DSTAR:
|
case STATE_DSTAR:
|
||||||
DEBUG1("Mode set to D-Star");
|
DEBUG1("Mode set to D-Star");
|
||||||
dmrIdleRX.reset();
|
|
||||||
dmrDMORX.reset();
|
|
||||||
dmrRX.reset();
|
|
||||||
ysfRX.reset();
|
|
||||||
p25RX.reset();
|
|
||||||
nxdnRX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
case STATE_YSF:
|
case STATE_YSF:
|
||||||
DEBUG1("Mode set to System Fusion");
|
DEBUG1("Mode set to System Fusion");
|
||||||
dmrIdleRX.reset();
|
|
||||||
dmrDMORX.reset();
|
|
||||||
dmrRX.reset();
|
|
||||||
dstarRX.reset();
|
|
||||||
p25RX.reset();
|
|
||||||
nxdnRX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
case STATE_P25:
|
case STATE_P25:
|
||||||
DEBUG1("Mode set to P25");
|
DEBUG1("Mode set to P25");
|
||||||
dmrIdleRX.reset();
|
|
||||||
dmrDMORX.reset();
|
|
||||||
dmrRX.reset();
|
|
||||||
dstarRX.reset();
|
|
||||||
ysfRX.reset();
|
|
||||||
nxdnRX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
case STATE_NXDN:
|
case STATE_NXDN:
|
||||||
DEBUG1("Mode set to NXDN");
|
DEBUG1("Mode set to NXDN");
|
||||||
dmrIdleRX.reset();
|
|
||||||
dmrDMORX.reset();
|
|
||||||
dmrRX.reset();
|
|
||||||
dstarRX.reset();
|
|
||||||
ysfRX.reset();
|
|
||||||
p25RX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
case STATE_POCSAG:
|
case STATE_POCSAG:
|
||||||
DEBUG1("Mode set to POCSAG");
|
DEBUG1("Mode set to POCSAG");
|
||||||
dmrIdleRX.reset();
|
break;
|
||||||
dmrDMORX.reset();
|
case STATE_FM:
|
||||||
dmrRX.reset();
|
DEBUG1("Mode set to FM");
|
||||||
dstarRX.reset();
|
|
||||||
ysfRX.reset();
|
|
||||||
p25RX.reset();
|
|
||||||
nxdnRX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
case STATE_DSTARCAL:
|
case STATE_DSTARCAL:
|
||||||
DEBUG1("Mode set to D-Star Calibrate");
|
DEBUG1("Mode set to D-Star Calibrate");
|
||||||
dmrIdleRX.reset();
|
|
||||||
dmrDMORX.reset();
|
|
||||||
dmrRX.reset();
|
|
||||||
dstarRX.reset();
|
|
||||||
ysfRX.reset();
|
|
||||||
p25RX.reset();
|
|
||||||
nxdnRX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
case STATE_DMRCAL:
|
case STATE_DMRCAL:
|
||||||
DEBUG1("Mode set to DMR Calibrate");
|
DEBUG1("Mode set to DMR Calibrate");
|
||||||
dmrIdleRX.reset();
|
|
||||||
dmrDMORX.reset();
|
|
||||||
dmrRX.reset();
|
|
||||||
dstarRX.reset();
|
|
||||||
ysfRX.reset();
|
|
||||||
p25RX.reset();
|
|
||||||
nxdnRX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
case STATE_RSSICAL:
|
case STATE_RSSICAL:
|
||||||
DEBUG1("Mode set to RSSI Calibrate");
|
DEBUG1("Mode set to RSSI Calibrate");
|
||||||
dmrIdleRX.reset();
|
|
||||||
dmrDMORX.reset();
|
|
||||||
dmrRX.reset();
|
|
||||||
dstarRX.reset();
|
|
||||||
ysfRX.reset();
|
|
||||||
p25RX.reset();
|
|
||||||
nxdnRX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
case STATE_LFCAL:
|
case STATE_LFCAL:
|
||||||
DEBUG1("Mode set to 80 Hz Calibrate");
|
DEBUG1("Mode set to 80 Hz Calibrate");
|
||||||
dmrIdleRX.reset();
|
|
||||||
dmrDMORX.reset();
|
|
||||||
dmrRX.reset();
|
|
||||||
dstarRX.reset();
|
|
||||||
ysfRX.reset();
|
|
||||||
p25RX.reset();
|
|
||||||
nxdnRX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
case STATE_DMRCAL1K:
|
case STATE_FMCAL10K:
|
||||||
DEBUG1("Mode set to DMR BS 1031 Hz Calibrate");
|
DEBUG1("Mode set to FM 10Khz Calibrate");
|
||||||
dmrIdleRX.reset();
|
break;
|
||||||
dmrDMORX.reset();
|
case STATE_FMCAL12K:
|
||||||
dmrRX.reset();
|
DEBUG1("Mode set to FM 12.5Khz Calibrate");
|
||||||
dstarRX.reset();
|
break;
|
||||||
ysfRX.reset();
|
case STATE_FMCAL15K:
|
||||||
p25RX.reset();
|
DEBUG1("Mode set to FM 15Khz Calibrate");
|
||||||
nxdnRX.reset();
|
break;
|
||||||
cwIdTX.reset();
|
case STATE_FMCAL20K:
|
||||||
|
DEBUG1("Mode set to FM 20Khz Calibrate");
|
||||||
|
break;
|
||||||
|
case STATE_FMCAL25K:
|
||||||
|
DEBUG1("Mode set to FM 10Khz Calibrate");
|
||||||
|
break;
|
||||||
|
case STATE_FMCAL30K:
|
||||||
|
DEBUG1("Mode set to FM 30Khz Calibrate");
|
||||||
break;
|
break;
|
||||||
case STATE_P25CAL1K:
|
case STATE_P25CAL1K:
|
||||||
DEBUG1("Mode set to P25 1011 Hz Calibrate");
|
DEBUG1("Mode set to P25 1011 Hz Calibrate");
|
||||||
dmrIdleRX.reset();
|
|
||||||
dmrDMORX.reset();
|
|
||||||
dmrRX.reset();
|
|
||||||
dstarRX.reset();
|
|
||||||
ysfRX.reset();
|
|
||||||
p25RX.reset();
|
|
||||||
nxdnRX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
case STATE_DMRDMO1K:
|
case STATE_DMRDMO1K:
|
||||||
DEBUG1("Mode set to DMR MS 1031 Hz Calibrate");
|
DEBUG1("Mode set to DMR MS 1031 Hz Calibrate");
|
||||||
dmrIdleRX.reset();
|
|
||||||
dmrDMORX.reset();
|
|
||||||
dmrRX.reset();
|
|
||||||
dstarRX.reset();
|
|
||||||
ysfRX.reset();
|
|
||||||
p25RX.reset();
|
|
||||||
nxdnRX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
case STATE_NXDNCAL1K:
|
case STATE_NXDNCAL1K:
|
||||||
DEBUG1("Mode set to NXDN 1031 Hz Calibrate");
|
DEBUG1("Mode set to NXDN 1031 Hz Calibrate");
|
||||||
dmrIdleRX.reset();
|
|
||||||
dmrDMORX.reset();
|
|
||||||
dmrRX.reset();
|
|
||||||
dstarRX.reset();
|
|
||||||
ysfRX.reset();
|
|
||||||
p25RX.reset();
|
|
||||||
nxdnRX.reset();
|
|
||||||
cwIdTX.reset();
|
|
||||||
break;
|
break;
|
||||||
default:
|
case STATE_POCSAGCAL:
|
||||||
|
DEBUG1("Mode set to POCSAG Calibrate");
|
||||||
|
break;
|
||||||
|
default: // STATE_IDLE
|
||||||
DEBUG1("Mode set to Idle");
|
DEBUG1("Mode set to Idle");
|
||||||
// STATE_IDLE
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (modemState != STATE_DSTAR)
|
||||||
|
dstarRX.reset();
|
||||||
|
|
||||||
|
if (modemState != STATE_DMR) {
|
||||||
|
dmrIdleRX.reset();
|
||||||
|
dmrDMORX.reset();
|
||||||
|
dmrRX.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modemState != STATE_YSF)
|
||||||
|
ysfRX.reset();
|
||||||
|
|
||||||
|
if (modemState != STATE_P25)
|
||||||
|
p25RX.reset();
|
||||||
|
|
||||||
|
if (modemState != STATE_NXDN)
|
||||||
|
nxdnRX.reset();
|
||||||
|
|
||||||
|
if (modemState != STATE_FM)
|
||||||
|
fm.reset();
|
||||||
|
|
||||||
|
cwIdTX.reset();
|
||||||
|
|
||||||
m_modemState = modemState;
|
m_modemState = modemState;
|
||||||
|
|
||||||
io.setMode();
|
io.setMode();
|
||||||
@@ -536,7 +603,7 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
|
|||||||
|
|
||||||
void CSerialPort::start()
|
void CSerialPort::start()
|
||||||
{
|
{
|
||||||
beginInt(1U, 115200);
|
beginInt(1U, SERIAL_SPEED);
|
||||||
|
|
||||||
#if defined(SERIAL_REPEATER)
|
#if defined(SERIAL_REPEATER)
|
||||||
beginInt(3U, 9600);
|
beginInt(3U, 9600);
|
||||||
@@ -601,15 +668,59 @@ void CSerialPort::process()
|
|||||||
sendACK();
|
sendACK();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MMDVM_FM_PARAMS1:
|
||||||
|
err = setFMParams1(m_buffer + 3U, m_len - 3U);
|
||||||
|
if (err == 0U) {
|
||||||
|
sendACK();
|
||||||
|
} else {
|
||||||
|
DEBUG2("Received invalid FM params 1", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MMDVM_FM_PARAMS2:
|
||||||
|
err = setFMParams2(m_buffer + 3U, m_len - 3U);
|
||||||
|
if (err == 0U) {
|
||||||
|
sendACK();
|
||||||
|
} else {
|
||||||
|
DEBUG2("Received invalid FM params 2", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MMDVM_FM_PARAMS3:
|
||||||
|
err = setFMParams3(m_buffer + 3U, m_len - 3U);
|
||||||
|
if (err == 0U) {
|
||||||
|
sendACK();
|
||||||
|
} else {
|
||||||
|
DEBUG2("Received invalid FM params 3", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MMDVM_FM_PARAMS4:
|
||||||
|
err = setFMParams4(m_buffer + 3U, m_len - 3U);
|
||||||
|
if (err == 0U) {
|
||||||
|
sendACK();
|
||||||
|
} else {
|
||||||
|
DEBUG2("Received invalid FM params 4", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case MMDVM_CAL_DATA:
|
case MMDVM_CAL_DATA:
|
||||||
if (m_modemState == STATE_DSTARCAL)
|
if (m_modemState == STATE_DSTARCAL)
|
||||||
err = calDStarTX.write(m_buffer + 3U, m_len - 3U);
|
err = calDStarTX.write(m_buffer + 3U, m_len - 3U);
|
||||||
if (m_modemState == STATE_DMRCAL || m_modemState == STATE_LFCAL || m_modemState == STATE_DMRCAL1K || m_modemState == STATE_DMRDMO1K)
|
if (m_modemState == STATE_DMRCAL || m_modemState == STATE_LFCAL || m_modemState == STATE_DMRCAL1K || m_modemState == STATE_DMRDMO1K)
|
||||||
err = calDMR.write(m_buffer + 3U, m_len - 3U);
|
err = calDMR.write(m_buffer + 3U, m_len - 3U);
|
||||||
|
if (m_modemState == STATE_FMCAL10K || m_modemState == STATE_FMCAL12K || m_modemState == STATE_FMCAL15K || m_modemState == STATE_FMCAL20K || m_modemState == STATE_FMCAL25K || m_modemState == STATE_FMCAL30K)
|
||||||
|
err = calFM.write(m_buffer + 3U, m_len - 3U);
|
||||||
if (m_modemState == STATE_P25CAL1K)
|
if (m_modemState == STATE_P25CAL1K)
|
||||||
err = calP25.write(m_buffer + 3U, m_len - 3U);
|
err = calP25.write(m_buffer + 3U, m_len - 3U);
|
||||||
if (m_modemState == STATE_NXDNCAL1K)
|
if (m_modemState == STATE_NXDNCAL1K)
|
||||||
err = calNXDN.write(m_buffer + 3U, m_len - 3U);
|
err = calNXDN.write(m_buffer + 3U, m_len - 3U);
|
||||||
|
if (m_modemState == STATE_POCSAGCAL)
|
||||||
|
err = calPOCSAG.write(m_buffer + 3U, m_len - 3U);
|
||||||
if (err == 0U) {
|
if (err == 0U) {
|
||||||
sendACK();
|
sendACK();
|
||||||
} else {
|
} else {
|
||||||
@@ -813,7 +924,22 @@ void CSerialPort::process()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MMDVM_FM_DATA:
|
||||||
|
if (m_fmEnable) {
|
||||||
|
if (m_modemState == STATE_IDLE || m_modemState == STATE_FM)
|
||||||
|
err = fm.writeData(m_buffer + 3U, m_len - 3U);
|
||||||
|
}
|
||||||
|
if (err == 0U) {
|
||||||
|
if (m_modemState == STATE_IDLE)
|
||||||
|
setMode(STATE_FM);
|
||||||
|
} else {
|
||||||
|
DEBUG2("Received invalid FM data", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case MMDVM_TRANSPARENT:
|
case MMDVM_TRANSPARENT:
|
||||||
|
case MMDVM_QSO_INFO:
|
||||||
// Do nothing on the MMDVM.
|
// Do nothing on the MMDVM.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1124,6 +1250,64 @@ void CSerialPort::writeNXDNLost()
|
|||||||
writeInt(1U, reply, 3);
|
writeInt(1U, reply, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSerialPort::writeFMData(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (m_modemState != STATE_FM && m_modemState != STATE_IDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_fmEnable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t reply[255U];
|
||||||
|
|
||||||
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
reply[1U] = 0U;
|
||||||
|
reply[2U] = MMDVM_FM_DATA;
|
||||||
|
|
||||||
|
uint8_t count = 3U;
|
||||||
|
for (uint8_t i = 0U; i < length; i++, count++)
|
||||||
|
reply[count] = data[i];
|
||||||
|
|
||||||
|
reply[1U] = count;
|
||||||
|
|
||||||
|
writeInt(1U, reply, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSerialPort::writeFMStatus(uint8_t status)
|
||||||
|
{
|
||||||
|
if (m_modemState != STATE_FM && m_modemState != STATE_IDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_fmEnable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t reply[10U];
|
||||||
|
|
||||||
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
reply[1U] = 4U;
|
||||||
|
reply[2U] = MMDVM_FM_STATUS;
|
||||||
|
reply[3U] = status;
|
||||||
|
|
||||||
|
writeInt(1U, reply, 4U);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSerialPort::writeFMEOT()
|
||||||
|
{
|
||||||
|
if (m_modemState != STATE_FM && m_modemState != STATE_IDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_fmEnable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t reply[10U];
|
||||||
|
|
||||||
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
reply[1U] = 3U;
|
||||||
|
reply[2U] = MMDVM_FM_EOT;
|
||||||
|
|
||||||
|
writeInt(1U, reply, 3U);
|
||||||
|
}
|
||||||
|
|
||||||
void CSerialPort::writeCalData(const uint8_t* data, uint8_t length)
|
void CSerialPort::writeCalData(const uint8_t* data, uint8_t length)
|
||||||
{
|
{
|
||||||
if (m_modemState != STATE_DSTARCAL)
|
if (m_modemState != STATE_DSTARCAL)
|
||||||
|
|||||||
+15
-4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,7 +21,11 @@
|
|||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "SerialRB.h"
|
#include "RingBuffer.h"
|
||||||
|
|
||||||
|
#if !defined(SERIAL_SPEED)
|
||||||
|
#define SERIAL_SPEED 115200
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
class CSerialPort {
|
class CSerialPort {
|
||||||
@@ -50,6 +54,10 @@ public:
|
|||||||
void writeNXDNData(const uint8_t* data, uint8_t length);
|
void writeNXDNData(const uint8_t* data, uint8_t length);
|
||||||
void writeNXDNLost();
|
void writeNXDNLost();
|
||||||
|
|
||||||
|
void writeFMData(const uint8_t* data, uint8_t length);
|
||||||
|
void writeFMStatus(uint8_t status);
|
||||||
|
void writeFMEOT();
|
||||||
|
|
||||||
void writeCalData(const uint8_t* data, uint8_t length);
|
void writeCalData(const uint8_t* data, uint8_t length);
|
||||||
void writeRSSIData(const uint8_t* data, uint8_t length);
|
void writeRSSIData(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
@@ -64,7 +72,7 @@ private:
|
|||||||
uint8_t m_ptr;
|
uint8_t m_ptr;
|
||||||
uint8_t m_len;
|
uint8_t m_len;
|
||||||
bool m_debug;
|
bool m_debug;
|
||||||
CSerialRB m_repeat;
|
CRingBuffer<uint8_t> m_repeat;
|
||||||
|
|
||||||
void sendACK();
|
void sendACK();
|
||||||
void sendNAK(uint8_t err);
|
void sendNAK(uint8_t err);
|
||||||
@@ -73,6 +81,10 @@ private:
|
|||||||
uint8_t setConfig(const uint8_t* data, uint8_t length);
|
uint8_t setConfig(const uint8_t* data, uint8_t length);
|
||||||
uint8_t setMode(const uint8_t* data, uint8_t length);
|
uint8_t setMode(const uint8_t* data, uint8_t length);
|
||||||
void setMode(MMDVM_STATE modemState);
|
void setMode(MMDVM_STATE modemState);
|
||||||
|
uint8_t setFMParams1(const uint8_t* data, uint8_t length);
|
||||||
|
uint8_t setFMParams2(const uint8_t* data, uint8_t length);
|
||||||
|
uint8_t setFMParams3(const uint8_t* data, uint8_t length);
|
||||||
|
uint8_t setFMParams4(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
// Hardware versions
|
// Hardware versions
|
||||||
void beginInt(uint8_t n, int speed);
|
void beginInt(uint8_t n, int speed);
|
||||||
@@ -83,4 +95,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
-100
@@ -1,100 +0,0 @@
|
|||||||
/*
|
|
||||||
Serial RB control - Copyright (C) KI6ZUM 2015
|
|
||||||
Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this library; if not, write to the
|
|
||||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "SerialRB.h"
|
|
||||||
|
|
||||||
CSerialRB::CSerialRB(uint16_t length) :
|
|
||||||
m_length(length),
|
|
||||||
m_head(0U),
|
|
||||||
m_tail(0U),
|
|
||||||
m_full(false)
|
|
||||||
{
|
|
||||||
m_buffer = new uint8_t[length];
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSerialRB::reset()
|
|
||||||
{
|
|
||||||
m_head = 0U;
|
|
||||||
m_tail = 0U;
|
|
||||||
m_full = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t CSerialRB::getSpace() const
|
|
||||||
{
|
|
||||||
uint16_t n = 0U;
|
|
||||||
|
|
||||||
if (m_tail == m_head)
|
|
||||||
n = m_full ? 0U : m_length;
|
|
||||||
else if (m_tail < m_head)
|
|
||||||
n = m_length - m_head + m_tail;
|
|
||||||
else
|
|
||||||
n = m_tail - m_head;
|
|
||||||
|
|
||||||
if (n > m_length)
|
|
||||||
n = 0U;
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t CSerialRB::getData() const
|
|
||||||
{
|
|
||||||
if (m_tail == m_head)
|
|
||||||
return m_full ? m_length : 0U;
|
|
||||||
else if (m_tail < m_head)
|
|
||||||
return m_head - m_tail;
|
|
||||||
else
|
|
||||||
return m_length - m_tail + m_head;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSerialRB::put(uint8_t c)
|
|
||||||
{
|
|
||||||
if (m_full)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
m_buffer[m_head] = c;
|
|
||||||
|
|
||||||
m_head++;
|
|
||||||
if (m_head >= m_length)
|
|
||||||
m_head = 0U;
|
|
||||||
|
|
||||||
if (m_head == m_tail)
|
|
||||||
m_full = true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t CSerialRB::peek() const
|
|
||||||
{
|
|
||||||
return m_buffer[m_tail];
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t CSerialRB::get()
|
|
||||||
{
|
|
||||||
uint8_t value = m_buffer[m_tail];
|
|
||||||
|
|
||||||
m_full = false;
|
|
||||||
|
|
||||||
m_tail++;
|
|
||||||
if (m_tail >= m_length)
|
|
||||||
m_tail = 0U;
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
-62
@@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
Serial fifo control - Copyright (C) KI6ZUM 2015
|
|
||||||
Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this library; if not, write to the
|
|
||||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(SERIALRB_H)
|
|
||||||
#define SERIALRB_H
|
|
||||||
|
|
||||||
#if defined(STM32F4XX)
|
|
||||||
#include "stm32f4xx.h"
|
|
||||||
#elif defined(STM32F7XX)
|
|
||||||
#include "stm32f7xx.h"
|
|
||||||
#elif defined(STM32F105xC)
|
|
||||||
#include "stm32f1xx.h"
|
|
||||||
#include <cstddef>
|
|
||||||
#else
|
|
||||||
#include <Arduino.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const uint16_t SERIAL_RINGBUFFER_SIZE = 1000U;
|
|
||||||
|
|
||||||
class CSerialRB {
|
|
||||||
public:
|
|
||||||
CSerialRB(uint16_t length = SERIAL_RINGBUFFER_SIZE);
|
|
||||||
|
|
||||||
uint16_t getSpace() const;
|
|
||||||
|
|
||||||
uint16_t getData() const;
|
|
||||||
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
bool put(uint8_t c);
|
|
||||||
|
|
||||||
uint8_t peek() const;
|
|
||||||
|
|
||||||
uint8_t get();
|
|
||||||
|
|
||||||
private:
|
|
||||||
uint16_t m_length;
|
|
||||||
volatile uint8_t* m_buffer;
|
|
||||||
volatile uint16_t m_head;
|
|
||||||
volatile uint16_t m_tail;
|
|
||||||
volatile bool m_full;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+76
-588
@@ -28,20 +28,18 @@ Pin definitions:
|
|||||||
|
|
||||||
- Host communication:
|
- Host communication:
|
||||||
USART1 - TXD PA9 - RXD PA10 (MMDVM-Pi board, MMDVM-Pi F722 board, MMDVM-F4M board, STM32F722-F7M board, STM32F4-DVM board)
|
USART1 - TXD PA9 - RXD PA10 (MMDVM-Pi board, MMDVM-Pi F722 board, MMDVM-F4M board, STM32F722-F7M board, STM32F4-DVM board)
|
||||||
USART2 - TXD PA2 - RXD PA3 (Nucleo64 F446RE board, Morpho or Arduino header)
|
USART2 - TXD PA2 - RXD PA3 (Nucleo64 F446RE board, Morpho or Arduino header, MMDVM_RPT_Hat BG4TGO/BG5HHP board)
|
||||||
USART3 - TXD PC10 - RXD PC11 (Discovery board)
|
USART3 - TXD PC10 - RXD PC11 (Discovery board)
|
||||||
USART3 - TXD PD8 - RXD PD9 (Nucleo144 F767ZI board)
|
USART3 - TXD PD8 - RXD PD9 (Nucleo144 F767ZI board)
|
||||||
|
|
||||||
- Serial repeater:
|
- Serial repeater:
|
||||||
USART1 - TXD PA9 - RXD PA10 (Nucleo with Arduino header)
|
USART1 - TXD PA9 - RXD PA10 (Nucleo with Arduino header)
|
||||||
UART5 - TXD PC12 - RXD PD2 (Discovery, MMDVM-Pi, MMDVM-Pi F722 board, MMDVM-F4M board, STM32F722-F7M board, STM32F4-DVM board, Nucleo64 with Morpho header and Nucleo144 F767ZI)
|
UART5 - TXD PC12 - RXD PD2 (Discovery, MMDVM-Pi, MMDVM-Pi F722 board, MMDVM-F4M board, STM32F722-F7M board, STM32F4-DVM board, Nucleo64 with Morpho header and Nucleo144 F767ZI, MMDVM_RPT_Hat BG4TGO/BG5HHP board)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(STM32F4XX) || defined(STM32F7XX)
|
#if defined(STM32F4XX) || defined(STM32F7XX)
|
||||||
|
|
||||||
#define TX_SERIAL_FIFO_SIZE 512U
|
#include "STMUART.h"
|
||||||
#define RX_SERIAL_FIFO_SIZE 512U
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void USART1_IRQHandler();
|
void USART1_IRQHandler();
|
||||||
void USART2_IRQHandler();
|
void USART2_IRQHandler();
|
||||||
@@ -50,113 +48,14 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ************* USART1 ***************** */
|
/* ************* USART1 ***************** */
|
||||||
#if defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_F7M) || defined(STM32F722_PI) || defined(STM32F722_F7HAT) || defined(STM32F4_DVM) || (defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER))
|
#if defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_F7M) || defined(STM32F722_PI) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || (defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)) || defined(DRCC_DVM)
|
||||||
|
|
||||||
volatile uint8_t TXSerialfifo1[TX_SERIAL_FIFO_SIZE];
|
|
||||||
volatile uint8_t RXSerialfifo1[RX_SERIAL_FIFO_SIZE];
|
|
||||||
volatile uint16_t TXSerialfifohead1, TXSerialfifotail1;
|
|
||||||
volatile uint16_t RXSerialfifohead1, RXSerialfifotail1;
|
|
||||||
|
|
||||||
// Init queues
|
static CSTMUART m_USART1;
|
||||||
void TXSerialfifoinit1()
|
|
||||||
{
|
|
||||||
TXSerialfifohead1 = 0U;
|
|
||||||
TXSerialfifotail1 = 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RXSerialfifoinit1()
|
|
||||||
{
|
|
||||||
RXSerialfifohead1 = 0U;
|
|
||||||
RXSerialfifotail1 = 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
// How full is queue
|
|
||||||
// TODO decide if how full or how empty is preferred info to return
|
|
||||||
uint16_t TXSerialfifolevel1()
|
|
||||||
{
|
|
||||||
uint32_t tail = TXSerialfifotail1;
|
|
||||||
uint32_t head = TXSerialfifohead1;
|
|
||||||
|
|
||||||
if (tail > head)
|
|
||||||
return TX_SERIAL_FIFO_SIZE + head - tail;
|
|
||||||
else
|
|
||||||
return head - tail;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t RXSerialfifolevel1()
|
|
||||||
{
|
|
||||||
uint32_t tail = RXSerialfifotail1;
|
|
||||||
uint32_t head = RXSerialfifohead1;
|
|
||||||
|
|
||||||
if (tail > head)
|
|
||||||
return RX_SERIAL_FIFO_SIZE + head - tail;
|
|
||||||
else
|
|
||||||
return head - tail;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flushes the transmit shift register
|
|
||||||
// warning: this call is blocking
|
|
||||||
void TXSerialFlush1()
|
|
||||||
{
|
|
||||||
// wait until the TXE shows the shift register is empty
|
|
||||||
while (USART_GetITStatus(USART1, USART_FLAG_TXE))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t TXSerialfifoput1(uint8_t next)
|
|
||||||
{
|
|
||||||
if (TXSerialfifolevel1() < TX_SERIAL_FIFO_SIZE) {
|
|
||||||
TXSerialfifo1[TXSerialfifohead1] = next;
|
|
||||||
|
|
||||||
TXSerialfifohead1++;
|
|
||||||
if (TXSerialfifohead1 >= TX_SERIAL_FIFO_SIZE)
|
|
||||||
TXSerialfifohead1 = 0U;
|
|
||||||
|
|
||||||
// make sure transmit interrupts are enabled as long as there is data to send
|
|
||||||
USART_ITConfig(USART1, USART_IT_TXE, ENABLE);
|
|
||||||
return 1U;
|
|
||||||
} else {
|
|
||||||
return 0U; // signal an overflow occurred by returning a zero count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void USART1_IRQHandler()
|
void USART1_IRQHandler()
|
||||||
{
|
{
|
||||||
uint8_t c;
|
m_USART1.handleIRQ();
|
||||||
|
|
||||||
if (USART_GetITStatus(USART1, USART_IT_RXNE)) {
|
|
||||||
c = (uint8_t) USART_ReceiveData(USART1);
|
|
||||||
|
|
||||||
if (RXSerialfifolevel1() < RX_SERIAL_FIFO_SIZE) {
|
|
||||||
RXSerialfifo1[RXSerialfifohead1] = c;
|
|
||||||
|
|
||||||
RXSerialfifohead1++;
|
|
||||||
if (RXSerialfifohead1 >= RX_SERIAL_FIFO_SIZE)
|
|
||||||
RXSerialfifohead1 = 0U;
|
|
||||||
} else {
|
|
||||||
// TODO - do something if rx fifo is full?
|
|
||||||
}
|
|
||||||
|
|
||||||
USART_ClearITPendingBit(USART1, USART_IT_RXNE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (USART_GetITStatus(USART1, USART_IT_TXE)) {
|
|
||||||
c = 0U;
|
|
||||||
|
|
||||||
if (TXSerialfifohead1 != TXSerialfifotail1) { // if the fifo is not empty
|
|
||||||
c = TXSerialfifo1[TXSerialfifotail1];
|
|
||||||
|
|
||||||
TXSerialfifotail1++;
|
|
||||||
if (TXSerialfifotail1 >= TX_SERIAL_FIFO_SIZE)
|
|
||||||
TXSerialfifotail1 = 0U;
|
|
||||||
|
|
||||||
USART_SendData(USART1, c);
|
|
||||||
} else { // if there's no more data to transmit then turn off TX interrupts
|
|
||||||
USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
USART_ClearITPendingBit(USART1, USART_IT_TXE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitUSART1(int speed)
|
void InitUSART1(int speed)
|
||||||
@@ -201,153 +100,20 @@ void InitUSART1(int speed)
|
|||||||
|
|
||||||
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
|
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
|
||||||
|
|
||||||
// initialize the fifos
|
m_USART1.init(USART1);
|
||||||
TXSerialfifoinit1();
|
|
||||||
RXSerialfifoinit1();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t AvailUSART1()
|
|
||||||
{
|
|
||||||
if (RXSerialfifolevel1() > 0U)
|
|
||||||
return 1U;
|
|
||||||
else
|
|
||||||
return 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AvailForWriteUSART1()
|
|
||||||
{
|
|
||||||
return TX_SERIAL_FIFO_SIZE - TXSerialfifolevel1();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t ReadUSART1()
|
|
||||||
{
|
|
||||||
uint8_t data_c = RXSerialfifo1[RXSerialfifotail1];
|
|
||||||
|
|
||||||
RXSerialfifotail1++;
|
|
||||||
if (RXSerialfifotail1 >= RX_SERIAL_FIFO_SIZE)
|
|
||||||
RXSerialfifotail1 = 0U;
|
|
||||||
|
|
||||||
return data_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WriteUSART1(const uint8_t* data, uint16_t length)
|
|
||||||
{
|
|
||||||
for (uint16_t i = 0U; i < length; i++)
|
|
||||||
TXSerialfifoput1(data[i]);
|
|
||||||
|
|
||||||
USART_ITConfig(USART1, USART_IT_TXE, ENABLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ************* USART2 ***************** */
|
/* ************* USART2 ***************** */
|
||||||
#if defined(STM32F4_NUCLEO)
|
#if defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO) || defined(DRCC_DVM)
|
||||||
|
|
||||||
volatile uint8_t TXSerialfifo2[TX_SERIAL_FIFO_SIZE];
|
static CSTMUART m_USART2;
|
||||||
volatile uint8_t RXSerialfifo2[RX_SERIAL_FIFO_SIZE];
|
|
||||||
volatile uint16_t TXSerialfifohead2, TXSerialfifotail2;
|
|
||||||
volatile uint16_t RXSerialfifohead2, RXSerialfifotail2;
|
|
||||||
|
|
||||||
// Init queues
|
|
||||||
void TXSerialfifoinit2()
|
|
||||||
{
|
|
||||||
TXSerialfifohead2 = 0U;
|
|
||||||
TXSerialfifotail2 = 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RXSerialfifoinit2()
|
|
||||||
{
|
|
||||||
RXSerialfifohead2 = 0U;
|
|
||||||
RXSerialfifotail2 = 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
// How full is queue
|
|
||||||
// TODO decide if how full or how empty is preferred info to return
|
|
||||||
uint16_t TXSerialfifolevel2()
|
|
||||||
{
|
|
||||||
uint32_t tail = TXSerialfifotail2;
|
|
||||||
uint32_t head = TXSerialfifohead2;
|
|
||||||
|
|
||||||
if (tail > head)
|
|
||||||
return TX_SERIAL_FIFO_SIZE + head - tail;
|
|
||||||
else
|
|
||||||
return head - tail;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t RXSerialfifolevel2()
|
|
||||||
{
|
|
||||||
uint32_t tail = RXSerialfifotail2;
|
|
||||||
uint32_t head = RXSerialfifohead2;
|
|
||||||
|
|
||||||
if (tail > head)
|
|
||||||
return RX_SERIAL_FIFO_SIZE + head - tail;
|
|
||||||
else
|
|
||||||
return head - tail;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flushes the transmit shift register
|
|
||||||
// warning: this call is blocking
|
|
||||||
void TXSerialFlush2()
|
|
||||||
{
|
|
||||||
// wait until the TXE shows the shift register is empty
|
|
||||||
while (USART_GetITStatus(USART2, USART_FLAG_TXE))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t TXSerialfifoput2(uint8_t next)
|
|
||||||
{
|
|
||||||
if (TXSerialfifolevel2() < TX_SERIAL_FIFO_SIZE) {
|
|
||||||
TXSerialfifo2[TXSerialfifohead2] = next;
|
|
||||||
|
|
||||||
TXSerialfifohead2++;
|
|
||||||
if (TXSerialfifohead2 >= TX_SERIAL_FIFO_SIZE)
|
|
||||||
TXSerialfifohead2 = 0U;
|
|
||||||
|
|
||||||
// make sure transmit interrupts are enabled as long as there is data to send
|
|
||||||
USART_ITConfig(USART2, USART_IT_TXE, ENABLE);
|
|
||||||
return 1U;
|
|
||||||
} else {
|
|
||||||
return 0U; // signal an overflow occurred by returning a zero count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void USART2_IRQHandler()
|
void USART2_IRQHandler()
|
||||||
{
|
{
|
||||||
uint8_t c;
|
m_USART2.handleIRQ();
|
||||||
|
|
||||||
if (USART_GetITStatus(USART2, USART_IT_RXNE)) {
|
|
||||||
c = (uint8_t) USART_ReceiveData(USART2);
|
|
||||||
|
|
||||||
if (RXSerialfifolevel2() < RX_SERIAL_FIFO_SIZE) {
|
|
||||||
RXSerialfifo2[RXSerialfifohead2] = c;
|
|
||||||
|
|
||||||
RXSerialfifohead2++;
|
|
||||||
if (RXSerialfifohead2 >= RX_SERIAL_FIFO_SIZE)
|
|
||||||
RXSerialfifohead2 = 0U;
|
|
||||||
} else {
|
|
||||||
// TODO - do something if rx fifo is full?
|
|
||||||
}
|
|
||||||
|
|
||||||
USART_ClearITPendingBit(USART2, USART_IT_RXNE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (USART_GetITStatus(USART2, USART_IT_TXE)) {
|
|
||||||
c = 0U;
|
|
||||||
|
|
||||||
if (TXSerialfifohead2 != TXSerialfifotail2) { // if the fifo is not empty
|
|
||||||
c = TXSerialfifo2[TXSerialfifotail2];
|
|
||||||
|
|
||||||
TXSerialfifotail2++;
|
|
||||||
if (TXSerialfifotail2 >= TX_SERIAL_FIFO_SIZE)
|
|
||||||
TXSerialfifotail2 = 0U;
|
|
||||||
|
|
||||||
USART_SendData(USART2, c);
|
|
||||||
} else { // if there's no more data to transmit then turn off TX interrupts
|
|
||||||
USART_ITConfig(USART2, USART_IT_TXE, DISABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
USART_ClearITPendingBit(USART2, USART_IT_TXE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitUSART2(int speed)
|
void InitUSART2(int speed)
|
||||||
@@ -392,41 +158,7 @@ void InitUSART2(int speed)
|
|||||||
|
|
||||||
USART_ITConfig(USART2, USART_IT_RXNE, ENABLE);
|
USART_ITConfig(USART2, USART_IT_RXNE, ENABLE);
|
||||||
|
|
||||||
// initialize the fifos
|
m_USART2.init(USART2);
|
||||||
TXSerialfifoinit2();
|
|
||||||
RXSerialfifoinit2();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t AvailUSART2()
|
|
||||||
{
|
|
||||||
if (RXSerialfifolevel2() > 0U)
|
|
||||||
return 1U;
|
|
||||||
else
|
|
||||||
return 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AvailForWriteUSART2()
|
|
||||||
{
|
|
||||||
return TX_SERIAL_FIFO_SIZE - TXSerialfifolevel2();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t ReadUSART2()
|
|
||||||
{
|
|
||||||
uint8_t data_c = RXSerialfifo2[RXSerialfifotail2];
|
|
||||||
|
|
||||||
RXSerialfifotail2++;
|
|
||||||
if (RXSerialfifotail2 >= RX_SERIAL_FIFO_SIZE)
|
|
||||||
RXSerialfifotail2 = 0U;
|
|
||||||
|
|
||||||
return data_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WriteUSART2(const uint8_t* data, uint16_t length)
|
|
||||||
{
|
|
||||||
for (uint16_t i = 0U; i < length; i++)
|
|
||||||
TXSerialfifoput2(data[i]);
|
|
||||||
|
|
||||||
USART_ITConfig(USART2, USART_IT_TXE, ENABLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -434,111 +166,11 @@ void WriteUSART2(const uint8_t* data, uint16_t length)
|
|||||||
/* ************* USART3 ***************** */
|
/* ************* USART3 ***************** */
|
||||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||||
|
|
||||||
volatile uint8_t TXSerialfifo3[TX_SERIAL_FIFO_SIZE];
|
static CSTMUART m_USART3;
|
||||||
volatile uint8_t RXSerialfifo3[RX_SERIAL_FIFO_SIZE];
|
|
||||||
volatile uint16_t TXSerialfifohead3, TXSerialfifotail3;
|
|
||||||
volatile uint16_t RXSerialfifohead3, RXSerialfifotail3;
|
|
||||||
|
|
||||||
// Init queues
|
|
||||||
void TXSerialfifoinit3()
|
|
||||||
{
|
|
||||||
TXSerialfifohead3 = 0U;
|
|
||||||
TXSerialfifotail3 = 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RXSerialfifoinit3()
|
|
||||||
{
|
|
||||||
RXSerialfifohead3 = 0U;
|
|
||||||
RXSerialfifotail3 = 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
// How full is queue
|
|
||||||
// TODO decide if how full or how empty is preferred info to return
|
|
||||||
uint16_t TXSerialfifolevel3()
|
|
||||||
{
|
|
||||||
uint32_t tail = TXSerialfifotail3;
|
|
||||||
uint32_t head = TXSerialfifohead3;
|
|
||||||
|
|
||||||
if (tail > head)
|
|
||||||
return TX_SERIAL_FIFO_SIZE + head - tail;
|
|
||||||
else
|
|
||||||
return head - tail;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t RXSerialfifolevel3()
|
|
||||||
{
|
|
||||||
uint32_t tail = RXSerialfifotail3;
|
|
||||||
uint32_t head = RXSerialfifohead3;
|
|
||||||
|
|
||||||
if (tail > head)
|
|
||||||
return RX_SERIAL_FIFO_SIZE + head - tail;
|
|
||||||
else
|
|
||||||
return head - tail;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flushes the transmit shift register
|
|
||||||
// warning: this call is blocking
|
|
||||||
void TXSerialFlush3()
|
|
||||||
{
|
|
||||||
// wait until the TXE shows the shift register is empty
|
|
||||||
while (USART_GetITStatus(USART3, USART_FLAG_TXE))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t TXSerialfifoput3(uint8_t next)
|
|
||||||
{
|
|
||||||
if (TXSerialfifolevel3() < TX_SERIAL_FIFO_SIZE) {
|
|
||||||
TXSerialfifo3[TXSerialfifohead3] = next;
|
|
||||||
|
|
||||||
TXSerialfifohead3++;
|
|
||||||
if (TXSerialfifohead3 >= TX_SERIAL_FIFO_SIZE)
|
|
||||||
TXSerialfifohead3 = 0U;
|
|
||||||
|
|
||||||
// make sure transmit interrupts are enabled as long as there is data to send
|
|
||||||
USART_ITConfig(USART3, USART_IT_TXE, ENABLE);
|
|
||||||
return 1U;
|
|
||||||
} else {
|
|
||||||
return 0U; // signal an overflow occurred by returning a zero count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void USART3_IRQHandler()
|
void USART3_IRQHandler()
|
||||||
{
|
{
|
||||||
uint8_t c;
|
m_USART3.handleIRQ();
|
||||||
|
|
||||||
if (USART_GetITStatus(USART3, USART_IT_RXNE)) {
|
|
||||||
c = (uint8_t) USART_ReceiveData(USART3);
|
|
||||||
|
|
||||||
if (RXSerialfifolevel3() < RX_SERIAL_FIFO_SIZE) {
|
|
||||||
RXSerialfifo3[RXSerialfifohead3] = c;
|
|
||||||
|
|
||||||
RXSerialfifohead3++;
|
|
||||||
if (RXSerialfifohead3 >= RX_SERIAL_FIFO_SIZE)
|
|
||||||
RXSerialfifohead3 = 0U;
|
|
||||||
} else {
|
|
||||||
// TODO - do something if rx fifo is full?
|
|
||||||
}
|
|
||||||
|
|
||||||
USART_ClearITPendingBit(USART3, USART_IT_RXNE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (USART_GetITStatus(USART3, USART_IT_TXE)) {
|
|
||||||
c = 0U;
|
|
||||||
|
|
||||||
if (TXSerialfifohead3 != TXSerialfifotail3) { // if the fifo is not empty
|
|
||||||
c = TXSerialfifo3[TXSerialfifotail3];
|
|
||||||
|
|
||||||
TXSerialfifotail3++;
|
|
||||||
if (TXSerialfifotail3 >= TX_SERIAL_FIFO_SIZE)
|
|
||||||
TXSerialfifotail3 = 0U;
|
|
||||||
|
|
||||||
USART_SendData(USART3, c);
|
|
||||||
} else { // if there's no more data to transmit then turn off TX interrupts
|
|
||||||
USART_ITConfig(USART3, USART_IT_TXE, DISABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
USART_ClearITPendingBit(USART3, USART_IT_TXE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(STM32F7_NUCLEO)
|
#if defined(STM32F7_NUCLEO)
|
||||||
@@ -600,41 +232,7 @@ void InitUSART3(int speed)
|
|||||||
|
|
||||||
USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);
|
USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);
|
||||||
|
|
||||||
// initialize the fifos
|
m_USART3.init(USART3);
|
||||||
TXSerialfifoinit3();
|
|
||||||
RXSerialfifoinit3();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t AvailUSART3()
|
|
||||||
{
|
|
||||||
if (RXSerialfifolevel3() > 0U)
|
|
||||||
return 1U;
|
|
||||||
else
|
|
||||||
return 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AvailForWriteUSART3()
|
|
||||||
{
|
|
||||||
return TX_SERIAL_FIFO_SIZE - TXSerialfifolevel3();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t ReadUSART3()
|
|
||||||
{
|
|
||||||
uint8_t data_c = RXSerialfifo3[RXSerialfifotail3];
|
|
||||||
|
|
||||||
RXSerialfifotail3++;
|
|
||||||
if (RXSerialfifotail3 >= RX_SERIAL_FIFO_SIZE)
|
|
||||||
RXSerialfifotail3 = 0U;
|
|
||||||
|
|
||||||
return data_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WriteUSART3(const uint8_t* data, uint16_t length)
|
|
||||||
{
|
|
||||||
for (uint16_t i = 0U; i < length; i++)
|
|
||||||
TXSerialfifoput3(data[i]);
|
|
||||||
|
|
||||||
USART_ITConfig(USART3, USART_IT_TXE, ENABLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -642,111 +240,11 @@ void WriteUSART3(const uint8_t* data, uint16_t length)
|
|||||||
/* ************* UART5 ***************** */
|
/* ************* UART5 ***************** */
|
||||||
#if !(defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER))
|
#if !(defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER))
|
||||||
|
|
||||||
volatile uint8_t TXSerialfifo5[TX_SERIAL_FIFO_SIZE];
|
static CSTMUART m_UART5;
|
||||||
volatile uint8_t RXSerialfifo5[RX_SERIAL_FIFO_SIZE];
|
|
||||||
volatile uint16_t TXSerialfifohead5, TXSerialfifotail5;
|
|
||||||
volatile uint16_t RXSerialfifohead5, RXSerialfifotail5;
|
|
||||||
|
|
||||||
// Init queues
|
|
||||||
void TXSerialfifoinit5()
|
|
||||||
{
|
|
||||||
TXSerialfifohead5 = 0U;
|
|
||||||
TXSerialfifotail5 = 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RXSerialfifoinit5()
|
|
||||||
{
|
|
||||||
RXSerialfifohead5 = 0U;
|
|
||||||
RXSerialfifotail5 = 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
// How full is queue
|
|
||||||
// TODO decide if how full or how empty is preferred info to return
|
|
||||||
uint16_t TXSerialfifolevel5()
|
|
||||||
{
|
|
||||||
uint32_t tail = TXSerialfifotail5;
|
|
||||||
uint32_t head = TXSerialfifohead5;
|
|
||||||
|
|
||||||
if (tail > head)
|
|
||||||
return TX_SERIAL_FIFO_SIZE + head - tail;
|
|
||||||
else
|
|
||||||
return head - tail;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t RXSerialfifolevel5()
|
|
||||||
{
|
|
||||||
uint32_t tail = RXSerialfifotail5;
|
|
||||||
uint32_t head = RXSerialfifohead5;
|
|
||||||
|
|
||||||
if (tail > head)
|
|
||||||
return RX_SERIAL_FIFO_SIZE + head - tail;
|
|
||||||
else
|
|
||||||
return head - tail;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flushes the transmit shift register
|
|
||||||
// warning: this call is blocking
|
|
||||||
void TXSerialFlush5()
|
|
||||||
{
|
|
||||||
// wait until the TXE shows the shift register is empty
|
|
||||||
while (USART_GetITStatus(UART5, USART_FLAG_TXE))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t TXSerialfifoput5(uint8_t next)
|
|
||||||
{
|
|
||||||
if (TXSerialfifolevel5() < TX_SERIAL_FIFO_SIZE) {
|
|
||||||
TXSerialfifo5[TXSerialfifohead5] = next;
|
|
||||||
|
|
||||||
TXSerialfifohead5++;
|
|
||||||
if (TXSerialfifohead5 >= TX_SERIAL_FIFO_SIZE)
|
|
||||||
TXSerialfifohead5 = 0U;
|
|
||||||
|
|
||||||
// make sure transmit interrupts are enabled as long as there is data to send
|
|
||||||
USART_ITConfig(UART5, USART_IT_TXE, ENABLE);
|
|
||||||
return 1U;
|
|
||||||
} else {
|
|
||||||
return 0U; // signal an overflow occurred by returning a zero count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void UART5_IRQHandler()
|
void UART5_IRQHandler()
|
||||||
{
|
{
|
||||||
uint8_t c;
|
m_UART5.handleIRQ();
|
||||||
|
|
||||||
if (USART_GetITStatus(UART5, USART_IT_RXNE)) {
|
|
||||||
c = (uint8_t) USART_ReceiveData(UART5);
|
|
||||||
|
|
||||||
if (RXSerialfifolevel5() < RX_SERIAL_FIFO_SIZE) {
|
|
||||||
RXSerialfifo5[RXSerialfifohead5] = c;
|
|
||||||
|
|
||||||
RXSerialfifohead5++;
|
|
||||||
if (RXSerialfifohead5 >= RX_SERIAL_FIFO_SIZE)
|
|
||||||
RXSerialfifohead5 = 0U;
|
|
||||||
} else {
|
|
||||||
// TODO - do something if rx fifo is full?
|
|
||||||
}
|
|
||||||
|
|
||||||
USART_ClearITPendingBit(UART5, USART_IT_RXNE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (USART_GetITStatus(UART5, USART_IT_TXE)) {
|
|
||||||
c = 0U;
|
|
||||||
|
|
||||||
if (TXSerialfifohead5 != TXSerialfifotail5) { // if the fifo is not empty
|
|
||||||
c = TXSerialfifo5[TXSerialfifotail5];
|
|
||||||
|
|
||||||
TXSerialfifotail5++;
|
|
||||||
if (TXSerialfifotail5 >= TX_SERIAL_FIFO_SIZE)
|
|
||||||
TXSerialfifotail5 = 0U;
|
|
||||||
|
|
||||||
USART_SendData(UART5, c);
|
|
||||||
} else { // if there's no more data to transmit then turn off TX interrupts
|
|
||||||
USART_ITConfig(UART5, USART_IT_TXE, DISABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
USART_ClearITPendingBit(UART5, USART_IT_TXE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitUART5(int speed)
|
void InitUART5(int speed)
|
||||||
@@ -795,41 +293,7 @@ void InitUART5(int speed)
|
|||||||
|
|
||||||
USART_ITConfig(UART5, USART_IT_RXNE, ENABLE);
|
USART_ITConfig(UART5, USART_IT_RXNE, ENABLE);
|
||||||
|
|
||||||
// initialize the fifos
|
m_UART5.init(UART5);
|
||||||
TXSerialfifoinit5();
|
|
||||||
RXSerialfifoinit5();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t AvailUART5()
|
|
||||||
{
|
|
||||||
if (RXSerialfifolevel5() > 0U)
|
|
||||||
return 1U;
|
|
||||||
else
|
|
||||||
return 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AvailForWriteUART5()
|
|
||||||
{
|
|
||||||
return TX_SERIAL_FIFO_SIZE - TXSerialfifolevel5();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t ReadUART5()
|
|
||||||
{
|
|
||||||
uint8_t data_c = RXSerialfifo5[RXSerialfifotail5];
|
|
||||||
|
|
||||||
RXSerialfifotail5++;
|
|
||||||
if (RXSerialfifotail5 >= RX_SERIAL_FIFO_SIZE)
|
|
||||||
RXSerialfifotail5 = 0U;
|
|
||||||
|
|
||||||
return data_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WriteUART5(const uint8_t* data, uint16_t length)
|
|
||||||
{
|
|
||||||
for (uint16_t i = 0U; i < length; i++)
|
|
||||||
TXSerialfifoput5(data[i]);
|
|
||||||
|
|
||||||
USART_ITConfig(UART5, USART_IT_TXE, ENABLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -841,15 +305,19 @@ void CSerialPort::beginInt(uint8_t n, int speed)
|
|||||||
case 1U:
|
case 1U:
|
||||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||||
InitUSART3(speed);
|
InitUSART3(speed);
|
||||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_F7HAT) || defined(STM32F4_DVM)
|
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM)
|
||||||
InitUSART1(speed);
|
InitUSART1(speed);
|
||||||
#elif defined(STM32F4_NUCLEO)
|
#elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO)
|
||||||
InitUSART2(speed);
|
InitUSART2(speed);
|
||||||
|
#elif defined(DRCC_DVM)
|
||||||
|
InitUSART1(speed);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 3U:
|
case 3U:
|
||||||
#if defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)
|
#if defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)
|
||||||
InitUSART1(speed);
|
InitUSART1(speed);
|
||||||
|
#elif defined(DRCC_DVM)
|
||||||
|
InitUSART2(speed);
|
||||||
#else
|
#else
|
||||||
InitUART5(speed);
|
InitUART5(speed);
|
||||||
#endif
|
#endif
|
||||||
@@ -864,17 +332,21 @@ int CSerialPort::availableInt(uint8_t n)
|
|||||||
switch (n) {
|
switch (n) {
|
||||||
case 1U:
|
case 1U:
|
||||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||||
return AvailUSART3();
|
return m_USART3.availble();//AvailUSART3();
|
||||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_F7HAT) || defined(STM32F4_DVM)
|
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM)
|
||||||
return AvailUSART1();
|
return m_USART1.available();//AvailUSART1();
|
||||||
#elif defined(STM32F4_NUCLEO)
|
#elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO)
|
||||||
return AvailUSART2();
|
return m_USART2.available();//AvailUSART2();
|
||||||
|
#elif defined(DRCC_DVM)
|
||||||
|
return m_USART1.available();//AvailUSART1();
|
||||||
#endif
|
#endif
|
||||||
case 3U:
|
case 3U:
|
||||||
#if defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)
|
#if defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)
|
||||||
return AvailUSART1();
|
return m_USART1.available(); //AvailUSART1();
|
||||||
|
#elif defined(DRCC_DVM)
|
||||||
|
return m_USART2.available(); //AvailUSART2();
|
||||||
#else
|
#else
|
||||||
return AvailUART5();
|
return m_UART5.available();//AvailUART5();
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
@@ -886,17 +358,21 @@ int CSerialPort::availableForWriteInt(uint8_t n)
|
|||||||
switch (n) {
|
switch (n) {
|
||||||
case 1U:
|
case 1U:
|
||||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||||
return AvailForWriteUSART3();
|
return m_USART3.availableForWrite(); //AvailForWriteUSART3();
|
||||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_F7HAT) || defined(STM32F4_DVM)
|
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM)
|
||||||
return AvailForWriteUSART1();
|
return m_USART1.availableForWrite(); //AvailForWriteUSART1();
|
||||||
#elif defined(STM32F4_NUCLEO)
|
#elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO)
|
||||||
return AvailForWriteUSART2();
|
return m_USART2.availableForWrite();//AvailForWriteUSART2();
|
||||||
|
#elif defined(DRCC_DVM)
|
||||||
|
return m_USART1.availableForWrite();//AvailForWriteUSART1();
|
||||||
#endif
|
#endif
|
||||||
case 3U:
|
case 3U:
|
||||||
#if defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)
|
#if defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)
|
||||||
return AvailForWriteUSART1();
|
return m_USART1.availableForWrite(); //AvailForWriteUSART1();
|
||||||
|
#elif defined(DRCC_DVM)
|
||||||
|
return m_USART2.availableForWrite();//AvailForWriteUSART2();
|
||||||
#else
|
#else
|
||||||
return AvailForWriteUART5();
|
return m_UART5.availableForWrite();//AvailForWriteUART5();
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
@@ -908,17 +384,21 @@ uint8_t CSerialPort::readInt(uint8_t n)
|
|||||||
switch (n) {
|
switch (n) {
|
||||||
case 1U:
|
case 1U:
|
||||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||||
return ReadUSART3();
|
return m_USART3.read();//ReadUSART3();
|
||||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_F7HAT) || defined(STM32F4_DVM)
|
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM)
|
||||||
return ReadUSART1();
|
return m_USART1.read();//ReadUSART1();
|
||||||
#elif defined(STM32F4_NUCLEO)
|
#elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO)
|
||||||
return ReadUSART2();
|
return m_USART2.read();//ReadUSART2();
|
||||||
|
#elif defined(DRCC_DVM)
|
||||||
|
return m_USART1.read();//ReadUSART1();
|
||||||
#endif
|
#endif
|
||||||
case 3U:
|
case 3U:
|
||||||
#if defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)
|
#if defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)
|
||||||
return ReadUSART1();
|
return m_USART1.read();//ReadUSART1();
|
||||||
|
#elif defined(DRCC_DVM)
|
||||||
|
return m_USART2.read();//ReadUSART2();
|
||||||
#else
|
#else
|
||||||
return ReadUART5();
|
return m_UART5.read();//ReadUART5();
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
return 0U;
|
return 0U;
|
||||||
@@ -930,28 +410,36 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool
|
|||||||
switch (n) {
|
switch (n) {
|
||||||
case 1U:
|
case 1U:
|
||||||
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
#if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO)
|
||||||
WriteUSART3(data, length);
|
m_USART3.write(data, length); //WriteUSART3(data, length);
|
||||||
if (flush)
|
if (flush)
|
||||||
TXSerialFlush3();
|
m_USART3.flush();//TXSerialFlush3();
|
||||||
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_F7HAT) || defined(STM32F4_DVM)
|
#elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM)
|
||||||
WriteUSART1(data, length);
|
m_USART1.write(data, length);//WriteUSART1(data, length);
|
||||||
if (flush)
|
if (flush)
|
||||||
TXSerialFlush1();
|
m_USART1.flush();//TXSerialFlush1();
|
||||||
#elif defined(STM32F4_NUCLEO)
|
#elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO)
|
||||||
WriteUSART2(data, length);
|
m_USART2.write(data, length);//WriteUSART2(data, length);
|
||||||
if (flush)
|
if (flush)
|
||||||
TXSerialFlush2();
|
m_USART2.flush();//TXSerialFlush2();
|
||||||
|
#elif defined(DRCC_DVM)
|
||||||
|
m_USART1.write(data, length);//WriteUSART1(data, length);
|
||||||
|
if (flush)
|
||||||
|
m_USART1.flush();//TXSerialFlush1();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 3U:
|
case 3U:
|
||||||
#if defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)
|
#if defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)
|
||||||
WriteUSART1(data, length);
|
m_USART1.write(data, length); //WriteUSART1(data, length);
|
||||||
if (flush)
|
if (flush)
|
||||||
TXSerialFlush1();
|
m_USART1.flush();
|
||||||
|
#elif defined(DRCC_DVM)
|
||||||
|
m_USART2.write(data, length);//WriteUSART2(data, length);
|
||||||
|
if (flush)
|
||||||
|
m_USART2.flush();//TXSerialFlush2();
|
||||||
#else
|
#else
|
||||||
WriteUART5(data, length);
|
m_UART5.write(data, length);//WriteUART5(data, length);
|
||||||
if (flush)
|
if (flush)
|
||||||
TXSerialFlush5();
|
m_UART5.flush();//TXSerialFlush5();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
# based on https://github.com/berndporr/iir_fixed_point/blob/master/gen_coeff.py
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import scipy.signal as signal
|
||||||
|
import pylab as pl
|
||||||
|
|
||||||
|
# Calculate the coefficients for a pure fixed point
|
||||||
|
# integer filter
|
||||||
|
|
||||||
|
# sampling rate
|
||||||
|
fs = 24000
|
||||||
|
|
||||||
|
# cutoffs
|
||||||
|
f1 = 300
|
||||||
|
f2 = 2700
|
||||||
|
# ripple
|
||||||
|
rp = 0.2
|
||||||
|
|
||||||
|
# scaling factor in bits, do not change !
|
||||||
|
q = 15
|
||||||
|
# scaling factor as facor...
|
||||||
|
scaling_factor = 2**q
|
||||||
|
|
||||||
|
# let's generate a sequence of 2nd order IIR filters
|
||||||
|
sos = signal.cheby1(3,rp,[f1, f2],'bandpass', output='sos', fs=fs)
|
||||||
|
#os = signal.cheby1(4, rp, f2, 'lowpass', output='sos', fs=fs) #deemphasis filter
|
||||||
|
#sos = signal.cheby1(1, rp, 2122, 'highpass', output='sos', fs=fs) #deemphasis filter
|
||||||
|
|
||||||
|
sosrounded = np.round((sos) * scaling_factor)
|
||||||
|
|
||||||
|
# print coefficients
|
||||||
|
for biquad in sosrounded:
|
||||||
|
for coeff in biquad:
|
||||||
|
print(int(coeff),",",sep="",end="")
|
||||||
|
#print((coeff),",",sep="",end="")
|
||||||
|
print("")
|
||||||
|
|
||||||
|
# plot the frequency response
|
||||||
|
b,a = signal.sos2tf(sos)
|
||||||
|
w,h = signal.freqz(b,a, worN=2048)
|
||||||
|
pl.plot(w/np.pi/2*fs,20*np.log(np.abs(h)))
|
||||||
|
pl.xlabel('frequency/Hz');
|
||||||
|
pl.ylabel('gain/dB');
|
||||||
|
pl.ylim(top=1,bottom=-30);
|
||||||
|
pl.xlim(left=250, right=12000);
|
||||||
|
pl.show()
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
% GNU Octave script to generate pre and deemphasis filters
|
||||||
|
% https://dsp.stackexchange.com/questions/34605/biquad-cookbook-formula-for-broadcast-fm-de-emphasis
|
||||||
|
% PACKAGES
|
||||||
|
|
||||||
|
pkg load control
|
||||||
|
pkg load signal
|
||||||
|
|
||||||
|
clear all;
|
||||||
|
clc;
|
||||||
|
|
||||||
|
fs = 24000;
|
||||||
|
samplingtime = 1/fs;
|
||||||
|
|
||||||
|
% analog prototype
|
||||||
|
A2 = [1];
|
||||||
|
B2 = [0.000075 1];
|
||||||
|
|
||||||
|
% Pre
|
||||||
|
Ds = tf(B2, A2);
|
||||||
|
% De
|
||||||
|
% Ds = tf(A2, B2);
|
||||||
|
|
||||||
|
Ds = Ds/dcgain(Ds);
|
||||||
|
|
||||||
|
% MZT
|
||||||
|
T1 = 0.000075; % 75us
|
||||||
|
z1 = -exp(-1.0/(fs*T1));
|
||||||
|
p1 = 1+z1;
|
||||||
|
|
||||||
|
a0 = 1.0;
|
||||||
|
a1 = p1;
|
||||||
|
a2 = 0;
|
||||||
|
|
||||||
|
b0 = 1.0;
|
||||||
|
b1 = z1;
|
||||||
|
b2 = 0;
|
||||||
|
|
||||||
|
% swap between a1, b1 to select pre- or de-emphasis
|
||||||
|
|
||||||
|
# Pre
|
||||||
|
Bmzt = [b0 a1 b2]
|
||||||
|
Amzt = [a0 b1 a2]
|
||||||
|
% De
|
||||||
|
% Bmzt = [b0 b1 b2]
|
||||||
|
% Amzt = [a0 a1 a2]
|
||||||
|
|
||||||
|
DzMZT = tf(Amzt, Bmzt, samplingtime);
|
||||||
|
DzMZT = DzMZT/dcgain(DzMZT);
|
||||||
|
|
||||||
|
%% Plot
|
||||||
|
wmin = 2 * pi * 20.0; % 20Hz
|
||||||
|
wmax = 2 * pi * ((fs/2.0) - (fs/2 - 20000)); %20kHz
|
||||||
|
|
||||||
|
figure(1);
|
||||||
|
bode(Ds, 'b', DzMZT, 'c', {wmin, wmax});
|
||||||
|
legend('Analog prototype', 'MZT 2nd order','location', 'northwest');
|
||||||
|
grid on;
|
||||||
|
pause();
|
||||||
@@ -44,7 +44,7 @@ const uint8_t YSF_END_SYNC = 0xFFU;
|
|||||||
const uint8_t YSF_HANG = 0x00U;
|
const uint8_t YSF_HANG = 0x00U;
|
||||||
|
|
||||||
CYSFTX::CYSFTX() :
|
CYSFTX::CYSFTX() :
|
||||||
m_buffer(4000U),
|
m_buffer(TX_BUFFER_LEN),
|
||||||
m_modFilter(),
|
m_modFilter(),
|
||||||
m_modState(),
|
m_modState(),
|
||||||
m_poBuffer(),
|
m_poBuffer(),
|
||||||
@@ -66,9 +66,6 @@ m_txCount(0U)
|
|||||||
|
|
||||||
void CYSFTX::process()
|
void CYSFTX::process()
|
||||||
{
|
{
|
||||||
if (m_buffer.getData() == 0U && m_poLen == 0U && m_txCount == 0U)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// If we have YSF data to transmit, do so.
|
// If we have YSF data to transmit, do so.
|
||||||
if (m_poLen == 0U && m_buffer.getData() > 0U) {
|
if (m_poLen == 0U && m_buffer.getData() > 0U) {
|
||||||
if (!m_tx) {
|
if (!m_tx) {
|
||||||
@@ -76,7 +73,8 @@ void CYSFTX::process()
|
|||||||
m_poBuffer[m_poLen++] = YSF_START_SYNC;
|
m_poBuffer[m_poLen++] = YSF_START_SYNC;
|
||||||
} else {
|
} else {
|
||||||
for (uint8_t i = 0U; i < YSF_FRAME_LENGTH_BYTES; i++) {
|
for (uint8_t i = 0U; i < YSF_FRAME_LENGTH_BYTES; i++) {
|
||||||
uint8_t c = m_buffer.get();
|
uint8_t c = 0U;
|
||||||
|
m_buffer.get(c);
|
||||||
m_poBuffer[m_poLen++] = c;
|
m_poBuffer[m_poLen++] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,4 +189,3 @@ void CYSFTX::setParams(bool on, uint8_t txHang)
|
|||||||
m_loDev = on;
|
m_loDev = on;
|
||||||
m_txHang = txHang * 1200U;
|
m_txHang = txHang * 1200U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
#include "SerialRB.h"
|
#include "RingBuffer.h"
|
||||||
|
|
||||||
class CYSFTX {
|
class CYSFTX {
|
||||||
public:
|
public:
|
||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
void setParams(bool on, uint8_t txHang);
|
void setParams(bool on, uint8_t txHang);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSerialRB m_buffer;
|
CRingBuffer<uint8_t> m_buffer;
|
||||||
arm_fir_interpolate_instance_q15 m_modFilter;
|
arm_fir_interpolate_instance_q15 m_modFilter;
|
||||||
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
||||||
uint8_t m_poBuffer[1200U];
|
uint8_t m_poBuffer[1200U];
|
||||||
|
|||||||
+1
-1
@@ -83,7 +83,7 @@ EOF
|
|||||||
"3") sed -e 's/\/\/ #define EXTERNAL_OSC 14400000/#define EXTERNAL_OSC 14400000/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "14.400 MHz clock enabled";;
|
"3") sed -e 's/\/\/ #define EXTERNAL_OSC 14400000/#define EXTERNAL_OSC 14400000/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "14.400 MHz clock enabled";;
|
||||||
"4") sed -e 's/\/\/ #define EXTERNAL_OSC 19200000/#define EXTERNAL_OSC 19200000/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "19.200 MHz clock enabled";;
|
"4") sed -e 's/\/\/ #define EXTERNAL_OSC 19200000/#define EXTERNAL_OSC 19200000/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "19.200 MHz clock enabled";;
|
||||||
"5") sed -e 's/\/\/ #define USE_COS_AS_LOCKOUT /#define USE_COS_AS_LOCKOUT/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "COS as Lockout enabled";;
|
"5") sed -e 's/\/\/ #define USE_COS_AS_LOCKOUT /#define USE_COS_AS_LOCKOUT/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "COS as Lockout enabled";;
|
||||||
"6") sed -e 's/\/\/ #define MODE_PINS/#define MODE_PINS/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Mode pins enabled";;
|
"6") sed -e 's/\/\/ #define MODE_LEDS/#define MODE_LEDS/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Mode pins enabled";;
|
||||||
"7") sed -e 's/\/\/ #define ARDUINO_DUE_PAPA/#define ARDUINO_DUE_PAPA/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Layout for the PAPA board enabled";;
|
"7") sed -e 's/\/\/ #define ARDUINO_DUE_PAPA/#define ARDUINO_DUE_PAPA/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Layout for the PAPA board enabled";;
|
||||||
"8") sed -e 's/\/\/ #define ARDUINO_DUE_ZUM_V10/#define ARDUINO_DUE_ZUM_V10/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Layout for ZUM V1.0 and V1.0.1 boards enabled";;
|
"8") sed -e 's/\/\/ #define ARDUINO_DUE_ZUM_V10/#define ARDUINO_DUE_ZUM_V10/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Layout for ZUM V1.0 and V1.0.1 boards enabled";;
|
||||||
"9") sed -e 's/\/\/ #define ARDUINO_DUE_NTH/#define ARDUINO_DUE_NTH/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Layout for SP8NTH board enabled";;
|
"9") sed -e 's/\/\/ #define ARDUINO_DUE_NTH/#define ARDUINO_DUE_NTH/' $conf > $conf.tmp && mv -f $conf.tmp $conf && echo "Layout for SP8NTH board enabled";;
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PINS_F4_DISCOVERY_H
|
||||||
|
#define _PINS_F4_DISCOVERY_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pin definitions for STM32F4 Discovery Board:
|
||||||
|
|
||||||
|
PTT PB13 output P1 Pin37
|
||||||
|
COSLED PA7 output P1 Pin17
|
||||||
|
LED PD15 output P1 Pin47
|
||||||
|
COS PA5 input P1 Pin15
|
||||||
|
|
||||||
|
DSTAR PD12 output P1 Pin44
|
||||||
|
DMR PD13 output P1 Pin45
|
||||||
|
YSF PD14 output P1 Pin46
|
||||||
|
P25 PD11 output P1 Pin43
|
||||||
|
NXDN PD10 output P1 Pin42
|
||||||
|
|
||||||
|
RX PA0 analog input P1 Pin12
|
||||||
|
RSSI PA1 analog input P1 Pin11
|
||||||
|
TX PA4 analog output P1 Pin16
|
||||||
|
|
||||||
|
EXT_CLK PA15 input P2 Pin40
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PIN_COS GPIO_Pin_5
|
||||||
|
#define PORT_COS GPIOA
|
||||||
|
#define RCC_Per_COS RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_PTT GPIO_Pin_13
|
||||||
|
#define PORT_PTT GPIOB
|
||||||
|
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_COSLED GPIO_Pin_7
|
||||||
|
#define PORT_COSLED GPIOA
|
||||||
|
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_LED GPIO_Pin_15
|
||||||
|
#define PORT_LED GPIOD
|
||||||
|
#define RCC_Per_LED RCC_AHB1Periph_GPIOD
|
||||||
|
|
||||||
|
#define PIN_P25 GPIO_Pin_11
|
||||||
|
#define PORT_P25 GPIOD
|
||||||
|
#define RCC_Per_P25 RCC_AHB1Periph_GPIOD
|
||||||
|
|
||||||
|
#define PIN_NXDN GPIO_Pin_10
|
||||||
|
#define PORT_NXDN GPIOD
|
||||||
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOD
|
||||||
|
|
||||||
|
#define PIN_DSTAR GPIO_Pin_12
|
||||||
|
#define PORT_DSTAR GPIOD
|
||||||
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOD
|
||||||
|
|
||||||
|
#define PIN_DMR GPIO_Pin_13
|
||||||
|
#define PORT_DMR GPIOD
|
||||||
|
#define RCC_Per_DMR RCC_AHB1Periph_GPIOD
|
||||||
|
|
||||||
|
#define PIN_YSF GPIO_Pin_14
|
||||||
|
#define PORT_YSF GPIOD
|
||||||
|
#define RCC_Per_YSF RCC_AHB1Periph_GPIOD
|
||||||
|
|
||||||
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
|
#define SRC_EXT_CLK GPIO_PinSource15
|
||||||
|
#define PORT_EXT_CLK GPIOA
|
||||||
|
|
||||||
|
#define PIN_RX GPIO_Pin_0
|
||||||
|
#define PIN_RX_CH ADC_Channel_0
|
||||||
|
#define PORT_RX GPIOA
|
||||||
|
#define RCC_Per_RX RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_RSSI GPIO_Pin_1
|
||||||
|
#define PIN_RSSI_CH ADC_Channel_1
|
||||||
|
#define PORT_RSSI GPIOA
|
||||||
|
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_TX GPIO_Pin_4
|
||||||
|
#define PIN_TX_CH DAC_Channel_1
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PINS_F4_DRCC_NQF_H
|
||||||
|
#define _PINS_F4_DRCC_NQF_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pin definitions for DRCC_DVM BG7NQF board rev1
|
||||||
|
|
||||||
|
PTT PB12 output
|
||||||
|
LED_PTT PB4 output
|
||||||
|
LED_COS PB5 output
|
||||||
|
LED_SRV PB10 output
|
||||||
|
COS PB13 input
|
||||||
|
|
||||||
|
DSTAR N/A
|
||||||
|
DMR N/A
|
||||||
|
YSF N/A
|
||||||
|
P25 N/A
|
||||||
|
NXDN N/A
|
||||||
|
POCSAG N/A
|
||||||
|
|
||||||
|
MDSTAR PB14 output
|
||||||
|
MDMR PB8 output
|
||||||
|
MYSF PB9 output
|
||||||
|
MP25 PB15 output
|
||||||
|
MNXDN N/A
|
||||||
|
MPOCSAG N/A
|
||||||
|
|
||||||
|
RX PB0 analog input
|
||||||
|
RSSI PB1 analog input
|
||||||
|
TX PA4 analog output
|
||||||
|
|
||||||
|
EXT_CLK PA15 input
|
||||||
|
|
||||||
|
UART1_TX PA9 output
|
||||||
|
UART1_RX PA10 output
|
||||||
|
UART2_TX PA2 output
|
||||||
|
UART2_RX PA3 output
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PIN_COS GPIO_Pin_13
|
||||||
|
#define PORT_COS GPIOB
|
||||||
|
#define RCC_Per_COS RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_PTT GPIO_Pin_12
|
||||||
|
#define PORT_PTT GPIOB
|
||||||
|
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_COSLED GPIO_Pin_5
|
||||||
|
#define PORT_COSLED GPIOB
|
||||||
|
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_LED GPIO_Pin_10
|
||||||
|
#define PORT_LED GPIOB
|
||||||
|
#define RCC_Per_LED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_TXLED GPIO_Pin_4
|
||||||
|
#define PORT_TXLED GPIOB
|
||||||
|
#define RCC_Per_TXLED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
// #define PIN_P25 GPIO_Pin_3
|
||||||
|
// #define PORT_P25 GPIOB
|
||||||
|
// #define RCC_Per_P25 RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
// #define PIN_NXDN GPIO_Pin_10
|
||||||
|
// #define PORT_NXDN GPIOA
|
||||||
|
// #define RCC_Per_NXDN RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
// #define PIN_POCSAG GPIO_Pin_12
|
||||||
|
// #define PORT_POCSAG GPIOB
|
||||||
|
// #define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
// #define PIN_DSTAR GPIO_Pin_10
|
||||||
|
// #define PORT_DSTAR GPIOB
|
||||||
|
// #define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
// #define PIN_DMR GPIO_Pin_4
|
||||||
|
// #define PORT_DMR GPIOB
|
||||||
|
// #define RCC_Per_DMR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
// #define PIN_YSF GPIO_Pin_5
|
||||||
|
// #define PORT_YSF GPIOB
|
||||||
|
// #define RCC_Per_YSF RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#if defined(MODE_PINS)
|
||||||
|
#define PIN_MP25 GPIO_Pin_15
|
||||||
|
#define PORT_MP25 GPIOB
|
||||||
|
#define RCC_Per_MP25 RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_MDSTAR GPIO_Pin_9
|
||||||
|
#define PORT_MDSTAR GPIOB
|
||||||
|
#define RCC_Per_MDSTAR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_MDMR GPIO_Pin_8
|
||||||
|
#define PORT_MDMR GPIOB
|
||||||
|
#define RCC_Per_MDMR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_MYSF GPIO_Pin_14
|
||||||
|
#define PORT_MYSF GPIOB
|
||||||
|
#define RCC_Per_MYSF RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
|
#define SRC_EXT_CLK GPIO_PinSource15
|
||||||
|
#define PORT_EXT_CLK GPIOA
|
||||||
|
|
||||||
|
#define PIN_RX GPIO_Pin_0
|
||||||
|
#define PIN_RX_CH ADC_Channel_0
|
||||||
|
#define PORT_RX GPIOB
|
||||||
|
#define RCC_Per_RX RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_RSSI GPIO_Pin_1
|
||||||
|
#define PIN_RSSI_CH ADC_Channel_1
|
||||||
|
#define PORT_RSSI GPIOB
|
||||||
|
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_TX GPIO_Pin_4
|
||||||
|
#define PIN_TX_CH DAC_Channel_1
|
||||||
|
#define PORT_TX GPIOA
|
||||||
|
#define RCC_Per_TX RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PINS_F4_F4M_H
|
||||||
|
#define _PINS_F4_F4M_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pin definitions for MMDVM-F4M Pi-Hat F0DEI board:
|
||||||
|
|
||||||
|
PTT PB13 output
|
||||||
|
COSLED PB14 output
|
||||||
|
LED PB15 output
|
||||||
|
COS PC0 input
|
||||||
|
|
||||||
|
DSTAR PC7 output
|
||||||
|
DMR PC8 output
|
||||||
|
YSF PA8 output
|
||||||
|
P25 PC9 output
|
||||||
|
NXDN PB1 output
|
||||||
|
POCSAG PB12 output
|
||||||
|
|
||||||
|
RX PA0 analog input
|
||||||
|
RSSI PA7 analog input
|
||||||
|
TX PA4 analog output
|
||||||
|
|
||||||
|
EXT_CLK PA15 input
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PIN_COS GPIO_Pin_0
|
||||||
|
#define PORT_COS GPIOC
|
||||||
|
#define RCC_Per_COS RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_PTT GPIO_Pin_13
|
||||||
|
#define PORT_PTT GPIOB
|
||||||
|
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_COSLED GPIO_Pin_14
|
||||||
|
#define PORT_COSLED GPIOB
|
||||||
|
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_LED GPIO_Pin_15
|
||||||
|
#define PORT_LED GPIOB
|
||||||
|
#define RCC_Per_LED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_P25 GPIO_Pin_9
|
||||||
|
#define PORT_P25 GPIOC
|
||||||
|
#define RCC_Per_P25 RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_NXDN GPIO_Pin_1
|
||||||
|
#define PORT_NXDN GPIOB
|
||||||
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_POCSAG GPIO_Pin_12
|
||||||
|
#define PORT_POCSAG GPIOB
|
||||||
|
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DSTAR GPIO_Pin_7
|
||||||
|
#define PORT_DSTAR GPIOC
|
||||||
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_DMR GPIO_Pin_8
|
||||||
|
#define PORT_DMR GPIOC
|
||||||
|
#define RCC_Per_DMR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_YSF GPIO_Pin_8
|
||||||
|
#define PORT_YSF GPIOA
|
||||||
|
#define RCC_Per_YSF RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
|
#define SRC_EXT_CLK GPIO_PinSource15
|
||||||
|
#define PORT_EXT_CLK GPIOA
|
||||||
|
|
||||||
|
#define PIN_RX GPIO_Pin_0
|
||||||
|
#define PIN_RX_CH ADC_Channel_0
|
||||||
|
#define PORT_RX GPIOA
|
||||||
|
#define RCC_Per_RX RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_RSSI GPIO_Pin_7
|
||||||
|
#define PIN_RSSI_CH ADC_Channel_7
|
||||||
|
#define PORT_RSSI GPIOA
|
||||||
|
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_TX GPIO_Pin_4
|
||||||
|
#define PIN_TX_CH DAC_Channel_1
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PINS_F4_NUCLEO_ARDUINO_H
|
||||||
|
#define _PINS_F4_NUCLEO_ARDUINO_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pin definitions for STM32F4 Nucleo boards (Arduino header):
|
||||||
|
|
||||||
|
PTT PB10 output CN9 Pin7
|
||||||
|
COSLED PB3 output CN9 Pin4
|
||||||
|
LED PB5 output CN9 Pin5
|
||||||
|
COS PB4 input CN9 Pin6
|
||||||
|
|
||||||
|
DSTAR PA1 output CN8 Pin2
|
||||||
|
DMR PA4 output CN8 Pin3
|
||||||
|
YSF PB0 output CN8 Pin4
|
||||||
|
P25 PC1 output CN8 Pin5
|
||||||
|
NXDN PA3 output CN9 Pin1
|
||||||
|
POCSAG PB12 output
|
||||||
|
|
||||||
|
RX PA0 analog input CN8 Pin1
|
||||||
|
RSSI PC0 analog input CN8 Pin6
|
||||||
|
TX PA5 analog output CN5 Pin6
|
||||||
|
|
||||||
|
EXT_CLK PB8 input CN5 Pin10
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PIN_COS GPIO_Pin_4
|
||||||
|
#define PORT_COS GPIOB
|
||||||
|
#define RCC_Per_COS RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_PTT GPIO_Pin_10
|
||||||
|
#define PORT_PTT GPIOB
|
||||||
|
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_COSLED GPIO_Pin_3
|
||||||
|
#define PORT_COSLED GPIOB
|
||||||
|
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_LED GPIO_Pin_5
|
||||||
|
#define PORT_LED GPIOB
|
||||||
|
#define RCC_Per_LED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_P25 GPIO_Pin_1
|
||||||
|
#define PORT_P25 GPIOC
|
||||||
|
#define RCC_Per_P25 RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_NXDN GPIO_Pin_3
|
||||||
|
#define PORT_NXDN GPIOA
|
||||||
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_POCSAG GPIO_Pin_12
|
||||||
|
#define PORT_POCSAG GPIOB
|
||||||
|
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DSTAR GPIO_Pin_1
|
||||||
|
#define PORT_DSTAR GPIOA
|
||||||
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_DMR GPIO_Pin_4
|
||||||
|
#define PORT_DMR GPIOA
|
||||||
|
#define RCC_Per_DMR RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_YSF GPIO_Pin_0
|
||||||
|
#define PORT_YSF GPIOB
|
||||||
|
#define RCC_Per_YSF RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_EXT_CLK GPIO_Pin_8
|
||||||
|
#define SRC_EXT_CLK GPIO_PinSource8
|
||||||
|
#define PORT_EXT_CLK GPIOB
|
||||||
|
|
||||||
|
#define PIN_RX GPIO_Pin_0
|
||||||
|
#define PIN_RX_CH ADC_Channel_0
|
||||||
|
#define PORT_RX GPIOA
|
||||||
|
#define RCC_Per_RX RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_RSSI GPIO_Pin_0
|
||||||
|
#define PIN_RSSI_CH ADC_Channel_10
|
||||||
|
#define PORT_RSSI GPIOC
|
||||||
|
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_TX GPIO_Pin_5
|
||||||
|
#define PIN_TX_CH DAC_Channel_2
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PINS_F4_NUCLEO_MORPHO_H
|
||||||
|
#define _PINS_F4_NUCLEO_MORPHO_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pin definitions for STM32F4 Nucleo boards (ST Morpho header):
|
||||||
|
|
||||||
|
PTT PB13 output CN10 Pin30
|
||||||
|
COSLED PB14 output CN10 Pin28
|
||||||
|
LED PA5 output CN10 Pin11
|
||||||
|
COS PB15 input CN10 Pin26
|
||||||
|
|
||||||
|
DSTAR PB10 output CN10 Pin25
|
||||||
|
DMR PB4 output CN10 Pin27
|
||||||
|
YSF PB5 output CN10 Pin29
|
||||||
|
P25 PB3 output CN10 Pin31
|
||||||
|
NXDN PA10 output CN10 Pin33
|
||||||
|
POCSAG PB12 output CN10 Pin16
|
||||||
|
|
||||||
|
MDSTAR PC4 output CN10 Pin34
|
||||||
|
MDMR PC5 output CN10 Pin6
|
||||||
|
MYSF PC2 output CN7 Pin35
|
||||||
|
MP25 PC3 output CN7 Pin37
|
||||||
|
MNXDN PC6 output CN10 Pin4
|
||||||
|
MPOCSAG PC8 output CN10 Pin2
|
||||||
|
|
||||||
|
RX PA0 analog input CN7 Pin28
|
||||||
|
RSSI PA1 analog input CN7 Pin30
|
||||||
|
TX PA4 analog output CN7 Pin32
|
||||||
|
|
||||||
|
EXT_CLK PA15 input CN7 Pin17
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PIN_COS GPIO_Pin_15
|
||||||
|
#define PORT_COS GPIOB
|
||||||
|
#define RCC_Per_COS RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_PTT GPIO_Pin_13
|
||||||
|
#define PORT_PTT GPIOB
|
||||||
|
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_COSLED GPIO_Pin_14
|
||||||
|
#define PORT_COSLED GPIOB
|
||||||
|
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_LED GPIO_Pin_5
|
||||||
|
#define PORT_LED GPIOA
|
||||||
|
#define RCC_Per_LED RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_P25 GPIO_Pin_3
|
||||||
|
#define PORT_P25 GPIOB
|
||||||
|
#define RCC_Per_P25 RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_NXDN GPIO_Pin_10
|
||||||
|
#define PORT_NXDN GPIOA
|
||||||
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_POCSAG GPIO_Pin_12
|
||||||
|
#define PORT_POCSAG GPIOB
|
||||||
|
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DSTAR GPIO_Pin_10
|
||||||
|
#define PORT_DSTAR GPIOB
|
||||||
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DMR GPIO_Pin_4
|
||||||
|
#define PORT_DMR GPIOB
|
||||||
|
#define RCC_Per_DMR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_YSF GPIO_Pin_5
|
||||||
|
#define PORT_YSF GPIOB
|
||||||
|
#define RCC_Per_YSF RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#if defined(MODE_PINS)
|
||||||
|
#define PIN_MP25 GPIO_Pin_3
|
||||||
|
#define PORT_MP25 GPIOC
|
||||||
|
#define RCC_Per_MP25 RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MNXDN GPIO_Pin_6
|
||||||
|
#define PORT_MNXDN GPIOC
|
||||||
|
#define RCC_Per_MNXDN RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MDSTAR GPIO_Pin_4
|
||||||
|
#define PORT_MDSTAR GPIOC
|
||||||
|
#define RCC_Per_MDSTAR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MDMR GPIO_Pin_5
|
||||||
|
#define PORT_MDMR GPIOC
|
||||||
|
#define RCC_Per_MDMR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MYSF GPIO_Pin_2
|
||||||
|
#define PORT_MYSF GPIOC
|
||||||
|
#define RCC_Per_MYSF RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MPOCSAG GPIO_Pin_8
|
||||||
|
#define PORT_MPOCSAG GPIOC
|
||||||
|
#define RCC_Per_MPOCSAG RCC_AHB1Periph_GPIOC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
|
#define SRC_EXT_CLK GPIO_PinSource15
|
||||||
|
#define PORT_EXT_CLK GPIOA
|
||||||
|
|
||||||
|
#define PIN_RX GPIO_Pin_0
|
||||||
|
#define PIN_RX_CH ADC_Channel_0
|
||||||
|
#define PORT_RX GPIOA
|
||||||
|
#define RCC_Per_RX RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_RSSI GPIO_Pin_1
|
||||||
|
#define PIN_RSSI_CH ADC_Channel_1
|
||||||
|
#define PORT_RSSI GPIOA
|
||||||
|
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_TX GPIO_Pin_4
|
||||||
|
#define PIN_TX_CH DAC_Channel_1
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PINS_F4_PI_H
|
||||||
|
#define _PINS_F4_PI_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pin definitions for STM32F4 Pi Board:
|
||||||
|
|
||||||
|
PTT PB13 output
|
||||||
|
COSLED PB14 output
|
||||||
|
LED PB15 output
|
||||||
|
COS PC0 input
|
||||||
|
|
||||||
|
DSTAR PC7 output
|
||||||
|
DMR PC8 output
|
||||||
|
YSF PA8 output
|
||||||
|
P25 PC9 output
|
||||||
|
NXDN PB1 output
|
||||||
|
POCSAG PB12 output
|
||||||
|
|
||||||
|
RX PA0 analog input
|
||||||
|
RSSI PA7 analog input
|
||||||
|
TX PA4 analog output
|
||||||
|
|
||||||
|
EXT_CLK PA15 input
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PIN_COS GPIO_Pin_0
|
||||||
|
#define PORT_COS GPIOC
|
||||||
|
#define RCC_Per_COS RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_PTT GPIO_Pin_13
|
||||||
|
#define PORT_PTT GPIOB
|
||||||
|
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_COSLED GPIO_Pin_14
|
||||||
|
#define PORT_COSLED GPIOB
|
||||||
|
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_LED GPIO_Pin_15
|
||||||
|
#define PORT_LED GPIOB
|
||||||
|
#define RCC_Per_LED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_P25 GPIO_Pin_9
|
||||||
|
#define PORT_P25 GPIOC
|
||||||
|
#define RCC_Per_P25 RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_NXDN GPIO_Pin_1
|
||||||
|
#define PORT_NXDN GPIOB
|
||||||
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_POCSAG GPIO_Pin_12
|
||||||
|
#define PORT_POCSAG GPIOB
|
||||||
|
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DSTAR GPIO_Pin_7
|
||||||
|
#define PORT_DSTAR GPIOC
|
||||||
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_DMR GPIO_Pin_8
|
||||||
|
#define PORT_DMR GPIOC
|
||||||
|
#define RCC_Per_DMR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_YSF GPIO_Pin_8
|
||||||
|
#define PORT_YSF GPIOA
|
||||||
|
#define RCC_Per_YSF RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
|
#define SRC_EXT_CLK GPIO_PinSource15
|
||||||
|
#define PORT_EXT_CLK GPIOA
|
||||||
|
|
||||||
|
#define PIN_RX GPIO_Pin_0
|
||||||
|
#define PIN_RX_CH ADC_Channel_0
|
||||||
|
#define PORT_RX GPIOA
|
||||||
|
#define RCC_Per_RX RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_RSSI GPIO_Pin_7
|
||||||
|
#define PIN_RSSI_CH ADC_Channel_7
|
||||||
|
#define PORT_RSSI GPIOA
|
||||||
|
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_TX GPIO_Pin_4
|
||||||
|
#define PIN_TX_CH DAC_Channel_1
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PINS_F4_RPT_TGO_H
|
||||||
|
#define _PINS_F4_RPT_TGO_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pin definitions for MMDVM_RPT_Hat Pi-Hat BG4TGO board::
|
||||||
|
|
||||||
|
PTT PB13 output CN10 Pin30
|
||||||
|
COSLED PB14 output CN10 Pin28
|
||||||
|
LED PA5 output CN10 Pin11
|
||||||
|
COS PB15 input CN10 Pin26
|
||||||
|
|
||||||
|
DSTAR PB10 output CN10 Pin25
|
||||||
|
DMR PB4 output CN10 Pin27
|
||||||
|
YSF PB5 output CN10 Pin29
|
||||||
|
P25 PB3 output CN10 Pin31
|
||||||
|
NXDN PA10 output CN10 Pin33
|
||||||
|
POCSAG PB12 output CN10 Pin16
|
||||||
|
|
||||||
|
MDSTAR PC4 output CN10 Pin34
|
||||||
|
MDMR PC5 output CN10 Pin6
|
||||||
|
MYSF PC2 output CN7 Pin35
|
||||||
|
MP25 PC3 output CN7 Pin37
|
||||||
|
MNXDN PC6 output CN10 Pin4
|
||||||
|
MPOCSAG PC8 output CN10 Pin2
|
||||||
|
|
||||||
|
RX PA0 analog input CN7 Pin28
|
||||||
|
RSSI PA1 analog input CN7 Pin30
|
||||||
|
TX PA4 analog output CN7 Pin32
|
||||||
|
|
||||||
|
EXT_CLK PA15 input CN7 Pin17
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PIN_COS GPIO_Pin_15
|
||||||
|
#define PORT_COS GPIOB
|
||||||
|
#define RCC_Per_COS RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_PTT GPIO_Pin_13
|
||||||
|
#define PORT_PTT GPIOB
|
||||||
|
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_COSLED GPIO_Pin_14
|
||||||
|
#define PORT_COSLED GPIOB
|
||||||
|
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_LED GPIO_Pin_5
|
||||||
|
#define PORT_LED GPIOA
|
||||||
|
#define RCC_Per_LED RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_P25 GPIO_Pin_3
|
||||||
|
#define PORT_P25 GPIOB
|
||||||
|
#define RCC_Per_P25 RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_NXDN GPIO_Pin_10
|
||||||
|
#define PORT_NXDN GPIOA
|
||||||
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_POCSAG GPIO_Pin_12
|
||||||
|
#define PORT_POCSAG GPIOB
|
||||||
|
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DSTAR GPIO_Pin_10
|
||||||
|
#define PORT_DSTAR GPIOB
|
||||||
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DMR GPIO_Pin_4
|
||||||
|
#define PORT_DMR GPIOB
|
||||||
|
#define RCC_Per_DMR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_YSF GPIO_Pin_5
|
||||||
|
#define PORT_YSF GPIOB
|
||||||
|
#define RCC_Per_YSF RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#if defined(MODE_PINS)
|
||||||
|
#define PIN_MP25 GPIO_Pin_3
|
||||||
|
#define PORT_MP25 GPIOC
|
||||||
|
#define RCC_Per_MP25 RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MNXDN GPIO_Pin_6
|
||||||
|
#define PORT_MNXDN GPIOC
|
||||||
|
#define RCC_Per_MNXDN RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MDSTAR GPIO_Pin_4
|
||||||
|
#define PORT_MDSTAR GPIOC
|
||||||
|
#define RCC_Per_MDSTAR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MDMR GPIO_Pin_5
|
||||||
|
#define PORT_MDMR GPIOC
|
||||||
|
#define RCC_Per_MDMR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MYSF GPIO_Pin_2
|
||||||
|
#define PORT_MYSF GPIOC
|
||||||
|
#define RCC_Per_MYSF RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MPOCSAG GPIO_Pin_8
|
||||||
|
#define PORT_MPOCSAG GPIOC
|
||||||
|
#define RCC_Per_MPOCSAG RCC_AHB1Periph_GPIOC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
|
#define SRC_EXT_CLK GPIO_PinSource15
|
||||||
|
#define PORT_EXT_CLK GPIOA
|
||||||
|
|
||||||
|
#define PIN_RX GPIO_Pin_0
|
||||||
|
#define PIN_RX_CH ADC_Channel_0
|
||||||
|
#define PORT_RX GPIOA
|
||||||
|
#define RCC_Per_RX RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_RSSI GPIO_Pin_1
|
||||||
|
#define PIN_RSSI_CH ADC_Channel_1
|
||||||
|
#define PORT_RSSI GPIOA
|
||||||
|
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_TX GPIO_Pin_4
|
||||||
|
#define PIN_TX_CH DAC_Channel_1
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PINS_F4_STM32DVM_V3_H
|
||||||
|
#define _PINS_F4_STM32DVM_V3_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pin definitions for STM32F4 STM32-DVM rev 3 Board:
|
||||||
|
|
||||||
|
COS PB13 input
|
||||||
|
PTT PB12 output
|
||||||
|
COSLED PB4 output
|
||||||
|
LED PB3 output
|
||||||
|
|
||||||
|
P25 PB8 output
|
||||||
|
NXDN PB9 output
|
||||||
|
DSTAR PB6 output
|
||||||
|
DMR PB5 output
|
||||||
|
YSF PB7 output
|
||||||
|
POCSAG PC10 output
|
||||||
|
|
||||||
|
RX PB0 analog input
|
||||||
|
RSSI PB1 analog input
|
||||||
|
TX PA4 analog output
|
||||||
|
|
||||||
|
EXT_CLK PA15 input
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PIN_COS GPIO_Pin_13
|
||||||
|
#define PORT_COS GPIOB
|
||||||
|
#define RCC_Per_COS RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
|
||||||
|
#define PIN_PTT GPIO_Pin_12
|
||||||
|
#define PORT_PTT GPIOB
|
||||||
|
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_COSLED GPIO_Pin_4
|
||||||
|
#define PORT_COSLED GPIOB
|
||||||
|
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_LED GPIO_Pin_3
|
||||||
|
#define PORT_LED GPIOB
|
||||||
|
#define RCC_Per_LED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_P25 GPIO_Pin_8
|
||||||
|
#define PORT_P25 GPIOB
|
||||||
|
#define RCC_Per_P25 RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_NXDN GPIO_Pin_9
|
||||||
|
#define PORT_NXDN GPIOB
|
||||||
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DSTAR GPIO_Pin_6
|
||||||
|
#define PORT_DSTAR GPIOB
|
||||||
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DMR GPIO_Pin_5
|
||||||
|
#define PORT_DMR GPIOB
|
||||||
|
#define RCC_Per_DMR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_YSF GPIO_Pin_7
|
||||||
|
#define PORT_YSF GPIOB
|
||||||
|
#define RCC_Per_YSF RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_POCSAG GPIO_Pin_10
|
||||||
|
#define PORT_POCSAG GPIOC
|
||||||
|
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
|
#define SRC_EXT_CLK GPIO_PinSource15
|
||||||
|
#define PORT_EXT_CLK GPIOA
|
||||||
|
|
||||||
|
#define PIN_RX GPIO_Pin_0
|
||||||
|
#define PIN_RX_CH ADC_Channel_8
|
||||||
|
#define PORT_RX GPIOB
|
||||||
|
#define RCC_Per_RX RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_RSSI GPIO_Pin_1
|
||||||
|
#define PIN_RSSI_CH ADC_Channel_9
|
||||||
|
#define PORT_RSSI GPIOB
|
||||||
|
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_TX GPIO_Pin_4
|
||||||
|
#define PIN_TX_CH DAC_Channel_1
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PINS_F7_F7M_H
|
||||||
|
#define _PINS_F7_F7M_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pin definitions for MMDVM-F7M Pi-Hat F0DEI board:
|
||||||
|
|
||||||
|
PTT PB13 output
|
||||||
|
COSLED PB14 output
|
||||||
|
LED PB15 output
|
||||||
|
COS PC0 input
|
||||||
|
|
||||||
|
DSTAR PC7 output
|
||||||
|
DMR PC8 output
|
||||||
|
YSF PA8 output
|
||||||
|
P25 PC9 output
|
||||||
|
NXDN PB1 output
|
||||||
|
POCSAG PB12 output
|
||||||
|
|
||||||
|
RX PA0 analog input
|
||||||
|
RSSI PA7 analog input
|
||||||
|
TX PA4 analog output
|
||||||
|
|
||||||
|
EXT_CLK PA15 input
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PIN_COS GPIO_Pin_0
|
||||||
|
#define PORT_COS GPIOC
|
||||||
|
#define RCC_Per_COS RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_PTT GPIO_Pin_13
|
||||||
|
#define PORT_PTT GPIOB
|
||||||
|
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_COSLED GPIO_Pin_14
|
||||||
|
#define PORT_COSLED GPIOB
|
||||||
|
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_LED GPIO_Pin_15
|
||||||
|
#define PORT_LED GPIOB
|
||||||
|
#define RCC_Per_LED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_P25 GPIO_Pin_9
|
||||||
|
#define PORT_P25 GPIOC
|
||||||
|
#define RCC_Per_P25 RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_NXDN GPIO_Pin_1
|
||||||
|
#define PORT_NXDN GPIOB
|
||||||
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_POCSAG GPIO_Pin_12
|
||||||
|
#define PORT_POCSAG GPIOB
|
||||||
|
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DSTAR GPIO_Pin_7
|
||||||
|
#define PORT_DSTAR GPIOC
|
||||||
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_DMR GPIO_Pin_8
|
||||||
|
#define PORT_DMR GPIOC
|
||||||
|
#define RCC_Per_DMR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_YSF GPIO_Pin_8
|
||||||
|
#define PORT_YSF GPIOA
|
||||||
|
#define RCC_Per_YSF RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
|
#define SRC_EXT_CLK GPIO_PinSource15
|
||||||
|
#define PORT_EXT_CLK GPIOA
|
||||||
|
|
||||||
|
#define PIN_RX GPIO_Pin_0
|
||||||
|
#define PIN_RX_CH ADC_Channel_0
|
||||||
|
#define PORT_RX GPIOA
|
||||||
|
#define RCC_Per_RX RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_RSSI GPIO_Pin_7
|
||||||
|
#define PIN_RSSI_CH ADC_Channel_7
|
||||||
|
#define PORT_RSSI GPIOA
|
||||||
|
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_TX GPIO_Pin_4
|
||||||
|
#define PIN_TX_CH DAC_Channel_1
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PINS_F7_NUCLEO_H
|
||||||
|
#define _PINS_F7_NUCLEO_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pin definitions for STM32F7 Nucleo boards (ST Morpho header):
|
||||||
|
|
||||||
|
PTT PB13 output CN12 Pin30
|
||||||
|
COSLED PB14 output CN12 Pin28
|
||||||
|
LED PA5 output CN12 Pin11
|
||||||
|
COS PB15 input CN12 Pin26
|
||||||
|
|
||||||
|
DSTAR PB10 output CN12 Pin25
|
||||||
|
DMR PB4 output CN12 Pin27
|
||||||
|
YSF PB5 output CN12 Pin29
|
||||||
|
P25 PB3 output CN12 Pin31
|
||||||
|
NXDN PA10 output CN12 Pin33
|
||||||
|
POCSAG PB12 output CN12 Pin16
|
||||||
|
|
||||||
|
MDSTAR PC4 output CN12 Pin34
|
||||||
|
MDMR PC5 output CN12 Pin6
|
||||||
|
MYSF PC2 output CN11 Pin35
|
||||||
|
MP25 PC3 output CN11 Pin37
|
||||||
|
MNXDN PC6 output CN12 Pin4
|
||||||
|
|
||||||
|
RX PA0 analog input CN11 Pin28
|
||||||
|
RSSI PA1 analog input CN11 Pin30
|
||||||
|
TX PA4 analog output CN11 Pin32
|
||||||
|
|
||||||
|
EXT_CLK PA15 input CN11 Pin17
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PIN_COS GPIO_Pin_15
|
||||||
|
#define PORT_COS GPIOB
|
||||||
|
#define RCC_Per_COS RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_PTT GPIO_Pin_13
|
||||||
|
#define PORT_PTT GPIOB
|
||||||
|
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_COSLED GPIO_Pin_14
|
||||||
|
#define PORT_COSLED GPIOB
|
||||||
|
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_LED GPIO_Pin_5
|
||||||
|
#define PORT_LED GPIOA
|
||||||
|
#define RCC_Per_LED RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_P25 GPIO_Pin_3
|
||||||
|
#define PORT_P25 GPIOB
|
||||||
|
#define RCC_Per_P25 RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_NXDN GPIO_Pin_10
|
||||||
|
#define PORT_NXDN GPIOA
|
||||||
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_POCSAG GPIO_Pin_12
|
||||||
|
#define PORT_POCSAG GPIOB
|
||||||
|
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DSTAR GPIO_Pin_10
|
||||||
|
#define PORT_DSTAR GPIOB
|
||||||
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DMR GPIO_Pin_4
|
||||||
|
#define PORT_DMR GPIOB
|
||||||
|
#define RCC_Per_DMR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_YSF GPIO_Pin_5
|
||||||
|
#define PORT_YSF GPIOB
|
||||||
|
#define RCC_Per_YSF RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#if defined(MODE_PINS)
|
||||||
|
#define PIN_MP25 GPIO_Pin_3
|
||||||
|
#define PORT_MP25 GPIOC
|
||||||
|
#define RCC_Per_MP25 RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MNXDN GPIO_Pin_6
|
||||||
|
#define PORT_MNXDN GPIOC
|
||||||
|
#define RCC_Per_MNXDN RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MDSTAR GPIO_Pin_4
|
||||||
|
#define PORT_MDSTAR GPIOC
|
||||||
|
#define RCC_Per_MDSTAR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MDMR GPIO_Pin_5
|
||||||
|
#define PORT_MDMR GPIOC
|
||||||
|
#define RCC_Per_MDMR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MYSF GPIO_Pin_2
|
||||||
|
#define PORT_MYSF GPIOC
|
||||||
|
#define RCC_Per_MYSF RCC_AHB1Periph_GPIOC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
|
#define SRC_EXT_CLK GPIO_PinSource15
|
||||||
|
#define PORT_EXT_CLK GPIOA
|
||||||
|
|
||||||
|
#define PIN_RX GPIO_Pin_0
|
||||||
|
#define PIN_RX_CH ADC_Channel_0
|
||||||
|
#define PORT_RX GPIOA
|
||||||
|
#define RCC_Per_RX RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_RSSI GPIO_Pin_1
|
||||||
|
#define PIN_RSSI_CH ADC_Channel_1
|
||||||
|
#define PORT_RSSI GPIOA
|
||||||
|
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_TX GPIO_Pin_4
|
||||||
|
#define PIN_TX_CH DAC_Channel_1
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PINS_F7_PI_H
|
||||||
|
#define _PINS_F7_PI_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pin definitions for STM32F722 Pi Board:
|
||||||
|
|
||||||
|
PTT PB13 output
|
||||||
|
COSLED PB14 output
|
||||||
|
LED PB15 output
|
||||||
|
COS PC0 input
|
||||||
|
|
||||||
|
DSTAR PC7 output
|
||||||
|
DMR PC8 output
|
||||||
|
YSF PA8 output
|
||||||
|
P25 PC9 output
|
||||||
|
NXDN PB1 output
|
||||||
|
POCSAG PB12 output
|
||||||
|
|
||||||
|
RX PA0 analog input
|
||||||
|
RSSI PA7 analog input
|
||||||
|
TX PA4 analog output
|
||||||
|
|
||||||
|
EXT_CLK PA15 input
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PIN_COS GPIO_Pin_0
|
||||||
|
#define PORT_COS GPIOC
|
||||||
|
#define RCC_Per_COS RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_PTT GPIO_Pin_13
|
||||||
|
#define PORT_PTT GPIOB
|
||||||
|
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_COSLED GPIO_Pin_14
|
||||||
|
#define PORT_COSLED GPIOB
|
||||||
|
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_LED GPIO_Pin_15
|
||||||
|
#define PORT_LED GPIOB
|
||||||
|
#define RCC_Per_LED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_P25 GPIO_Pin_9
|
||||||
|
#define PORT_P25 GPIOC
|
||||||
|
#define RCC_Per_P25 RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_NXDN GPIO_Pin_1
|
||||||
|
#define PORT_NXDN GPIOB
|
||||||
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_POCSAG GPIO_Pin_12
|
||||||
|
#define PORT_POCSAG GPIOB
|
||||||
|
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DSTAR GPIO_Pin_7
|
||||||
|
#define PORT_DSTAR GPIOC
|
||||||
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_DMR GPIO_Pin_8
|
||||||
|
#define PORT_DMR GPIOC
|
||||||
|
#define RCC_Per_DMR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_YSF GPIO_Pin_8
|
||||||
|
#define PORT_YSF GPIOA
|
||||||
|
#define RCC_Per_YSF RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
|
#define SRC_EXT_CLK GPIO_PinSource15
|
||||||
|
#define PORT_EXT_CLK GPIOA
|
||||||
|
|
||||||
|
#define PIN_RX GPIO_Pin_0
|
||||||
|
#define PIN_RX_CH ADC_Channel_0
|
||||||
|
#define PORT_RX GPIOA
|
||||||
|
#define RCC_Per_RX RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_RSSI GPIO_Pin_7
|
||||||
|
#define PIN_RSSI_CH ADC_Channel_7
|
||||||
|
#define PORT_RSSI GPIOA
|
||||||
|
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_TX GPIO_Pin_4
|
||||||
|
#define PIN_TX_CH DAC_Channel_1
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by BG5HHP
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PINS_F7_RPT_HAT_H
|
||||||
|
#define _PINS_F7_RPT_HAT_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pin definitions for MMDVM_RPT_Hat Pi-Hat F0DEI DB9MAT DF2ET board:
|
||||||
|
|
||||||
|
PTT PB14 output
|
||||||
|
COSLED PB13 output
|
||||||
|
LED PB12 output
|
||||||
|
COS PC0 input
|
||||||
|
|
||||||
|
DSTAR PB15 output
|
||||||
|
DMR PC6 output
|
||||||
|
YSF PC7 output
|
||||||
|
P25 PC8 output
|
||||||
|
NXDN PC9 output
|
||||||
|
POCSAG PA8 output
|
||||||
|
FM PA11 output
|
||||||
|
|
||||||
|
MDSTAR PC1 output
|
||||||
|
MDMR PC2 output
|
||||||
|
MYSF PC3 output
|
||||||
|
MP25 PC4 output
|
||||||
|
MNXDN PC10 output
|
||||||
|
MPOCSAG PC11 output
|
||||||
|
MFM PC13 output
|
||||||
|
|
||||||
|
RX PA0 analog input
|
||||||
|
RSSI PA7 analog input
|
||||||
|
TX PA4 analog output
|
||||||
|
|
||||||
|
EXT_CLK PA15 input
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PIN_COS GPIO_Pin_0
|
||||||
|
#define PORT_COS GPIOC
|
||||||
|
#define RCC_Per_COS RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_PTT GPIO_Pin_14
|
||||||
|
#define PORT_PTT GPIOB
|
||||||
|
#define RCC_Per_PTT RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_COSLED GPIO_Pin_13
|
||||||
|
#define PORT_COSLED GPIOB
|
||||||
|
#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_LED GPIO_Pin_12
|
||||||
|
#define PORT_LED GPIOB
|
||||||
|
#define RCC_Per_LED RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_P25 GPIO_Pin_8
|
||||||
|
#define PORT_P25 GPIOC
|
||||||
|
#define RCC_Per_P25 RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_NXDN GPIO_Pin_9
|
||||||
|
#define PORT_NXDN GPIOC
|
||||||
|
#define RCC_Per_NXDN RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_POCSAG GPIO_Pin_8
|
||||||
|
#define PORT_POCSAG GPIOA
|
||||||
|
#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_FM GPIO_Pin_11
|
||||||
|
#define PORT_FM GPIOA
|
||||||
|
#define RCC_Per_FM RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_DSTAR GPIO_Pin_15
|
||||||
|
#define PORT_DSTAR GPIOB
|
||||||
|
#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB
|
||||||
|
|
||||||
|
#define PIN_DMR GPIO_Pin_6
|
||||||
|
#define PORT_DMR GPIOC
|
||||||
|
#define RCC_Per_DMR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_YSF GPIO_Pin_7
|
||||||
|
#define PORT_YSF GPIOC
|
||||||
|
#define RCC_Per_YSF RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#if defined(MODE_PINS)
|
||||||
|
#define PIN_MP25 GPIO_Pin_4
|
||||||
|
#define PORT_MP25 GPIOC
|
||||||
|
#define RCC_Per_MP25 RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MNXDN GPIO_Pin_10
|
||||||
|
#define PORT_MNXDN GPIOC
|
||||||
|
#define RCC_Per_MNXDN RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MDSTAR GPIO_Pin_1
|
||||||
|
#define PORT_MDSTAR GPIOC
|
||||||
|
#define RCC_Per_MDSTAR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MDMR GPIO_Pin_2
|
||||||
|
#define PORT_MDMR GPIOC
|
||||||
|
#define RCC_Per_MDMR RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MYSF GPIO_Pin_3
|
||||||
|
#define PORT_MYSF GPIOC
|
||||||
|
#define RCC_Per_MYSF RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MPOCSAG GPIO_Pin_11
|
||||||
|
#define PORT_MPOCSAG GPIOC
|
||||||
|
#define RCC_Per_MPOCSAG RCC_AHB1Periph_GPIOC
|
||||||
|
|
||||||
|
#define PIN_MFM GPIO_Pin_13
|
||||||
|
#define PORT_MFM GPIOC
|
||||||
|
#define RCC_Per_MFM RCC_AHB1Periph_GPIOC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PIN_EXT_CLK GPIO_Pin_15
|
||||||
|
#define SRC_EXT_CLK GPIO_PinSource15
|
||||||
|
#define PORT_EXT_CLK GPIOA
|
||||||
|
|
||||||
|
#define PIN_RX GPIO_Pin_0
|
||||||
|
#define PIN_RX_CH ADC_Channel_0
|
||||||
|
#define PORT_RX GPIOA
|
||||||
|
#define RCC_Per_RX RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_RSSI GPIO_Pin_7
|
||||||
|
#define PIN_RSSI_CH ADC_Channel_7
|
||||||
|
#define PORT_RSSI GPIOA
|
||||||
|
#define RCC_Per_RSSI RCC_AHB1Periph_GPIOA
|
||||||
|
|
||||||
|
#define PIN_TX GPIO_Pin_4
|
||||||
|
#define PIN_TX_CH DAC_Channel_1
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user