Jasper v. Blanckenburg 698c6a24c4 [WIP] SDC screen
This hasn't really been tested yet and sometimes looks weird.
2023-11-18 14:48:13 +01:00

185 lines
8.3 KiB
C++

/* DO NOT EDIT THIS FILE */
/* This file is autogenerated by the text-database code generator */
#include <stdarg.h>
#include <touchgfx/TextProvider.hpp>
#include <touchgfx/Texts.hpp>
#include <touchgfx/TypedText.hpp>
#include <touchgfx/Unicode.hpp>
#include <touchgfx/hal/HAL.hpp>
#include <touchgfx/lcd/LCD.hpp>
#include <texts/TypedTextDatabase.hpp>
uint16_t touchgfx::Font::getStringWidth(const touchgfx::Unicode::UnicodeChar* text, ...) const
{
va_list pArg;
va_start(pArg, text);
uint16_t width = getStringWidthLTR(TEXT_DIRECTION_LTR, text, pArg);
va_end(pArg);
return width;
}
uint16_t touchgfx::Font::getStringWidth(touchgfx::TextDirection textDirection, const touchgfx::Unicode::UnicodeChar* text, ...) const
{
va_list pArg;
va_start(pArg, text);
uint16_t width = getStringWidthLTR(textDirection, text, pArg);
va_end(pArg);
return width;
}
touchgfx::Unicode::UnicodeChar touchgfx::TextProvider::getNextLigature(TextDirection direction)
{
if (fontGsubTable && nextCharacters.peekChar())
{
substituteGlyphs();
if (nextCharacters.peekChar(1) == 0x093F) // Hindi I-matra
{
nextCharacters.replaceAt1(nextCharacters.peekChar());
nextCharacters.replaceAt0(0x093F);
}
}
return getNextChar();
}
void touchgfx::TextProvider::initializeInternal()
{
fillInputBuffer();
}
void touchgfx::LCD::drawString(touchgfx::Rect widgetArea, const touchgfx::Rect& invalidatedArea, const touchgfx::LCD::StringVisuals& stringVisuals, const touchgfx::Unicode::UnicodeChar* format, ...)
{
va_list pArg;
va_start(pArg, format);
drawStringLTR(widgetArea, invalidatedArea, stringVisuals, format, pArg);
va_end(pArg);
}
// Default TypedTextDatabase
extern const touchgfx::TypedText::TypedTextData* const typedTextDatabaseArray[];
TEXT_LOCATION_FLASH_PRAGMA
KEEP extern const touchgfx::Unicode::UnicodeChar texts_all_languages[] TEXT_LOCATION_FLASH_ATTRIBUTE = {
0x44, 0x41, 0x53, 0x48, 0xa, 0x42, 0x4f, 0x54, 0x53, 0xa, 0x49, 0x4e, 0x45, 0x52, 0x54, 0x49, 0x41, 0x0, // @0 "DASH\nBOTS\nINERTIA"
0x43, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x20, 0x61, 0x20, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x0, // @18 "Choose a mission"
0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x21, 0x0, // @35 "Invalid Mission!"
0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x0, // @52 "Invalid Mission"
0x50, 0x72, 0x65, 0x73, 0x73, 0x75, 0x72, 0x65, 0x20, 0x41, 0x63, 0x63, 0x20, 0x41, 0x3a, 0x0, // @68 "Pressure Acc A:"
0x50, 0x72, 0x65, 0x73, 0x73, 0x75, 0x72, 0x65, 0x20, 0x41, 0x63, 0x63, 0x20, 0x42, 0x3a, 0x0, // @84 "Pressure Acc B:"
0x50, 0x72, 0x65, 0x73, 0x73, 0x75, 0x72, 0x65, 0x20, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x3a, 0x0, // @100 "Pressure Front:"
0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x20, 0x44, 0x72, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x0, // @116 "Manual Driving"
0x50, 0x72, 0x65, 0x73, 0x73, 0x75, 0x72, 0x65, 0x20, 0x52, 0x65, 0x61, 0x72, 0x3a, 0x0, // @131 "Pressure Rear:"
0x41, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0, // @146 "Acceleration"
0x53, 0x44, 0x42, 0xa, 0x52, 0x45, 0x53, 0xa, 0x53, 0x44, 0x43, 0x4c, 0x0, // @159 "SDB\nRES\nSDCL"
0x41, 0x53, 0x20, 0x2, 0x0, // @172 "AS <>"
0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x0, // @177 "Inspection"
0x50, 0x41, 0x52, 0x41, 0x4d, 0x45, 0x54, 0x45, 0x52, 0x53, 0x0, // @188 "PARAMETERS"
0x54, 0x72, 0x61, 0x63, 0x6b, 0x64, 0x72, 0x69, 0x76, 0x65, 0x0, // @199 "Trackdrive"
0x41, 0x4d, 0x53, 0x20, 0x45, 0x72, 0x72, 0x4f, 0x72, 0x0, // @210 "AMS ErrOr"
0x41, 0x75, 0x74, 0x6f, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x0, // @220 "Autocross"
0x50, 0x52, 0x45, 0x43, 0x48, 0x41, 0x52, 0x47, 0x45, 0x0, // @230 "PRECHARGE"
0x2, 0x25, 0x0, // @240 "<>%"
0x42, 0x53, 0x50, 0x44, 0xa, 0x48, 0x56, 0x44, 0x0, // @243 "BSPD\nHVD"
0x45, 0x42, 0x53, 0x20, 0x54, 0x65, 0x73, 0x74, 0x0, // @252 "EBS Test"
0x41, 0x53, 0x53, 0x54, 0x41, 0x54, 0x45, 0x0, // @261 "ASSTATE"
0x44, 0x53, 0x50, 0x45, 0x45, 0x44, 0x3a, 0x0, // @269 "DSPEED:"
0x49, 0x43, 0x53, 0x54, 0x41, 0x54, 0x45, 0x0, // @277 "ICSTATE"
0x49, 0x4e, 0x56, 0x4c, 0x52, 0x44, 0x59, 0x0, // @285 "INVLRDY"
0x49, 0x4e, 0x56, 0x52, 0x52, 0x44, 0x59, 0x0, // @293 "INVRRDY"
0x4d, 0x49, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x0, // @301 "MISSION"
0x4d, 0x53, 0x50, 0x45, 0x45, 0x44, 0x3a, 0x0, // @309 "MSPEED:"
0x52, 0x32, 0x44, 0x50, 0x52, 0x4f, 0x47, 0x0, // @317 "R2DPROG"
0x53, 0x6b, 0x69, 0x64, 0x70, 0x61, 0x64, 0x0, // @325 "Skidpad"
0x54, 0x53, 0x53, 0x54, 0x41, 0x54, 0x45, 0x0, // @333 "TSSTATE"
0x42, 0x52, 0x41, 0x4b, 0x45, 0x53, 0x0, // @341 "BRAKES"
0x54, 0x53, 0x56, 0x42, 0x41, 0x54, 0x0, // @348 "TSVBAT"
0x54, 0x53, 0x56, 0x56, 0x45, 0x48, 0x0, // @355 "TSVVEH"
0xa, 0xa, 0x41, 0x4d, 0x53, 0x0, // @362 "\n\nAMS"
0xa, 0xa, 0x49, 0x4d, 0x44, 0x0, // @368 "\n\nIMD"
0xa, 0xa, 0x50, 0x44, 0x55, 0x0, // @374 "\n\nPDU"
0x44, 0x41, 0x4e, 0x47, 0x3a, 0x0, // @380 "DANG:"
0x45, 0x52, 0x52, 0x4f, 0x52, 0x0, // @386 "ERROR"
0x4c, 0x56, 0x53, 0x4f, 0x43, 0x0, // @392 "LVSOC"
0x4d, 0x41, 0x4e, 0x47, 0x3a, 0x0, // @398 "MANG:"
0x53, 0x50, 0x45, 0x45, 0x44, 0x0, // @404 "SPEED"
0x54, 0x53, 0x53, 0x4f, 0x43, 0x0, // @410 "TSSOC"
0x42, 0x42, 0x41, 0x4c, 0x0, // @416 "BBAL"
0x49, 0x4e, 0x49, 0x54, 0x0, // @421 "INIT"
0x4c, 0x41, 0x50, 0x53, 0x0, // @426 "LAPS"
0x54, 0x4d, 0x41, 0x58, 0x0, // @431 "TMAX"
0x54, 0x53, 0x4d, 0x53, 0x0, // @436 "TSMS"
0x54, 0x54, 0x46, 0x4c, 0x0, // @441 "TTFL"
0x54, 0x54, 0x46, 0x52, 0x0, // @446 "TTFR"
0x54, 0x54, 0x52, 0x4c, 0x0, // @451 "TTRL"
0x54, 0x54, 0x52, 0x52, 0x0, // @456 "TTRR"
0x56, 0x4d, 0x49, 0x4e, 0x0, // @461 "VMIN"
0x41, 0x43, 0x43, 0x0, // @466 "ACC"
0x49, 0x4e, 0x56, 0x0, // @470 "INV"
0x49, 0x54, 0x53, 0x0, // @474 "ITS"
0x52, 0x32, 0x44, 0x0, // @478 "R2D"
0x53, 0x43, 0x53, 0x0, // @482 "SCS"
0x53, 0x44, 0x43, 0x0, // @486 "SDC"
0x4c, 0x56, 0x0 // @490 "LV"
};
TEXT_LOCATION_FLASH_PRAGMA
KEEP extern const uint32_t indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE;
// Array holding dynamically installed languages
struct TranslationHeader
{
uint32_t offset_to_texts;
uint32_t offset_to_indices;
uint32_t offset_to_typedtext;
};
static const TranslationHeader* languagesArray[1] = { 0 };
// Compiled and linked in languages
static const uint32_t* const staticLanguageIndices[] = {
indicesGb
};
touchgfx::LanguageId touchgfx::Texts::currentLanguage = static_cast<touchgfx::LanguageId>(0);
static const touchgfx::Unicode::UnicodeChar* currentLanguagePtr = 0;
static const uint32_t* currentLanguageIndices = 0;
void touchgfx::Texts::setLanguage(touchgfx::LanguageId id)
{
const touchgfx::TypedText::TypedTextData* currentLanguageTypedText = 0;
if (id < 1)
{
if (languagesArray[id] != 0)
{
// Dynamic translation is added
const TranslationHeader* translation = languagesArray[id];
currentLanguagePtr = (const touchgfx::Unicode::UnicodeChar*)(((const uint8_t*)translation) + translation->offset_to_texts);
currentLanguageIndices = (const uint32_t*)(((const uint8_t*)translation) + translation->offset_to_indices);
currentLanguageTypedText = (const touchgfx::TypedText::TypedTextData*)(((const uint8_t*)translation) + translation->offset_to_typedtext);
}
else
{
// Compiled and linked in languages
currentLanguagePtr = texts_all_languages;
currentLanguageIndices = staticLanguageIndices[id];
currentLanguageTypedText = typedTextDatabaseArray[id];
}
}
if (currentLanguageTypedText)
{
currentLanguage = id;
touchgfx::TypedText::registerTypedTextDatabase(currentLanguageTypedText,
TypedTextDatabase::getFonts(), TypedTextDatabase::getInstanceSize());
}
}
void touchgfx::Texts::setTranslation(touchgfx::LanguageId id, const void* translation)
{
languagesArray[id] = (const TranslationHeader*)translation;
}
const touchgfx::Unicode::UnicodeChar* touchgfx::Texts::getText(TypedTextId id) const
{
return &currentLanguagePtr[currentLanguageIndices[id]];
}