mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
@@ -23,7 +23,7 @@ extern const char SettingRightChar;
|
||||
extern const char SettingLeftChar;
|
||||
extern const char SettingAutoChar;
|
||||
|
||||
//#define LANG_EN
|
||||
#define LANG_EN
|
||||
//#define LANG_RU
|
||||
//#define LANG_ES
|
||||
//#define LANG_SE
|
||||
|
||||
@@ -63,7 +63,8 @@ void OLED::initialize() {
|
||||
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
|
||||
HAL_Delay(5);
|
||||
//Send the setup settings
|
||||
HAL_I2C_Master_Transmit(i2c, DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, configLength, 0xFFFF);
|
||||
HAL_I2C_Master_Transmit(i2c, DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array,
|
||||
configLength, 0xFFFF);
|
||||
//displayOnOff(true);
|
||||
|
||||
}
|
||||
@@ -73,9 +74,9 @@ void OLED::refresh() {
|
||||
screenBuffer[0] = 0x80;
|
||||
screenBuffer[1] = 0x21;
|
||||
screenBuffer[2] = 0x80;
|
||||
screenBuffer[3] = inLeftHandedMode ? 0 : 32; //display is shifted by 32 in left handed mode as driver ram is 128 wide
|
||||
screenBuffer[3] = inLeftHandedMode ? 0 : 32; //display is shifted by 32 in left handed mode as driver ram is 128 wide
|
||||
screenBuffer[4] = 0x80;
|
||||
screenBuffer[5] = inLeftHandedMode ? 95 : 0x7F; //End address of the ram segment we are writing to (96 wide)
|
||||
screenBuffer[5] = inLeftHandedMode ? 95 : 0x7F; //End address of the ram segment we are writing to (96 wide)
|
||||
|
||||
screenBuffer[6] = 0x80; //Set pages to rollover after 2
|
||||
screenBuffer[7] = 0x22;
|
||||
@@ -88,7 +89,8 @@ void OLED::refresh() {
|
||||
taskENTER_CRITICAL();
|
||||
//Because I2C is shared, we cant task switch in the middle of the xfer
|
||||
|
||||
HAL_I2C_Master_Transmit(i2c, DEVICEADDR_OLED, screenBuffer, 12 + 96 * 2 + 1, 0xFFFF);
|
||||
HAL_I2C_Master_Transmit(i2c, DEVICEADDR_OLED, screenBuffer, 12 + 96 * 2 + 1,
|
||||
0xFFFF);
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
}
|
||||
@@ -99,42 +101,49 @@ void OLED::refresh() {
|
||||
* Precursor is the command char that is used to select the table.
|
||||
*/
|
||||
void OLED::drawChar(char c, char PrecursorCommand) {
|
||||
if (c < ' ') {
|
||||
return;
|
||||
}
|
||||
if (c < ' ') {
|
||||
return;
|
||||
}
|
||||
|
||||
//We are left with
|
||||
uint8_t* charPointer;
|
||||
//We are left with
|
||||
uint8_t* charPointer;
|
||||
|
||||
uint16_t index = 0;
|
||||
if (PrecursorCommand == 0) {
|
||||
//Fonts are offset to start at the space char
|
||||
index = (c - ' ');
|
||||
}
|
||||
else {
|
||||
//This is for extended range
|
||||
//We decode the precursor command to find the offset
|
||||
//Latin starts at 96
|
||||
c -= 0x80;
|
||||
uint16_t index = 0;
|
||||
if (PrecursorCommand == 0) {
|
||||
//Fonts are offset to start at the space char
|
||||
index = (c - ' ');
|
||||
} else {
|
||||
//This is for extended range
|
||||
//We decode the precursor command to find the offset
|
||||
//Latin starts at 96
|
||||
c -= 0x80;
|
||||
|
||||
switch (PrecursorCommand) {
|
||||
switch (PrecursorCommand) {
|
||||
|
||||
case 0xC2: index = (96 - 32) + (c); break; //-32 compensate for chars excluded from font C2 section
|
||||
case 0xC3: index = (128) + (c); break;
|
||||
case 0xD0: index = (192) + (c); break;
|
||||
case 0xD1: index = (256) + (c); break;
|
||||
case 0xC2:
|
||||
index = (96 - 32) + (c);
|
||||
break; //-32 compensate for chars excluded from font C2 section
|
||||
case 0xC3:
|
||||
index = (128) + (c);
|
||||
break;
|
||||
case 0xD0:
|
||||
index = (192) + (c);
|
||||
break;
|
||||
case 0xD1:
|
||||
index = (256) + (c);
|
||||
break;
|
||||
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
charPointer = ((uint8_t*) currentFont) + ((fontWidth * (fontHeight / 8)) * index);
|
||||
charPointer = ((uint8_t*) currentFont)
|
||||
+ ((fontWidth * (fontHeight / 8)) * index);
|
||||
|
||||
if (cursor_x >= 0 && cursor_x < 96) {
|
||||
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
|
||||
}
|
||||
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
|
||||
|
||||
cursor_x += fontWidth;
|
||||
cursor_x += fontWidth;
|
||||
}
|
||||
|
||||
void OLED::displayOnOff(bool on) {
|
||||
@@ -165,7 +174,8 @@ void OLED::setRotation(bool leftHanded) {
|
||||
}
|
||||
taskENTER_CRITICAL();
|
||||
|
||||
HAL_I2C_Master_Transmit(i2c, DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, 50, 0xFFFF);
|
||||
HAL_I2C_Master_Transmit(i2c, DEVICEADDR_OLED,
|
||||
(uint8_t*) OLED_Setup_Array, 50, 0xFFFF);
|
||||
taskEXIT_CRITICAL();
|
||||
inLeftHandedMode = leftHanded;
|
||||
}
|
||||
@@ -257,26 +267,31 @@ void OLED::drawBattery(uint8_t state) {
|
||||
void OLED::drawSymbol(uint8_t symbolID) {
|
||||
//draw a symbol to the current cursor location
|
||||
setFont(2);
|
||||
drawChar(' ' + symbolID); // space offset is in all fonts, so we pad it here and remove it later
|
||||
drawChar(' ' + symbolID); // space offset is in all fonts, so we pad it here and remove it later
|
||||
setFont(0);
|
||||
}
|
||||
|
||||
//Draw an area, but y must be aligned on 0/8 offset
|
||||
void OLED::drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t* ptr) {
|
||||
void OLED::drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
|
||||
const uint8_t* ptr) {
|
||||
// Splat this from x->x+wide in two strides
|
||||
if (x < 0)
|
||||
return; //cutoffleft
|
||||
if ((x + wide) > 96)
|
||||
if ((x) > 96)
|
||||
return; //cutoff right
|
||||
uint8_t width = wide;
|
||||
if ((x + wide) > 96)
|
||||
width = 96 - x; // trimming to draw partials
|
||||
|
||||
if (y == 0) {
|
||||
//Splat first line of data
|
||||
for (uint8_t xx = 0; xx < (wide); xx++) {
|
||||
for (uint8_t xx = 0; xx < (width); xx++) {
|
||||
firstStripPtr[xx + x] = ptr[xx];
|
||||
}
|
||||
}
|
||||
if (y == 8 || height == 16) {
|
||||
// Splat the second line
|
||||
for (uint8_t xx = 0; xx < wide; xx++) {
|
||||
for (uint8_t xx = 0; xx < width; xx++) {
|
||||
secondStripPtr[x + xx] = ptr[xx + (height == 16 ? wide : 0)];
|
||||
|
||||
}
|
||||
|
||||
@@ -314,7 +314,8 @@ static void gui_settingsMenu() {
|
||||
settingsResetRequest = false;
|
||||
bool earlyExit = false;
|
||||
uint32_t descriptionStart = 0;
|
||||
while ((settingsMenu[currentScreen].incrementHandler.func != NULL) && earlyExit == false) {
|
||||
while ((settingsMenu[currentScreen].incrementHandler.func != NULL)
|
||||
&& earlyExit == false) {
|
||||
lcd.setFont(0);
|
||||
lcd.clearScreen();
|
||||
lcd.setCursor(0, 0);
|
||||
@@ -331,9 +332,9 @@ static void gui_settingsMenu() {
|
||||
descriptionStart = HAL_GetTick();
|
||||
|
||||
int16_t descriptionOffset = (((HAL_GetTick() - descriptionStart)
|
||||
/ 150) % maxOffset);
|
||||
/ 10) % (maxOffset * 12));
|
||||
//^ Rolling offset based on time
|
||||
lcd.setCursor(12 * (7 - descriptionOffset), 0);
|
||||
lcd.setCursor(((7 * 12) - descriptionOffset), 0);
|
||||
lcd.print(settingsMenu[currentScreen].description);
|
||||
}
|
||||
|
||||
@@ -376,7 +377,7 @@ static void gui_settingsMenu() {
|
||||
}
|
||||
|
||||
lcd.refresh(); //update the LCD
|
||||
GUIDelay();
|
||||
osDelay(20);
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
|
||||
}
|
||||
|
||||
@@ -124,12 +124,12 @@
|
||||
<configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.release.723264573" name="Release" parent="fr.ac6.managedbuild.config.gnu.cross.exe.release" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary "${BuildArtifactFileBaseName}.elf" "${BuildArtifactFileBaseName}.bin"; arm-none-eabi-size -B "${BuildArtifactFileName}" ;arm-none-eabi-objcopy -O ihex "${BuildArtifactFileBaseName}.elf" "${BuildArtifactFileBaseName}.hex"">
|
||||
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.release.723264573." name="/" resourcePath="">
|
||||
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release.1456567544" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release">
|
||||
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.67332574" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" value="STM32F103T8Ux" valueType="string"/>
|
||||
<option id="fr.ac6.managedbuild.option.gnu.cross.board.1570943989" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board" value="ts100" valueType="string"/>
|
||||
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.67332574" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" useByScannerDiscovery="false" value="STM32F103T8Ux" valueType="string"/>
|
||||
<option id="fr.ac6.managedbuild.option.gnu.cross.board.1570943989" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board" useByScannerDiscovery="false" value="ts100" valueType="string"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross.793444160" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder buildPath="${workspace_loc:/TS100}/Release" id="fr.ac6.managedbuild.builder.gnu.cross.548236022" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="fr.ac6.managedbuild.builder.gnu.cross"/>
|
||||
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.1363306495" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.1100266163" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.more" valueType="enumerated"/>
|
||||
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.1100266163" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.size" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.debugging.level.2139237845" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.include.paths.1770182855" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/inc""/>
|
||||
@@ -154,7 +154,7 @@
|
||||
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.1210653460" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
|
||||
</tool>
|
||||
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.1414722294" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.1489744363" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.cpp.optimization.level.more" valueType="enumerated"/>
|
||||
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.1489744363" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.cpp.optimization.level.size" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.debugging.level.641509376" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.include.paths.105977434" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/inc""/>
|
||||
@@ -188,7 +188,7 @@
|
||||
</tool>
|
||||
<tool id="fr.ac6.managedbuild.tool.gnu.archiver.907512577" name="MCU GCC Archiver" superClass="fr.ac6.managedbuild.tool.gnu.archiver"/>
|
||||
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.1906472572" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler">
|
||||
<option id="gnu.both.asm.option.include.paths.1277819409" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
|
||||
<option id="gnu.both.asm.option.include.paths.1277819409" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/CMSIS/core""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/CMSIS/device""/>
|
||||
|
||||
Reference in New Issue
Block a user