Merge branch 'master' into win32
This commit is contained in:
@@ -31,6 +31,7 @@ typedef unsigned char UCHAR;
|
||||
#define HMODULE void*
|
||||
|
||||
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
//图像查表变换的方式
|
||||
|
||||
@@ -14,7 +14,11 @@
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
|
||||
#include "camera/wrapper_head.h"
|
||||
#include "camera/CameraApi.h"
|
||||
#ifdef Windows
|
||||
#include "camera/CameraApi.h"
|
||||
#elif defined(Linux)
|
||||
#include "camera/camera_api.h"
|
||||
#endif
|
||||
|
||||
class CameraWrapper: public WrapperHead {
|
||||
private:
|
||||
|
||||
@@ -124,8 +124,8 @@
|
||||
__FILE__, __LINE__, ##__VA_ARGS__)
|
||||
|
||||
/******************** the time counter API ************************/
|
||||
#ifndef DO_NOT_CNT_TIME && LOG_LEVEL > LOG_NONE
|
||||
#ifdef WIN32
|
||||
#if !defined(DO_NOT_CNT_TIME) && LOG_LEVEL > LOG_NONE
|
||||
#ifdef Windows
|
||||
#include <Windows.h>
|
||||
#define CNT_TIME(tag, codes, ...) do{ \
|
||||
static SYSTEMTIME ts, te; \
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef _ADDITIONS_H_
|
||||
#define _ADDITIONS_H_
|
||||
|
||||
#include <uart/uart.h>
|
||||
#include <serial/serial.h>
|
||||
#include <opencv2/core.hpp>
|
||||
#include <thread>
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#ifndef _SERIAL_H_
|
||||
#define _SERIAL_H_
|
||||
|
||||
#ifdef Windows
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
class Serial
|
||||
{
|
||||
public:
|
||||
Serial(UINT portNo = 1, UINT baud = CBR_9600, char parity = 'N', UINT databits = 8, UINT stopsbits = 1, DWORD dwCommEvents = EV_RXCHAR);
|
||||
Serial(UINT baud = CBR_115200, char parity = 'N', UINT databits = 8, UINT stopsbits = 1, DWORD dwCommEvents = EV_RXCHAR);
|
||||
~Serial();
|
||||
|
||||
bool InitPort(UINT portNo = 1, UINT baud = CBR_9600, char parity = 'N', UINT databits = 8, UINT stopsbits = 1, DWORD dwCommEvents = EV_RXCHAR);
|
||||
@@ -27,4 +29,33 @@ private:
|
||||
DWORD dwCommEvents;
|
||||
};
|
||||
|
||||
#elif defined(Linux)
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
class Serial {
|
||||
private:
|
||||
int fd;
|
||||
int nSpeed;
|
||||
char nEvent;
|
||||
int nBits;
|
||||
int nStop;
|
||||
|
||||
int set_opt(int fd, int nSpeed, char nEvent, int nBits, int nStop);
|
||||
|
||||
public:
|
||||
Serial(int nSpeed = 115200, char nEvent = 'N', int nBits = 8, int nStop = 1);
|
||||
~Serial();
|
||||
|
||||
bool InitPort(int nSpeed = 115200, char nEvent = 'N', int nBits = 8, int nStop = 1);
|
||||
// int GetBytesInCOM() const ;
|
||||
bool WriteData(const unsigned char* pData, unsigned int length);
|
||||
bool ReadData(unsigned char* buffer, unsigned int length);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _SERIAL_H_ */
|
||||
|
||||
Reference in New Issue
Block a user