kopia lustrzana https://github.com/rpp0/gr-lora
Add support for all coding rates (4/8,4/7,4/6,4/5)
rodzic
41e4d98bf9
commit
780a56a3b8
|
@ -511,10 +511,6 @@
|
|||
<key>_enabled</key>
|
||||
<value>1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>finetune</key>
|
||||
<value>finetune</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>freq</key>
|
||||
<value>capture_freq</value>
|
||||
|
@ -543,6 +539,10 @@
|
|||
<key>in_samp_rate</key>
|
||||
<value>samp_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>sf</key>
|
||||
<value>7</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>wxgui_fftsink2</key>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
##################################################
|
||||
# GNU Radio Python Flow Graph
|
||||
# Title: Lora Receive File
|
||||
# Generated: Thu Aug 11 11:27:08 2016
|
||||
# Generated: Wed Sep 28 11:24:38 2016
|
||||
##################################################
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -53,6 +53,23 @@ class lora_receive_file(grc_wxgui.top_block_gui):
|
|||
##################################################
|
||||
# Blocks
|
||||
##################################################
|
||||
self.wxgui_fftsink2_1 = fftsink2.fft_sink_c(
|
||||
self.GetWin(),
|
||||
baseband_freq=capture_freq,
|
||||
y_per_div=10,
|
||||
y_divs=10,
|
||||
ref_level=0,
|
||||
ref_scale=2.0,
|
||||
sample_rate=samp_rate,
|
||||
fft_size=1024,
|
||||
fft_rate=15,
|
||||
average=False,
|
||||
avg_alpha=None,
|
||||
title='FFT Plot',
|
||||
peak_hold=False,
|
||||
)
|
||||
self.Add(self.wxgui_fftsink2_1.win)
|
||||
self.lora_lora_receiver_0 = lora.lora_receiver(samp_rate, capture_freq, offset, 7, True)
|
||||
_finetune_sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self._finetune_text_box = forms.text_box(
|
||||
parent=self.GetWin(),
|
||||
|
@ -76,25 +93,8 @@ class lora_receive_file(grc_wxgui.top_block_gui):
|
|||
proportion=1,
|
||||
)
|
||||
self.Add(_finetune_sizer)
|
||||
self.wxgui_fftsink2_1 = fftsink2.fft_sink_c(
|
||||
self.GetWin(),
|
||||
baseband_freq=capture_freq,
|
||||
y_per_div=10,
|
||||
y_divs=10,
|
||||
ref_level=0,
|
||||
ref_scale=2.0,
|
||||
sample_rate=samp_rate,
|
||||
fft_size=1024,
|
||||
fft_rate=15,
|
||||
average=False,
|
||||
avg_alpha=None,
|
||||
title="FFT Plot",
|
||||
peak_hold=False,
|
||||
)
|
||||
self.Add(self.wxgui_fftsink2_1.win)
|
||||
self.lora_lora_receiver_0 = lora.lora_receiver(samp_rate, capture_freq, offset, finetune, False)
|
||||
self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
|
||||
self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "counting_cr4_sf7.cfile", True)
|
||||
self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, 'counting_cr4_sf7.cfile', True)
|
||||
|
||||
##################################################
|
||||
# Connections
|
||||
|
@ -155,6 +155,7 @@ class lora_receive_file(grc_wxgui.top_block_gui):
|
|||
|
||||
def set_offset(self, offset):
|
||||
self.offset = offset
|
||||
self.lora_lora_receiver_0.set_offset(self.offset)
|
||||
|
||||
def get_firdes_tap(self):
|
||||
return self.firdes_tap
|
||||
|
@ -169,7 +170,6 @@ class lora_receive_file(grc_wxgui.top_block_gui):
|
|||
self.finetune = finetune
|
||||
self._finetune_slider.set_value(self.finetune)
|
||||
self._finetune_text_box.set_value(self.finetune)
|
||||
self.lora_lora_receiver_0.set_finetune(self.finetune)
|
||||
|
||||
def get_bitrate(self):
|
||||
return self.bitrate
|
||||
|
|
|
@ -401,10 +401,6 @@
|
|||
<key>_enabled</key>
|
||||
<value>1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>finetune</key>
|
||||
<value>finetune</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>freq</key>
|
||||
<value>capture_freq</value>
|
||||
|
@ -433,6 +429,10 @@
|
|||
<key>in_samp_rate</key>
|
||||
<value>samp_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>sf</key>
|
||||
<value>7</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>osmosdr_source</key>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
##################################################
|
||||
# GNU Radio Python Flow Graph
|
||||
# Title: Lora Receive Realtime
|
||||
# Generated: Thu Aug 11 11:27:37 2016
|
||||
# Generated: Wed Sep 28 10:00:46 2016
|
||||
##################################################
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -54,6 +54,34 @@ class lora_receive_realtime(grc_wxgui.top_block_gui):
|
|||
##################################################
|
||||
# Blocks
|
||||
##################################################
|
||||
self.wxgui_fftsink2_1 = fftsink2.fft_sink_c(
|
||||
self.GetWin(),
|
||||
baseband_freq=capture_freq,
|
||||
y_per_div=10,
|
||||
y_divs=10,
|
||||
ref_level=0,
|
||||
ref_scale=2.0,
|
||||
sample_rate=samp_rate,
|
||||
fft_size=1024,
|
||||
fft_rate=15,
|
||||
average=False,
|
||||
avg_alpha=None,
|
||||
title='FFT Plot',
|
||||
peak_hold=False,
|
||||
)
|
||||
self.Add(self.wxgui_fftsink2_1.win)
|
||||
self.uhd_usrp_source_0 = uhd.usrp_source(
|
||||
",".join(("", "")),
|
||||
uhd.stream_args(
|
||||
cpu_format="fc32",
|
||||
channels=range(1),
|
||||
),
|
||||
)
|
||||
self.uhd_usrp_source_0.set_samp_rate(samp_rate)
|
||||
self.uhd_usrp_source_0.set_center_freq(capture_freq, 0)
|
||||
self.uhd_usrp_source_0.set_gain(15, 0)
|
||||
self.uhd_usrp_source_0.set_antenna('RX2', 0)
|
||||
self.lora_lora_receiver_0 = lora.lora_receiver(samp_rate, capture_freq, offset, 7, True)
|
||||
_finetune_sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self._finetune_text_box = forms.text_box(
|
||||
parent=self.GetWin(),
|
||||
|
@ -77,34 +105,6 @@ class lora_receive_realtime(grc_wxgui.top_block_gui):
|
|||
proportion=1,
|
||||
)
|
||||
self.Add(_finetune_sizer)
|
||||
self.wxgui_fftsink2_1 = fftsink2.fft_sink_c(
|
||||
self.GetWin(),
|
||||
baseband_freq=capture_freq,
|
||||
y_per_div=10,
|
||||
y_divs=10,
|
||||
ref_level=0,
|
||||
ref_scale=2.0,
|
||||
sample_rate=samp_rate,
|
||||
fft_size=1024,
|
||||
fft_rate=15,
|
||||
average=False,
|
||||
avg_alpha=None,
|
||||
title="FFT Plot",
|
||||
peak_hold=False,
|
||||
)
|
||||
self.Add(self.wxgui_fftsink2_1.win)
|
||||
self.uhd_usrp_source_0 = uhd.usrp_source(
|
||||
",".join(("", "")),
|
||||
uhd.stream_args(
|
||||
cpu_format="fc32",
|
||||
channels=range(1),
|
||||
),
|
||||
)
|
||||
self.uhd_usrp_source_0.set_samp_rate(samp_rate)
|
||||
self.uhd_usrp_source_0.set_center_freq(capture_freq, 0)
|
||||
self.uhd_usrp_source_0.set_gain(15, 0)
|
||||
self.uhd_usrp_source_0.set_antenna("RX2", 0)
|
||||
self.lora_lora_receiver_0 = lora.lora_receiver(samp_rate, capture_freq, offset, finetune, True)
|
||||
|
||||
##################################################
|
||||
# Connections
|
||||
|
@ -165,6 +165,7 @@ class lora_receive_realtime(grc_wxgui.top_block_gui):
|
|||
|
||||
def set_offset(self, offset):
|
||||
self.offset = offset
|
||||
self.lora_lora_receiver_0.set_offset(self.offset)
|
||||
|
||||
def get_firdes_tap(self):
|
||||
return self.firdes_tap
|
||||
|
@ -179,7 +180,6 @@ class lora_receive_realtime(grc_wxgui.top_block_gui):
|
|||
self.finetune = finetune
|
||||
self._finetune_slider.set_value(self.finetune)
|
||||
self._finetune_text_box.set_value(self.finetune)
|
||||
self.lora_lora_receiver_0.set_finetune(self.finetune)
|
||||
|
||||
def get_bitrate(self):
|
||||
return self.bitrate
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<key>lora_lora_receiver</key>
|
||||
<category>lora</category>
|
||||
<import>import lora</import>
|
||||
<make>lora.lora_receiver($in_samp_rate, $freq, $offset, $sf, $realtime)</make>
|
||||
<make>lora.lora_receiver($in_samp_rate, $freq, $offset, $sf, True)</make>
|
||||
|
||||
<callback>set_sf($sf)</callback>
|
||||
<callback>set_offset($offset)</callback>
|
||||
|
@ -32,12 +32,6 @@
|
|||
<type>float</type>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Realtime</name>
|
||||
<key>realtime</key>
|
||||
<type>bool</type>
|
||||
</param>
|
||||
|
||||
<sink>
|
||||
<name>in</name>
|
||||
<type>complex</type>
|
||||
|
|
|
@ -433,7 +433,7 @@ namespace gr {
|
|||
}
|
||||
|
||||
std::reverse(words_deinterleaved.begin(),words_deinterleaved.end());
|
||||
print_vector(words_deinterleaved, "D", sizeof(uint8_t)*8);
|
||||
//print_vector(words_deinterleaved, "D", sizeof(uint8_t)*8);
|
||||
|
||||
// Add to demodulated data
|
||||
for(int i = 0; i < words_deinterleaved.size(); i++) {
|
||||
|
@ -452,13 +452,15 @@ namespace gr {
|
|||
prng = prng_header;
|
||||
} else {
|
||||
if(d_cr == 4)
|
||||
prng = prng_payload;
|
||||
prng = prng_payload_cr8;
|
||||
else if(d_cr == 3)
|
||||
prng = prng_payload_cr7;
|
||||
else if(d_cr == 2)
|
||||
prng = prng_payload_cr6;
|
||||
else if(d_cr == 1)
|
||||
prng = prng_payload_cr5;
|
||||
else
|
||||
prng = prng_payload;
|
||||
prng = prng_payload_cr8;
|
||||
}
|
||||
|
||||
deshuffle(shuffle_pattern);
|
||||
|
@ -498,7 +500,7 @@ namespace gr {
|
|||
}
|
||||
|
||||
//print_vector(d_words_deshuffled, "S", sizeof(uint8_t)*8);
|
||||
print_vector_raw(d_words_deshuffled, sizeof(uint8_t)*8);
|
||||
//print_vector_raw(d_words_deshuffled, sizeof(uint8_t)*8);
|
||||
|
||||
// We're done with these words
|
||||
d_demodulated.clear();
|
||||
|
@ -513,31 +515,26 @@ namespace gr {
|
|||
d_words_dewhitened.push_back(xor_b);
|
||||
}
|
||||
|
||||
print_vector(d_words_dewhitened, "W", sizeof(uint8_t)*8);
|
||||
//print_vector(d_words_dewhitened, "W", sizeof(uint8_t)*8);
|
||||
|
||||
d_words_deshuffled.clear();
|
||||
}
|
||||
|
||||
void decoder_impl::hamming_decode(uint8_t* out_data) {
|
||||
uint8_t data_indices[4] = {1, 2, 3, 5};
|
||||
unsigned int n = ceil(d_words_dewhitened.size() * 4.0f / (4.0f + d_cr));
|
||||
fec_scheme fs = LIQUID_FEC_HAMMING84;
|
||||
|
||||
if(d_cr == 4) {
|
||||
fs = LIQUID_FEC_HAMMING84;
|
||||
/*uint32_t j = 0;
|
||||
for(uint32_t i = 1; i < d_words_dewhitened.size(); i+=2) { // TODO: Fix me when uneven number of symbols
|
||||
out_data[j] = (hamming_decode_soft(d_words_dewhitened[i-1]) << 4) | hamming_decode_soft(d_words_dewhitened[i]);
|
||||
j++;
|
||||
}
|
||||
d_words_dewhitened.clear();
|
||||
return;*/
|
||||
} else if(d_cr == 3) {
|
||||
fs = LIQUID_FEC_HAMMING84;
|
||||
} else if(d_cr == 2) {
|
||||
fs = LIQUID_FEC_HAMMING128;
|
||||
} else if(d_cr == 1) { // TODO: Temporary, since Liquid doesn't support 4/5 Hamming so we need to implement it ourselves / extend Liquid.
|
||||
uint8_t indices[4] = {1, 2, 3, 5};
|
||||
fec_extract_data_only(&d_words_dewhitened[0], d_words_dewhitened.size(), indices, 4, out_data);
|
||||
fec_extract_data_only(&d_words_dewhitened[0], d_words_dewhitened.size(), data_indices, 4, out_data);
|
||||
d_words_dewhitened.clear();
|
||||
return;
|
||||
} else if(d_cr == 1) { // TODO: Report parity error to the user
|
||||
fec_extract_data_only(&d_words_dewhitened[0], d_words_dewhitened.size(), data_indices, 4, out_data);
|
||||
d_words_dewhitened.clear();
|
||||
return;
|
||||
}
|
||||
|
@ -635,19 +632,19 @@ namespace gr {
|
|||
|
||||
uint8_t decoder_impl::lookup_cr(uint8_t bytevalue) {
|
||||
switch (bytevalue & 0x0f) {
|
||||
case 0x0a: {
|
||||
case 0x01: {
|
||||
return 4;
|
||||
break;
|
||||
}
|
||||
case 0x07: {
|
||||
case 0x0f: {
|
||||
return 3;
|
||||
break;
|
||||
}
|
||||
case 0x05: {
|
||||
case 0x0d: {
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
case 0x03: {
|
||||
case 0x0b: {
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
@ -688,18 +685,18 @@ namespace gr {
|
|||
double c = detect_downchirp(&input[0], d_samples_per_symbol);
|
||||
d_debug << "Cd: " << c << std::endl;
|
||||
|
||||
if(c > 0.8f) {
|
||||
if(c > 0.96f) {
|
||||
d_debug << "SYNC: " << c << std::endl;
|
||||
// Debug stuff
|
||||
samples_to_file("/tmp/sync", &input[0], d_samples_per_symbol, sizeof(gr_complex));
|
||||
|
||||
d_state = PAUSE;
|
||||
d_cr = 4;
|
||||
consume_each(d_samples_per_symbol);
|
||||
} else {
|
||||
d_corr_fails++;
|
||||
if(d_corr_fails > 32) {
|
||||
d_state = DETECT;
|
||||
d_debug << "Lost sync" << std::endl;
|
||||
}
|
||||
consume_each(d_samples_per_symbol);
|
||||
}
|
||||
|
@ -713,18 +710,19 @@ namespace gr {
|
|||
break;
|
||||
}
|
||||
case DECODE_HEADER: {
|
||||
d_cr = 4;
|
||||
if(demodulate(input, true)) {
|
||||
uint8_t decoded[3];
|
||||
d_payload_length = 3; // TODO: A bit messy. I think it's better to make an internal decoded std::vector
|
||||
decode(decoded, true);
|
||||
|
||||
nibble_reverse(decoded, 1); // TODO: Why?
|
||||
nibble_reverse(decoded, 1); // TODO: Why? Is the radio chip CPU 16-bit?
|
||||
d_payload_length = decoded[0];
|
||||
d_cr = lookup_cr(decoded[1]);
|
||||
|
||||
int symbols_per_block = d_cr + 4;
|
||||
int bits_needed = ((d_payload_length * 8) + 16) * (symbols_per_block / 4);
|
||||
float symbols_needed = float(bits_needed) / float(d_sf);
|
||||
int bits_needed = ((d_payload_length * 8) + 16);
|
||||
float symbols_needed = float(bits_needed) * (symbols_per_block / 4.0f) / float(d_sf);
|
||||
int blocks_needed = ceil(symbols_needed / symbols_per_block);
|
||||
d_payload_symbols = blocks_needed * symbols_per_block;
|
||||
|
||||
|
@ -743,6 +741,7 @@ namespace gr {
|
|||
|
||||
if(d_payload_symbols <= 0) {
|
||||
uint8_t decoded[d_payload_length];
|
||||
memset(decoded, 0x00, d_payload_length);
|
||||
decode(decoded, false);
|
||||
|
||||
d_state = DETECT;
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
namespace gr {
|
||||
namespace lora {
|
||||
const uint8_t prng_header[] = {
|
||||
0x22, 0x11, 0x00, 0x00, 0x00
|
||||
0x22, 0x11, 0x01, 0x00, 0x00
|
||||
};
|
||||
|
||||
const uint8_t prng_payload[] = {
|
||||
const uint8_t prng_payload_cr8[] = {
|
||||
0xdf, 0xef, 0xb0, 0xf7, 0x9e, 0xfd, 0xc6, 0xdf, 0x10, 0xfb, 0x43, 0x34, 0xa8, 0x5f, 0xf2, 0x97, 0x62, 0x8, 0xf8, 0x49, 0xbe, 0x8a, 0xa4, 0xd6, 0x16, 0xe6, 0x85, 0x39, 0x6b, 0xef, 0xe5, 0xbc, 0xb3, 0x1c, 0x14, 0xa7, 0x3d, 0x4f, 0x91, 0x61, 0x85, 0x72, 0x20, 0x45, 0x4, 0x25, 0x80, 0x1b, 0x41, 0xa7, 0x5b, 0x4, 0xa2, 0x80, 0x9b, 0x41, 0xa7, 0x10, 0x4f, 0x43, 0x61, 0xa8, 0x39, 0xb9, 0xa4, 0x83, 0x16, 0xcb, 0x85, 0xa0, 0x6b, 0x68, 0xae, 0xbc, 0x19, 0x1c, 0x8d, 0xa7, 0xba, 0x4f, 0xda, 0x2a, 0x64, 0xd8, 0x58, 0xdc, 0xb0, 0xa2, 0x9e, 0xd0, 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0x88, 0x94, 0xd4, 0x8, 0xe4, 0x48, 0x70, 0xc0, 0xc, 0x7c, 0x8c, 0x7c, 0x0, 0xbc, 0x68, 0xa4, 0xe4, 0x5c, 0xf8, 0x64, 0xbc, 0x10, 0xec, 0x50, 0xbc, 0xe4, 0x54, 0x38, 0x44, 0xec, 0x34, 0xbc, 0xd4, 0x54, 0x24, 0xc, 0x68, 0xd4, 0xf4, 0xe4, 0xb4, 0x38, 0x74, 0xa4, 0x28, 0x5c, 0x50, 0x2c, 0x24, 0xb8, 0x68, 0x80, 0xbc, 0xc8, 0x54, 0xe8, 0xc, 0x88, 0x9c, 0x8c, 0x4, 0x0, 0x8, 0x68, 0xb8, 0xe4, 0x90, 0xb0, 0x84, 0x14, 0x20, 0x74, 0x4c, 0x38, 0x60, 0x1c, 0x70, 0xa4, 0x44, 0x4c, 0x6c, 0x60, 0x30, 0x38, 0x3c, 0xec, 0x80, 0xbc, 0xc8, 0x1c, 0xa0, 0xec, 0x68, 0xe4, 0xf4, 0xf8, 0xb4, 0xf4, 0x3c, 0xc, 0xc8, 0xc4, 0x60, 0xe0, 0x38, 0x10, 0xa4, 0x18, 0x14, 0x4, 0xcc, 0x8, 0xc0, 0xb8, 0x34, 0xd8, 0x9c, 0x64, 0xc4, 0x10, 0x58, 0x50, 0xa0, 0xac, 0xd0, 0xd8, 0x44, 0xdc, 0x34, 0xa0, 0xd4, 0x98, 0x6c, 0xa4, 0x88, 0x4c, 0xc4, 0x28, 0xa8, 0x90, 0xb8, 0x3c, 0x80, 0x90, 0xc8, 0xcc, 0xe8, 0x88, 0xc0, 0xd4, 0x24, 0xac, 0x98, 0x90
|
||||
};
|
||||
|
||||
const uint8_t prng_payload_cr5[] = {
|
||||
0x54, 0x64, 0x38, 0x7c, 0x14, 0x74, 0x4c, 0x54, 0x10, 0x70, 0x40, 0x3c, 0x28, 0x54, 0x70, 0x1c, 0x68, 0x8, 0x78, 0x48, 0x34, 0x8, 0x2c, 0x54, 0x1c, 0x6c, 0xc, 0x38, 0x68, 0x64, 0x64, 0x34, 0x30, 0x14, 0x1c, 0x2c, 0x34, 0x4c, 0x10, 0x60, 0xc, 0x70, 0x20, 0x4c, 0x4, 0x2c, 0x0, 0x18, 0x40, 0x2c, 0x58, 0x4, 0x20, 0x0, 0x18, 0x40, 0x2c, 0x10, 0x4c, 0x40, 0x60, 0x28, 0x38, 0x38, 0x2c, 0x8, 0x1c, 0x48, 0xc, 0x20, 0x68, 0x68, 0x2c, 0x34, 0x18, 0x14, 0x4, 0x2c, 0x38, 0x4c, 0x58, 0x28, 0x6c, 0x58, 0x58, 0x54, 0x38, 0x20, 0x14, 0x50, 0x4c, 0x4c, 0x10, 0x7c, 0x8, 0x3c, 0x0, 0x54, 0x68, 0x1c, 0x64, 0x8, 0x30, 0x0, 0x54, 0x20, 0x54, 0x4c, 0x20, 0x60, 0x18, 0x70, 0x64, 0x4, 0x2c, 0x4c, 0x18, 0x28, 0x4, 0x38, 0x70, 0x40, 0x38, 0x28, 0x5c, 0x58, 0x4c, 0x54, 0x7c, 0x68, 0x3c, 0x30, 0x54, 0x7c, 0x54, 0x68, 0x20, 0x78, 0x18, 0x7c, 0x2c, 0x14, 0x4, 0x4c, 0x0, 0x28, 0x8, 0x38, 0x38, 0x8, 0x58, 0x0, 0x24, 0x40, 0x70, 0x58, 0x68, 0x20, 0x30, 0x50, 0x1c, 0x4, 0x7c, 0x54, 0x38, 0x6c, 0x5c, 0x70, 0x4, 0x4c, 0x54, 0x64, 0x6c, 0x30, 0x70, 0x7c, 0x4, 0x20, 0x4c, 0x50, 0x28, 0x2c, 0x70, 0x20, 0x68, 0x1c, 0x30, 0x44, 0x54, 0x8, 0x1c, 0x54, 0x8, 0x6c, 0x48, 0x70, 0x40, 0x4, 0x7c, 0x4, 0x74, 0x0, 0x34, 0x68, 0x2c, 0x64, 0x54, 0x78, 0x6c, 0x34, 0x10, 0x64, 0x58, 0x34, 0x6c, 0x5c, 0x38, 0x4c, 0x64, 0x34, 0x34, 0x5c, 0x5c, 0x2c, 0x4, 0x68, 0x54, 0x7c, 0x6c, 0x3c, 0x38, 0x7c, 0x2c, 0x20, 0x54, 0x50, 0x24, 0x2c, 0x38, 0x68, 0x8, 0x34, 0x48, 0x5c, 0x68, 0x4, 0x8, 0x1c, 0x4, 0xc, 0x0, 0x8, 0x68, 0x38, 0x64, 0x10, 0x30, 0xc, 0x1c, 0x20, 0x7c, 0x4c, 0x38, 0x60, 0x14, 0x70, 0x2c, 0x4c, 0x4c, 0x64, 0x60, 0x30, 0x38, 0x34, 0x64, 0x8, 0x34, 0x48, 0x14, 0x20, 0x64, 0x68, 0x64, 0x7c, 0x78, 0x3c, 0x7c, 0x34, 0x4, 0x40, 0x4c, 0x60, 0x60, 0x38, 0x10, 0x2c, 0x10, 0x1c, 0xc, 0x44, 0x8, 0x40, 0x38, 0x34, 0x58, 0x14, 0x6c, 0x4c, 0x10, 0x58, 0x58, 0x20, 0x24, 0x50, 0x58, 0x4c, 0x54, 0x34, 0x20, 0x5c, 0x18, 0x64, 0x2c, 0x8, 0x4c, 0x4c, 0x28, 0x28, 0x10, 0x38, 0x34, 0x8, 0x10, 0x48, 0x44, 0x68, 0x8, 0x40, 0x54, 0x2c, 0x24, 0x18, 0x10, 0x64, 0x34, 0x2c, 0x10, 0x50, 0x44, 0x64, 0x40, 0x40, 0x7c, 0x2c, 0x3c, 0x18, 0x1c, 0x64, 0x7c, 0x64, 0x70, 0x78, 0x3c, 0x7c, 0x3c, 0x4c, 0x68, 0x44, 0x38, 0x78, 0x54, 0x5c, 0x74, 0x58, 0x78, 0x6c, 0x74, 0x70, 0x14, 0x4, 0x38, 0x7c, 0x50, 0x60, 0x2c, 0x58, 0x28, 0x40, 0x78, 0x3c, 0x7c, 0x1c, 0x14, 0x7c, 0x8, 0x70, 0x5c, 0x78, 0x64, 0x14, 0x8, 0x60, 0x68, 0x34, 0x60, 0x1c, 0x50, 0x14, 0x0, 0x10, 0x4c, 0x40, 0x20
|
||||
};
|
||||
|
|
|
@ -55,27 +55,33 @@ namespace gr {
|
|||
return (((count+1) % 2) == 0);
|
||||
}
|
||||
|
||||
// TODO: Crappy implementation! Fix
|
||||
void fec_extract_data_only(uint8_t* in_data, uint32_t len, uint8_t* indices, uint8_t n, uint8_t* out_data) {
|
||||
uint8_t index = 0;
|
||||
for(uint32_t i = 1; i < len; i+=2) {
|
||||
uint8_t d1 = 0;
|
||||
for(uint32_t j = 0; j < n; j++) {
|
||||
uint8_t power = pow(2, indices[j]);
|
||||
if((in_data[i-1] & power) > 0) {
|
||||
d1 += pow(2, j);
|
||||
}
|
||||
uint32_t select_bits(uint32_t data, uint8_t* indices, uint8_t n) {
|
||||
uint32_t result = 0;
|
||||
|
||||
for(uint32_t j = 0; j < n; j++) {
|
||||
uint32_t power = pow(2, indices[j]);
|
||||
if((data & power) > 0) {
|
||||
result += pow(2, j);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void fec_extract_data_only(uint8_t* in_data, uint32_t len, uint8_t* indices, uint8_t n, uint8_t* out_data) {
|
||||
uint8_t out_index = 0;
|
||||
|
||||
for(uint32_t i = 0; i < len; i+=2) {
|
||||
uint8_t d1 = 0;
|
||||
d1 = select_bits(in_data[i], indices, n) & 0xff;
|
||||
|
||||
|
||||
uint8_t d2 = 0;
|
||||
for(uint32_t j = 0; j < n; j++) {
|
||||
uint8_t power = pow(2, indices[j]);
|
||||
if((in_data[i] & power) > 0) {
|
||||
d2 += pow(2, j);
|
||||
}
|
||||
}
|
||||
out_data[index] = (d1 << 4) | d1;
|
||||
index++;
|
||||
if(i+1 < len)
|
||||
d2 = select_bits(in_data[i+1], indices, n) & 0xff;
|
||||
|
||||
out_data[out_index] = (d1 << 4) | d2;
|
||||
out_index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue