led_ctrl/include/SerialPort.h

22 lines
375 B
C
Raw Normal View History

2025-06-05 09:03:12 +08:00
// SerialPort.h
#pragma once
#include <string>
#include <termios.h>
class SerialPort
{
public:
SerialPort();
~SerialPort();
bool openPort(const std::string &portName, int baudrate);
void closePort();
bool writeData(const uint8_t *data, size_t size);
private:
int fd;
termios tty;
speed_t getBaudrate(int baudrate);
};