2024-03-20 18:25:20 +00:00
|
|
|
//
|
|
|
|
// CMOSRAM.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 20/03/2024.
|
|
|
|
// Copyright © 2024 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../../../Components/I2C/I2C.hpp"
|
|
|
|
|
|
|
|
namespace Archimedes {
|
|
|
|
|
|
|
|
struct CMOSRAM: public I2C::Peripheral {
|
2024-03-26 16:24:24 +00:00
|
|
|
void start(bool is_read) override {
|
|
|
|
expecting_address_ = !is_read;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::optional<uint8_t> read() override {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void write(uint8_t value) override {
|
|
|
|
if(expecting_address_) {
|
|
|
|
address_ = value;
|
|
|
|
} else {
|
2024-03-26 16:27:37 +00:00
|
|
|
printf("Write to %d\n", address_);
|
|
|
|
++address_;
|
2024-03-26 16:24:24 +00:00
|
|
|
// TODO: write to RAM.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool expecting_address_ = false;
|
|
|
|
uint8_t address_;
|
2024-03-20 18:25:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|