From: Rostislav Lisovy Date: Wed, 13 Apr 2011 23:33:46 +0000 (+0200) Subject: ADCs setting implemented. X-Git-Url: https://rtime.felk.cvut.cz/gitweb/mf6xx.git/commitdiff_plain/bf1d5615de0e46cc6e464e21b91cd95f3f0990fa ADCs setting implemented. --- diff --git a/src/qemu/mf624_interface/untitled/mainwindow.cpp b/src/qemu/mf624_interface/untitled/mainwindow.cpp index ac35e72..5c360a2 100644 --- a/src/qemu/mf624_interface/untitled/mainwindow.cpp +++ b/src/qemu/mf624_interface/untitled/mainwindow.cpp @@ -81,3 +81,38 @@ void MainWindow::on_horizontalSlider_valueChanged(int value) { s_thread->socket_send("ADC0=%d\n", value); } + +void MainWindow::on_horizontalSlider_2_valueChanged(int value) +{ + s_thread->socket_send("ADC1=%d\n", value); +} + +void MainWindow::on_horizontalSlider_3_valueChanged(int value) +{ + s_thread->socket_send("ADC2=%d\n", value); +} + +void MainWindow::on_horizontalSlider_4_valueChanged(int value) +{ + s_thread->socket_send("ADC3=%d\n", value); +} + +void MainWindow::on_horizontalSlider_5_valueChanged(int value) +{ + s_thread->socket_send("ADC4=%d\n", value); +} + +void MainWindow::on_horizontalSlider_6_valueChanged(int value) +{ + s_thread->socket_send("ADC5=%d\n", value); +} + +void MainWindow::on_horizontalSlider_7_valueChanged(int value) +{ + s_thread->socket_send("ADC6=%d\n", value); +} + +void MainWindow::on_horizontalSlider_8_valueChanged(int value) +{ + s_thread->socket_send("ADC7=%d\n", value); +} diff --git a/src/qemu/mf624_interface/untitled/mainwindow.h b/src/qemu/mf624_interface/untitled/mainwindow.h index 504063e..f68fb41 100644 --- a/src/qemu/mf624_interface/untitled/mainwindow.h +++ b/src/qemu/mf624_interface/untitled/mainwindow.h @@ -31,6 +31,20 @@ private slots: void on_horizontalSlider_valueChanged(int value); + void on_horizontalSlider_2_valueChanged(int value); + + void on_horizontalSlider_3_valueChanged(int value); + + void on_horizontalSlider_4_valueChanged(int value); + + void on_horizontalSlider_5_valueChanged(int value); + + void on_horizontalSlider_6_valueChanged(int value); + + void on_horizontalSlider_7_valueChanged(int value); + + void on_horizontalSlider_8_valueChanged(int value); + private: int DIN; //DIN register diff --git a/src/qemu/mf624_interface/untitled/socket_thread.cpp b/src/qemu/mf624_interface/untitled/socket_thread.cpp index d10e8cc..a37e273 100644 --- a/src/qemu/mf624_interface/untitled/socket_thread.cpp +++ b/src/qemu/mf624_interface/untitled/socket_thread.cpp @@ -48,7 +48,6 @@ void socket_thread::run() char read_buffer[STRING_BUFF_SIZE]; char reg[STRING_BUFF_SIZE+1]; int val; - char buffer[256]; @@ -79,14 +78,14 @@ void socket_thread::run() while(1) { - memset(buffer, '\0', 256); - n = read(sockfd, buffer, 255); + memset(read_buffer, '\0', 256); + n = read(sockfd, read_buffer, 255); if (n < 0) { perror("read()"); sleep(1); } - status = sscanf(buffer, "%[A-Z0-9]=%u", reg, &val); + status = sscanf(read_buffer, "%[A-Z0-9]=%i", reg, &val); if (status == 2) { if(!strcmp(reg, "DOUT")) { mf624_io_status.DOUT = val;