This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug)] | |
#[repr(C)] | |
/// Constructs a device-tree `node`, given a name and buffer. The buffer must be adequately sized. | |
pub struct RawNodeConstructor<'a> { | |
fdt_begin_node: u32, | |
node_name: &'a [u8], | |
} | |
impl<'a> RawNodeConstructor<'a> { | |
pub fn make_raw_node(buf: &'a mut [u8], name: &'a str) -> Result<Self> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
real_tokens = [] | |
imag_tokens = [] | |
for i in range(0, len(symbols_real)): | |
if symbols_real[i] == 15: | |
token = symbols_real[i:i+9] | |
checksum = np.sum(token) % 16 | |
if checksum <= 4 or checksum >= 13 : | |
q = (''.join([format(symbol, 'x') for symbol in token[1:7]])) | |
# print(q) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tokens_real = [] | |
tokens_imag = [] | |
for i in range(0, len(symbols_real)-1): | |
if symbols_real[i] == 15: | |
token = symbols_real[i:i+8] | |
tokens_real.append(token) | |
for i in range(0, len(symbols_imag)-1): | |
if symbols_imag[i] == 15: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
symbols_real = [] | |
symbols_imag = [] | |
base_freq = 100 # This is in Hertz | |
symbol_rate = 23.6 | |
num_tones = 16 # This particular MFSK modulation contains 16 tones i.e. (500-100/23.6) =~ 16.95 | |
# But its apparently odd to have an odd number of frequencies | |
# So, I settled on '16'. Turns out that was right. | |
tone_zero = int(round(base_freq/symbol_rate)) # the first or lowest tone in the sequence |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.fftpack import fft, fftfreq, fftshift | |
from scipy import signal | |
from scipy.signal import butter,filtfilt | |
k = 38389 # one of the peaks chosen randomly | |
sample_rate = 48000 | |
nyq_rate = sample_rate / 2.0 | |
order = 9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = signal.resample(mot, 512) | |
N = 512 | |
# sample spacing | |
T = 1.0 / 12000.0 | |
yf = fft(f) | |
xf = fftfreq(N, T) | |
xf = fftshift(xf) | |
yplot = fftshift(yf) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = np.linspace(0, 42.33, 2032) | |
y = np.sin(2 * np.pi * ((4+0)/42.33) * x) | |
print(len(x)) | |
print(len(y)) | |
z = np.multiply(y, us1) | |
mot = np.multiply(z, us1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i = 3844 | |
peaks = [] | |
while True: | |
v = max(normalized_correlation_magnitude_buffer[i-200 : i+200]) | |
s, = np.where(np.isclose(normalized_correlation_magnitude_buffer, v, rtol = 1e-09)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h3 = sorted((v,i) for (v,i) in enumerate(squared_correlation_magnitude_buffer) if (i > 125) and ( v < 4000)) | |
h4 = max([i for v,i in h3]) | |
print(h3) | |
print(h4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import os | |
from scipy.io import wavfile | |
import matplotlib.pyplot as plt | |
file_path = "/Users/Nil/devspace/Github_repos/alltheFSKs/iPhone_MFSK_Gpay_samples/iPhone_stereo_r_48khz_raw_c4755658_frequency_translated_lowpass_filtered.wav" | |
fs, data = wavfile.read(file_path) | |
# print(fs) |