mirror of
https://github.com/justinian/jsix.git
synced 2025-12-11 00:44:31 -08:00
I'm a tabs guy. I like tabs, it's an elegant way to represent indentation instead of brute-forcing it. But I have to admit that the world seems to be going towards spaces, and tooling tends not to play nice with tabs. So here we go, changing the whole repo to spaces since I'm getting tired of all the inconsistent formatting.
34 lines
601 B
C++
34 lines
601 B
C++
#pragma once
|
|
/// \file serial.h
|
|
/// Declarations related to serial ports.
|
|
#include <stdint.h>
|
|
|
|
#include "kutil/bip_buffer.h"
|
|
|
|
class serial_port
|
|
{
|
|
public:
|
|
/// Constructor.
|
|
/// \arg port The IO address of the serial port
|
|
serial_port(uint16_t port);
|
|
|
|
serial_port();
|
|
|
|
void write(char c);
|
|
char read();
|
|
|
|
void handle_interrupt();
|
|
|
|
private:
|
|
bool m_writing;
|
|
uint16_t m_port;
|
|
kutil::bip_buffer m_out_buffer;
|
|
kutil::bip_buffer m_in_buffer;
|
|
|
|
void do_read();
|
|
void do_write();
|
|
void handle_error(uint16_t reg, uint8_t value);
|
|
};
|
|
|
|
extern serial_port &g_com1;
|