mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Creating my own font table for the OLED
This commit is contained in:
@@ -15,9 +15,8 @@
|
||||
#include "Bios.h"
|
||||
#include "I2C.h"
|
||||
#include "Hardware.h"
|
||||
|
||||
#include "UI.h"
|
||||
|
||||
#include "Font.h"
|
||||
|
||||
//Setup params depending on oled model
|
||||
#ifdef SSD1316
|
||||
@@ -37,8 +36,7 @@ u8 gOled_param[46] = { 0x80, 0xAE, 0x80, 0xD5, 0x80, 0x52, 0x80, 0xA8, 0x80,
|
||||
/*******************************************************************************
|
||||
|
||||
*******************************************************************************/
|
||||
void Sc_Pt(u8 Co)
|
||||
{
|
||||
void Sc_Pt(u8 Co) {
|
||||
u8 pt[4] = { 0x80, 0x81, 0x80, Co };
|
||||
|
||||
I2C_PageWrite(pt, 4, DEVICEADDR_OLED);
|
||||
@@ -154,7 +152,7 @@ void Init_Oled(void) {
|
||||
u8 param_len;
|
||||
|
||||
OLED_RST();
|
||||
Delay_Ms(2);
|
||||
Delay_Ms(2); //reset the oled
|
||||
OLED_ACT();
|
||||
Delay_Ms(2);
|
||||
|
||||
@@ -178,7 +176,7 @@ void Clear_Screen(void) {
|
||||
#ifdef SSD1316
|
||||
wd = 32;
|
||||
#else
|
||||
wd = 16;
|
||||
wd = 16; //how many lines the display is
|
||||
#endif
|
||||
|
||||
memset(&tx_data[0], 0, 128);
|
||||
@@ -186,7 +184,22 @@ void Clear_Screen(void) {
|
||||
Oled_DrawArea(0, i * 8, 128, 8, tx_data);
|
||||
}
|
||||
}
|
||||
void OLED_DrawString(char* string, uint8_t length) {
|
||||
for (uint8_t i = 0; i < length; i++) {
|
||||
OLED_DrawChar(string[i], i * 16);
|
||||
}
|
||||
}
|
||||
void OLED_DrawChar(char c, uint8_t x) {
|
||||
if ((x) > 112)
|
||||
return; //Rudimentary clipping to not draw off screen
|
||||
u8* ptr;
|
||||
u8 temp;
|
||||
|
||||
|
||||
if (c >= 'A' && c <= 'Z') {
|
||||
ptr = (u8*) FONT;
|
||||
ptr += (c - 'A') * 32;
|
||||
Oled_DrawArea(x, 0, 16, 16, (u8*) ptr);
|
||||
}
|
||||
}
|
||||
/******************************** END OF FILE *********************************/
|
||||
|
||||
|
||||
@@ -632,10 +632,8 @@ void Show_HeatingIcon(u32 ht_flag, u16 active) {
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Display_Str
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ʾ16*16<31>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:x: λ<><CEBB> str :<3A><>ʾ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
<20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>:NULL
|
||||
Function:Display_Str
|
||||
Description: Draws certain chars to the screen at certain locations
|
||||
*******************************************************************************/
|
||||
void Display_Str(u8 x, char* str) {
|
||||
u8* ptr;
|
||||
@@ -655,7 +653,7 @@ void Display_Str(u8 x, char* str) {
|
||||
if ((temp >= 0x30) && (temp < 0x3a))
|
||||
temp = temp - 0x30; /* 0 --9 */
|
||||
else {
|
||||
if ((temp >= 0x41) && (temp <= 0x46))
|
||||
if ((temp >= 0x41) && (temp <= 0x47))
|
||||
temp = temp - 0x41 + 11;/*ABD*/
|
||||
else
|
||||
return;
|
||||
@@ -914,12 +912,12 @@ void OLed_Display(void) {
|
||||
}
|
||||
|
||||
Display_Temp(1,temp_val/10);
|
||||
Show_HeatingIcon(ht_flag,Get_MmaActive()); //0<><30><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD>
|
||||
Show_HeatingIcon(ht_flag,Get_MmaActive());
|
||||
td_cnt++;
|
||||
}
|
||||
break;
|
||||
case TEMP_SET:
|
||||
Temp_SetProc(); //<2F><><EFBFBD><EFBFBD>
|
||||
Temp_SetProc();
|
||||
break;
|
||||
case USB_POWER:
|
||||
if(gCont == 1) {
|
||||
@@ -1015,10 +1013,10 @@ void OLed_Display(void) {
|
||||
}
|
||||
break;
|
||||
case SETTINGS_MENU:
|
||||
//We are in the menu structure.
|
||||
//We need to move through the selected menu items, or if the user has hit the EOL then jump back to IDLE
|
||||
//We are in the menu structure.
|
||||
//We need to move through the selected menu items, or if the user has hit the EOL then jump back to IDLE
|
||||
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user