Skip to content

Instantly share code, notes, and snippets.

@admsyn
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save admsyn/79cc02ebd147ce530cf1 to your computer and use it in GitHub Desktop.
Save admsyn/79cc02ebd147ce530cf1 to your computer and use it in GitHub Desktop.
Setting up rtlsdr
void setup() {
cout << "Device Count: " << rtlsdr_get_device_count() << endl;
cout << "Open: " << rtlsdr_open(&device, 0) << endl;
rtlsdr_set_center_freq(device, 156050000);
rtlsdr_set_sample_rate(device, sampleRate);
rtlsdr_set_agc_mode(device, 1);
rtlsdr_set_freq_correction(device, 0);
rtlsdr_reset_buffer(device);
char man[256], pro[256], ser[256];
rtlsdr_get_usb_strings(device, man, pro, ser);
cout << "Manufacturer: " << string(man) << endl;
cout << "Product: " << string(pro) << endl;
cout << "Serial: " << string(ser) << endl;
cout << "Freq: " << rtlsdr_get_center_freq(device) << endl;
// (this blocks until cancelled)
rtlsdr_read_async(_device, RtlRead, _ctx, 0, 16384);
}
void RtlRead(unsigned char * buffer, uint32_t len, void * ctx) {
// whatever
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment