From c7e271300482e1acb0fd36b330542df565471c50 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sat, 17 Sep 2016 21:13:15 +1000 Subject: [PATCH] Creating my own font table for the OLED --- .../ts100/.settings/language.settings.xml | 4 +- workspace/ts100/inc/Font.h | 67 +++++++++++++ workspace/ts100/inc/Oled.h | 4 + workspace/ts100/inc/WordLib.h | 93 +++++++------------ workspace/ts100/src/Oled.c | 27 ++++-- workspace/ts100/src/UI.c | 18 ++-- 6 files changed, 132 insertions(+), 81 deletions(-) create mode 100644 workspace/ts100/inc/Font.h diff --git a/workspace/ts100/.settings/language.settings.xml b/workspace/ts100/.settings/language.settings.xml index 9cc48e9a..1f3b00e2 100644 --- a/workspace/ts100/.settings/language.settings.xml +++ b/workspace/ts100/.settings/language.settings.xml @@ -6,7 +6,7 @@ - + @@ -18,7 +18,7 @@ - + diff --git a/workspace/ts100/inc/Font.h b/workspace/ts100/inc/Font.h new file mode 100644 index 00000000..7adb60b9 --- /dev/null +++ b/workspace/ts100/inc/Font.h @@ -0,0 +1,67 @@ +/* + * Font.h + * + * Created on: 17 Sep 2016 + * Author: Ralim + */ + +#ifndef FONT_H_ +#define FONT_H_ + +const u8 FONT[]={ + 0x00,0x00,0x00,0xE0,0x18,0x06,0x18,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1C,0x03,0x02,0x02,0x02,0x02,0x02,0x03,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,/*A*/ + 0x00,0xFE,0x42,0x42,0x42,0x42,0x42,0x62,0x9C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1F,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00,0x00,0x00,/*B*/ + 0x00,0xF0,0x0C,0x04,0x02,0x02,0x02,0x02,0x04,0x0C,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x03,0x0C,0x08,0x10,0x10,0x10,0x10,0x08,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,/*C*/ + 0x00,0xFE,0x02,0x02,0x02,0x02,0x02,0x04,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1F,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x06,0x01,0x00,0x00,0x00,0x00,0x00,/*D*/ + 0x00,0xFE,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*E*/ + 0x00,0xFE,0x42,0x42,0x42,0x42,0x42,0x42,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*F*/ + 0x00,0xF0,0x0C,0x04,0x02,0x02,0x02,0x82,0x82,0x84,0x8C,0x00,0x00,0x00,0x00,0x00, + 0x00,0x03,0x0C,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x0F,0x00,0x00,0x00,0x00,0x00,/*G*/ + 0x00,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xFE,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,/*H*/ + 0x00,0x02,0x02,0xFE,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x10,0x10,0x1F,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*I*/ + 0x00,0x00,0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*J*/ + 0x00,0xFE,0x00,0x80,0xC0,0x20,0x10,0x08,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1F,0x01,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,/*K*/ + 0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*L*/ + 0x00,0xFE,0x06,0x18,0x60,0x80,0x00,0x80,0x60,0x18,0x06,0xFE,0x00,0x00,0x00,0x00, + 0x00,0x1F,0x00,0x00,0x00,0x01,0x06,0x01,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,/*M*/ + 0x00,0xFE,0x04,0x08,0x30,0x40,0x80,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x08,0x1F,0x00,0x00,0x00,0x00,0x00,/*N*/ + 0x00,0xF0,0x0C,0x04,0x02,0x02,0x02,0x02,0x02,0x04,0x0C,0xF0,0x00,0x00,0x00,0x00, + 0x00,0x03,0x0C,0x08,0x10,0x10,0x10,0x10,0x10,0x08,0x0C,0x03,0x00,0x00,0x00,0x00,/*O*/ + 0x00,0xFE,0x02,0x02,0x02,0x02,0x02,0x84,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1F,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*P*/ + 0x00,0xF0,0x0C,0x04,0x02,0x02,0x02,0x02,0x02,0x04,0x0C,0xF0,0x00,0x00,0x00,0x00, + 0x00,0x03,0x0C,0x08,0x10,0x10,0x10,0x70,0x90,0x88,0x8C,0x83,0x00,0x00,0x00,0x00,/*Q*/ + 0x00,0xFE,0x82,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1F,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00,0x00,0x00,0x00,/*R*/ + 0x00,0x38,0x44,0x42,0x42,0x82,0x82,0x84,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x04,0x08,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*S*/ + 0x00,0x02,0x02,0x02,0x02,0xFE,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*T*/ + 0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + 0x00,0x07,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00,0x00,/*U*/ + 0x00,0x0E,0x30,0xC0,0x00,0x00,0x00,0xC0,0x30,0x0E,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x06,0x18,0x06,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*V*/ + 0x00,0x0E,0xF0,0x00,0x00,0x00,0xC0,0x38,0x06,0x38,0xC0,0x00,0x00,0x00,0xF0,0x0E, + 0x00,0x00,0x00,0x07,0x18,0x07,0x00,0x00,0x00,0x00,0x00,0x07,0x18,0x07,0x00,0x00,/*W*/ + 0x00,0x02,0x04,0x18,0x20,0xC0,0x20,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x10,0x08,0x06,0x01,0x00,0x01,0x06,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,/*X*/ + 0x00,0x02,0x0C,0x10,0x60,0x80,0x60,0x10,0x0C,0x02,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*Y*/ + 0x00,0x02,0x02,0x02,0x02,0xC2,0x22,0x12,0x0A,0x06,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x18,0x14,0x12,0x11,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,/*Z*/ + +}; + +#endif /* FONT_H_ */ diff --git a/workspace/ts100/inc/Oled.h b/workspace/ts100/inc/Oled.h index 4ceff112..0f227e02 100644 --- a/workspace/ts100/inc/Oled.h +++ b/workspace/ts100/inc/Oled.h @@ -29,5 +29,9 @@ void Reg_Command(u8 posi,u8 flag); void Clear_Screen(void); void Write_InitCommand_data(u32 Com_len,u8* data); void Display_BG(void); +void OLED_DrawString(char* string, uint8_t length); + + + #endif /******************************** END OF FILE *********************************/ diff --git a/workspace/ts100/inc/WordLib.h b/workspace/ts100/inc/WordLib.h index 11ff17cd..ab4937de 100644 --- a/workspace/ts100/inc/WordLib.h +++ b/workspace/ts100/inc/WordLib.h @@ -1,27 +1,37 @@ #ifndef _WORDLIB_H #define _WORDLIB_H -const u8 wordlib[] = { //16*16 ÁÐÐÐʽ£¬ÒõÂë£¬ÄæÏò +const u8 wordlib[] = { //16*16 chars 0x00,0x00,0x00,0xF8,0xFE,0x03,0x01,0x01,0x01,0x03,0xFE,0xFC,0xF0,0x00,0x00,0x00, 0x00,0x00,0x00,0x3F,0x7F,0xE0,0x80,0x80,0x80,0xC0,0x7F,0x3F,0x07,0x00,0x00,0x00,/*"0",0*/ + 0x00,0x00,0x00,0x08,0x04,0x04,0x06,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xFF,0xFF,0x80,0x80,0x80,0x00,0x00,0x00,0x00,/*"1",1*/ + 0x00,0x00,0x00,0x06,0x07,0x01,0x01,0x01,0x81,0xC3,0x7F,0x3E,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xE0,0xF0,0xD8,0xCC,0xC6,0xC3,0xC0,0xC0,0xE0,0x00,0x00,0x00,0x00,/*"2",2*/ + 0x00,0x00,0x00,0x06,0x07,0x81,0x81,0x81,0xC1,0x63,0x3F,0x1E,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xE0,0xC0,0x80,0x80,0x81,0x81,0xC3,0x7F,0x3E,0x00,0x00,0x00,0x00,/*"3",3*/ + 0x00,0x00,0x00,0x00,0xC0,0x60,0x38,0x0C,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x06,0x07,0x05,0x04,0x04,0x84,0xFF,0xFF,0xC4,0x84,0x06,0x00,0x00,0x00,/*"4",4*/ + 0x00,0x00,0x00,0xFF,0xFF,0x83,0x83,0x83,0x83,0x83,0x83,0x03,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xE0,0xC0,0x80,0x80,0x80,0x80,0xC1,0x7F,0x3F,0x08,0x00,0x00,0x00,/*"5",5*/ + 0x00,0x00,0x00,0xE0,0xF8,0x9C,0x8E,0xC2,0xC3,0xC1,0x81,0x81,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x3F,0x7F,0xC0,0x80,0x80,0x80,0x80,0xC1,0x7F,0x3F,0x00,0x00,0x00,/*"6",6*/ + 0x00,0x00,0x00,0x0F,0x03,0x03,0x03,0x03,0x83,0xE3,0x3B,0x0F,0x03,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x80,0xE0,0x78,0x1E,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x00,/*"7",7*/ + 0x00,0x00,0x18,0x7E,0x7E,0xC3,0x81,0x81,0x81,0x81,0x67,0x7E,0x3C,0x00,0x00,0x00, 0x00,0x00,0x1C,0x7E,0xFF,0xC1,0x80,0x80,0x80,0x81,0xE3,0x7F,0x3C,0x00,0x00,0x00,/*"8",8*/ + 0x00,0x00,0x78,0xFE,0xC6,0x03,0x01,0x01,0x01,0x03,0x9E,0xFC,0xF0,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0x01,0x83,0x83,0xC3,0x61,0x71,0x3F,0x0F,0x01,0x00,0x00,0x00,/*"9",9*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",10*/ @@ -29,18 +39,21 @@ const u8 wordlib[] = { //16*16 0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x01,0x01,0x01,0x00,//"+",11 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,//"-",12 - + 0x0E,0x11,0x11,0x0E,0xE0,0xF8,0x0C,0x06,0x03,0x01,0x01,0x01,0x01,0x02,0x1E,0x00, - 0x00,0x00,0x00,0x00,0x0F,0x3F,0x70,0xC0,0x80,0x80,0x80,0x80,0x80,0x40,0x20,0x00,/*"¡æ",13*/ + 0x00,0x00,0x00,0x00,0x0F,0x3F,0x70,0xC0,0x80,0x80,0x80,0x80,0x80,0x40,0x20,0x00,/*"deg C",13*/ 0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x00,//":",14 0x08,0x14,0x22,0x14,0x08,0x02,0x02,0xFE,0x06,0x02,0x02,0x02,0xC2,0x02,0x06,0x1E, - 0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xFF,0x81,0x81,0x01,0x01,0x03,0x00,0x00,0x00,/*"¨H",15*/ + 0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xFF,0x81,0x81,0x01,0x01,0x03,0x00,0x00,0x00,/*"Deg F",15*/ 0xC0,0x30,0x08,0x04,0x04,0x02,0xFA,0xAA,0xFA,0x02,0x04,0x04,0x08,0x30,0xC0,0x00, - 0x07,0x18,0x20,0x40,0x58,0xA4,0xDB,0xDE,0xDB,0xA4,0x58,0x40,0x20,0x18,0x07,0x00,/*"ζȼÆ",16*/ + 0x07,0x18,0x20,0x40,0x58,0xA4,0xDB,0xDE,0xDB,0xA4,0x58,0x40,0x20,0x18,0x07,0x00,/*"Temp Symbol",16*/ + + + }; const u8 Maplib[] = { @@ -95,7 +108,7 @@ const u8 Maplib1[] = {/* 14 * 16*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0x60,0x20,0x10,0x18,0x0C,0x86, 0xE0,0xE0,0xE0,0xEC,0xFC,0xF2,0xF3,0xF1,0xF0,0xF8,0xEC,0xE4,0xE4,0xE2,0xE3,0x01,/*"C:\Users\888\Desktop\sssss.BMP",0*/ - + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x40,0x20,0x30,0x18,0x0C, 0xC0,0xC0,0xC0,0xD8,0xF8,0xE4,0xE6,0xE3,0xE1,0xF1,0xD8,0xC8,0xC8,0xC4,0xC6,0x03,/*"C:\Users\888\Desktop\sssss.BMP",0*/ @@ -109,7 +122,7 @@ const u8 Maplib1[] = {/* 14 * 16*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0x60,0x30,0x18,0x0C,0x86, 0x00,0xE0,0xE0,0xEC,0xF4,0xF6,0xF6,0xFB,0xF5,0xE8,0xE8,0xE4,0xE2,0xE2,0xE1,0x00,/*"δÃüÃûÎļþ",0*/ - + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x60,0x30,0x18,0x0C, 0x00,0xC0,0xC0,0xD8,0xE8,0xEC,0xEC,0xF6,0xEB,0xD1,0xD1,0xC8,0xC4,0xC4,0xC2,0x01,/*"δÃüÃûÎļþ",0*/ @@ -119,61 +132,17 @@ const u8 Maplib1[] = {/* 14 * 16*/ 0xFE,0xFE,0x80,0x40,0x40,0x60,0x58,0x54,0x02,0x02,0x02,0x02,0x02,0x02,0x84,0x84, 0x3F,0x3F,0x00,0x01,0x01,0x01,0x01,0x01,0x07,0x05,0x05,0x06,0x02,0x01,0x00,0x00,/*"δÃüÃûÎļþ",0*/ }; - -const u8 MiniTS[] = {/*16*16*/ - 0x01,0xF9,0xFF,0x3F,0xFF,0xF0,0x80,0x00,0x80,0xF0,0x7E,0xFF,0xFF,0xFF,0x01,0x01, - 0x80,0xFF,0xFF,0x80,0x83,0x1F,0xFF,0xF8,0x3F,0x87,0x80,0xFF,0xFF,0xFF,0x80,0x80,/*"M",0*/ - 0x00,0x00,0x00,0x20,0x20,0x20,0x63,0xE3,0xE3,0x03,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0xFF,0xFF,0x80,0x80,0x80,0x80,0x00,0x00,0x00,/*"i",1*/ - 0x00,0x20,0xE0,0xE0,0xE0,0xC0,0x40,0x60,0x20,0x20,0x60,0xC0,0xC0,0x00,0x00,0x00, - 0x00,0x80,0xFF,0xFF,0xFF,0x80,0x80,0x00,0x00,0x80,0x80,0xFF,0xFF,0x80,0x80,0x00,/*"n",2*/ - 0x00,0x00,0x00,0x20,0x20,0x20,0x63,0xE3,0xE3,0x03,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0xFF,0xFF,0x80,0x80,0x80,0x80,0x00,0x00,0x00,/*"i",3*/ - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"-",4*/ - 0x00,0x06,0x07,0x03,0x01,0x01,0xFF,0xFF,0xFF,0x01,0x01,0x01,0x03,0x0F,0x0C,0x00, - 0x00,0x00,0x00,0x00,0x80,0x80,0xFF,0xFF,0xFF,0x80,0x80,0x00,0x00,0x00,0x00,0x00,/*"T",5*/ - 0x00,0x00,0x00,0x80,0xC0,0x40,0x60,0x20,0x20,0x60,0x40,0xC0,0x80,0x00,0x00,0x00, - 0x00,0x0E,0x3F,0x7F,0xE1,0x80,0x80,0x80,0x80,0x80,0xC0,0x71,0x7F,0x3F,0x00,0x00,/*"o",6*/ - 0x00,0x00,0x00,0x80,0xC0,0x40,0x60,0x20,0x20,0x60,0x40,0xC0,0x80,0x00,0x00,0x00, - 0x00,0x0E,0x3F,0x7F,0xE1,0x80,0x80,0x80,0x80,0x80,0xC0,0x71,0x7F,0x3F,0x00,0x00,/*"o",7*/ - 0x00,0x00,0x00,0x01,0x01,0x01,0x01,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0xFF,0xFF,0x80,0x80,0x80,0x80,0x00,0x00,0x00,/*"l",8*/ - 0x00,0x00,0x00,0x80,0xC0,0x40,0x60,0x20,0x20,0x60,0x40,0xC0,0xC0,0x00,0x00,0x00, - 0x00,0x00,0x20,0xE3,0xC3,0x86,0x86,0x84,0x8C,0x8C,0x8C,0xF8,0x78,0x30,0x00,0x00,/*"s",9*/ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",10*/ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",11*/ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",12*/ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",13*/ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",14*/ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",15*/ -}; -//const u8 Arrow[] = {/*16*16*/ -// 0x00,0x03,0x0E,0x18,0x60,0xC3,0x06,0x18,0x70,0xC0,0x00,0x00,0x00,0x80,0x60,0x38, -// 0x0C,0x83,0xC1,0x30,0x0C,0x07,0x01,0x00,/*"¡·",0*/ -// 0x00,0x00,0xC0,0x60,0x18,0x0C,0xC3,0x71,0x18,0x06,0x03,0x00,0x00,0x01,0x03,0x0C, -// 0x30,0x61,0x87,0x0C,0x30,0xE0,0x80,0x00,/*"¡¶",0*/ - -// 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -// 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/ -//}; const u8 Triangle[] = {/*16*16*/ 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0xFE,0x00,0x00,0x00, 0x00,0x00,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x3F,0x00,0x00,0x00,/*"×ó¡÷",0*/ - + 0x00,0x00,0xFE,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, 0x00,0x00,0x3F,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x01,0x01,0x00,0x00,0x00,/*"ÓÒ¡÷",0*/ 0x00,0x80,0x80,0xC0,0xC0,0x60,0x60,0x30,0x30,0x18,0x18,0x0C,0x0C,0xFE,0x00,0x00, 0x00,0x01,0x01,0x03,0x03,0x06,0x06,0x0C,0x0C,0x18,0x18,0x30,0x30,0x7F,0x00,0x00,/*"¼Ó´Ö×ó¡÷",0*/ - + 0x00,0x00,0xFE,0x0C,0x0C,0x18,0x18,0x30,0x30,0x60,0x60,0xC0,0xC0,0x80,0x80,0x00, 0x00,0x00,0x7F,0x30,0x30,0x18,0x18,0x0C,0x0C,0x06,0x06,0x03,0x03,0x01,0x01,0x00,/*"¼Ó´ÖÓÒ¡÷",0*/ @@ -194,23 +163,23 @@ const u8 IhIcon[] = { const u8 TempIcon[] = {/*16*16*/ 0x10,0x18,0x8C,0xC6,0x63,0x63,0xC6,0x8C,0x18,0x10, 0x42,0x63,0x31,0x18,0x0C,0x0C,0x18,0x31,0x63,0x42,/*"10*16",0*/ - + 0x00,0xF0,0x1E,0x1F,0xF0,0x00, 0x00,0xFF,0x80,0x80,0xFF,0x00,/*"6*16",0*/ 0x42,0xC6,0x8C,0x18,0x30,0x30,0x18,0x8C,0xC6,0x42, 0x08,0x18,0x31,0x63,0xC6,0xC6,0x63,0x31,0x18,0x08,/*"10*16",1*/ - + 0x8C,0x8C,0xC6,0xC6,0x8C,0x8C,0xC6,0xC6,0x8C,0x8C, 0x31,0x31,0x18,0x18,0x31,0x31,0x18,0x18,0x31,0x31,/*"10*16",2*/ - + 0x00,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x00, 0x00,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x00,/*"ÎÂ¶ÈÆ½ºâ",0*/ - + 0x80,0xC0,0x60,0x30,0x98,0xCC,0x66,0x33,0x33,0x66,0xCC,0x98,0x30,0x60,0xC0,0x80, 0x88,0xCC,0x66,0x33,0x19,0x0C,0x06,0x03,0x03,0x06,0x0C,0x19,0x33,0x66,0xCC,0x88,/*"¼ÓÈÈ",0*/ - + 0x11,0x33,0x66,0xCC,0x98,0x30,0x60,0xC0,0xC0,0x60,0x30,0x98,0xCC,0x66,0x33,0x11, 0x01,0x03,0x06,0x0C,0x19,0x33,0x66,0xCC,0xCC,0x66,0x33,0x19,0x0C,0x06,0x03,0x01,/*"½µÎÂ",0*/ }; @@ -230,7 +199,7 @@ const u8 Warning[] = {/*10*16*/ 0x10,0x1F,0x10,0x00,/*"n",5*/ 0x00,0xE0,0x10,0x10,0x10,0x10,0xF0,0x10,0x00,0x00,0x00,0x7D,0x8A,0x8A,0x8A,0x8A, 0x91,0x70,0x00,0x00,/*"g",6*/ - + 0x00,0x00,0x00,0x80,0xE0,0xF8,0xFE,0x07,0x07,0xFE,0xF8,0xE0,0x80,0x00,0x00,0x00, 0x10,0x1C,0x1F,0x1F,0x1F,0x1F,0x1F,0x12,0x12,0x1F,0x1F,0x1F,0x1F,0x1F,0x1C,0x10,/*"C:\Users\888\Desktop\attention.bmp",0*/ }; @@ -287,7 +256,7 @@ const u8 LowVot[] = {/*10*16*/ const u8 Cal_UnDone[] = { /*16*16 Cal_Ud*/ 0xE0,0x18,0x04,0x02,0x12,0x21,0x41,0x81,0x81,0x41,0x22,0x12,0x04,0x18,0xE0,0x00, 0x03,0x0C,0x10,0x20,0x28,0x44,0x42,0x41,0x41,0x42,0x24,0x28,0x10,0x0C,0x03,0x00,/*"У׼ʧ°Ü.BMP",0*/ - + 0xF0,0x0C,0x02,0x01,0x01,0x01,0x01,0x02,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x03,0x0C,0x08,0x10,0x10,0x10,0x10,0x08,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"C",0*/ 0x00,0x60,0x10,0x10,0x90,0x90,0x90,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -370,7 +339,7 @@ const u8 Number10[] = { /*10*16*/ 0x40,0x40,0x20,0x10,/*"¡æ",11*/ 0x1C,0x12,0x0C,0x02,0x02,0xFE,0x82,0x82,0xE2,0x02,0x00,0x00,0x00,0x00,0x40,0x7F, 0x40,0x00,0x03,0x00,/*"¨H",12*/ - + }; const u8 Guide[] = { /*16*16*/ @@ -383,7 +352,7 @@ const u8 Guide[] = { /*16*16*/ 0x00,0x00,0x18,0x30,0x60,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x0C,0x06,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*">",0*/ 0x00,0x00,0x18,0x30,0x60,0xC0,0x98,0x30,0x60,0xC0,0x80,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x0C,0x06,0x03,0x01,0x0C,0x06,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,/*">>",0*/ + 0x00,0x00,0x0C,0x06,0x03,0x01,0x0C,0x06,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,/*">>",0*/ 0x00,0x00,0x18,0x30,0x60,0xC0,0x98,0x30,0x60,0xC0,0x98,0x30,0x60,0xC0,0x80,0x00, 0x00,0x00,0x0C,0x06,0x03,0x01,0x0C,0x06,0x03,0x01,0x0C,0x06,0x03,0x01,0x00,0x00,/*">>>",0*/ }; diff --git a/workspace/ts100/src/Oled.c b/workspace/ts100/src/Oled.c index 0409e388..5fa2f3fa 100644 --- a/workspace/ts100/src/Oled.c +++ b/workspace/ts100/src/Oled.c @@ -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 *********************************/ diff --git a/workspace/ts100/src/UI.c b/workspace/ts100/src/UI.c index ce4d1649..65fba492 100644 --- a/workspace/ts100/src/UI.c +++ b/workspace/ts100/src/UI.c @@ -632,10 +632,8 @@ void Show_HeatingIcon(u32 ht_flag, u16 active) { } } /******************************************************************************* - ������: Display_Str - ��������:��ʾ16*16�ַ��� - �������:x: � str :��ʾ�ַ��� - ���ز���: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����1����2���� + Show_HeatingIcon(ht_flag,Get_MmaActive()); td_cnt++; } break; case TEMP_SET: - Temp_SetProc(); //���� + 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; }