From 2f4cef7921c255ecbc17dfbbeca0f891e54aad80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 1 Mar 2011 12:11:32 +0100 Subject: update k8055gui, usw k8055++, test button --- k8055gui/CMakeLists.txt | 6 +++--- k8055gui/MyFrame.cpp | 40 ++++++++++++++++++---------------------- k8055gui/MyFrame.h | 2 ++ 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/k8055gui/CMakeLists.txt b/k8055gui/CMakeLists.txt index e641518..736080b 100644 --- a/k8055gui/CMakeLists.txt +++ b/k8055gui/CMakeLists.txt @@ -2,18 +2,18 @@ ADD_EXECUTABLE(k8055gui WIN32 MACOSX_BUNDLE MyApp.cpp MyFrame.cpp ) TARGET_LINK_LIBRARIES(k8055gui - k8055-${VERSION} + k8055++-${VERSION} ${wxWidgets_LIBRARIES} ) INCLUDE(${wxWidgets_USE_FILE}) INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/libk8055 # ${wxWidgets_INCLUDE_DIRS} ) -ADD_DEPENDENCIES(k8055gui k8055-${VERSION}) +ADD_DEPENDENCIES(k8055gui k8055++-${VERSION}) INSTALL(TARGETS k8055gui RUNTIME DESTINATION bin BUNDLE DESTINATION bin ) diff --git a/k8055gui/MyFrame.cpp b/k8055gui/MyFrame.cpp index e5b4a78..7ea9270 100644 --- a/k8055gui/MyFrame.cpp +++ b/k8055gui/MyFrame.cpp @@ -19,7 +19,6 @@ */ #include "MyFrame.h" -#include "k8055.h" #include using namespace std; @@ -148,7 +147,7 @@ void MyFrame::OnBnClickedSK6(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnBnClickedConnect(wxCommandEvent& WXUNUSED(event)) { address=3-SK5->GetValue()-2*SK6->GetValue(); - if (OpenDevice(address)==-1) + if (k8055.OpenDevice(address)==-1) { connected=0; ConnectionStatus->Clear(); @@ -213,16 +212,13 @@ void MyFrame::OnBnClickedClearallanalog(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnBnClickedOutputtest(wxCommandEvent& WXUNUSED(event)) { if (DEBUG) cout<<"OutputTest clicked!"<SetValue(1); -// O2->SetValue(0); -// O3->SetValue(0); -// O4->SetValue(0); -// O5->SetValue(0); -// O6->SetValue(0); -// O7->SetValue(0); -// O8->SetValue(0); -// WriteDigital(); + k8055.ClearAllDigital(); + k8055.ClearAllAnalog(); + k8055.SetAnalogChannel( 1 ); + for( int i=0, j=255; i<256; i++, j--) k8055.SetAllValues(i,i,j); + k8055.ClearAllDigital(); + k8055.ClearAllAnalog(); + OutputTest->SetValue(false); } void MyFrame::OnNMCustomdrawDa1(wxScrollEvent& WXUNUSED(event)) @@ -313,7 +309,7 @@ void MyFrame::OnBnClickedResct1(wxCommandEvent& WXUNUSED(event)) if (DEBUG) cout<<"Resct1 clicked!"<SetValue(data1 & 0x01); @@ -384,7 +380,7 @@ void MyFrame::WriteDigital() { long word=O1->GetValue()+2*O2->GetValue()+4*O3->GetValue()+8*O4->GetValue()+ 16*O5->GetValue()+32*O6->GetValue()+64*O7->GetValue()+128*O8->GetValue(); - WriteAllDigital(word); + k8055.WriteAllDigital(word); } } @@ -395,7 +391,7 @@ void MyFrame::WriteAnalog() { //OutputAnalogChannel(1, (long) AnalgOutput1->GetValue()); //OutputAnalogChannel(2, (long) AnalgOutput2->GetValue()); - OutputAllAnalog((long) AnalgOutput1->GetValue(), (long) AnalgOutput2->GetValue()); + k8055.WriteAllAnalog( AnalgOutput1->GetValue(), AnalgOutput2->GetValue()); } } @@ -413,7 +409,7 @@ void MyFrame::WriteDebounce1() case 2 : DebounceTime=10; break; case 3 : DebounceTime=1000; } - SetCounterDebounceTime(1, DebounceTime); + k8055.SetCounterDebounceTime(1, DebounceTime); } } @@ -431,7 +427,7 @@ void MyFrame::WriteDebounce2() case 2 : DebounceTime=10; break; case 3 : DebounceTime=1000; } - SetCounterDebounceTime(2, DebounceTime); + k8055.SetCounterDebounceTime(2, DebounceTime); } } @@ -442,8 +438,8 @@ void MyFrame::WriteAll() { long word=O1->GetValue()+2*O2->GetValue()+4*O3->GetValue()+8*O4->GetValue()+ 16*O5->GetValue()+32*O6->GetValue()+64*O7->GetValue()+128*O8->GetValue(); - WriteAllDigital(word); - OutputAllAnalog((long) AnalgOutput1->GetValue(), (long) AnalgOutput2->GetValue()); + k8055.WriteAllDigital(word); + k8055.WriteAllAnalog((long) AnalgOutput1->GetValue(), (long) AnalgOutput2->GetValue()); WriteDebounce1(); WriteDebounce2(); } diff --git a/k8055gui/MyFrame.h b/k8055gui/MyFrame.h index 3b22424..13632ea 100644 --- a/k8055gui/MyFrame.h +++ b/k8055gui/MyFrame.h @@ -23,6 +23,7 @@ #include #include +#include "k8055++.h" enum { @@ -67,6 +68,7 @@ class MyFrame: public wxFrame protected: long address; // board address 0 -> 3 bool connected;// true if connected + K8055 k8055; public: //constructor -- cgit v1.1-2-g2b99