1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-02 02:49:28 +00:00
CLK/Machines/Amiga/Keyboard.hpp

46 lines
669 B
C++
Raw Normal View History

2021-07-30 22:23:15 +00:00
//
// Keyboard.hpp
// Clock Signal
//
// Created by Thomas Harte on 29/07/2021.
// Copyright © 2021 Thomas Harte. All rights reserved.
//
#ifndef Keyboard_hpp
#define Keyboard_hpp
#include <cstdint>
namespace Amiga {
class Keyboard {
public:
enum Lines: uint8_t {
Data = (1 << 0),
Clock = (1 << 1),
};
uint8_t update(uint8_t);
private:
enum class ShiftState {
Shifting,
AwaitingHandshake,
Idle,
} shift_state_ = ShiftState::Idle;
enum class State {
Startup,
} state_ = State::Startup;
int bit_phase_ = 0;
uint32_t shift_sequence_ = 0;
int bits_remaining_ = 0;
uint8_t lines_ = 0;
};
}
#endif /* Keyboard_hpp */