2021-05-10 20:33:25 +00:00
|
|
|
#pragma once
|
2023-10-28 19:51:04 +00:00
|
|
|
// For now these are the standard
|
|
|
|
// serial ports we can talk to
|
|
|
|
enum SERIALPORT {
|
|
|
|
COM1 = 0x3F8,
|
|
|
|
COM2 = 0x2F8,
|
|
|
|
COM3 = 0x3E8,
|
|
|
|
COM4 = 0x2E8
|
|
|
|
};
|
2021-05-10 20:33:25 +00:00
|
|
|
|
2023-10-28 19:51:04 +00:00
|
|
|
struct SerialConfig {
|
|
|
|
SERIALPORT port;
|
|
|
|
char baud_rate_lo ;
|
|
|
|
char baud_rate_hi;
|
|
|
|
};
|
2021-05-10 20:33:25 +00:00
|
|
|
|
|
|
|
|
2023-10-28 19:51:04 +00:00
|
|
|
class Serial {
|
|
|
|
|
|
|
|
public:
|
|
|
|
Serial (SerialConfig config );
|
2021-05-10 20:33:25 +00:00
|
|
|
|
2023-10-28 19:51:04 +00:00
|
|
|
char read();
|
|
|
|
void write(void* data, int length);
|
2021-05-10 20:33:25 +00:00
|
|
|
|
2023-10-28 19:51:04 +00:00
|
|
|
private:
|
|
|
|
SERIALPORT port;
|
|
|
|
int is_transmit_empty();
|
2021-05-10 20:33:25 +00:00
|
|
|
};
|