EHS/include/ehs/io/COM.h

55 lines
942 B
C
Raw Normal View History

2024-01-31 22:28:19 -08:00
#pragma once
#include "ehs/EHS.h"
namespace ehs
{
enum class Parity : UInt_8
{
NONE,
ODD,
EVEN,
MARK,
SPACE
};
enum class StopBits : UInt_8
{
ONE,
ONE_POINT_FIVE,
TWO
};
class COM
{
private:
UInt_8 port;
UInt_32 baudRate;
UInt_8 byteSize;
Parity parity;
StopBits stopBits;
void* hdl;
bool initialized;
public:
COM();
COM(const UInt_8 port, const UInt_32 baudRate, const UInt_8 byteSize, const Parity parity, const StopBits stopBits);
COM(const COM& com) = default;
void Initialize();
void UnInitialize();
UInt_32 Wait();
void Transmit(const Char_8 data);
UInt_32 Send(const Char_8* data, const UInt_32 size);
UInt_32 Receive(const Char_8* data, const UInt_32 size);
void Flush();
};
}