Create the FakeGPIO.hpp to be used as Mock for testing and Update the timing for the delays and also create the Write method on the HAL to choreograph the writing process in the YMF262

This commit is contained in:
Gustavo Henrique Santos Souza de Miranda
2026-06-03 12:23:00 -03:00
parent 7898563f39
commit 8e4fceec7e
3 changed files with 42 additions and 19 deletions
+22
View File
@@ -0,0 +1,22 @@
#ifndef FAKE_GPIO_HPP
#define FAKE_GPIO_HPP
#include <cstdint>
#include <vector>
#include <string>
#include "GPIO.hpp"
struct FakeGpio {
std::vector<std::string> log;
void set_data_bus(uint8_t val) { log.push_back("data " + std::to_string(val)); }
void set_a0(Port port) { log.push_back(port == Port::ADDRESS ? "a0 ADDR" : "a0 DATA"); }
void set_a1(Bank bank) { log.push_back(bank == Bank::BANK_0 ? "a1 B0" : "a1 B1"); }
void set_cs(State s) { log.push_back(s == State::ACTIVE ? "cs ON" : "cs OFF"); }
void set_wr(State s) { log.push_back(s == State::ACTIVE ? "wr ON" : "wr OFF"); }
void set_ic(State s) { log.push_back(s == State::ACTIVE ? "ic ON" : "ic OFF"); }
void set_rd(State s) { log.push_back(s == State::ACTIVE ? "rd ON" : "rd OFF"); }
void delay_ticks(uint32_t n) { log.push_back("delay " + std::to_string(n)); }
};
#endif