52 lines
1.8 KiB
C++
52 lines
1.8 KiB
C++
#pragma once
|
|
#include "ioport.hpp"
|
|
|
|
namespace JabyEngine {
|
|
namespace Periphery_IO_Values {
|
|
__declare_io_value(JOY_BAUD, uint16_t) {
|
|
static constexpr JOY_BAUD create() {
|
|
return JOY_BAUD{0x0088};
|
|
}
|
|
};
|
|
|
|
__declare_io_value(JOY_CTRL, uint16_t) {
|
|
static constexpr auto TXEnable = Bit(0);
|
|
static constexpr auto SelectJoy = Bit(1);
|
|
static constexpr auto ACK = Bit(4);
|
|
static constexpr auto ACKIrqEnable = Bit(12);
|
|
static constexpr auto PortBSelected = Bit(13);
|
|
static constexpr auto PortASelected = !PortBSelected;
|
|
|
|
static constexpr JOY_CTRL create_for(uint16_t port) {
|
|
return JOY_CTRL{static_cast<uint16_t>(port << PortBSelected)}.set(TXEnable, SelectJoy, ACKIrqEnable);
|
|
}
|
|
|
|
static constexpr JOY_CTRL close() {
|
|
return JOY_CTRL{0};
|
|
}
|
|
};
|
|
|
|
__declare_io_value(JOY_MODE, uint16_t) {
|
|
static constexpr JOY_MODE create() {
|
|
return JOY_MODE{0x000D};
|
|
}
|
|
};
|
|
|
|
__declare_io_value(JOY_RX_DATA, uint8_t) {
|
|
};
|
|
|
|
__declare_io_value(JOY_STAT, uint32_t) {
|
|
static constexpr auto TXReadyStart = Bit(0);
|
|
static constexpr auto RXFifoNonEmpty = Bit(1);
|
|
static constexpr auto TXReadyFinished = Bit(2);
|
|
static constexpr auto RXParityError = Bit(3);
|
|
static constexpr auto ACKIrqLow = Bit(7);
|
|
};
|
|
|
|
__declare_io_value(JOY_TX_DATA, uint32_t) {
|
|
static constexpr JOY_TX_DATA create(uint8_t byte) {
|
|
return JOY_TX_DATA{byte};
|
|
}
|
|
};
|
|
}
|
|
} |