mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-04 05:30:32 -05:00 
			
		
		
		
	Interleaving.
This commit is contained in:
		
							parent
							
								
									bfdd03e903
								
							
						
					
					
						commit
						36f92a89e1
					
				@ -4,15 +4,16 @@
 | 
				
			|||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Needs adjusting for different sizes
 | 
					// Needs adjusting for different sizes
 | 
				
			||||||
void LoRaDemod::interleave(short* inout)
 | 
					void LoRaDemod::interleave(char* inout)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i, index = 6;
 | 
						int i, index = 6;
 | 
				
			||||||
	short in[index * 2];
 | 
						char in[index * 2];
 | 
				
			||||||
	for (i = 0; i < index; i++)
 | 
						for (i = 0; i < index; i++)
 | 
				
			||||||
		in[i] = inout[i];
 | 
							in[i] = inout[i];
 | 
				
			||||||
 | 
						// top bits are swapped ?
 | 
				
			||||||
	for (i = 0; i < index; i++) {
 | 
						for (i = 0; i < index; i++) {
 | 
				
			||||||
		inout[i] = (1 & in[0 + i]) | (2 & in[1 + i]) | (4 & in[2 + i])
 | 
							inout[i] = (32 & in[1 + i]) | (16 & in[0 + i]) | (8 & in[2 + i])
 | 
				
			||||||
			| (8 & in[3 + i]) | (16 & in[4 + i]) | (32 & in[5 + i]); 
 | 
									| (4 & in[3 + i]) | (2 & in[4 + i]) | (1 & in[5 + i]);
 | 
				
			||||||
		in[i + index] = in[i];
 | 
							in[i + index] = in[i];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -74,16 +74,20 @@ void LoRaDemod::configure(MessageQueue* messageQueue, Real Bandwidth)
 | 
				
			|||||||
void LoRaDemod::dumpRaw()
 | 
					void LoRaDemod::dumpRaw()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	short bin, j, max;
 | 
						short bin, j, max;
 | 
				
			||||||
	max = m_time / 4 - 1;
 | 
						max = m_time / 4 - 3;
 | 
				
			||||||
	if (max > 32)
 | 
						if (max > 36)
 | 
				
			||||||
		max = 32;
 | 
							max = 36;
 | 
				
			||||||
	char text[256];
 | 
						char text[256];
 | 
				
			||||||
	for ( j=0; j < max; j++) {
 | 
						for ( j=0; j < max; j++) {
 | 
				
			||||||
		bin = (history[j * 4 + 4] + m_tune) & (LORA_SFFT_LEN - 1);
 | 
							bin = (history[j * 4 + 12] + m_tune ) & (LORA_SFFT_LEN - 1);
 | 
				
			||||||
		text[j] = 32 + (toGray(bin) >> 1);
 | 
							text[j] = toGray(bin >> 1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						for ( j=0; j < max; j+=6)
 | 
				
			||||||
 | 
							interleave(&text[j]);
 | 
				
			||||||
 | 
						for ( j=0; j < max; j++)
 | 
				
			||||||
 | 
							text[j] += 32;
 | 
				
			||||||
	text[j] = 0;
 | 
						text[j] = 0;
 | 
				
			||||||
	printf(">%s..(%d)\n", text, m_time / 4);
 | 
						printf(">%s..(%d)\n", text, m_time / 4 - 2);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
short LoRaDemod::synch(short bin)
 | 
					short LoRaDemod::synch(short bin)
 | 
				
			||||||
 | 
				
			|||||||
@ -44,7 +44,7 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	int  detect(Complex sample, Complex angle);
 | 
						int  detect(Complex sample, Complex angle);
 | 
				
			||||||
	void interleave(short* inout);
 | 
						void interleave(char* inout);
 | 
				
			||||||
	void dumpRaw(void);
 | 
						void dumpRaw(void);
 | 
				
			||||||
	short synch (short bin);
 | 
						short synch (short bin);
 | 
				
			||||||
	short toGray(short bin);
 | 
						short toGray(short bin);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user