1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Big Endian.

This commit is contained in:
John Greb 2015-02-05 19:38:46 +00:00
parent 36f92a89e1
commit 988b912d3c
4 changed files with 39 additions and 6 deletions

View File

@ -23,3 +23,31 @@ short LoRaDemod::toGray(short num)
return (num >> 1) ^ num;
}
// ignore FEC, data in lsb
void LoRaDemod::hamming(char* inout, int size)
{
int i;
char c;
for (i = 0; i < size; i++) {
c = inout[i];
c = ((c&1)<<3) | ((c&2)<<1) | ((c&4)>>1) | ((c&8)>>3);
inout[i] = c;
}
inout[i] = 0;
}
// data whitening
void LoRaDemod::prng(char* inout, int size)
{
const char otp[] = {
" "
};
int i, maxchars;
maxchars = sizeof( otp );
if (size < maxchars)
maxchars = size;
for (i = 0; i < maxchars; i++)
inout[i] ^= otp[i] - 32;
}

View File

@ -75,8 +75,8 @@ void LoRaDemod::dumpRaw()
{
short bin, j, max;
max = m_time / 4 - 3;
if (max > 36)
max = 36;
if (max > 80)
max = 80; // 80 symbols is about 40 chars
char text[256];
for ( j=0; j < max; j++) {
bin = (history[j * 4 + 12] + m_tune ) & (LORA_SFFT_LEN - 1);
@ -84,10 +84,12 @@ void LoRaDemod::dumpRaw()
}
for ( j=0; j < max; j+=6)
interleave(&text[j]);
prng(text, max); // ??
hamming(text, max);
for ( j=0; j < max; j++)
text[j] += 32;
text[j] += 64; // 4 bits per symbol
text[j] = 0;
printf(">%s..(%d)\n", text, m_time / 4 - 2);
printf(">%s<\n", text);
}
short LoRaDemod::synch(short bin)

View File

@ -48,6 +48,9 @@ private:
void dumpRaw(void);
short synch (short bin);
short toGray(short bin);
void hamming(char* inout, int size);
void prng(char* inout, int size);
class MsgConfigureLoRaDemod : public Message {
MESSAGE_CLASS_DECLARATION

View File

@ -71,7 +71,7 @@
<number>0</number>
</property>
<property name="maximum">
<number>1</number>
<number>2</number>
</property>
<property name="pageStep">
<number>1</number>
@ -109,7 +109,7 @@
</size>
</property>
<property name="text">
<string>2^8</string>
<string>6:4 2^8</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>