Add software
This commit is contained in:
		
							
								
								
									
										17
									
								
								Software/BTLE/matlab/get_number.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Software/BTLE/matlab/get_number.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
function a = get_number
 | 
			
		||||
a = [0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 1 0 1 1 1 1 1 0 1 ...
 | 
			
		||||
1 0 0 1 0 0 0 1 0 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 ...
 | 
			
		||||
1 1 1 0 1 1 1 1 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 1 ...
 | 
			
		||||
1 0 0 1 1 1 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 ...
 | 
			
		||||
1 0 0 0 1 1 0 1 1 1 0 1 0 1 1 0 0 0 0 1 1 1 0 0 ...
 | 
			
		||||
0 1 0 0 1 0 1 0 1 0 0 1 0 0 0 0 1 1 1 0 0 1 0 1 ...
 | 
			
		||||
0 0 1 0 0 0 1 0 0 0 0 1 0 0 1 1 1 1 0 1 1 0 1 1 ...
 | 
			
		||||
0 1 1 0 0 1 1 0 0 0 0 1 1 0 1 1 0 1 0 1 1 0 0 1 ...
 | 
			
		||||
1 0 0 1 0 1 1 1 1 1 0 1 0 1 0 1 1 1 0 0 0 1 1 0 ...
 | 
			
		||||
1 1 0 0 1 0 0 0 0 1 0 1 0 1 1 1 0 0 0 1 0 0 0 1 ...
 | 
			
		||||
0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 0 1 0 0 0 ...
 | 
			
		||||
1 0 1 1 1 1 1 1 1 1 0 1 1 0 0 0 1 0 1 1 0 0 1 1 ...
 | 
			
		||||
0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 1 0 1 1 0 1 1 ...
 | 
			
		||||
1 0 1 1 0 1 1 0 0 1 0 1 1 0 1 0 0 0 1 1 1 1 1 1 ...
 | 
			
		||||
1 0 0 1 0 0 0 1 1 1 0 1 0 1 0 0 1 0 1 1 1 0 1 1 ...
 | 
			
		||||
1 1 0 0 1 0 1 1 1 1 0 0 0 1 1 0 ];
 | 
			
		||||
							
								
								
									
										128
									
								
								Software/BTLE/matlab/get_number1.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								Software/BTLE/matlab/get_number1.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,128 @@
 | 
			
		||||
function a = get_number1
 | 
			
		||||
a = [127 0 127 0 127 0 127 0 127 0 127 -2 127 -10 122 -35 105 -72 73 -104 44 -119 44 -119 ...
 | 
			
		||||
73 -104 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 ...
 | 
			
		||||
73 -104 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 73 -104 106 -71 125 -25 125 25 ...
 | 
			
		||||
106 71 73 104 44 119 44 119 73 104 104 73 119 44 119 44 104 73 73 104 44 119 44 119 ...
 | 
			
		||||
73 104 104 73 119 44 119 44 104 73 71 106 25 125 -25 125 -71 106 -104 73 -119 44 -119 44 ...
 | 
			
		||||
-104 73 -73 104 -44 119 -44 119 -73 104 -106 71 -125 25 -125 -25 -106 -71 -71 -106 -25 -125 25 -125 ...
 | 
			
		||||
71 -106 106 -71 125 -25 125 25 106 71 71 106 25 125 -25 125 -71 106 -104 73 -119 44 -119 44 ...
 | 
			
		||||
-104 73 -73 104 -44 119 -44 119 -73 104 -106 71 -125 25 -125 -25 -106 -71 -73 -104 -44 -119 -44 -119 ...
 | 
			
		||||
-73 -104 -106 -71 -125 -25 -125 25 -106 71 -73 104 -44 119 -44 119 -73 104 -104 73 -119 44 -119 44 ...
 | 
			
		||||
-104 73 -71 106 -25 125 25 125 71 106 106 71 125 25 125 -25 106 -71 73 -104 44 -119 44 -119 ...
 | 
			
		||||
73 -104 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 73 -104 106 -71 125 -25 125 25 ...
 | 
			
		||||
106 71 71 106 25 125 -25 125 -71 106 -104 73 -119 44 -119 44 -104 73 -71 106 -25 125 25 125 ...
 | 
			
		||||
71 106 106 71 125 25 125 -25 106 -71 73 -104 44 -119 44 -119 73 -104 106 -71 125 -25 125 25 ...
 | 
			
		||||
106 71 71 106 25 125 -25 125 -71 106 -106 71 -125 25 -125 -25 -106 -71 -71 -106 -25 -125 25 -125 ...
 | 
			
		||||
71 -106 104 -73 119 -44 119 -44 104 -73 71 -106 25 -125 -25 -125 -71 -106 -104 -73 -119 -44 -119 -44 ...
 | 
			
		||||
-104 -73 -71 -106 -25 -125 25 -125 71 -106 106 -71 125 -25 125 25 106 71 71 106 25 125 -25 125 ...
 | 
			
		||||
-71 106 -106 71 -125 25 -125 -25 -106 -71 -73 -104 -44 -119 -44 -119 -73 -104 -104 -73 -119 -44 -119 -44 ...
 | 
			
		||||
-104 -73 -71 -106 -25 -125 25 -125 71 -106 106 -71 125 -25 125 25 106 71 71 106 25 125 -25 125 ...
 | 
			
		||||
-71 106 -106 71 -125 25 -125 -25 -106 -71 -73 -104 -44 -119 -44 -119 -73 -104 -106 -71 -125 -25 -125 25 ...
 | 
			
		||||
-106 71 -71 106 -25 125 25 125 71 106 104 73 119 44 119 44 104 73 73 104 44 119 44 119 ...
 | 
			
		||||
73 104 104 73 119 44 119 44 104 73 73 104 44 119 44 119 73 104 106 71 125 25 125 -25 ...
 | 
			
		||||
106 -71 71 -106 25 -125 -25 -125 -71 -106 -104 -73 -119 -44 -119 -44 -104 -73 -73 -104 -44 -119 -44 -119 ...
 | 
			
		||||
-73 -104 -106 -71 -125 -25 -125 25 -106 71 -73 104 -44 119 -44 119 -73 104 -104 73 -119 44 -119 44 ...
 | 
			
		||||
-104 73 -73 104 -44 119 -44 119 -73 104 -106 71 -125 25 -125 -25 -106 -71 -73 -104 -44 -119 -44 -119 ...
 | 
			
		||||
-73 -104 -106 -71 -125 -25 -125 25 -106 71 -73 104 -44 119 -44 119 -73 104 -106 71 -125 25 -125 -25 ...
 | 
			
		||||
-106 -71 -71 -106 -25 -125 25 -125 71 -106 104 -73 119 -44 119 -44 104 -73 71 -106 25 -125 -25 -125 ...
 | 
			
		||||
-71 -106 -106 -71 -125 -25 -125 25 -106 71 -71 106 -25 125 25 125 71 106 104 73 119 44 119 44 ...
 | 
			
		||||
104 73 73 104 44 119 44 119 73 104 106 71 125 25 125 -25 106 -71 73 -104 44 -119 44 -119 ...
 | 
			
		||||
73 -104 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 71 -106 25 -125 -25 -125 -71 -106 -104 -73 -119 -44 -119 -44 -104 -73 -73 -104 -44 -119 -44 -119 ...
 | 
			
		||||
-73 -104 -106 -71 -125 -25 -125 25 -106 71 -73 104 -44 119 -44 119 -73 104 -106 71 -125 25 -125 -25 ...
 | 
			
		||||
-106 -71 -73 -104 -44 -119 -44 -119 -73 -104 -104 -73 -119 -44 -119 -44 -104 -73 -73 -104 -44 -119 -44 -119 ...
 | 
			
		||||
-73 -104 -106 -71 -125 -25 -125 25 -106 71 -71 106 -25 125 25 125 71 106 104 73 119 44 119 44 ...
 | 
			
		||||
104 73 71 106 25 125 -25 125 -71 106 -104 73 -119 44 -119 44 -104 73 -73 104 -44 119 -44 119 ...
 | 
			
		||||
-73 104 -106 71 -125 25 -125 -25 -106 -71 -71 -106 -25 -125 25 -125 71 -106 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 ...
 | 
			
		||||
73 -104 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 73 104 106 71 125 25 125 -25 ...
 | 
			
		||||
106 -71 71 -106 25 -125 -25 -125 -71 -106 -106 -71 -125 -25 -125 25 -106 71 -73 104 -44 119 -44 119 ...
 | 
			
		||||
-73 104 -106 71 -125 25 -125 -25 -106 -71 -71 -106 -25 -125 25 -125 71 -106 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 71 -106 25 -125 -25 -125 -71 -106 -106 -71 -125 -25 -125 25 -106 71 -73 104 -44 119 -44 119 ...
 | 
			
		||||
-73 104 -104 73 -119 44 -119 44 -104 73 -71 106 -25 125 25 125 71 106 104 73 119 44 119 44 ...
 | 
			
		||||
104 73 73 104 44 119 44 119 73 104 104 73 119 44 119 44 104 73 73 104 44 119 44 119 ...
 | 
			
		||||
73 104 104 73 119 44 119 44 104 73 73 104 44 119 44 119 73 104 106 71 125 25 125 -25 ...
 | 
			
		||||
106 -71 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 104 -73 71 -106 25 -125 -25 -125 ...
 | 
			
		||||
-71 -106 -106 -71 -125 -25 -125 25 -106 71 -71 106 -25 125 25 125 71 106 104 73 119 44 119 44 ...
 | 
			
		||||
104 73 71 106 25 125 -25 125 -71 106 -106 71 -125 25 -125 -25 -106 -71 -73 -104 -44 -119 -44 -119 ...
 | 
			
		||||
-73 -104 -106 -71 -125 -25 -125 25 -106 71 -73 104 -44 119 -44 119 -73 104 -104 73 -119 44 -119 44 ...
 | 
			
		||||
-104 73 -73 104 -44 119 -44 119 -73 104 -104 73 -119 44 -119 44 -104 73 -71 106 -25 125 25 125 ...
 | 
			
		||||
71 106 104 73 119 44 119 44 104 73 73 104 44 119 44 119 73 104 106 71 125 25 125 -25 ...
 | 
			
		||||
106 -71 71 -106 25 -125 -25 -125 -71 -106 -104 -73 -119 -44 -119 -44 -104 -73 -73 -104 -44 -119 -44 -119 ...
 | 
			
		||||
-73 -104 -106 -71 -125 -25 -125 25 -106 71 -71 106 -25 125 25 125 71 106 106 71 125 25 125 -25 ...
 | 
			
		||||
106 -71 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 104 -73 71 -106 25 -125 -25 -125 ...
 | 
			
		||||
-71 -106 -104 -73 -119 -44 -119 -44 -104 -73 -71 -106 -25 -125 25 -125 71 -106 106 -71 125 -25 125 25 ...
 | 
			
		||||
106 71 71 106 25 125 -25 125 -71 106 -104 73 -119 44 -119 44 -104 73 -73 104 -44 119 -44 119 ...
 | 
			
		||||
-73 104 -106 71 -125 25 -125 -25 -106 -71 -73 -104 -44 -119 -44 -119 -73 -104 -104 -73 -119 -44 -119 -44 ...
 | 
			
		||||
-104 -73 -71 -106 -25 -125 25 -125 71 -106 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 ...
 | 
			
		||||
73 -104 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 73 104 106 71 125 25 125 -25 ...
 | 
			
		||||
106 -71 73 -104 44 -119 44 -119 73 -104 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 ...
 | 
			
		||||
73 104 106 71 125 25 125 -25 106 -71 71 -106 25 -125 -25 -125 -71 -106 -106 -71 -125 -25 -125 25 ...
 | 
			
		||||
-106 71 -73 104 -44 119 -44 119 -73 104 -106 71 -125 25 -125 -25 -106 -71 -73 -104 -44 -119 -44 -119 ...
 | 
			
		||||
-73 -104 -104 -73 -119 -44 -119 -44 -104 -73 -71 -106 -25 -125 25 -125 71 -106 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 ...
 | 
			
		||||
73 -104 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 73 104 106 71 125 25 125 -25 ...
 | 
			
		||||
106 -71 73 -104 44 -119 44 -119 73 -104 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 ...
 | 
			
		||||
73 104 106 71 125 25 125 -25 106 -71 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 73 -104 44 -119 44 -119 73 -104 106 -71 125 -25 125 25 106 71 71 106 25 125 -25 125 ...
 | 
			
		||||
-71 106 -106 71 -125 25 -125 -25 -106 -71 -71 -106 -25 -125 25 -125 71 -106 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 ...
 | 
			
		||||
73 -104 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 73 -104 106 -71 125 -25 125 25 ...
 | 
			
		||||
106 71 71 106 25 125 -25 125 -71 106 -104 73 -119 44 -119 44 -104 73 -71 106 -25 125 25 125 ...
 | 
			
		||||
71 106 106 71 125 25 125 -25 106 -71 73 -104 44 -119 44 -119 73 -104 106 -71 125 -25 125 25 ...
 | 
			
		||||
106 71 73 104 44 119 44 119 73 104 104 73 119 44 119 44 104 73 71 106 25 125 -25 125 ...
 | 
			
		||||
-71 106 -104 73 -119 44 -119 44 -104 73 -71 106 -25 125 25 125 71 106 104 73 119 44 119 44 ...
 | 
			
		||||
104 73 73 104 44 119 44 119 73 104 106 71 125 25 125 -25 106 -71 71 -106 25 -125 -25 -125 ...
 | 
			
		||||
-71 -106 -106 -71 -125 -25 -125 25 -106 71 -73 104 -44 119 -44 119 -73 104 -104 73 -119 44 -119 44 ...
 | 
			
		||||
-104 73 -73 104 -44 119 -44 119 -73 104 -104 73 -119 44 -119 44 -104 73 -73 104 -44 119 -44 119 ...
 | 
			
		||||
-73 104 -106 71 -125 25 -125 -25 -106 -71 -71 -106 -25 -125 25 -125 71 -106 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 71 -106 25 -125 -25 -125 -71 -106 -106 -71 -125 -25 -125 25 -106 71 -73 104 -44 119 -44 119 ...
 | 
			
		||||
-73 104 -104 73 -119 44 -119 44 -104 73 -71 106 -25 125 25 125 71 106 106 71 125 25 125 -25 ...
 | 
			
		||||
106 -71 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 ...
 | 
			
		||||
73 -104 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 73 104 104 73 119 44 119 44 ...
 | 
			
		||||
104 73 71 106 25 125 -25 125 -71 106 -104 73 -119 44 -119 44 -104 73 -73 104 -44 119 -44 119 ...
 | 
			
		||||
-73 104 -104 73 -119 44 -119 44 -104 73 -73 104 -44 119 -44 119 -73 104 -106 71 -125 25 -125 -25 ...
 | 
			
		||||
-106 -71 -71 -106 -25 -125 25 -125 71 -106 106 -71 125 -25 125 25 106 71 71 106 25 125 -25 125 ...
 | 
			
		||||
-71 106 -104 73 -119 44 -119 44 -104 73 -71 106 -25 125 25 125 71 106 106 71 125 25 125 -25 ...
 | 
			
		||||
106 -71 73 -104 44 -119 44 -119 73 -104 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 ...
 | 
			
		||||
73 104 104 73 119 44 119 44 104 73 73 104 44 119 44 119 73 104 106 71 125 25 125 -25 ...
 | 
			
		||||
106 -71 71 -106 25 -125 -25 -125 -71 -106 -104 -73 -119 -44 -119 -44 -104 -73 -73 -104 -44 -119 -44 -119 ...
 | 
			
		||||
-73 -104 -104 -73 -119 -44 -119 -44 -104 -73 -71 -106 -25 -125 25 -125 71 -106 106 -71 125 -25 125 25 ...
 | 
			
		||||
106 71 71 106 25 125 -25 125 -71 106 -106 71 -125 25 -125 -25 -106 -71 -71 -106 -25 -125 25 -125 ...
 | 
			
		||||
71 -106 106 -71 125 -25 125 25 106 71 71 106 25 125 -25 125 -71 106 -104 73 -119 44 -119 44 ...
 | 
			
		||||
-104 73 -73 104 -44 119 -44 119 -73 104 -106 71 -125 25 -125 -25 -106 -71 -73 -104 -44 -119 -44 -119 ...
 | 
			
		||||
-73 -104 -106 -71 -125 -25 -125 25 -106 71 -71 106 -25 125 25 125 71 106 104 73 119 44 119 44 ...
 | 
			
		||||
104 73 73 104 44 119 44 119 73 104 104 73 119 44 119 44 104 73 71 106 25 125 -25 125 ...
 | 
			
		||||
-71 106 -104 73 -119 44 -119 44 -104 73 -71 106 -25 125 25 125 71 106 104 73 119 44 119 44 ...
 | 
			
		||||
104 73 71 106 25 125 -25 125 -71 106 -104 73 -119 44 -119 44 -104 73 -71 106 -25 125 25 125 ...
 | 
			
		||||
71 106 106 71 125 25 125 -25 106 -71 71 -106 25 -125 -25 -125 -71 -106 -106 -71 -125 -25 -125 25 ...
 | 
			
		||||
-106 71 -71 106 -25 125 25 125 71 106 104 73 119 44 119 44 104 73 73 104 44 119 44 119 ...
 | 
			
		||||
73 104 106 71 125 25 125 -25 106 -71 71 -106 25 -125 -25 -125 -71 -106 -106 -71 -125 -25 -125 25 ...
 | 
			
		||||
-106 71 -71 106 -25 125 25 125 71 106 104 73 119 44 119 44 104 73 73 104 44 119 44 119 ...
 | 
			
		||||
73 104 106 71 125 25 125 -25 106 -71 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 ...
 | 
			
		||||
73 -104 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 73 104 104 73 119 44 119 44 ...
 | 
			
		||||
104 73 71 106 25 125 -25 125 -71 106 -106 71 -125 25 -125 -25 -106 -71 -73 -104 -44 -119 -44 -119 ...
 | 
			
		||||
-73 -104 -104 -73 -119 -44 -119 -44 -104 -73 -71 -106 -25 -125 25 -125 71 -106 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 73 -104 44 -119 44 -119 73 -104 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 ...
 | 
			
		||||
73 104 106 71 125 25 125 -25 106 -71 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 73 -104 44 -119 44 -119 73 -104 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 ...
 | 
			
		||||
73 104 104 73 119 44 119 44 104 73 73 104 44 119 44 119 73 104 106 71 125 25 125 -25 ...
 | 
			
		||||
106 -71 71 -106 25 -125 -25 -125 -71 -106 -104 -73 -119 -44 -119 -44 -104 -73 -71 -106 -25 -125 25 -125 ...
 | 
			
		||||
71 -106 106 -71 125 -25 125 25 106 71 71 106 25 125 -25 125 -71 106 -106 71 -125 25 -125 -25 ...
 | 
			
		||||
-106 -71 -71 -106 -25 -125 25 -125 71 -106 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 ...
 | 
			
		||||
73 104 106 71 125 25 125 -25 106 -71 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 71 -106 25 -125 -25 -125 -71 -106 -106 -71 -125 -25 -125 25 -106 71 -73 104 -44 119 -44 119 ...
 | 
			
		||||
-73 104 -106 71 -125 25 -125 -25 -106 -71 -71 -106 -25 -125 25 -125 71 -106 104 -73 119 -44 119 -44 ...
 | 
			
		||||
104 -73 73 -104 44 -119 44 -119 73 -104 104 -73 119 -44 119 -44 104 -73 73 -104 44 -119 44 -119 ...
 | 
			
		||||
73 -104 104 -73 119 -44 119 -44 104 -73 71 -106 25 -125 -25 -125 -71 -106 -104 -73 -119 -44 -119 -44 ...
 | 
			
		||||
-104 -73 -73 -104 -44 -119 -44 -119 -73 -104 -104 -73 -119 -44 -119 -44 -104 -73 -71 -106 -25 -125 25 -125 ...
 | 
			
		||||
71 -106 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 73 104 104 73 119 44 119 44 ...
 | 
			
		||||
104 73 71 106 25 125 -25 125 -71 106 -106 71 -125 25 -125 -25 -106 -71 -71 -106 -25 -125 25 -125 ...
 | 
			
		||||
71 -106 104 -73 119 -44 119 -44 104 -73 71 -106 25 -125 -25 -125 -71 -106 -104 -73 -119 -44 -119 -44 ...
 | 
			
		||||
-104 -73 -73 -104 -44 -119 -44 -119 -73 -104 -104 -73 -119 -44 -119 -44 -104 -73 -71 -106 -25 -125 25 -125 ...
 | 
			
		||||
71 -106 106 -71 125 -25 125 25 106 71 71 106 25 125 -25 125 -71 106 -104 73 -119 44 -119 44 ...
 | 
			
		||||
-104 73 -71 106 -25 125 25 125 71 106 106 71 125 25 125 -25 106 -71 73 -104 44 -119 44 -119 ...
 | 
			
		||||
73 -104 106 -71 125 -25 125 25 106 71 73 104 44 119 44 119 73 104 105 72 122 35 127 10 ...
 | 
			
		||||
127 2 127 0 127 0 127 0 127 0 127 0 127 0 127 0 ];
 | 
			
		||||
							
								
								
									
										31
									
								
								Software/BTLE/matlab/get_signal_from_hackrf_bin.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								Software/BTLE/matlab/get_signal_from_hackrf_bin.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
function [s, status] = get_signal_from_hackrf_bin(filename, num_sample_read)
 | 
			
		||||
s = int8(-1);
 | 
			
		||||
status = false;
 | 
			
		||||
 | 
			
		||||
fid = fopen(filename);
 | 
			
		||||
 | 
			
		||||
if fid == -1
 | 
			
		||||
    disp('get_signal_from_hackrf_bin: Can not open file!');
 | 
			
		||||
    status = true;
 | 
			
		||||
    return;
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
[s, count] = fread(fid, num_sample_read*2, 'int8');
 | 
			
		||||
fclose(fid);
 | 
			
		||||
 | 
			
		||||
% s = int8(s);
 | 
			
		||||
 | 
			
		||||
if num_sample_read~=inf && count ~= (num_sample_read*2)
 | 
			
		||||
    disp('get_signal_from_hackrf_bin: No enough samples in the file!');
 | 
			
		||||
    status = true;
 | 
			
		||||
    return;
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
% s = single( (s(1:2:end) + 1i.*s(2:2:end))./128 );
 | 
			
		||||
% s = (s(1:2:end) + 1i.*s(2:2:end))./128;
 | 
			
		||||
 | 
			
		||||
s = complex(s(1:2:end), s(2:2:end));
 | 
			
		||||
 | 
			
		||||
% len_s = length(s);
 | 
			
		||||
% 
 | 
			
		||||
% s = s((len_s/2)+1:end);
 | 
			
		||||
							
								
								
									
										32769
									
								
								Software/BTLE/matlab/sample_iq_4msps.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32769
									
								
								Software/BTLE/matlab/sample_iq_4msps.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										18
									
								
								Software/BTLE/matlab/save_int_var_for_c.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Software/BTLE/matlab/save_int_var_for_c.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
function save_int_var_for_c(a, type_and_name, filename, access_mode)
 | 
			
		||||
  fid = fopen(filename, access_mode);
 | 
			
		||||
  if fid == -1
 | 
			
		||||
    disp(['save_var_for_c: fopen' filename ' failed!']);
 | 
			
		||||
    return;
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  fprintf(fid, [type_and_name, '[%d] = {'], length(a) );
 | 
			
		||||
  for i = 1 : length(a)
 | 
			
		||||
    if mod(i-1, 24) == 0
 | 
			
		||||
      fprintf(fid, '\n');
 | 
			
		||||
    end
 | 
			
		||||
    fprintf(fid, '%d, ', a(i));
 | 
			
		||||
  end
 | 
			
		||||
  fprintf(fid, '};\n\n');
 | 
			
		||||
  
 | 
			
		||||
  fclose(fid);
 | 
			
		||||
  
 | 
			
		||||
							
								
								
									
										22
									
								
								Software/BTLE/matlab/save_int_var_for_c_2d.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								Software/BTLE/matlab/save_int_var_for_c_2d.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
function save_int_var_for_c_2d(a, type_and_name, filename, access_mode)
 | 
			
		||||
  fid = fopen(filename, access_mode);
 | 
			
		||||
  if fid == -1
 | 
			
		||||
    disp(['save_int_var_for_c_2d: fopen' filename ' failed!']);
 | 
			
		||||
    return;
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  [num_row, num_col] = size(a);
 | 
			
		||||
  
 | 
			
		||||
  fprintf(fid, [type_and_name, '[%d][%d] = {'], num_row, num_col );
 | 
			
		||||
  for j = 1 : num_row
 | 
			
		||||
      fprintf(fid, '\n{');
 | 
			
		||||
      for i = 1 : num_col
 | 
			
		||||
        fprintf(fid, '%d, ', a(j,i));
 | 
			
		||||
      end
 | 
			
		||||
      fprintf(fid, '},');
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  fprintf(fid, '\n};\n\n');
 | 
			
		||||
  
 | 
			
		||||
  fclose(fid);
 | 
			
		||||
  
 | 
			
		||||
							
								
								
									
										45
									
								
								Software/BTLE/matlab/scramble_gen.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								Software/BTLE/matlab/scramble_gen.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
function a = scramble_gen(channel_number, num_bit, filename, varargin)
 | 
			
		||||
 | 
			
		||||
  bit_store = zeros(1, 7);
 | 
			
		||||
  bit_store_update = zeros(1, 7);
 | 
			
		||||
  
 | 
			
		||||
  channel_number_bin = dec2bin(channel_number, 6);
 | 
			
		||||
  
 | 
			
		||||
  bit_store(1) = 1;
 | 
			
		||||
  bit_store(2) = ( channel_number_bin(1) == '1' );
 | 
			
		||||
  bit_store(3) = ( channel_number_bin(2) == '1' );
 | 
			
		||||
  bit_store(4) = ( channel_number_bin(3) == '1' );
 | 
			
		||||
  bit_store(5) = ( channel_number_bin(4) == '1' );
 | 
			
		||||
  bit_store(6) = ( channel_number_bin(5) == '1' );
 | 
			
		||||
  bit_store(7) = ( channel_number_bin(6) == '1' );
 | 
			
		||||
  
 | 
			
		||||
  bit_seq = zeros(1, num_bit);
 | 
			
		||||
  for i = 1 : num_bit
 | 
			
		||||
    bit_seq(i) =  bit_store(7);
 | 
			
		||||
 | 
			
		||||
    bit_store_update(1) = bit_store(7);
 | 
			
		||||
 | 
			
		||||
    bit_store_update(2) = bit_store(1);
 | 
			
		||||
    bit_store_update(3) = bit_store(2);
 | 
			
		||||
    bit_store_update(4) = bit_store(3);
 | 
			
		||||
 | 
			
		||||
    bit_store_update(5) = mod(bit_store(4)+bit_store(7), 2);
 | 
			
		||||
 | 
			
		||||
    bit_store_update(6) = bit_store(5);
 | 
			
		||||
    bit_store_update(7) = bit_store(6);
 | 
			
		||||
 | 
			
		||||
    bit_store = bit_store_update;
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  a = zeros(1, num_bit/8);
 | 
			
		||||
  
 | 
			
		||||
  for i = 0 : 8 : num_bit-1
 | 
			
		||||
    idx = floor(i/8) + 1;
 | 
			
		||||
    a(idx) = bit_seq(i+1) + bit_seq(i+2)*2 + bit_seq(i+3)*4 + bit_seq(i+4)*8 + bit_seq(i+5)*16 + bit_seq(i+6)*32 + bit_seq(i+7)*64 + bit_seq(i+8)*128;
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  if nargin == 3
 | 
			
		||||
    save_int_var_for_c(a, ['const uint8_t const scramble_table_ch' num2str(channel_number)], filename, 'w');
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  
 | 
			
		||||
							
								
								
									
										333
									
								
								Software/BTLE/matlab/test_btle_rx.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										333
									
								
								Software/BTLE/matlab/test_btle_rx.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,333 @@
 | 
			
		||||
function test_btle_rx(channel_number, varargin)
 | 
			
		||||
sample_per_symbol = 4;
 | 
			
		||||
 | 
			
		||||
if nargin<=0 || nargin >2
 | 
			
		||||
    disp('Wrong number of input parameters!');
 | 
			
		||||
    return;
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
if nargin == 2
 | 
			
		||||
% 'sample_iq_4msps.txt'
 | 
			
		||||
    filename = varargin{1};
 | 
			
		||||
    a = load(filename);
 | 
			
		||||
    a = a';
 | 
			
		||||
    a = a(:)';
 | 
			
		||||
%     a = a(2:end-1);
 | 
			
		||||
    a = a(1:2:end) + 1i.*a(2:2:end);
 | 
			
		||||
else
 | 
			
		||||
    symbol_rate = 1e6;
 | 
			
		||||
 | 
			
		||||
    sampling_rate = sample_per_symbol*symbol_rate;
 | 
			
		||||
    cap_time = 1; % in second
 | 
			
		||||
    
 | 
			
		||||
    num_samples = cap_time*sampling_rate;
 | 
			
		||||
    if channel_number == 39
 | 
			
		||||
        freq = 2480000000;
 | 
			
		||||
    elseif channel_number == 37
 | 
			
		||||
        freq = 2402000000;
 | 
			
		||||
    elseif channel_number == 38
 | 
			
		||||
        freq = 2426000000;
 | 
			
		||||
    elseif channel_number >=0 && channel_number <= 10
 | 
			
		||||
        freq = 2404000000 + channel_number*2000000;
 | 
			
		||||
    elseif channel_number >=11 && channel_number <= 36
 | 
			
		||||
        freq = 2428000000 + (channel_number-11)*2000000;
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
    ant_gain = 0; % 0 turn off, 1 turn on
 | 
			
		||||
    lna_gain = 40; %0-40dB, 8dB steps
 | 
			
		||||
    vga_gain = 6; %0-62dB, 2dB steps
 | 
			
		||||
 | 
			
		||||
    cmd_str = ['hackrf_transfer -f ' num2str(freq) ' -a ' num2str(ant_gain) ' -l ' num2str(lna_gain) ' -g ' num2str(vga_gain) ' -s ' num2str(sampling_rate) ' -n ' num2str(num_samples) ' -b 1000000 -r hackrf_tmp_cap.bin'];
 | 
			
		||||
    
 | 
			
		||||
    delete hackrf_tmp_cap.bin;
 | 
			
		||||
    [status, cmd_out] = system(cmd_str, '-echo');
 | 
			
		||||
%     disp(cmd_out);
 | 
			
		||||
    if status == 0
 | 
			
		||||
        a = get_signal_from_hackrf_bin('hackrf_tmp_cap.bin', inf);
 | 
			
		||||
    else
 | 
			
		||||
        disp('Abnormal status! Return directly!');
 | 
			
		||||
        return;
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
pdu_type_str = {'ADV_IND', 'ADV_DIRECT_IND', 'ADV_NONCONN_IND', 'SCAN_REQ', 'SCAN_RSP', 'CONNECT_REQ', 'ADV_SCAN_IND', 'Reserved', 'Reserved', 'Reserved', 'Reserved', 'Reserved', 'Reserved', 'Reserved', 'Reserved', 'Reserved'};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
% subplot(3,1,1); plot(abs(a));
 | 
			
		||||
% subplot(3,1,2); plot(angle(a));
 | 
			
		||||
% subplot(3,1,3); plot(angle(a(2:end)./a(1:end-1)), 'r.-');
 | 
			
		||||
 | 
			
		||||
max_num_scramble_bits = (39 + 3)*8; % 39 is maximum pdu length in octets; 3 is the number of CRC post-fix octets.
 | 
			
		||||
scramble_bits = scramble_gen(channel_number, max_num_scramble_bits);
 | 
			
		||||
 | 
			
		||||
match_bit = de2bi(hex2dec('8E89BED6AA'), 40, 'right-msb');
 | 
			
		||||
num_pdu_header_bits = 16;
 | 
			
		||||
sp = 1;
 | 
			
		||||
disp('Start demodulation ...');
 | 
			
		||||
%plot(abs(a)); drawnow;
 | 
			
		||||
pkt_count = 0;
 | 
			
		||||
while 1
 | 
			
		||||
%     disp(' ');
 | 
			
		||||
    sp_new = search_unique_bits(a(sp:end), match_bit, sample_per_symbol);
 | 
			
		||||
    if sp_new == -1
 | 
			
		||||
        break;
 | 
			
		||||
    end
 | 
			
		||||
    disp(num2str(a(sp_new:(sp_new+7))));
 | 
			
		||||
    disp(num2str(sp + sp_new -1));
 | 
			
		||||
    sp = sp + sp_new -1 + length(match_bit)*sample_per_symbol;
 | 
			
		||||
    pkt_count = pkt_count + 1;
 | 
			
		||||
%     disp(['relative sp ' num2str(sp_new) ' absolute sp ' num2str(sp)]);
 | 
			
		||||
    
 | 
			
		||||
    % pdu header
 | 
			
		||||
    pdu_header_bits = demod_bits(a(sp:end), num_pdu_header_bits, sample_per_symbol);
 | 
			
		||||
    disp(num2str(a(sp:(sp+7))));
 | 
			
		||||
    pdu_header_bits = xor(pdu_header_bits, scramble_bits(1:num_pdu_header_bits));
 | 
			
		||||
    [pdu_type, tx_add, rx_add, payload_len] = parse_adv_pdu_header_bits(pdu_header_bits);
 | 
			
		||||
    sp = sp + num_pdu_header_bits*sample_per_symbol;
 | 
			
		||||
    
 | 
			
		||||
    if payload_len<6 || payload_len>37
 | 
			
		||||
        disp(['Pkt' num2str(pkt_count) ' Ch' num2str(channel_number) ' AccessAddr8E89BED6 ADV_PDU_Type' num2str(pdu_type) '(' pdu_type_str{pdu_type+1} ') TxAdd' num2str(tx_add) ' RxAdd' num2str(rx_add) ' PayloadLen' num2str(payload_len)]);
 | 
			
		||||
        continue;
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
    % pdu payload + 3 crc octets
 | 
			
		||||
    num_pdu_payload_crc_bits = (payload_len+3)*8;
 | 
			
		||||
    pdu_payload_crc_bits = demod_bits(a(sp:end), num_pdu_payload_crc_bits, sample_per_symbol);
 | 
			
		||||
    pdu_payload_crc_bits = xor(pdu_payload_crc_bits, scramble_bits( (num_pdu_header_bits+1) : (num_pdu_header_bits+num_pdu_payload_crc_bits)));
 | 
			
		||||
 | 
			
		||||
    payload_parse_result_str = parse_adv_pdu_payload(pdu_payload_crc_bits(1:(end-3*8)), pdu_type);
 | 
			
		||||
    
 | 
			
		||||
    crc_24bits = ble_crc([pdu_header_bits pdu_payload_crc_bits(1:(end-3*8))], '555555');
 | 
			
		||||
%     disp(num2str(crc_24bits));
 | 
			
		||||
%     disp(num2str(pdu_payload_crc_bits((end-3*8+1):end)));
 | 
			
		||||
    if sum(crc_24bits==pdu_payload_crc_bits((end-3*8+1):end)) == 24
 | 
			
		||||
        crc_str = 'CRC:OK';
 | 
			
		||||
    else
 | 
			
		||||
        crc_str = 'CRC:Bad';
 | 
			
		||||
    end
 | 
			
		||||
    disp(['Pkt' num2str(pkt_count) ' Ch' num2str(channel_number) ' AccessAddr8E89BED6 ADV_PDU_Type' num2str(pdu_type) '(' pdu_type_str{pdu_type+1} ') TxAdd' num2str(tx_add) ' RxAdd' num2str(rx_add) ' PayloadLen' num2str(payload_len) ' ' payload_parse_result_str ' ' crc_str]);
 | 
			
		||||
    
 | 
			
		||||
    sp = sp + num_pdu_payload_crc_bits*sample_per_symbol;
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function bytes_str_out = reorder_bytes_str(bytes_str_in)
 | 
			
		||||
bytes_str_out = vec2mat(bytes_str_in, 2);
 | 
			
		||||
bytes_str_out = bytes_str_out(end:-1:1,:);
 | 
			
		||||
bytes_str_out = bytes_str_out.';
 | 
			
		||||
bytes_str_out = bytes_str_out(:).';
 | 
			
		||||
 | 
			
		||||
function payload_parse_result_str = parse_adv_pdu_payload(payload_bits, pdu_type)
 | 
			
		||||
if length(payload_bits)<6*8
 | 
			
		||||
    payload_parse_result_str = ['Payload Too Short (only ' num2str(length(payload_bits)) ' bits)'];
 | 
			
		||||
    return;
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
tmp_bits = vec2mat(payload_bits, 8);
 | 
			
		||||
payload_bytes = dec2hex(bi2de(tmp_bits, 'right-msb'), 2);
 | 
			
		||||
payload_bytes = payload_bytes.';
 | 
			
		||||
payload_bytes = payload_bytes(:).';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if pdu_type == 0 || pdu_type == 2 || pdu_type == 6
 | 
			
		||||
    AdvA = reorder_bytes_str( payload_bytes(1 : (2*6)) );
 | 
			
		||||
    AdvData = payload_bytes((2*6+1):end);
 | 
			
		||||
    payload_parse_result_str = ['AdvA:' AdvA ' AdvData:' AdvData];
 | 
			
		||||
elseif pdu_type == 1
 | 
			
		||||
    AdvA = reorder_bytes_str( payload_bytes(1 : (2*6)) );
 | 
			
		||||
    InitA = reorder_bytes_str( payload_bytes((2*6+1):end) );
 | 
			
		||||
    payload_parse_result_str = ['AdvA:' AdvA ' InitA:' InitA];
 | 
			
		||||
elseif pdu_type == 3 % SCAN_REQ
 | 
			
		||||
    ScanA = reorder_bytes_str( payload_bytes(1 : (2*6)) );
 | 
			
		||||
    AdvA = reorder_bytes_str( payload_bytes((2*6+1):end) );
 | 
			
		||||
    payload_parse_result_str = ['ScanA:' ScanA ' AdvA:' AdvA];
 | 
			
		||||
elseif pdu_type == 4 % SCAN_RSP
 | 
			
		||||
    AdvA = reorder_bytes_str( payload_bytes(1 : (2*6)) );
 | 
			
		||||
    ScanRspData = payload_bytes((2*6+1):end);
 | 
			
		||||
    payload_parse_result_str = ['AdvA:' AdvA ' ScanRspData:' ScanRspData];
 | 
			
		||||
elseif pdu_type == 5 % CONNECT_REQ
 | 
			
		||||
    if length(payload_bits) ~= 34*8
 | 
			
		||||
        payload_parse_result_str = ['Payload Too Short (only ' num2str(length(payload_bits)) ' bits)'];
 | 
			
		||||
        return;
 | 
			
		||||
    end
 | 
			
		||||
    InitA = reorder_bytes_str( payload_bytes(1 : (2*6)) );
 | 
			
		||||
    AdvA = reorder_bytes_str( payload_bytes((2*6+1):(2*6+2*6)) );
 | 
			
		||||
    AA = reorder_bytes_str( payload_bytes((2*6+2*6+1):(2*6+2*6+2*4)) );
 | 
			
		||||
    CRCInit = payload_bytes((2*6+2*6+2*4+1):(2*6+2*6+2*4+2*3));
 | 
			
		||||
    WinSize = payload_bytes((2*6+2*6+2*4+2*3+1):(2*6+2*6+2*4+2*3+2*1));
 | 
			
		||||
    WinOffset = reorder_bytes_str( payload_bytes((2*6+2*6+2*4+2*3+2*1+1):(2*6+2*6+2*4+2*3+2*1+2*2)) );
 | 
			
		||||
    Interval = reorder_bytes_str( payload_bytes((2*6+2*6+2*4+2*3+2*1+2*2+1):(2*6+2*6+2*4+2*3+2*1+2*2+2*2)) );
 | 
			
		||||
    Latency = reorder_bytes_str( payload_bytes((2*6+2*6+2*4+2*3+2*1+2*2+2*2+1):(2*6+2*6+2*4+2*3+2*1+2*2+2*2+2*2)) );
 | 
			
		||||
    Timeout = reorder_bytes_str( payload_bytes((2*6+2*6+2*4+2*3+2*1+2*2+2*2+2*2+1):(2*6+2*6+2*4+2*3+2*1+2*2+2*2+2*2+2*2)) );
 | 
			
		||||
    ChM = reorder_bytes_str( payload_bytes((2*6+2*6+2*4+2*3+2*1+2*2+2*2+2*2+2*2+1):(2*6+2*6+2*4+2*3+2*1+2*2+2*2+2*2+2*2+2*5)) );
 | 
			
		||||
    tmp_bits = payload_bits((end-7) : end);
 | 
			
		||||
    Hop = num2str( bi2de(tmp_bits(1:5), 'right-msb') );
 | 
			
		||||
    SCA = num2str( bi2de(tmp_bits(6:end), 'right-msb') );
 | 
			
		||||
    payload_parse_result_str = ['InitA:' InitA ' AdvA:' AdvA ...
 | 
			
		||||
                                ' AA:' AA ...
 | 
			
		||||
                                ' CRCInit:' CRCInit ... 
 | 
			
		||||
                                ' WinSize:' WinSize ...
 | 
			
		||||
                                ' WinOffset:' WinOffset ...
 | 
			
		||||
                                ' Interval:' Interval ...
 | 
			
		||||
                                ' Latency:' Latency ...
 | 
			
		||||
                                ' Timeout:' Timeout ...
 | 
			
		||||
                                ' ChM:' ChM ...
 | 
			
		||||
                                ' Hop:' Hop ...
 | 
			
		||||
                                ' SCA:' SCA];
 | 
			
		||||
else
 | 
			
		||||
    payload_parse_result_str = 'Reserved PDU type';
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function reg_bits = ble_crc(pdu, init_reg_bits)
 | 
			
		||||
 | 
			
		||||
reg_bits = de2bi(hex2dec(init_reg_bits), 24, 'right-msb');
 | 
			
		||||
for i = 1 : length(pdu)
 | 
			
		||||
    reg_bits = LFSR_crc(reg_bits, pdu(i));
 | 
			
		||||
end
 | 
			
		||||
reg_bits = reg_bits(end:-1:1);
 | 
			
		||||
 | 
			
		||||
function [seq] = LFSR_crc(old_seq, pdu_bit)
 | 
			
		||||
proc_bit = xor(old_seq(24), pdu_bit);
 | 
			
		||||
 | 
			
		||||
seq(1) = proc_bit;
 | 
			
		||||
seq(2) = xor(old_seq(1), proc_bit);
 | 
			
		||||
seq(3) = old_seq(2);
 | 
			
		||||
seq(4) = xor(old_seq(3), proc_bit);
 | 
			
		||||
seq(5) = xor(old_seq(4), proc_bit);
 | 
			
		||||
seq(6) = old_seq(5);
 | 
			
		||||
seq(7) = xor(old_seq(6), proc_bit);
 | 
			
		||||
seq(8:9) = old_seq(7:8);
 | 
			
		||||
seq(10) = xor(old_seq(9), proc_bit);
 | 
			
		||||
seq(11) = xor(old_seq(10), proc_bit);
 | 
			
		||||
seq(12:24) = old_seq(11:23);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function scramble_bits = scramble_gen(channel_number, num_bit)
 | 
			
		||||
 | 
			
		||||
bit_store = zeros(1, 7);
 | 
			
		||||
bit_store_update = zeros(1, 7);
 | 
			
		||||
 | 
			
		||||
% channel_number_bin = dec2bin(channel_number, 6);
 | 
			
		||||
% 
 | 
			
		||||
% bit_store(1) = 1;
 | 
			
		||||
% bit_store(2) = ( channel_number_bin(1) == '1' );
 | 
			
		||||
% bit_store(3) = ( channel_number_bin(2) == '1' );
 | 
			
		||||
% bit_store(4) = ( channel_number_bin(3) == '1' );
 | 
			
		||||
% bit_store(5) = ( channel_number_bin(4) == '1' );
 | 
			
		||||
% bit_store(6) = ( channel_number_bin(5) == '1' );
 | 
			
		||||
% bit_store(7) = ( channel_number_bin(6) == '1' );
 | 
			
		||||
 | 
			
		||||
channel_number_bin = de2bi(channel_number, 6, 'left-msb');
 | 
			
		||||
 | 
			
		||||
bit_store(1) = 1;
 | 
			
		||||
bit_store(2:7) = channel_number_bin;
 | 
			
		||||
 | 
			
		||||
bit_seq = zeros(1, num_bit);
 | 
			
		||||
for i = 1 : num_bit
 | 
			
		||||
    bit_seq(i) =  bit_store(7);
 | 
			
		||||
 | 
			
		||||
    bit_store_update(1) = bit_store(7);
 | 
			
		||||
 | 
			
		||||
    bit_store_update(2) = bit_store(1);
 | 
			
		||||
    bit_store_update(3) = bit_store(2);
 | 
			
		||||
    bit_store_update(4) = bit_store(3);
 | 
			
		||||
 | 
			
		||||
    bit_store_update(5) = mod(bit_store(4)+bit_store(7), 2);
 | 
			
		||||
 | 
			
		||||
    bit_store_update(6) = bit_store(5);
 | 
			
		||||
    bit_store_update(7) = bit_store(6);
 | 
			
		||||
 | 
			
		||||
    bit_store = bit_store_update;
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
scramble_bits = bit_seq;
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
function [pdu_type, tx_add, rx_add, payload_len] = parse_adv_pdu_header_bits(bits)
 | 
			
		||||
% pdu_type_str = {'ADV_IND', 'ADV_DIRECT_IND', 'ADV_NONCONN_IND', 'SCAN_REQ', 'SCAN_RSP', 'CONNECT_REQ', 'ADV_SCAN_IND', 'Reserved', 'Reserved', 'Reserved', 'Reserved', 'Reserved', 'Reserved', 'Reserved', 'Reserved'};
 | 
			
		||||
pdu_type = bi2de(bits(1:4), 'right-msb');
 | 
			
		||||
% disp(['   PDU Type: ' pdu_type_str{pdu_type+1}]);
 | 
			
		||||
 | 
			
		||||
tx_add = bits(7);
 | 
			
		||||
% disp(['     Tx Add: ' num2str(tx_add)]);
 | 
			
		||||
 | 
			
		||||
rx_add = bits(8);
 | 
			
		||||
% disp(['     Rx Add: ' num2str(rx_add)]);
 | 
			
		||||
 | 
			
		||||
payload_len = bi2de(bits(9:14), 'right-msb');
 | 
			
		||||
% disp(['Payload Len: ' num2str(payload_len)]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function bits = demod_bits(a, num_bits, sample_per_symbol)
 | 
			
		||||
 | 
			
		||||
bits = zeros(1, num_bits);
 | 
			
		||||
k = 1;
 | 
			
		||||
for i = 1 : sample_per_symbol : (1 + (num_bits-1)*sample_per_symbol)
 | 
			
		||||
    I0 = real(a(i));
 | 
			
		||||
    Q0 = imag(a(i));
 | 
			
		||||
    I1 = real(a(i+1));
 | 
			
		||||
    Q1 = imag(a(i+1));
 | 
			
		||||
 | 
			
		||||
    if (I0*Q1 - I1*Q0) > 0
 | 
			
		||||
        bits(k) = 1;
 | 
			
		||||
    else
 | 
			
		||||
        bits(k) = 0;
 | 
			
		||||
    end
 | 
			
		||||
    k = k + 1;
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function sp = search_unique_bits(a, match_bit, sample_per_symbol)
 | 
			
		||||
 | 
			
		||||
demod_buf_len = length(match_bit); % in bits
 | 
			
		||||
demod_buf_offset = 0;
 | 
			
		||||
 | 
			
		||||
demod_buf = zeros(sample_per_symbol, demod_buf_len);
 | 
			
		||||
i = 1;
 | 
			
		||||
while 1
 | 
			
		||||
    
 | 
			
		||||
    sp = mod(demod_buf_offset-demod_buf_len+1, demod_buf_len);
 | 
			
		||||
    
 | 
			
		||||
    for j = 1 : sample_per_symbol
 | 
			
		||||
        I0 = real(a(i+j-1));
 | 
			
		||||
        Q0 = imag(a(i+j-1));
 | 
			
		||||
        I1 = real(a(i+j-1+1));
 | 
			
		||||
        Q1 = imag(a(i+j-1+1));
 | 
			
		||||
 | 
			
		||||
        if (I0*Q1 - I1*Q0) > 0
 | 
			
		||||
            demod_buf(j, demod_buf_offset+1) = 1;
 | 
			
		||||
        else
 | 
			
		||||
            demod_buf(j, demod_buf_offset+1) = 0;
 | 
			
		||||
        end
 | 
			
		||||
        
 | 
			
		||||
        k = sp;
 | 
			
		||||
        unequal_flag = 0;
 | 
			
		||||
        for p = 1 : demod_buf_len
 | 
			
		||||
            if demod_buf(j, k+1) ~= match_bit(p);
 | 
			
		||||
                unequal_flag = 1;
 | 
			
		||||
                break;
 | 
			
		||||
            end
 | 
			
		||||
            k = mod(k + 1, demod_buf_len);
 | 
			
		||||
        end
 | 
			
		||||
        
 | 
			
		||||
        if unequal_flag==0
 | 
			
		||||
            break;
 | 
			
		||||
        end
 | 
			
		||||
        
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
    if unequal_flag==0
 | 
			
		||||
        sp = i+j-1-(demod_buf_len-1)*sample_per_symbol;
 | 
			
		||||
%         disp(num2str(sp));
 | 
			
		||||
        return;
 | 
			
		||||
    end 
 | 
			
		||||
    
 | 
			
		||||
    i = i + sample_per_symbol;
 | 
			
		||||
    if (i+sample_per_symbol) > length(a)
 | 
			
		||||
        break;
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
    demod_buf_offset = mod(demod_buf_offset+1, demod_buf_len);
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
sp = -1;
 | 
			
		||||
phase = -1;
 | 
			
		||||
							
								
								
									
										120
									
								
								Software/BTLE/matlab/test_fixed_point.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								Software/BTLE/matlab/test_fixed_point.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,120 @@
 | 
			
		||||
clear all;
 | 
			
		||||
close all;
 | 
			
		||||
 | 
			
		||||
% original float point version
 | 
			
		||||
gauss_coef = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.231548e-14, 2.007605e-11, 7.561773e-09, 1.197935e-06, 8.050684e-05, 2.326833e-03, 2.959908e-02, 1.727474e-01, 4.999195e-01, 8.249246e-01, 9.408018e-01, 8.249246e-01, 4.999195e-01, 1.727474e-01, 2.959908e-02, 2.326833e-03, 8.050684e-05, 1.197935e-06, 7.561773e-09, 2.007605e-11, 2.231548e-14, 0];
 | 
			
		||||
%plot(gauss_coef, 'r+-'); axis([0 length(gauss_coef) 0 0.0001]);
 | 
			
		||||
 | 
			
		||||
% short it to 16 points:
 | 
			
		||||
gauss_coef = [7.561773e-09, 1.197935e-06, 8.050684e-05, 2.326833e-03, 2.959908e-02, 1.727474e-01, 4.999195e-01, 8.249246e-01, 9.408018e-01, 8.249246e-01, 4.999195e-01, 1.727474e-01, 2.959908e-02, 2.326833e-03, 8.050684e-05, 1.197935e-06];
 | 
			
		||||
%plot(gauss_coef, 'r+-');
 | 
			
		||||
 | 
			
		||||
SAMPLE_PER_SYMBOL = 4;
 | 
			
		||||
LEN_GAUSS_FILTER = length(gauss_coef)/SAMPLE_PER_SYMBOL;
 | 
			
		||||
MAX_NUM_PHY_BYTE  = 47;
 | 
			
		||||
MAX_NUM_PHY_SAMPLE = ((MAX_NUM_PHY_BYTE*8*SAMPLE_PER_SYMBOL)+(LEN_GAUSS_FILTER*SAMPLE_PER_SYMBOL));
 | 
			
		||||
MOD_IDX = 0.5;
 | 
			
		||||
AMPLITUDE = 127;
 | 
			
		||||
tmp_phy_bit_over_sampling = zeros(1, MAX_NUM_PHY_SAMPLE + 2*LEN_GAUSS_FILTER*SAMPLE_PER_SYMBOL);
 | 
			
		||||
tmp_phy_bit_over_sampling = zeros(1, MAX_NUM_PHY_SAMPLE);
 | 
			
		||||
 | 
			
		||||
num_bit = MAX_NUM_PHY_BYTE*8;
 | 
			
		||||
%bit = round(rand(1, num_bit));
 | 
			
		||||
bit = get_number;
 | 
			
		||||
num_bit_oversample = num_bit*SAMPLE_PER_SYMBOL;
 | 
			
		||||
len_gauss_oversample = LEN_GAUSS_FILTER*SAMPLE_PER_SYMBOL;
 | 
			
		||||
num_sample = num_bit_oversample + len_gauss_oversample;
 | 
			
		||||
 | 
			
		||||
  pre_len = len_gauss_oversample-1;
 | 
			
		||||
  tmp_phy_bit_over_sampling(1:pre_len) = 0.0;
 | 
			
		||||
  
 | 
			
		||||
  post_sp = num_bit_oversample + pre_len + 1;
 | 
			
		||||
  post_ep = post_sp + pre_len - 1;
 | 
			
		||||
  tmp_phy_bit_over_sampling(post_sp:post_ep) = 0.0;
 | 
			
		||||
 | 
			
		||||
  tmp_phy_bit_over_sampling((pre_len+1):(pre_len+num_bit_oversample)) = 0;
 | 
			
		||||
  tmp_phy_bit_over_sampling((pre_len+1):SAMPLE_PER_SYMBOL:(pre_len+num_bit_oversample)) = bit.*2 - 1;
 | 
			
		||||
 | 
			
		||||
  % len_conv_result = length(tmp_phy_bit_over_sampling) - len_gauss_oversample + 1
 | 
			
		||||
  % = post_ep - len_gauss_oversample + 1
 | 
			
		||||
  % = num_bit_oversample + pre_len + 1 + pre_len - 1  - len_gauss_oversample + 1
 | 
			
		||||
  % = num_bit_oversample + 2*(len_gauss_oversample-1)  - len_gauss_oversample + 1
 | 
			
		||||
  % = num_bit_oversample + len_gauss_oversample - 1
 | 
			
		||||
  len_conv_result = num_sample - 1;
 | 
			
		||||
 | 
			
		||||
% -------------------------------------- float point reference -----------------------------------------------
 | 
			
		||||
  for i = 1 : len_conv_result
 | 
			
		||||
    acc = 0;
 | 
			
		||||
    for j = 1 : len_gauss_oversample
 | 
			
		||||
      acc = acc + gauss_coef(len_gauss_oversample-j+1)*tmp_phy_bit_over_sampling(i+j-1); %num_sample - 1+len_gauss_oversample-1= length(tmp_phy_bit_over_sampling)
 | 
			
		||||
    end
 | 
			
		||||
    tmp_phy_bit_over_sampling1(i) = acc;
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  tmp = 0;
 | 
			
		||||
  sample = zeros(1, 2*num_sample);
 | 
			
		||||
  sample(1) = round( cos(tmp)*AMPLITUDE );
 | 
			
		||||
  sample(2) = round( sin(tmp)*AMPLITUDE );
 | 
			
		||||
  for i=2:num_sample
 | 
			
		||||
    tmp = tmp + (pi*MOD_IDX)*tmp_phy_bit_over_sampling1(i-1)/(SAMPLE_PER_SYMBOL);
 | 
			
		||||
    sample((i-1)*2 + 1) = round( cos(tmp)*AMPLITUDE );
 | 
			
		||||
    sample((i-1)*2 + 2) = round( sin(tmp)*AMPLITUDE );
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
% -------------------------------------------------- fixed point ------------- -----------------------------------------------
 | 
			
		||||
tmp_phy_bit_over_sampling_int16 = int16(tmp_phy_bit_over_sampling);
 | 
			
		||||
tmp_phy_bit_over_sampling1_int16 = int16(tmp_phy_bit_over_sampling1);
 | 
			
		||||
gauss_coef_scale = 128;
 | 
			
		||||
cos_table_size = 1024; % 0 to 2PI
 | 
			
		||||
gauss_coef_int16 = int16(gauss_coef.*gauss_coef_scale);
 | 
			
		||||
 | 
			
		||||
  cos_table_int8 = int8(zeros(1, cos_table_size));
 | 
			
		||||
  sin_table_int8 = int8(zeros(1, cos_table_size));
 | 
			
		||||
  for i=1:cos_table_size
 | 
			
		||||
    cos_table_int8(i) = int8(cos(2*pi*(i-1)/cos_table_size)*127);
 | 
			
		||||
    sin_table_int8(i) = int8(sin(2*pi*(i-1)/cos_table_size)*127);
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  save_int_var_for_c(gauss_coef_int16./2, 'const int8_t const gauss_coef_int8', 'gauss_cos_sin_table.h', 'w');
 | 
			
		||||
  save_int_var_for_c(cos_table_int8, 'const int8_t const cos_table_int8', 'gauss_cos_sin_table.h', 'a');
 | 
			
		||||
  save_int_var_for_c(sin_table_int8, 'const int8_t const sin_table_int8', 'gauss_cos_sin_table.h', 'a');
 | 
			
		||||
  
 | 
			
		||||
  for i = 1 : len_conv_result
 | 
			
		||||
    acc_int16 = int16(0);
 | 
			
		||||
    for j = 1 : len_gauss_oversample
 | 
			
		||||
      acc_int16 = acc_int16 + gauss_coef_int16(len_gauss_oversample-j+1)*tmp_phy_bit_over_sampling_int16(i+j-1); 
 | 
			
		||||
    end
 | 
			
		||||
    tmp_phy_bit_over_sampling1_int16(i) = acc_int16;
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
%figure; 
 | 
			
		||||
%subplot(2,1,1); plot(tmp_phy_bit_over_sampling1_int16); hold on;
 | 
			
		||||
%plot(tmp_phy_bit_over_sampling1.*128, 'r.');
 | 
			
		||||
%subplot(2,1,2); plot(abs(double(tmp_phy_bit_over_sampling1_int16)-tmp_phy_bit_over_sampling1.*128));
 | 
			
		||||
 | 
			
		||||
phase_per_step = 2*pi/cos_table_size;
 | 
			
		||||
phase_delta_orig = ((pi*MOD_IDX)/SAMPLE_PER_SYMBOL)/gauss_coef_scale;
 | 
			
		||||
enlarge_scale = phase_per_step/phase_delta_orig
 | 
			
		||||
if enlarge_scale <1
 | 
			
		||||
  tmp_phy_bit_over_sampling1_int16 = tmp_phy_bit_over_sampling1_int16.*int16(1/enlarge_scale);
 | 
			
		||||
else
 | 
			
		||||
  tmp_phy_bit_over_sampling1_int16 = tmp_phy_bit_over_sampling1_int16./int16(enlarge_scale);
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
  tmp_int16 = int16(0);
 | 
			
		||||
  sample_int16 = int8(zeros(1, 2*num_sample));
 | 
			
		||||
  sample_int16(1) = cos_table_int8(tmp_int16+1);
 | 
			
		||||
  sample_int16(2) = sin_table_int8(tmp_int16+1);
 | 
			
		||||
  for i=2:num_sample
 | 
			
		||||
    tmp_int16 = tmp_int16 + tmp_phy_bit_over_sampling1_int16(i-1);
 | 
			
		||||
    tmp_int16 = mod(tmp_int16, int16(cos_table_size));
 | 
			
		||||
    sample_int16((i-1)*2 + 1) = cos_table_int8(tmp_int16+1);
 | 
			
		||||
    sample_int16((i-1)*2 + 2) = sin_table_int8(tmp_int16+1);
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
figure(1);
 | 
			
		||||
subplot(2,1,1); plot(sample_int16);
 | 
			
		||||
ref_sample = get_number1;
 | 
			
		||||
%ref_sample = sample;
 | 
			
		||||
hold on; plot(ref_sample, 'r.');
 | 
			
		||||
subplot(2,1,2); plot((double(sample_int16)-ref_sample));
 | 
			
		||||
							
								
								
									
										68
									
								
								Software/BTLE/matlab/test_float_point.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								Software/BTLE/matlab/test_float_point.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
clear all;
 | 
			
		||||
close all;
 | 
			
		||||
 | 
			
		||||
% original float point version
 | 
			
		||||
gauss_coef = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.231548e-14, 2.007605e-11, 7.561773e-09, 1.197935e-06, 8.050684e-05, 2.326833e-03, 2.959908e-02, 1.727474e-01, 4.999195e-01, 8.249246e-01, 9.408018e-01, 8.249246e-01, 4.999195e-01, 1.727474e-01, 2.959908e-02, 2.326833e-03, 8.050684e-05, 1.197935e-06, 7.561773e-09, 2.007605e-11, 2.231548e-14, 0];
 | 
			
		||||
%plot(gauss_coef, 'r+-'); axis([0 length(gauss_coef) 0 0.0001]);
 | 
			
		||||
 | 
			
		||||
% short it to 16 points:
 | 
			
		||||
gauss_coef = [7.561773e-09, 1.197935e-06, 8.050684e-05, 2.326833e-03, 2.959908e-02, 1.727474e-01, 4.999195e-01, 8.249246e-01, 9.408018e-01, 8.249246e-01, 4.999195e-01, 1.727474e-01, 2.959908e-02, 2.326833e-03, 8.050684e-05, 1.197935e-06];
 | 
			
		||||
%plot(gauss_coef, 'r+-');
 | 
			
		||||
 | 
			
		||||
SAMPLE_PER_SYMBOL = 4;
 | 
			
		||||
LEN_GAUSS_FILTER = length(gauss_coef)/SAMPLE_PER_SYMBOL;
 | 
			
		||||
MAX_NUM_PHY_BYTE  = 47;
 | 
			
		||||
MAX_NUM_PHY_SAMPLE = ((MAX_NUM_PHY_BYTE*8*SAMPLE_PER_SYMBOL)+(LEN_GAUSS_FILTER*SAMPLE_PER_SYMBOL));
 | 
			
		||||
MOD_IDX = 0.5;
 | 
			
		||||
AMPLITUDE = 127;
 | 
			
		||||
tmp_phy_bit_over_sampling = zeros(1, MAX_NUM_PHY_SAMPLE + 2*LEN_GAUSS_FILTER*SAMPLE_PER_SYMBOL);
 | 
			
		||||
tmp_phy_bit_over_sampling = zeros(1, MAX_NUM_PHY_SAMPLE);
 | 
			
		||||
 | 
			
		||||
num_bit = MAX_NUM_PHY_BYTE*8;
 | 
			
		||||
%bit = round(rand(1, num_bit));
 | 
			
		||||
bit = get_number;
 | 
			
		||||
num_bit_oversample = num_bit*SAMPLE_PER_SYMBOL;
 | 
			
		||||
len_gauss_oversample = LEN_GAUSS_FILTER*SAMPLE_PER_SYMBOL;
 | 
			
		||||
num_sample = num_bit_oversample + len_gauss_oversample;
 | 
			
		||||
 | 
			
		||||
  pre_len = len_gauss_oversample-1;
 | 
			
		||||
  tmp_phy_bit_over_sampling(1:pre_len) = 0.0;
 | 
			
		||||
  
 | 
			
		||||
  post_sp = num_bit_oversample + pre_len + 1;
 | 
			
		||||
  post_ep = post_sp + pre_len - 1;
 | 
			
		||||
  tmp_phy_bit_over_sampling(post_sp:post_ep) = 0.0;
 | 
			
		||||
 | 
			
		||||
  tmp_phy_bit_over_sampling((pre_len+1):(pre_len+num_bit_oversample)) = 0;
 | 
			
		||||
  tmp_phy_bit_over_sampling((pre_len+1):SAMPLE_PER_SYMBOL:(pre_len+num_bit_oversample)) = bit.*2 - 1;
 | 
			
		||||
 | 
			
		||||
  % len_conv_result = length(tmp_phy_bit_over_sampling) - len_gauss_oversample + 1
 | 
			
		||||
  % = post_ep - len_gauss_oversample + 1
 | 
			
		||||
  % = num_bit_oversample + pre_len + 1 + pre_len - 1  - len_gauss_oversample + 1
 | 
			
		||||
  % = num_bit_oversample + 2*(len_gauss_oversample-1)  - len_gauss_oversample + 1
 | 
			
		||||
  % = num_bit_oversample + len_gauss_oversample - 1
 | 
			
		||||
  len_conv_result = num_sample - 1;
 | 
			
		||||
  
 | 
			
		||||
% -------------------------------------- float point reference -----------------------------------------------
 | 
			
		||||
  for i = 1 : len_conv_result
 | 
			
		||||
    acc = 0;
 | 
			
		||||
    for j = 1 : len_gauss_oversample
 | 
			
		||||
      acc = acc + gauss_coef(len_gauss_oversample-j+1)*tmp_phy_bit_over_sampling(i+j-1); %num_sample - 1+len_gauss_oversample-1= length(tmp_phy_bit_over_sampling)
 | 
			
		||||
    end
 | 
			
		||||
    tmp_phy_bit_over_sampling1(i) = acc;
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  tmp = 0;
 | 
			
		||||
  sample = zeros(1, 2*num_sample);
 | 
			
		||||
  sample(1) = round( cos(tmp)*AMPLITUDE );
 | 
			
		||||
  sample(2) = round( sin(tmp)*AMPLITUDE );
 | 
			
		||||
  for i=2:num_sample
 | 
			
		||||
    tmp = tmp + (pi*MOD_IDX)*tmp_phy_bit_over_sampling1(i-1)/(SAMPLE_PER_SYMBOL);
 | 
			
		||||
    sample((i-1)*2 + 1) = round( cos(tmp)*AMPLITUDE );
 | 
			
		||||
    sample((i-1)*2 + 2) = round( sin(tmp)*AMPLITUDE );
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
figure(1);
 | 
			
		||||
subplot(2,1,1); plot(sample);
 | 
			
		||||
ref_sample = get_number1;
 | 
			
		||||
hold on; plot(ref_sample, 'r.');
 | 
			
		||||
subplot(2,1,2); plot(abs(sample-ref_sample));
 | 
			
		||||
							
								
								
									
										10
									
								
								Software/BTLE/matlab/test_scramble_gen_all_channel.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Software/BTLE/matlab/test_scramble_gen_all_channel.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
clear all;
 | 
			
		||||
close all;
 | 
			
		||||
 | 
			
		||||
num_bit = 42*8; % 42 = 2(pdu header) + 37(maximum payload length) + 3(CRC octets)
 | 
			
		||||
a = zeros(40, num_bit/8);
 | 
			
		||||
for channel_number = 0:39
 | 
			
		||||
    a(channel_number+1, :) = scramble_gen(channel_number, num_bit, ' ', 1);
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
save_int_var_for_c_2d(a, 'const uint8_t const scramble_table', 'scramble_table.h', 'w');
 | 
			
		||||
		Reference in New Issue
	
	Block a user