mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[ion/device/flasher] Pimp my flasher (light & verbose) (#27)
This commit is contained in:
committed by
GitHub
parent
15c96cefa6
commit
efda561425
@@ -1,10 +1,16 @@
|
||||
#include <ion.h>
|
||||
#include <kandinsky.h>
|
||||
|
||||
namespace Flasher {
|
||||
namespace Display {
|
||||
|
||||
void init() {
|
||||
Ion::Display::pushRectUniform(KDRect(0,0,Ion::Display::Width,Ion::Display::Height), KDColor::RGB24(0xFFFF00));
|
||||
KDRect screen = KDRect(0,0,Ion::Display::Width,Ion::Display::Height);
|
||||
Ion::Display::pushRectUniform(KDRect(0,0,Ion::Display::Width,Ion::Display::Height), KDColor::RGB24(0x5e81ac));
|
||||
KDContext * ctx = KDIonContext::sharedContext();
|
||||
ctx->setOrigin(KDPointZero);
|
||||
ctx->setClippingRect(screen);
|
||||
ctx->drawString("RECOVERY MODE", KDPoint(10, 10), KDFont::LargeFont, KDColorWhite, KDColor::RGB24(0x5e81ac));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,47 +1,55 @@
|
||||
#include <ion.h>
|
||||
#include <kandinsky.h>
|
||||
#include "image.h"
|
||||
|
||||
namespace Flasher {
|
||||
namespace Display {
|
||||
namespace Display {
|
||||
|
||||
constexpr static int sNumberOfMessages = 5;
|
||||
constexpr static int sNumberOfLanguages = 2;
|
||||
constexpr static int sNumberOfMessages = 5;
|
||||
|
||||
constexpr static const char * sMessages[sNumberOfLanguages][sNumberOfMessages] = {
|
||||
{"RECOVERY MODE",
|
||||
"Your calculator is waiting",
|
||||
"for a new software.",
|
||||
"Follow the instructions",
|
||||
"on your computer to continue."},
|
||||
{"MODE RECUPERATION",
|
||||
"Votre calculatrice attend",
|
||||
"l'installation d'un nouveau logiciel.",
|
||||
"Suivez les instructions sur",
|
||||
"votre ordinateur pour continuer."}
|
||||
};
|
||||
constexpr static const char * sMessages[sNumberOfMessages] = {
|
||||
"RECOVERY MODE",
|
||||
"Your calculator is waiting",
|
||||
"for Upsilon to be installed.",
|
||||
"Follow the instructions",
|
||||
"on your computer to continue.",
|
||||
};
|
||||
|
||||
void init() {
|
||||
KDRect screen = KDRect(0,0,Ion::Display::Width,Ion::Display::Height);
|
||||
Ion::Display::pushRectUniform(screen, KDColor::RGB24(0x2B2B2B));
|
||||
KDContext * ctx = KDIonContext::sharedContext();
|
||||
ctx->setOrigin(KDPointZero);
|
||||
ctx->setClippingRect(screen);
|
||||
KDCoordinate margin = 30;
|
||||
KDCoordinate currentHeight = margin;
|
||||
|
||||
/* Title */
|
||||
const char * title = sMessages[0];
|
||||
KDSize titleSize = KDFont::LargeFont->stringSize(title);
|
||||
ctx->drawString(title, KDPoint((Ion::Display::Width-titleSize.width())/2, currentHeight),
|
||||
KDFont::LargeFont, KDColorWhite, KDColor::RGB24(0x2B2B2B));
|
||||
currentHeight = (uint16_t)((Ion::Display::Height*2)/3);
|
||||
|
||||
/* Logo */
|
||||
for (int i = 0; i < IMAGE_WIDTH; ++i) {
|
||||
for (int j = 0; j < IMAGE_HEIGHT; ++j) {
|
||||
ctx->setPixel(KDPoint(i+(uint16_t)((Ion::Display::Width-IMAGE_WIDTH)/2),
|
||||
j+(titleSize.height()+margin+15)),
|
||||
KDColor::RGB16(image[i+(j*IMAGE_WIDTH)]));
|
||||
}
|
||||
}
|
||||
|
||||
/* Messages */
|
||||
const char * message;
|
||||
for (int i = 1; i < sNumberOfMessages; ++i) {
|
||||
message = sMessages[i];
|
||||
KDSize messageSize = KDFont::SmallFont->stringSize(message);
|
||||
ctx->drawString(message, KDPoint((Ion::Display::Width-messageSize.width())/2, currentHeight),
|
||||
KDFont::SmallFont, KDColorWhite, KDColor::RGB24(0x2B2B2B));
|
||||
currentHeight += messageSize.height();
|
||||
}
|
||||
}
|
||||
|
||||
void init() {
|
||||
KDRect screen = KDRect(0,0,Ion::Display::Width,Ion::Display::Height);
|
||||
Ion::Display::pushRectUniform(screen, KDColorWhite);
|
||||
KDContext * ctx = KDIonContext::sharedContext();
|
||||
ctx->setOrigin(KDPointZero);
|
||||
ctx->setClippingRect(screen);
|
||||
KDCoordinate margin = 20;
|
||||
KDCoordinate currentHeight = 0;
|
||||
for (int i = 0; i < sNumberOfLanguages; i++) {
|
||||
currentHeight += margin;
|
||||
const char * title = sMessages[i][0];
|
||||
KDSize titleSize = KDFont::LargeFont->stringSize(title);
|
||||
ctx->drawString(title, KDPoint((Ion::Display::Width-titleSize.width())/2, currentHeight), KDFont::LargeFont);
|
||||
currentHeight += 2*titleSize.height();
|
||||
for (int j = 1; j < sNumberOfMessages; j++) {
|
||||
const char * message = sMessages[i][j];
|
||||
KDSize messageSize = KDFont::SmallFont->stringSize(message);
|
||||
ctx->drawString(message, KDPoint((Ion::Display::Width-messageSize.width())/2, currentHeight), KDFont::SmallFont);
|
||||
currentHeight += messageSize.height();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
11
ion/src/device/flasher/image.h
Normal file
11
ion/src/device/flasher/image.h
Normal file
File diff suppressed because one or more lines are too long
@@ -22,7 +22,11 @@ MEMORY {
|
||||
* object). Using a stack too small would result in some memory being
|
||||
* overwritten (for instance, vtables that live in the .rodata section). */
|
||||
|
||||
STACK_SIZE = 32K;
|
||||
/* The image is quite large too!
|
||||
* So we put the stack to 18K so there's still space
|
||||
* for our image, if not LD will throw an error. */
|
||||
|
||||
STACK_SIZE = 18K;
|
||||
|
||||
SECTIONS {
|
||||
.isr_vector_table ORIGIN(RAM_BUFFER) : {
|
||||
|
||||
Reference in New Issue
Block a user