19
19
#include <getopt.h>
20
20
21
21
#include "horus_l2.h"
22
+ #include "H_128_384_23.h"
23
+ #include "H_256_768_22.h"
22
24
23
25
// TODO: Move these packet format definitions to somehwere common.
24
26
@@ -134,17 +136,14 @@ int main(int argc,char *argv[]) {
134
136
int nbytes = sizeof (struct TBinaryPacket1 );
135
137
struct TBinaryPacket1 input_payload ;
136
138
137
- // TODO: Add Calculation of expected number of TX bytes based on LDPC code.
138
- int num_tx_data_bytes = nbytes ;
139
+ int num_tx_data_bytes = 4 + H_256_768_22_DATA_BYTES + H_256_768_22_PARITY_BYTES ;
139
140
unsigned char tx [num_tx_data_bytes ];
140
141
141
142
/* all zeros is nastiest sequence for demod before scrambling */
142
143
memset (& input_payload , 0 , nbytes );
143
144
input_payload .Checksum = horus_l2_gen_crc16 ((unsigned char * )& input_payload , nbytes - 2 );
144
145
145
-
146
- // TODO: Replaced with LDPC Encoding
147
- memcpy (tx , (unsigned char * )& input_payload , nbytes );
146
+ int ldpc_tx_bytes = ldpc_encode_packet (tx , (unsigned char * )& input_payload , 1 );
148
147
149
148
int b ;
150
149
uint8_t tx_bit ;
@@ -164,16 +163,15 @@ int main(int argc,char *argv[]) {
164
163
struct TBinaryPacket2 input_payload ;
165
164
166
165
// TODO: Add Calculation of expected number of TX bytes based on LDPC code.
167
- int num_tx_data_bytes = nbytes ;
166
+ int num_tx_data_bytes = 4 + H_128_384_23_DATA_BYTES + H_128_384_23_PARITY_BYTES ;
168
167
unsigned char tx [num_tx_data_bytes ];
169
168
170
169
/* all zeros is nastiest sequence for demod before scrambling */
171
170
memset (& input_payload , 0 , nbytes );
172
171
input_payload .Checksum = horus_l2_gen_crc16 ((unsigned char * )& input_payload , nbytes - 2 );
173
172
174
173
175
- // TODO: Replaced with LDPC Encoding
176
- memcpy (tx , (unsigned char * )& input_payload , nbytes );
174
+ int ldpc_tx_bytes = ldpc_encode_packet (tx , (unsigned char * )& input_payload , 2 );
177
175
178
176
int b ;
179
177
uint8_t tx_bit ;
0 commit comments