Introduce QuickFill
This commit is contained in:
parent
b5533733c3
commit
679899279d
|
@ -3,25 +3,17 @@
|
||||||
#include "../jabyengine_defines.h"
|
#include "../jabyengine_defines.h"
|
||||||
|
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
struct __no_align Color3 {
|
struct Color {
|
||||||
uint8_t blue;
|
uint8_t red = 0;
|
||||||
uint8_t green;
|
uint8_t green = 0;
|
||||||
uint8_t red;
|
uint8_t blue = 0;
|
||||||
|
|
||||||
static constexpr Color3 black() {
|
constexpr Color() = default;
|
||||||
return {0x0, 0x0, 0x0};
|
constexpr Color(uint8_t r, uint8_t g, uint8_t b) : blue(b), green(g), red(r) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr Color3 rgb(uint8_t r, uint8_t g, uint8_t b) {
|
constexpr uint32_t raw() const {
|
||||||
return {b, g, r};
|
return ((this->blue << 16) | (this->green << 8) | this->red);
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct __no_align Color {
|
|
||||||
uint8_t reserved;
|
|
||||||
Color3 color_data;
|
|
||||||
|
|
||||||
constexpr Color(Color3 color) : reserved(0), color_data(color) {
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef __JABYENGINE_GPU_IO_HPP__
|
#ifndef __JABYENGINE_GPU_IO_HPP__
|
||||||
#define __JABYENGINE_GPU_IO_HPP__
|
#define __JABYENGINE_GPU_IO_HPP__
|
||||||
#include "IOPort.hpp"
|
#include "IOPort.hpp"
|
||||||
|
#include "../../GPU/GPU_Types.hpp"
|
||||||
|
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
namespace Port {
|
namespace Port {
|
||||||
|
@ -42,17 +43,29 @@ namespace GPU {
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Command {
|
namespace Command {
|
||||||
static constexpr uint32_t construct_cmd(uint8_t cmd, uint32_t value) {
|
|
||||||
return ((cmd << 24) | value);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct __no_align GP0 : public ComplexBitMap<uint32_t> {
|
struct __no_align GP0 : public ComplexBitMap<uint32_t> {
|
||||||
__io_port_inherit_complex_bit_map(GP0);
|
__io_port_inherit_complex_bit_map(GP0);
|
||||||
|
|
||||||
|
static constexpr GP0 QuickFill(Color color) {
|
||||||
|
return {(0x02 << 24) | color.raw()};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr GP0 TopLeftPosition(uint16_t x, uint16_t y) {
|
||||||
|
return {(y << 16) | x};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr GP0 WidthHeight(uint16_t w, uint16_t h) {
|
||||||
|
return {(h << 16) | h};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __no_align GP1 : public ComplexBitMap<uint32_t> {
|
struct __no_align GP1 : public ComplexBitMap<uint32_t> {
|
||||||
__io_port_inherit_complex_bit_map(GP1);
|
__io_port_inherit_complex_bit_map(GP1);
|
||||||
|
|
||||||
|
static constexpr uint32_t construct_cmd(uint8_t cmd, uint32_t value) {
|
||||||
|
return ((cmd << 24) | value);
|
||||||
|
}
|
||||||
|
|
||||||
static constexpr GP1 Reset() {
|
static constexpr GP1 Reset() {
|
||||||
return {0};
|
return {0};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
|
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
void setup() {
|
void setup() {
|
||||||
Port::GP1.write(Port::Command::GP1::Reset());
|
//Port::GP1.write(Port::Command::GP1::Reset());
|
||||||
Port::GP1.write(Port::Command::GP1::SetDisplayState(Port::DisplayState::On));
|
|
||||||
|
//Quickfill
|
||||||
|
Port::GP0.write(Port::Command::GP0::QuickFill(Color(0xFF, 0x0, 0x0)));
|
||||||
|
Port::GP0.write(Port::Command::GP0::TopLeftPosition(8, 8));
|
||||||
|
Port::GP0.write(Port::Command::GP0::WidthHeight(32, 32));
|
||||||
|
|
||||||
|
//Port::GP1.write(Port::Command::GP1::SetDisplayState(Port::DisplayState::On));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue