hardware.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef HAND_BRIDGE_HARDWARE_H_
19 #define HAND_BRIDGE_HARDWARE_H_
20 
21 #include <boost/chrono.hpp>
22 #include "serial_port.h"
23 
25  boost::chrono::steady_clock::time_point start;
27 
28 public:
29  void init(char * param)
30  {
31  if(!serial.init(param)) exit(1);
32  }
33  unsigned long time()
34  {
35  return boost::chrono::duration_cast<boost::chrono::milliseconds>(boost::chrono::steady_clock::now() - start).count();
36  }
37  int read(){
38  return serial.readByte();
39  }
40  void write(uint8_t* data, int length)
41  {
42  serial.write(data, length);
43  }
44 };
45 
46 #endif // HAND_BRIDGE_HARDWARE_H_
bool write(uint8_t *data, int length)
Definition: serial_port.h:59
boost::chrono::steady_clock::time_point start
Definition: hardware.h:25
bool init(char *param)
Definition: serial_port.h:33
void init(char *param)
Definition: hardware.h:29
unsigned long time()
Definition: hardware.h:33
void write(uint8_t *data, int length)
Definition: hardware.h:40
int readByte()
Definition: serial_port.h:53
SerialPort serial
Definition: hardware.h:26


cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Tue Oct 20 2020 03:35:57