Support Controller

This commit is contained in:
2024-01-02 22:51:51 -06:00
parent 837073fcda
commit 73a452d616
6 changed files with 152 additions and 16 deletions

View File

@@ -106,7 +106,9 @@ namespace JabyEngine {
return (ButtonState::was_down(button) && !ButtonState::is_down(button));
}
friend class RawController;
friend class RawController;
friend struct ControllerHelper;
friend void query_controller();
};
Header header;

View File

@@ -3,6 +3,15 @@
namespace JabyEngine {
namespace Periphery_IO {
__declare_io_value(JOY_TX_DATA, uint32_t) {
static constexpr JOY_TX_DATA create(uint8_t byte) {
return JOY_TX_DATA{byte};
}
};
__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);
@@ -48,8 +57,8 @@ namespace JabyEngine {
}
};
__declare_io_port_w_type(, uint8_t, JOY_TX_DATA, 0x1F801040);
__declare_io_port_w_type(const, uint8_t, JOY_RX_DATA, 0x1F801040);
__declare_io_port(, JOY_TX_DATA, 0x1F801040);
__declare_io_port(const, JOY_RX_DATA, 0x1F801040);
__declare_io_port(const, JOY_STAT, 0x1F801044);
__declare_io_port(, JOY_MODE, 0x1F801048);
__declare_io_port(, JOY_CTRL, 0x1F80104A);