You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
599 B
37 lines
599 B
|
|
|
|
|
|
#include "WWSerialPortApi.h"
|
|
|
|
|
|
WWSerialPortApi::WWSerialPortApi()
|
|
{
|
|
|
|
}
|
|
|
|
WWSerialPortApi::~WWSerialPortApi()
|
|
{
|
|
|
|
}
|
|
|
|
bool WWSerialPortApi::open(const char* portname) {
|
|
bool res =mSerialPort.open(portname, 115200, 0, 8, 1, 1);
|
|
return res;
|
|
}
|
|
|
|
//关闭串口,参数待定
|
|
void WWSerialPortApi::close() {
|
|
mSerialPort.close();
|
|
}
|
|
|
|
|
|
void WWSerialPortApi::setBeamDir(int angle) {
|
|
mSerialPort.send_command(2, 4, angle);//set beam ,2个参数,4设置beam ,参数是angle
|
|
mSerialPort.recv_results();
|
|
}
|
|
|
|
void WWSerialPortApi::getBeamDir() {
|
|
mSerialPort.send_command(1, 3, 0);//get beam
|
|
mSerialPort.recv_results();
|
|
}
|
|
|
|
|