Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of KS0108 by
Revision 6:7c0770d5639d, committed 2015-01-10
- Comitter:
- tmccurbin
- Date:
- Sat Jan 10 23:46:14 2015 +0000
- Parent:
- 5:e4b50f4c13a8
- Commit message:
- Changed some wait times to 1 microsecond. Added Arial 10 font.
Changed in this revision
Arial10.h | Show annotated file Show diff for this revision Revisions of this file |
KS0108.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Arial10.h Sat Jan 10 23:46:14 2015 +0000 @@ -0,0 +1,154 @@ + +/* + * + * File Name : Arial10.h + * Date : 15.11.2014 + * Font size in bytes : 3801 + * Font width : 10 + * Font height : 9 + * Font first char : 32 + * Font last char : 128 + * Font used chars : 96 + * + * The font data are defined as + * + * struct _FONT_ { + * uint16_t font_Size_in_Bytes_over_all_included_Size_it_self; + * uint8_t font_Width_in_Pixel_for_fixed_drawing; + * uint8_t font_Height_in_Pixel_for_all_characters; + * unit8_t font_First_Char; + * uint8_t font_Char_Count; + * + * uint8_t font_Char_Widths[font_Last_Char - font_First_Char +1]; + * // for each character the separate width in pixels, + * // characters < 128 have an implicit virtual right empty row + * + * uint8_t font_data[]; + * // bit field of all characters + */ + +#ifndef ARIAL10_H +#define ARIAL10_H + +#define ARIAL10_WIDTH 10 +#define ARIAL10_HEIGHT 9 + +unsigned int Arial10[] = { + 0x0E, 0xD9, // size + 0x0A, // width + 0x09, // height + 0x20, // first char + 0x60, // char count + + // char widths + 0x00, 0x01, 0x03, 0x05, 0x05, 0x07, 0x07, 0x01, 0x03, 0x03, + 0x03, 0x05, 0x01, 0x02, 0x01, 0x03, 0x05, 0x03, 0x05, 0x05, + 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x01, 0x01, 0x04, 0x05, + 0x04, 0x06, 0x09, 0x07, 0x05, 0x05, 0x05, 0x05, 0x04, 0x06, + 0x05, 0x01, 0x04, 0x06, 0x05, 0x07, 0x05, 0x06, 0x05, 0x06, + 0x05, 0x05, 0x05, 0x05, 0x07, 0x09, 0x07, 0x07, 0x06, 0x02, + 0x03, 0x02, 0x05, 0x06, 0x02, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x03, 0x04, 0x04, 0x01, 0x02, 0x04, 0x01, 0x07, 0x04, 0x04, + 0x04, 0x04, 0x02, 0x04, 0x03, 0x04, 0x05, 0x07, 0x05, 0x05, + 0x05, 0x03, 0x01, 0x03, 0x05, 0x05, + + // font data + 0x5F, 0x00, // 33 + 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, // 34 + 0x74, 0x1E, 0x75, 0x1E, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, // 35 + 0x26, 0x4D, 0xFF, 0x49, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, // 36 + 0x06, 0x09, 0x66, 0x18, 0x36, 0x49, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 37 + 0x30, 0x4A, 0x4D, 0x55, 0x23, 0x70, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 38 + 0x07, 0x00, // 39 + 0x7C, 0x82, 0x01, 0x00, 0x00, 0x80, // 40 + 0x01, 0x82, 0x7C, 0x80, 0x00, 0x00, // 41 + 0x05, 0x03, 0x05, 0x00, 0x00, 0x00, // 42 + 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, // 43 + 0xC0, 0x00, // 44 + 0x10, 0x10, 0x00, 0x00, // 45 + 0x40, 0x00, // 46 + 0x60, 0x1C, 0x03, 0x00, 0x00, 0x00, // 47 + 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, // 48 + 0x04, 0x02, 0x7F, 0x00, 0x00, 0x00, // 49 + 0x42, 0x61, 0x51, 0x49, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, // 50 + 0x22, 0x41, 0x49, 0x49, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, // 51 + 0x18, 0x14, 0x12, 0x11, 0x7F, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 52 + 0x2C, 0x47, 0x45, 0x45, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, // 53 + 0x3E, 0x45, 0x45, 0x45, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, // 54 + 0x01, 0x61, 0x19, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // 55 + 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, // 56 + 0x2E, 0x51, 0x51, 0x51, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, // 57 + 0x44, 0x00, // 58 + 0xC4, 0x00, // 59 + 0x08, 0x14, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, // 60 + 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, // 61 + 0x22, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, // 62 + 0x02, 0x01, 0x01, 0x59, 0x09, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 63 + 0x78, 0x86, 0x3A, 0x45, 0x45, 0x79, 0x4D, 0xA2, 0x9C, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, // 64 + 0x40, 0x38, 0x16, 0x11, 0x16, 0x38, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 65 + 0x7F, 0x49, 0x49, 0x49, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, // 66 + 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // 67 + 0x7F, 0x41, 0x41, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, // 68 + 0x7F, 0x49, 0x49, 0x49, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, // 69 + 0x7F, 0x09, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00, // 70 + 0x1C, 0x22, 0x41, 0x49, 0x2A, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 71 + 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, // 72 + 0x7F, 0x00, // 73 + 0x60, 0x40, 0x40, 0x3F, 0x00, 0x00, 0x00, 0x00, // 74 + 0x7F, 0x10, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 75 + 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, // 76 + 0x7F, 0x06, 0x38, 0x40, 0x38, 0x06, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 77 + 0x7F, 0x06, 0x08, 0x30, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, // 78 + 0x3E, 0x41, 0x41, 0x41, 0x41, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 79 + 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // 80 + 0x3E, 0x41, 0x41, 0x61, 0x61, 0x5E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 81 + 0x7F, 0x09, 0x09, 0x19, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, // 82 + 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, // 83 + 0x01, 0x01, 0x7F, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // 84 + 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, // 85 + 0x01, 0x0E, 0x30, 0x40, 0x30, 0x0E, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 86 + 0x03, 0x3C, 0x40, 0x3E, 0x01, 0x3E, 0x40, 0x3C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 87 + 0x40, 0x21, 0x12, 0x0C, 0x12, 0x21, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 88 + 0x01, 0x02, 0x04, 0x78, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 89 + 0x61, 0x51, 0x49, 0x45, 0x43, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 90 + 0xFF, 0x01, 0x80, 0x80, // 91 + 0x03, 0x1C, 0x60, 0x00, 0x00, 0x00, // 92 + 0x01, 0xFF, 0x80, 0x80, // 93 + 0x08, 0x06, 0x01, 0x06, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, // 94 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // 95 + 0x01, 0x02, 0x00, 0x00, // 96 + 0x60, 0x54, 0x54, 0x7C, 0x00, 0x00, 0x00, 0x00, // 97 + 0x7F, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, // 98 + 0x38, 0x44, 0x44, 0x28, 0x00, 0x00, 0x00, 0x00, // 99 + 0x38, 0x44, 0x44, 0x7F, 0x00, 0x00, 0x00, 0x00, // 100 + 0x38, 0x54, 0x54, 0x58, 0x00, 0x00, 0x00, 0x00, // 101 + 0x04, 0x7E, 0x05, 0x00, 0x00, 0x00, // 102 + 0xB8, 0x44, 0x44, 0xFC, 0x00, 0x80, 0x80, 0x00, // 103 + 0x7F, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00, 0x00, // 104 + 0x7D, 0x00, // 105 + 0x00, 0xFD, 0x80, 0x00, // 106 + 0x7F, 0x10, 0x38, 0x44, 0x00, 0x00, 0x00, 0x00, // 107 + 0x7F, 0x00, // 108 + 0x7C, 0x04, 0x04, 0x7C, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 109 + 0x7C, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00, 0x00, // 110 + 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, // 111 + 0xFC, 0x44, 0x44, 0x38, 0x80, 0x00, 0x00, 0x00, // 112 + 0x38, 0x44, 0x44, 0xFC, 0x00, 0x00, 0x00, 0x80, // 113 + 0x7C, 0x04, 0x00, 0x00, // 114 + 0x48, 0x54, 0x54, 0x24, 0x00, 0x00, 0x00, 0x00, // 115 + 0x04, 0x7F, 0x44, 0x00, 0x00, 0x00, // 116 + 0x3C, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, 0x00, // 117 + 0x04, 0x38, 0x40, 0x38, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // 118 + 0x3C, 0x40, 0x38, 0x04, 0x38, 0x40, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 119 + 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, // 120 + 0x04, 0x38, 0xC0, 0x38, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, // 121 + 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, // 122 + 0x10, 0xEF, 0x01, 0x00, 0x80, 0x80, // 123 + 0xFF, 0x80, // 124 + 0x01, 0xEF, 0x10, 0x80, 0x80, 0x00, // 125 + 0x18, 0x08, 0x18, 0x10, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, // 126 + 0x7E, 0x42, 0x42, 0x42, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00 // 127 + +}; + +#endif
--- a/KS0108.cpp Mon May 02 19:05:30 2011 +0000 +++ b/KS0108.cpp Sat Jan 10 23:46:14 2015 +0000 @@ -24,11 +24,11 @@ SelectSide(side); //select controller - wait(0.0000003); //wait 300ns + wait_us(1); //wait 1 microsecond. This is the smallest resolution of the wait funtion (see mbed handbook). E.write(1); DB.output(); DB.write(Command); - wait(0.0000001); + wait_us(1); E.write(0); } @@ -40,11 +40,11 @@ SelectSide(side); - wait(0.0000003); // 300ns + wait_us(1); E = 1; DB.output(); DB.write(data); - wait(0.0000001); + wait_us(1); E = 0; } @@ -54,7 +54,7 @@ if(Coord.x >= SCREEN_WIDTH) return; chip = Coord.x/CHIP_WIDTH; - wait(0.000000450); // 300ns + wait_us(1); if(Coord.x % CHIP_WIDTH == 0 && chip > 0){ GotoXY(Coord.x, Coord.y); @@ -78,9 +78,9 @@ displayData |= data << yOffset; if(Inverted) displayData = ~displayData; DB.write(displayData); // write data - wait(0.0000003); // 300ns + wait_us(1); E.write(1); - wait(0.0000001); + wait_us(1); E.write(0); // second page @@ -100,9 +100,9 @@ displayData = ~displayData; DB.write(displayData); // write data - wait(0.0000003); // 300ns + wait_us(1); E.write(1); - wait(0.0000001); + wait_us(1); E.write(0); GotoXY(Coord.x+1, Coord.y-8); @@ -111,11 +111,11 @@ // just this code gets executed if the write is on a single page if(Inverted) data = ~data; - wait(0.0000003); // 300nsEN_DELAY(); + wait_us(1); // EN_DELAY(); DB.write(data); // write data - wait(0.0000003); // 300ns + wait_us(1); E = 1; - wait(0.0000001); + wait_us(1); E = 0; Coord.x++; } @@ -155,10 +155,10 @@ RW.write(1); E.write(1); - wait(0.00000045); + wait_us(1); data = DB.read(); - wait(0.0000001); + wait_us(1); E.write(0); DB.output(); @@ -173,11 +173,11 @@ RW.write(1); E.write(1); - wait(0.00000045); + wait_us(1); status = DB.read(); E.write(0); - wait(0.0000001); + wait_us(1); DB.output(); return status;