mirror of https://github.com/EspoTek/Labrador.git
librador_get_iso_data takes inputs in seconds rather than per-sample.
This commit is contained in:
parent
d771678c55
commit
aeb2d48809
|
@ -73,7 +73,7 @@ void MainWindow::on_pushButton_4_clicked()
|
|||
void MainWindow::on_pushButton_5_clicked()
|
||||
{
|
||||
|
||||
QVector<double> yaxis = QVector<double>::fromStdVector(*(librador_get_iso_data(75000, 1, 1500, 0)));
|
||||
QVector<double> yaxis = QVector<double>::fromStdVector(*(librador_get_iso_data(0.5, 375000, 0.1, 0)));
|
||||
|
||||
//qDebug() << yaxis;
|
||||
|
||||
|
|
|
@ -60,8 +60,18 @@ int librador_avr_debug(){
|
|||
return internal_librador_object->usb_driver->avrDebug();
|
||||
}
|
||||
|
||||
std::vector<double> * librador_get_iso_data(int numToGet, int interval_samples, int delay_sample, int filter_mode){
|
||||
return internal_librador_object->usb_driver->getMany_double(numToGet, interval_samples, delay_sample, filter_mode);
|
||||
std::vector<double> * librador_get_iso_data(double timeWindow_seconds, double sample_rate_hz, double delay_seconds, int filter_mode){
|
||||
double samples_per_second = internal_librador_object->usb_driver->get_samples_per_second();
|
||||
|
||||
if(samples_per_second == 0){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int interval_samples = round(samples_per_second / sample_rate_hz);
|
||||
int delay_samples = round(delay_seconds * samples_per_second);
|
||||
int numToGet = round(timeWindow_seconds * samples_per_second);
|
||||
return internal_librador_object->usb_driver->getMany_double(numToGet, interval_samples, delay_samples, filter_mode);
|
||||
}
|
||||
|
||||
int librador_reset_usb(){
|
||||
|
|
|
@ -34,6 +34,6 @@ uint8_t LIBRADORSHARED_EXPORT librador_get_device_firmware_variant();
|
|||
//aa
|
||||
//int LIBRADORSHARED_EXPORT librador_kickstart_isochronous_loop();
|
||||
|
||||
std::vector<double> * LIBRADORSHARED_EXPORT librador_get_iso_data(int numToGet, int interval_samples, int delay_sample, int filter_mode);
|
||||
std::vector<double> * LIBRADORSHARED_EXPORT librador_get_iso_data(double timeWindow_seconds, double sample_rate_hz, double delay_seconds, int filter_mode);
|
||||
|
||||
#endif // LIBRADOR_H
|
||||
|
|
|
@ -471,3 +471,20 @@ uint8_t usbCallHandler::get_firmware_variant(){
|
|||
send_control_transfer(0xc0, 0xa9, 0, 0, 1, NULL);
|
||||
return *((uint8_t *) inBuffer);
|
||||
}
|
||||
|
||||
double usbCallHandler::get_samples_per_second(){
|
||||
switch(deviceMode){
|
||||
case 0:
|
||||
return (double)(375000.0);
|
||||
case 1:
|
||||
return (double)(375000.0);
|
||||
case 2:
|
||||
return (double)(375000.0);
|
||||
case 6:
|
||||
return (double)(750000.0);
|
||||
case 7:
|
||||
return (double)(375000.0);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
int send_control_transfer(uint8_t RequestType, uint8_t Request, uint16_t Value, uint16_t Index, uint16_t Length, unsigned char *LDATA);
|
||||
int avrDebug(void);
|
||||
int send_device_reset();
|
||||
double get_samples_per_second();
|
||||
std::vector<double> *getMany_double(int numToGet, int interval_samples, int delay_sample, int filter_mode);
|
||||
bool connected;
|
||||
//Control Command Vars
|
||||
|
|
Loading…
Reference in New Issue