/[H7]/branches/linux-serial/H7Serial.cpp
ViewVC logotype

Diff of /branches/linux-serial/H7Serial.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 55 by torben, Mon Feb 5 10:10:18 2007 UTC revision 56 by torben, Mon Feb 5 10:24:24 2007 UTC
# Line 22  CH7Serial::~CH7Serial(void) Line 22  CH7Serial::~CH7Serial(void)
22  short CH7Serial::readTarget(unsigned char target)  short CH7Serial::readTarget(unsigned char target)
23  {  {
24          using namespace std;          using namespace std;
         cout << "read start" << endl;  
25          short retval;          short retval;
26          unsigned char frame[1];          unsigned char frame[1];
27          unsigned char hi_target = (target & 0x0F) << 4;          unsigned char hi_target = (target & 0x0F) << 4;
28          frame[0] = hi_target | 0x00;          frame[0] = hi_target | 0x00;
29    
30          writeFrame(frame,1);          writeFrame(frame,1);
         cout << "read mid" << endl;  
31          Sleep(50); //be nice and wait a little          Sleep(50); //be nice and wait a little
32          std::vector<unsigned char> answer = readFrame();          std::vector<unsigned char> answer = readFrame();
         cout << "read done" << endl;  
33    
34          if (answer.size() == 0)          if (answer.size() == 0)
35                  throw std::runtime_error("No reply");                  throw std::runtime_error("No reply");
# Line 60  void CH7Serial::writeTarget(unsigned cha Line 57  void CH7Serial::writeTarget(unsigned cha
57          unsigned char hi_target = (target & 0x0F) << 4;          unsigned char hi_target = (target & 0x0F) << 4;
58          frame[0] = hi_target | 0x01;          frame[0] = hi_target | 0x01;
59          frame[1] = data;          frame[1] = data;
         cout << "write start" << endl;  
60    
61          writeFrame(frame,2);          writeFrame(frame,2);
         cout << "write mid" << endl;  
62          Sleep(50); //be nice and wait a little          Sleep(50); //be nice and wait a little
63          std::vector<unsigned char> answer = readFrame();          std::vector<unsigned char> answer = readFrame();
64                    
         cout << "write stop" << endl;  
65          if (answer.size() == 0)          if (answer.size() == 0)
66                  throw std::runtime_error("No reply");                  throw std::runtime_error("No reply");
67    

Legend:
Removed from v.55  
changed lines
  Added in v.56

  ViewVC Help
Powered by ViewVC 1.1.20