mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[ion] Add a Display::waitForVBlank method
Change-Id: Ie744ec4a73eeb7c2d7c549fd7f47ff4c74aab5ee
This commit is contained in:
@@ -21,6 +21,8 @@ void pushRect(KDRect r, const KDColor * pixels);
|
||||
void pushRectUniform(KDRect r, KDColor c);
|
||||
void pullRect(KDRect r, KDColor * pixels);
|
||||
|
||||
void waitForVBlank();
|
||||
|
||||
constexpr int Width = 320;
|
||||
constexpr int Height = 240;
|
||||
|
||||
|
||||
@@ -31,6 +31,18 @@ void pullRect(KDRect r, KDColor * pixels) {
|
||||
Device::pullPixels(pixels, r.width()*r.height());
|
||||
}
|
||||
|
||||
void waitForVBlank() {
|
||||
// We want to return as soon as the TE line is transitionning from "DOWN" to "UP"
|
||||
while (Device::TearingEffectPin.group().IDR()->get(Device::TearingEffectPin.pin())) {
|
||||
// Loop while high, exit when low
|
||||
// Wait for zero
|
||||
}
|
||||
while (!Device::TearingEffectPin.group().IDR()->get(Device::TearingEffectPin.pin())) {
|
||||
// Loop while low, exit when high
|
||||
}
|
||||
// Here, we went from low to high
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +81,10 @@ void initGPIO() {
|
||||
ResetPin.group().MODER()->setMode(ResetPin.pin(), GPIO::MODER::Mode::Output);
|
||||
ResetPin.group().ODR()->set(ResetPin.pin(), true);
|
||||
|
||||
// Turn on the Tearing Effect pin
|
||||
TearingEffectPin.group().MODER()->setMode(TearingEffectPin.pin(), GPIO::MODER::Mode::Input);
|
||||
TearingEffectPin.group().PUPDR()->setPull(TearingEffectPin.pin(), GPIO::PUPDR::Pull::None);
|
||||
|
||||
msleep(120);
|
||||
}
|
||||
|
||||
@@ -86,6 +102,8 @@ void shutdownGPIO() {
|
||||
|
||||
PowerPin.group().MODER()->setMode(PowerPin.pin(), GPIO::MODER::Mode::Analog);
|
||||
PowerPin.group().PUPDR()->setPull(PowerPin.pin(), GPIO::PUPDR::Pull::None);
|
||||
|
||||
TearingEffectPin.group().MODER()->setMode(TearingEffectPin.pin(), GPIO::MODER::Mode::Analog);
|
||||
}
|
||||
|
||||
void initFSMC() {
|
||||
@@ -173,6 +191,7 @@ void initPanel() {
|
||||
|
||||
SEND_COMMAND(PixelFormatSet, 0x05);
|
||||
SEND_COMMAND(MemoryAccessControl, 0xA0);
|
||||
SEND_COMMAND(TearingEffectLineOn, 0x00);
|
||||
|
||||
*CommandAddress = Command::DisplayOn;
|
||||
//msleep(50);
|
||||
|
||||
@@ -64,6 +64,7 @@ enum class Command : uint16_t {
|
||||
PageAddressSet = 0x2B,
|
||||
MemoryWrite = 0x2C,
|
||||
MemoryRead = 0x2E,
|
||||
TearingEffectLineOn = 0x35,
|
||||
MemoryAccessControl = 0x36,
|
||||
PixelFormatSet = 0x3A,
|
||||
};
|
||||
@@ -79,6 +80,7 @@ constexpr static GPIOPin FSMCPins[] = {
|
||||
|
||||
constexpr static GPIOPin PowerPin = GPIOPin(GPIOB, 14);
|
||||
constexpr static GPIOPin ResetPin = GPIOPin(GPIOE, 9);
|
||||
constexpr static GPIOPin TearingEffectPin = GPIOPin(GPIOB, 10);
|
||||
|
||||
constexpr static int FSMCMemoryBank = 1;
|
||||
constexpr static int FSMCDataCommandAddressBit = 16;
|
||||
|
||||
@@ -58,6 +58,9 @@ void Ion::Display::pullRect(KDRect r, KDColor * pixels) {
|
||||
sFrameBuffer->pullRect(r, pixels);
|
||||
}
|
||||
|
||||
void Ion::Display::waitForVBlank() {
|
||||
}
|
||||
|
||||
Ion::Keyboard::State Ion::Keyboard::scan() {
|
||||
Ion::Keyboard::State result = 0;
|
||||
for (int i=0; i<Ion::Keyboard::NumberOfKeys; i++) {
|
||||
|
||||
Reference in New Issue
Block a user