Configurate Screen

This commit is contained in:
2022-10-03 15:38:54 +02:00
parent 587f5ecb97
commit 97226300d6
5 changed files with 83 additions and 21 deletions

View File

@@ -12,6 +12,14 @@
namespace GPU {
namespace Display {
#ifdef JABYENGINE_PAL
static constexpr size_t Width = 320;
static constexpr size_t Height = 256;
#else
static constexpr size_t Width = 320;
static constexpr size_t Height = 240;
#endif
static void enable() {
GP1.write(Command::GP1::SetDisplayState(DisplayState::On));
}
@@ -19,6 +27,8 @@ namespace GPU {
static void disable() {
GP1.write(Command::GP1::SetDisplayState(DisplayState::Off));
}
void set_offset(uint16_t x, uint16_t y);
}
}

View File

@@ -90,6 +90,20 @@ namespace GPU {
return ComplexBitMap{construct_cmd(0x04, static_cast<uint32_t>(dir))};
}
static constexpr GP1 HorizontalDisplayRange(uint32_t x1, uint32_t x2) {
constexpr auto X1 = BitRange<uint32_t>::from_to(0, 11);
constexpr auto X2 = BitRange<uint32_t>::from_to(12, 23);
return ComplexBitMap{construct_cmd(0x06, ComplexBitMap<uint32_t>::with(X1.with(x1), X2.with(x2)).raw)};
}
static constexpr GP1 VerticalDisplayRange(uint32_t y1, uint32_t y2) {
constexpr auto Y1 = BitRange<uint32_t>::from_to(0, 9);
constexpr auto Y2 = BitRange<uint32_t>::from_to(10, 19);
return ComplexBitMap{construct_cmd(0x07, ComplexBitMap<uint32_t>::with(Y1.with(y1), Y2.with(y2)).raw)};
}
static constexpr GP1 DisplayMode(uint32_t mode) {
return ComplexBitMap{construct_cmd(0x08, mode)};
}