From 359f34a0012bd58c86a5c171695abf8874a7e7b2 Mon Sep 17 00:00:00 2001 From: chaoskagami Date: Sat, 18 Jun 2016 21:05:23 -0400 Subject: [PATCH] Strip i2c handling out completely --- Makefile | 6 +- bdf.c | 11 +- font6x8.h | 111 --------------- font816.h | 111 --------------- font88.h | 121 ---------------- li2c.c | 132 ------------------ li2c.h | 72 ---------- main.c | 100 -------------- ossd_i2c.c | 399 ----------------------------------------------------- ossd_i2c.h | 136 ------------------ wi2c.cpp | 18 --- wi2c.h | 16 --- 12 files changed, 9 insertions(+), 1224 deletions(-) delete mode 100644 font6x8.h delete mode 100644 font816.h delete mode 100644 font88.h delete mode 100644 li2c.c delete mode 100644 li2c.h delete mode 100644 ossd_i2c.c delete mode 100644 ossd_i2c.h delete mode 100644 wi2c.cpp delete mode 100644 wi2c.h diff --git a/Makefile b/Makefile index df44e63..c87c388 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,9 @@ CFLAGS += -g LIBS = CORE = bdfe -OBJS = main.o ossd_i2c.o bdf.o rterm.o li2c.o -HFILES = Makefile li2c.h ossd_i2c.h rterm.h font88.h font816.h -CFILES = ossd_i2c.c bdf.c rterm.c main.c +OBJS = main.o bdf.o rterm.o +HFILES = Makefile rterm.h +CFILES = bdf.c rterm.c main.c all: $(CORE) diff --git a/bdf.c b/bdf.c index 8353d2d..47b2a03 100644 --- a/bdf.c +++ b/bdf.c @@ -16,7 +16,7 @@ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) @@ -90,7 +90,7 @@ bdfe_t *bdf_convert(const char *name, unsigned gmin, unsigned gmax, unsigned asc memset(buf, 0, sizeof(buf)); int mute = flags & BDF_MUTE; - + if (!mute && (flags & BDF_HEADER)) { printf("// File generated by 'bdfe"); if (flags & BDF_NATIVE) @@ -127,6 +127,7 @@ bdfe_t *bdf_convert(const char *name, unsigned gmin, unsigned gmax, unsigned asc strtoul(arg, &arg, 10); descent = -strtoul(arg, &arg, 10); } + if (key_arg(buf, "FONT_DESCENT", &arg)) { if (!mute && (flags & BDF_HEADER)) printf("// %s\n", buf); @@ -178,7 +179,7 @@ bdfe_t *bdf_convert(const char *name, unsigned gmin, unsigned gmax, unsigned asc descent += dy - gh; gh = dy; } - + if (!mute && (flags & BDF_HEADER)) printf("// Converted Font Size %dx%d\n\n", dx, dy); if (ascender > dy/2) @@ -202,13 +203,13 @@ bdfe_t *bdf_convert(const char *name, unsigned gmin, unsigned gmax, unsigned asc unsigned bbw = 0; int bbox = 0, bboy = 0; uint8_t *gin = gbuf + gsize; - + memset(gin, 0, gsize); // store a copy in case if verbose output is on arg = strchr(buf, '\0'); while(*arg < ' ' && arg != buf) *arg-- = '\0'; strcpy(startchar, buf); - + while(fgets(buf, sizeof(buf) - 2, fp) != NULL) { arg = strchr(buf, '\0'); while(*arg < ' ' && arg != buf) *arg-- = '\0'; diff --git a/font6x8.h b/font6x8.h deleted file mode 100644 index e5f3767..0000000 --- a/font6x8.h +++ /dev/null @@ -1,111 +0,0 @@ -// File generated by 'bdfe -n -r -s 32-126 koi5x8.bdf' -// COMMENT http://cvsweb.xfree86.org/cvsweb/xc/fonts/bdf/cyrillic/koi5x8.bdf -// COMMENT AUTOMATICALLY GENERATED FILE. DO NOT EDIT! -// COMMENT Generated with 'ucs2any.pl 5x8.bdf ../xcyr-2.3/tryfont/KOI8-C.TXT KOI8-C' -// COMMENT from an ISO10646-1 encoded source BDF font. -// COMMENT ucs2any.pl by Markus Kuhn , 1999. -// COMMENT Send bug reports to Markus Kuhn -// COMMENT Changes 1999 by Serge Winitzki. -// COMMENT $XFree86: xc/fonts/bdf/cyrillic/koi5x8.bdf,v 1.1 2002/12/15 01:49:06 dawes Exp $ -// FONT -Misc-Fixed-Medium-R-Normal--8-80-75-75-C-50-KOI8-R -// FONTBOUNDINGBOX 5 8 0 -1 -// FONT_DESCENT 1 -// FONT_ASCENT 7 -// COPYRIGHT "Public domain font. Share and enjoy." -// Converted Font Size 5x8 - - 0x00,0x00,0x00,0x00,0x00,0x00, // 32 ' ' - 0x00,0x00,0x5E,0x00,0x00,0x00, // 33 '!' - 0x00,0x0E,0x00,0x0E,0x00,0x00, // 34 '"' - 0x14,0x7F,0x14,0x7F,0x14,0x00, // 35 '#' - 0x04,0x2A,0x7F,0x2A,0x10,0x00, // 36 '$' - 0x00,0x16,0x08,0x34,0x00,0x00, // 37 '%' - 0x36,0x49,0x36,0x40,0x00,0x00, // 38 '&' - 0x00,0x00,0x0E,0x00,0x00,0x00, // 39 ''' - 0x00,0x3C,0x42,0x00,0x00,0x00, // 40 '(' - 0x00,0x42,0x3C,0x00,0x00,0x00, // 41 ')' - 0x54,0x38,0x38,0x54,0x00,0x00, // 42 '*' - 0x10,0x10,0x7C,0x10,0x10,0x00, // 43 '+' - 0x00,0x80,0x60,0x20,0x00,0x00, // 44 ',' - 0x10,0x10,0x10,0x10,0x00,0x00, // 45 '-' - 0x00,0x40,0xE0,0x40,0x00,0x00, // 46 '.' - 0x60,0x10,0x08,0x06,0x00,0x00, // 47 '/' - 0x00,0x3C,0x42,0x3C,0x00,0x00, // 48 '0' - 0x00,0x44,0x7E,0x40,0x00,0x00, // 49 '1' - 0x64,0x52,0x52,0x4C,0x00,0x00, // 50 '2' - 0x22,0x4A,0x4E,0x32,0x00,0x00, // 51 '3' - 0x18,0x14,0x7E,0x10,0x00,0x00, // 52 '4' - 0x2E,0x4A,0x4A,0x32,0x00,0x00, // 53 '5' - 0x3C,0x4A,0x4A,0x30,0x00,0x00, // 54 '6' - 0x02,0x62,0x1A,0x06,0x00,0x00, // 55 '7' - 0x34,0x4A,0x4A,0x34,0x00,0x00, // 56 '8' - 0x0C,0x52,0x52,0x3C,0x00,0x00, // 57 '9' - 0x00,0x6C,0x6C,0x00,0x00,0x00, // 58 ':' - 0x00,0x80,0x6C,0x2C,0x00,0x00, // 59 ';' - 0x00,0x18,0x24,0x42,0x00,0x00, // 60 '<' - 0x28,0x28,0x28,0x28,0x00,0x00, // 61 '=' - 0x00,0x42,0x24,0x18,0x00,0x00, // 62 '>' - 0x00,0x04,0x52,0x0C,0x00,0x00, // 63 '?' - 0x3C,0x42,0x99,0xA5,0x1E,0x00, // 64 '@' - 0x7C,0x12,0x12,0x7C,0x00,0x00, // 65 'A' - 0x7E,0x4A,0x4A,0x34,0x00,0x00, // 66 'B' - 0x3C,0x42,0x42,0x24,0x00,0x00, // 67 'C' - 0x7E,0x42,0x42,0x3C,0x00,0x00, // 68 'D' - 0x7E,0x4A,0x4A,0x42,0x00,0x00, // 69 'E' - 0x7E,0x0A,0x0A,0x02,0x00,0x00, // 70 'F' - 0x3C,0x42,0x52,0x34,0x00,0x00, // 71 'G' - 0x7E,0x08,0x08,0x7E,0x00,0x00, // 72 'H' - 0x00,0x42,0x7E,0x42,0x00,0x00, // 73 'I' - 0x20,0x42,0x3E,0x02,0x00,0x00, // 74 'J' - 0x7E,0x08,0x34,0x42,0x00,0x00, // 75 'K' - 0x7E,0x40,0x40,0x40,0x00,0x00, // 76 'L' - 0x7E,0x0C,0x0C,0x7E,0x00,0x00, // 77 'M' - 0x7E,0x0C,0x38,0x7E,0x00,0x00, // 78 'N' - 0x3C,0x42,0x42,0x3C,0x00,0x00, // 79 'O' - 0x7E,0x12,0x12,0x0C,0x00,0x00, // 80 'P' - 0x3C,0x52,0x62,0xBC,0x00,0x00, // 81 'Q' - 0x7E,0x12,0x12,0x6C,0x00,0x00, // 82 'R' - 0x24,0x4A,0x52,0x24,0x00,0x00, // 83 'S' - 0x00,0x02,0x7E,0x02,0x00,0x00, // 84 'T' - 0x3E,0x40,0x40,0x3E,0x00,0x00, // 85 'U' - 0x1E,0x60,0x60,0x1E,0x00,0x00, // 86 'V' - 0x7E,0x30,0x30,0x7E,0x00,0x00, // 87 'W' - 0x66,0x18,0x18,0x66,0x00,0x00, // 88 'X' - 0x06,0x08,0x70,0x08,0x06,0x00, // 89 'Y' - 0x62,0x52,0x4A,0x46,0x00,0x00, // 90 'Z' - 0x00,0x7E,0x42,0x42,0x00,0x00, // 91 '[' - 0x06,0x08,0x10,0x60,0x00,0x00, // 92 '\' - 0x00,0x42,0x42,0x7E,0x00,0x00, // 93 ']' - 0x00,0x04,0x02,0x04,0x00,0x00, // 94 '^' - 0x80,0x80,0x80,0x80,0x00,0x00, // 95 '_' - 0x00,0x02,0x04,0x00,0x00,0x00, // 96 '`' - 0x30,0x48,0x48,0x78,0x00,0x00, // 97 'a' - 0x7E,0x48,0x48,0x30,0x00,0x00, // 98 'b' - 0x00,0x30,0x48,0x48,0x00,0x00, // 99 'c' - 0x30,0x48,0x48,0x7E,0x00,0x00, // 100 'd' - 0x30,0x68,0x58,0x10,0x00,0x00, // 101 'e' - 0x10,0x7C,0x12,0x04,0x00,0x00, // 102 'f' - 0x10,0xA8,0xA8,0x70,0x00,0x00, // 103 'g' - 0x7E,0x08,0x08,0x70,0x00,0x00, // 104 'h' - 0x00,0x48,0x7A,0x40,0x00,0x00, // 105 'i' - 0x00,0x40,0x80,0x7A,0x00,0x00, // 106 'j' - 0x7E,0x10,0x10,0x68,0x00,0x00, // 107 'k' - 0x00,0x42,0x7E,0x40,0x00,0x00, // 108 'l' - 0x78,0x08,0x70,0x08,0x70,0x00, // 109 'm' - 0x78,0x08,0x08,0x70,0x00,0x00, // 110 'n' - 0x30,0x48,0x48,0x30,0x00,0x00, // 111 'o' - 0xF8,0x28,0x28,0x10,0x00,0x00, // 112 'p' - 0x10,0x28,0x28,0xF8,0x00,0x00, // 113 'q' - 0x78,0x10,0x08,0x10,0x00,0x00, // 114 'r' - 0x00,0x50,0x58,0x28,0x00,0x00, // 115 's' - 0x08,0x3E,0x48,0x20,0x00,0x00, // 116 't' - 0x38,0x40,0x40,0x78,0x00,0x00, // 117 'u' - 0x00,0x38,0x40,0x38,0x00,0x00, // 118 'v' - 0x38,0x40,0x30,0x40,0x38,0x00, // 119 'w' - 0x48,0x30,0x30,0x48,0x00,0x00, // 120 'x' - 0x58,0xA0,0xA0,0x78,0x00,0x00, // 121 'y' - 0x48,0x68,0x58,0x48,0x00,0x00, // 122 'z' - 0x08,0x2A,0x55,0x41,0x00,0x00, // 123 '{' - 0x00,0x00,0x7E,0x00,0x00,0x00, // 124 '|' - 0x41,0x55,0x2A,0x08,0x00,0x00, // 125 '}' - 0x04,0x02,0x04,0x02,0x00,0x00, // 126 '~' diff --git a/font816.h b/font816.h deleted file mode 100644 index 009a3b8..0000000 --- a/font816.h +++ /dev/null @@ -1,111 +0,0 @@ -// File generated by 'bdfe -n -r -a 1 -s 32-126 zevv-peep-iso8859-1-08x16.bdf' -// FONT -zevv-peep-Medium-R-Normal--16-140-75-75-C-80-ISO8859-1 -// COMMENT - -// COMMENT http://zevv.nl/play/code/zevv-peep/ -// COMMENT Clean, avoid clutter -// COMMENT Very clear distinction between similar characters like 0/O/o, i/I/l/1/| -// COMMENT Suitable for light text on a dark background. -// COMMENT Not to densly packed to allow a good seperation between characters -// COMMENT The zevv-peep font is available under the terms of the MIT license. -// COMMENT - -// FONTBOUNDINGBOX 8 16 0 -3 -// COPYRIGHT "Zevv" -// FONT_ASCENT 13 -// FONT_DESCENT 3 -// Converted Font Size 8x16 - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 32 ' ' - 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B,0x00,0x00,0x00,0x00, // 33 '!' - 0x00,0x00,0x78,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 34 '"' - 0x00,0x40,0xF0,0x40,0x40,0xF0,0x40,0x00,0x00,0x02,0x0F,0x02,0x02,0x0F,0x02,0x00, // 35 '#' - 0x00,0xC0,0x20,0xF0,0x20,0x20,0x00,0x00,0x00,0x08,0x09,0x1F,0x09,0x06,0x00,0x00, // 36 '$' - 0x00,0x30,0x48,0x30,0xC0,0x20,0x18,0x00,0x00,0x18,0x04,0x03,0x0C,0x12,0x0C,0x00, // 37 '%' - 0x00,0x60,0x90,0x90,0x60,0x00,0x00,0x00,0x00,0x0E,0x11,0x11,0x12,0x0C,0x12,0x00, // 38 '&' - 0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 39 ''' - 0x00,0x00,0x00,0xC0,0x30,0x08,0x04,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00, // 40 '(' - 0x00,0x04,0x08,0x30,0xC0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00, // 41 ')' - 0x00,0x00,0x40,0x80,0x80,0x40,0x00,0x00,0x00,0x01,0x05,0x03,0x03,0x05,0x01,0x00, // 42 '*' - 0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x0F,0x01,0x01,0x01, // 43 '+' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x30,0x18,0x08,0x00,0x00,0x00, // 44 ',' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00, // 45 '-' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x38,0x10,0x00,0x00,0x00, // 46 '.' - 0x00,0x00,0x00,0x00,0xC0,0x30,0x0C,0x00,0x00,0x30,0x0C,0x03,0x00,0x00,0x00,0x00, // 47 '/' - 0x00,0xE0,0x10,0x08,0x88,0x10,0xE0,0x00,0x00,0x07,0x08,0x11,0x10,0x08,0x07,0x00, // 48 '0' - 0x00,0x40,0x20,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00, // 49 '1' - 0x00,0x30,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x18,0x14,0x12,0x11,0x10,0x10,0x00, // 50 '2' - 0x00,0x10,0x08,0x88,0x88,0x88,0x70,0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x0F,0x00, // 51 '3' - 0x00,0x00,0xC0,0x30,0x08,0xF8,0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x1F,0x02,0x00, // 52 '4' - 0x00,0xF8,0x48,0x48,0x48,0x48,0x88,0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x0F,0x00, // 53 '5' - 0x00,0xF0,0x08,0x88,0x88,0x88,0x10,0x00,0x00,0x0F,0x11,0x10,0x10,0x10,0x0F,0x00, // 54 '6' - 0x00,0x08,0x08,0x08,0x88,0x68,0x18,0x00,0x00,0x00,0x18,0x06,0x01,0x00,0x00,0x00, // 55 '7' - 0x00,0x70,0x88,0x88,0x88,0x88,0x70,0x00,0x00,0x0F,0x10,0x10,0x10,0x10,0x0F,0x00, // 56 '8' - 0x00,0xF0,0x08,0x08,0x08,0x88,0xF0,0x00,0x00,0x08,0x11,0x11,0x11,0x10,0x0F,0x00, // 57 '9' - 0x00,0x00,0x40,0xE0,0x40,0x00,0x00,0x00,0x00,0x00,0x10,0x38,0x10,0x00,0x00,0x00, // 58 ':' - 0x00,0x00,0x40,0xE0,0x40,0x00,0x00,0x00,0x00,0x40,0x30,0x18,0x08,0x00,0x00,0x00, // 59 ';' - 0x00,0x00,0x80,0x40,0x20,0x10,0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // 60 '<' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x00, // 61 '=' - 0x00,0x00,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x10,0x08,0x04,0x02,0x01,0x00, // 62 '>' - 0x00,0x08,0x08,0x88,0x48,0x30,0x00,0x00,0x00,0x00,0x1B,0x00,0x00,0x00,0x00,0x00, // 63 '?' - 0x00,0xE0,0x10,0x88,0x48,0x48,0xF0,0x00,0x00,0x07,0x08,0x13,0x14,0x14,0x07,0x00, // 64 '@' - 0x00,0xF0,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x1F,0x01,0x01,0x01,0x01,0x1F,0x00, // 65 'A' - 0x00,0xF8,0x88,0x88,0x88,0xF0,0x00,0x00,0x00,0x1F,0x10,0x10,0x10,0x10,0x0F,0x00, // 66 'B' - 0x00,0xF0,0x08,0x08,0x08,0x08,0x30,0x00,0x00,0x0F,0x10,0x10,0x10,0x10,0x0C,0x00, // 67 'C' - 0x00,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x00,0x1F,0x10,0x10,0x10,0x08,0x07,0x00, // 68 'D' - 0x00,0xF8,0x88,0x88,0x88,0x88,0x08,0x00,0x00,0x1F,0x10,0x10,0x10,0x10,0x10,0x00, // 69 'E' - 0x00,0xF8,0x88,0x88,0x88,0x88,0x08,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00, // 70 'F' - 0x00,0xF0,0x08,0x08,0x08,0x08,0x30,0x00,0x00,0x0F,0x10,0x10,0x11,0x11,0x0F,0x00, // 71 'G' - 0x00,0xF8,0x80,0x80,0x80,0x80,0xF8,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x1F,0x00, // 72 'H' - 0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x10,0x10,0x1F,0x10,0x10,0x00,0x00, // 73 'I' - 0x00,0x00,0x00,0x08,0x08,0x08,0xF8,0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x0F,0x00, // 74 'J' - 0x00,0xF8,0x80,0x40,0xA0,0x10,0x08,0x00,0x00,0x1F,0x00,0x00,0x01,0x06,0x18,0x00, // 75 'K' - 0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x10,0x10,0x10,0x10,0x10,0x00, // 76 'L' - 0x00,0xF8,0x30,0xC0,0x00,0xC0,0x30,0xF8,0x00,0x1F,0x00,0x00,0x03,0x00,0x00,0x1F, // 77 'M' - 0x00,0xF8,0x30,0xC0,0x00,0x00,0xF8,0x00,0x00,0x1F,0x00,0x00,0x03,0x0C,0x1F,0x00, // 78 'N' - 0x00,0xF0,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x0F,0x10,0x10,0x10,0x10,0x0F,0x00, // 79 'O' - 0x00,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x1F,0x01,0x01,0x01,0x01,0x00,0x00, // 80 'P' - 0x00,0xF0,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x0F,0x10,0x10,0x1C,0x30,0x2F,0x00, // 81 'Q' - 0x00,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x1F,0x01,0x03,0x05,0x09,0x10,0x00, // 82 'R' - 0x00,0x70,0x88,0x88,0x08,0x08,0x10,0x00,0x00,0x08,0x10,0x10,0x11,0x11,0x0E,0x00, // 83 'S' - 0x00,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00, // 84 'T' - 0x00,0xF8,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x0F,0x10,0x10,0x10,0x10,0x0F,0x00, // 85 'U' - 0x00,0xF8,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x01,0x06,0x18,0x18,0x06,0x01,0x00, // 86 'V' - 0x00,0xF8,0x00,0x00,0x80,0x00,0x00,0xF8,0x00,0x07,0x18,0x06,0x01,0x06,0x18,0x07, // 87 'W' - 0x00,0x18,0x60,0x80,0x80,0x60,0x18,0x00,0x00,0x18,0x06,0x01,0x01,0x06,0x18,0x00, // 88 'X' - 0x00,0x78,0x80,0x00,0x00,0x80,0x78,0x00,0x00,0x00,0x00,0x01,0x1F,0x00,0x00,0x00, // 89 'Y' - 0x00,0x08,0x08,0x08,0x88,0x68,0x18,0x00,0x00,0x18,0x14,0x13,0x10,0x10,0x10,0x00, // 90 'Z' - 0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00, // 91 '[' - 0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0C,0x30,0x00, // 92 '\' - 0x00,0x04,0x04,0x04,0xFC,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00, // 93 ']' - 0x00,0x20,0x10,0x08,0x08,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 94 '^' - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x00, // 95 '_' - 0x00,0x00,0x08,0x18,0x30,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 96 '`' - 0x00,0x00,0x40,0x40,0x40,0x40,0x80,0x00,0x00,0x0E,0x11,0x11,0x11,0x09,0x1F,0x00, // 97 'a' - 0x00,0xF8,0x80,0x40,0x40,0x40,0x80,0x00,0x00,0x1F,0x08,0x10,0x10,0x10,0x0F,0x00, // 98 'b' - 0x00,0x80,0x40,0x40,0x40,0x40,0x80,0x00,0x00,0x0F,0x10,0x10,0x10,0x10,0x08,0x00, // 99 'c' - 0x00,0x80,0x40,0x40,0x40,0x80,0xF8,0x00,0x00,0x0F,0x10,0x10,0x10,0x08,0x1F,0x00, // 100 'd' - 0x00,0x80,0x40,0x40,0x40,0x40,0x80,0x00,0x00,0x0F,0x12,0x12,0x12,0x12,0x13,0x00, // 101 'e' - 0x00,0x00,0xF0,0x08,0x08,0x08,0x10,0x00,0x00,0x01,0x1F,0x01,0x01,0x01,0x00,0x00, // 102 'f' - 0x00,0x80,0x40,0x40,0x40,0x80,0xC0,0x00,0x00,0x47,0x88,0x88,0x88,0x84,0x7F,0x00, // 103 'g' - 0x00,0xF8,0x80,0x40,0x40,0x40,0x80,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x1F,0x00, // 104 'h' - 0x00,0x00,0x40,0x40,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00, // 105 'i' - 0x00,0x00,0x00,0x40,0x40,0xD8,0x00,0x00,0x00,0x20,0x40,0x40,0x40,0x3F,0x00,0x00, // 106 'j' - 0x00,0xF8,0x00,0x00,0x80,0x40,0x00,0x00,0x00,0x1F,0x02,0x03,0x04,0x08,0x10,0x00, // 107 'k' - 0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x10,0x10,0x10,0x00,0x00, // 108 'l' - 0x00,0xC0,0x40,0x40,0x80,0x40,0x40,0x80,0x00,0x1F,0x00,0x00,0x07,0x00,0x00,0x1F, // 109 'm' - 0x00,0xC0,0x80,0x40,0x40,0x40,0x80,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x1F,0x00, // 110 'n' - 0x00,0x80,0x40,0x40,0x40,0x40,0x80,0x00,0x00,0x0F,0x10,0x10,0x10,0x10,0x0F,0x00, // 111 'o' - 0x00,0xC0,0x80,0x40,0x40,0x40,0x80,0x00,0x00,0xFF,0x04,0x08,0x08,0x08,0x07,0x00, // 112 'p' - 0x00,0x80,0x40,0x40,0x40,0x80,0xC0,0x00,0x00,0x07,0x08,0x08,0x08,0x04,0xFF,0x00, // 113 'q' - 0x00,0xC0,0x80,0x40,0x40,0x40,0x80,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00, // 114 'r' - 0x00,0x80,0x40,0x40,0x40,0x40,0x80,0x00,0x00,0x09,0x12,0x12,0x12,0x12,0x0C,0x00, // 115 's' - 0x00,0x40,0xF0,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x0F,0x10,0x10,0x10,0x08,0x00, // 116 't' - 0x00,0xC0,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x0F,0x10,0x10,0x10,0x08,0x1F,0x00, // 117 'u' - 0x00,0xC0,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x01,0x06,0x18,0x18,0x06,0x01,0x00, // 118 'v' - 0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x0F,0x10,0x08,0x07,0x08,0x10,0x0F, // 119 'w' - 0x00,0x40,0x80,0x00,0x00,0x80,0x40,0x00,0x00,0x10,0x08,0x05,0x05,0x08,0x10,0x00, // 120 'x' - 0x00,0xC0,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x47,0x88,0x88,0x88,0x84,0x7F,0x00, // 121 'y' - 0x00,0x40,0x40,0x40,0x40,0x40,0xC0,0x00,0x00,0x10,0x18,0x14,0x12,0x11,0x10,0x00, // 122 'z' - 0x00,0x00,0x00,0x00,0xF8,0x04,0x04,0x00,0x00,0x00,0x01,0x01,0x3E,0x40,0x40,0x00, // 123 '{' - 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00, // 124 '|' - 0x00,0x04,0x04,0xF8,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x3E,0x01,0x01,0x00,0x00, // 125 '}' - 0x00,0x60,0x10,0x10,0x20,0x40,0x40,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 126 '~' diff --git a/font88.h b/font88.h deleted file mode 100644 index 6b10b59..0000000 --- a/font88.h +++ /dev/null @@ -1,121 +0,0 @@ -// File generated by 'bdfe -r -s 32-126 clR8x8.bdf' -// COMMENT http://cgit.freedesktop.org/xorg/font/schumacher-misc/tree/clR8x8.bdf -// COMMENT $Xorg: clR8x8.bdf,v 1.3 2000/08/18 15:17:40 xorgcvs Exp $ -// COMMENT -// COMMENT Copyright 1989 Dale Schumacher, dal@syntel.mn.org -// COMMENT 399 Beacon Ave. -// COMMENT St. Paul, MN 55104-3527 -// COMMENT -// COMMENT Permission to use, copy, modify, and distribute this software and -// COMMENT its documentation for any purpose and without fee is hereby -// COMMENT granted, provided that the above copyright notice appear in all -// COMMENT copies and that both that copyright notice and this permission -// COMMENT notice appear in supporting documentation, and that the name of -// COMMENT Dale Schumacher not be used in advertising or publicity pertaining to -// COMMENT distribution of the software without specific, written prior -// COMMENT permission. Dale Schumacher makes no representations about the -// COMMENT suitability of this software for any purpose. It is provided "as -// COMMENT is" without express or implied warranty. -// COMMENT -// FONT -Schumacher-Clean-Medium-R-Normal--8-80-75-75-C-80-ISO646.1991-IRV -// FONTBOUNDINGBOX 8 8 0 -1 -// FONT_ASCENT 7 -// FONT_DESCENT 1 -// COPYRIGHT "Copyright 1989 Dale Schumacher." -// Converted Font Size 8x8 - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 32 ' ' - 0x00,0x00,0x00,0x00,0x5F,0x00,0x00,0x00, // 33 '!' - 0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x00, // 34 '"' - 0x00,0x00,0x14,0x7F,0x14,0x7F,0x14,0x00, // 35 '#' - 0x00,0x00,0x24,0x2A,0x7F,0x2A,0x12,0x00, // 36 '$' - 0x00,0x02,0x45,0x32,0x08,0x26,0x51,0x20, // 37 '%' - 0x00,0x32,0x4D,0x49,0x51,0x20,0x50,0x00, // 38 '&' - 0x00,0x00,0x00,0x04,0x03,0x01,0x00,0x00, // 39 ''' - 0x00,0x00,0x00,0x1C,0x22,0x41,0x00,0x00, // 40 '(' - 0x00,0x00,0x00,0x41,0x22,0x1C,0x00,0x00, // 41 ')' - 0x00,0x04,0x44,0x28,0x1F,0x28,0x44,0x04, // 42 '*' - 0x00,0x08,0x08,0x08,0x7F,0x08,0x08,0x08, // 43 '+' - 0x00,0x00,0x80,0x60,0x20,0x00,0x00,0x00, // 44 ',' - 0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, // 45 '-' - 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00, // 46 '.' - 0x00,0x00,0xC0,0x30,0x0C,0x03,0x00,0x00, // 47 '/' - 0x00,0x3E,0x41,0x41,0x41,0x41,0x3E,0x00, // 48 '0' - 0x00,0x00,0x00,0x02,0x7F,0x00,0x00,0x00, // 49 '1' - 0x00,0x42,0x61,0x51,0x49,0x45,0x42,0x00, // 50 '2' - 0x00,0x22,0x41,0x49,0x49,0x49,0x36,0x00, // 51 '3' - 0x00,0x10,0x18,0x14,0x52,0x7F,0x50,0x00, // 52 '4' - 0x00,0x4F,0x49,0x49,0x49,0x49,0x31,0x00, // 53 '5' - 0x00,0x3C,0x4A,0x49,0x49,0x49,0x30,0x00, // 54 '6' - 0x00,0x01,0x01,0x41,0x31,0x0D,0x03,0x00, // 55 '7' - 0x00,0x36,0x49,0x49,0x49,0x49,0x36,0x00, // 56 '8' - 0x00,0x06,0x49,0x49,0x49,0x29,0x1E,0x00, // 57 '9' - 0x00,0x00,0x00,0x66,0x66,0x00,0x00,0x00, // 58 ':' - 0x00,0x00,0x80,0x66,0x26,0x00,0x00,0x00, // 59 ';' - 0x00,0x08,0x08,0x14,0x14,0x22,0x22,0x00, // 60 '<' - 0x00,0x24,0x24,0x24,0x24,0x24,0x24,0x24, // 61 '=' - 0x00,0x22,0x22,0x14,0x14,0x08,0x08,0x00, // 62 '>' - 0x00,0x00,0x02,0x01,0x51,0x09,0x06,0x00, // 63 '?' - 0x00,0x1C,0x22,0x49,0x55,0x49,0x12,0x0C, // 64 '@' - 0x00,0x40,0x70,0x1C,0x17,0x1C,0x70,0x40, // 65 'A' - 0x00,0x7F,0x49,0x49,0x49,0x49,0x49,0x36, // 66 'B' - 0x00,0x1C,0x22,0x41,0x41,0x41,0x41,0x22, // 67 'C' - 0x00,0x7F,0x41,0x41,0x41,0x41,0x22,0x1C, // 68 'D' - 0x00,0x7F,0x49,0x49,0x49,0x49,0x41,0x41, // 69 'E' - 0x00,0x7F,0x09,0x09,0x09,0x09,0x01,0x01, // 70 'F' - 0x00,0x1C,0x22,0x41,0x41,0x49,0x49,0x7A, // 71 'G' - 0x00,0x7F,0x08,0x08,0x08,0x08,0x08,0x7F, // 72 'H' - 0x00,0x00,0x41,0x41,0x7F,0x41,0x41,0x00, // 73 'I' - 0x00,0x30,0x40,0x40,0x41,0x41,0x3F,0x00, // 74 'J' - 0x00,0x7F,0x08,0x08,0x14,0x22,0x41,0x00, // 75 'K' - 0x00,0x7F,0x40,0x40,0x40,0x40,0x40,0x00, // 76 'L' - 0x00,0x7F,0x02,0x04,0x08,0x04,0x02,0x7F, // 77 'M' - 0x00,0x7F,0x02,0x04,0x08,0x10,0x20,0x7F, // 78 'N' - 0x00,0x1C,0x22,0x41,0x41,0x41,0x22,0x1C, // 79 'O' - 0x00,0x7F,0x09,0x09,0x09,0x09,0x09,0x06, // 80 'P' - 0x00,0x1C,0x22,0x41,0x41,0xC1,0xA2,0x9C, // 81 'Q' - 0x00,0x7F,0x09,0x09,0x09,0x19,0x29,0x46, // 82 'R' - 0x00,0x26,0x49,0x49,0x49,0x49,0x49,0x32, // 83 'S' - 0x00,0x01,0x01,0x01,0x7F,0x01,0x01,0x01, // 84 'T' - 0x00,0x3F,0x40,0x40,0x40,0x40,0x40,0x3F, // 85 'U' - 0x00,0x01,0x07,0x18,0x60,0x18,0x07,0x01, // 86 'V' - 0x00,0x7F,0x20,0x10,0x08,0x10,0x20,0x7F, // 87 'W' - 0x00,0x41,0x22,0x14,0x08,0x14,0x22,0x41, // 88 'X' - 0x00,0x01,0x02,0x04,0x78,0x04,0x02,0x01, // 89 'Y' - 0x00,0x41,0x61,0x51,0x49,0x45,0x43,0x41, // 90 'Z' - 0x00,0x00,0x00,0x00,0x7F,0x41,0x41,0x00, // 91 '[' - 0x00,0x00,0x03,0x0C,0x30,0xC0,0x00,0x00, // 92 '\' - 0x00,0x00,0x41,0x41,0x7F,0x00,0x00,0x00, // 93 ']' - 0x00,0x00,0x04,0x02,0x01,0x02,0x04,0x00, // 94 '^' - 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80, // 95 '_' - 0x00,0x00,0x00,0x01,0x03,0x04,0x00,0x00, // 96 '`' - 0x00,0x38,0x44,0x44,0x44,0x44,0x24,0x7C, // 97 'a' - 0x00,0x7F,0x44,0x44,0x44,0x44,0x44,0x38, // 98 'b' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x00, // 99 'c' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x7F, // 100 'd' - 0x00,0x38,0x54,0x54,0x54,0x54,0x54,0x18, // 101 'e' - 0x00,0x04,0x7E,0x05,0x05,0x01,0x01,0x00, // 102 'f' - 0x00,0x18,0xA4,0xA4,0xA4,0xA4,0xA4,0x7C, // 103 'g' - 0x00,0x7F,0x04,0x04,0x04,0x04,0x04,0x78, // 104 'h' - 0x00,0x00,0x44,0x44,0x7D,0x40,0x40,0x00, // 105 'i' - 0x00,0x00,0x80,0x84,0x84,0x84,0x7D,0x00, // 106 'j' - 0x00,0x7F,0x10,0x10,0x28,0x44,0x44,0x00, // 107 'k' - 0x00,0x00,0x00,0x41,0x7F,0x40,0x00,0x00, // 108 'l' - 0x00,0x7C,0x04,0x04,0x38,0x04,0x04,0x78, // 109 'm' - 0x00,0x7C,0x08,0x04,0x04,0x04,0x04,0x78, // 110 'n' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38, // 111 'o' - 0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0x38, // 112 'p' - 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0xFC, // 113 'q' - 0x00,0x00,0x7C,0x08,0x04,0x04,0x04,0x00, // 114 'r' - 0x00,0x48,0x54,0x54,0x54,0x54,0x24,0x00, // 115 's' - 0x00,0x04,0x04,0x3F,0x44,0x44,0x44,0x00, // 116 't' - 0x00,0x3C,0x40,0x40,0x40,0x40,0x20,0x7C, // 117 'u' - 0x00,0x04,0x0C,0x30,0x40,0x30,0x0C,0x04, // 118 'v' - 0x00,0x3C,0x40,0x40,0x38,0x40,0x40,0x3C, // 119 'w' - 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44, // 120 'x' - 0x00,0x1C,0xA0,0xA0,0xA0,0xA0,0x7C,0x00, // 121 'y' - 0x00,0x44,0x64,0x54,0x54,0x4C,0x44,0x00, // 122 'z' - 0x00,0x00,0x00,0x08,0x36,0x41,0x00,0x00, // 123 '{' - 0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00, // 124 '|' - 0x00,0x00,0x00,0x41,0x36,0x08,0x00,0x00, // 125 '}' - 0x00,0x06,0x01,0x01,0x02,0x04,0x04,0x03, // 126 '~' diff --git a/li2c.c b/li2c.c deleted file mode 100644 index eda6fa0..0000000 --- a/li2c.c +++ /dev/null @@ -1,132 +0,0 @@ -/* BSD License - Copyright (c) 2015 Andrey Chilikin https://github.com/achilikin - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - Basic Linux I2C wrapper for Raspberry Pi and Intel Edison, - only write is supported - - For Raspberry Pi make sure that RPi i2c driver is enabled, check following - files: - /etc/modprobe.d/raspi-blacklist.conf - #blacklist i2c-bcm2708 - /etc/modules - i2c-dev - /etc/modprobe.d/i2c.conf - options i2c_bcm2708 baudrate=400000 -*/ - -#include -#include -#include -#include -#include - -#include "li2c.h" - -/* by default RPi mode, so bus 1 is valid for RPi and Edison */ -static li2c_mode_t i2c_mode = LI2C_RPI; - -/** i2c bus file descriptors */ -static int i2c_bus[LI2C_MAX_BUS]; - -static int is_valid_bus(uint8_t bus) -{ - if (i2c_mode == LI2C_RPI) { - if (bus > PI2C_MAX_BUS) - return 0; - return 1; - } - if (i2c_mode == LI2C_EDISON) { - if (bus > EDI2C_MAX_BUS) - return 0; - return 1; - } - return 0; -} - -/* select I2C mode - Raspberry or Edison for bus index validation */ -int li2c_init(li2c_mode_t mode) -{ - for(int i = 0; i < LI2C_MAX_BUS; i++) - i2c_bus[i] = -1; - i2c_mode = mode; - return 0; -} - -/** open I2C bus if not opened yet and store file descriptor */ -int li2c_open(uint8_t bus) -{ - char bus_name[64]; - - if (!is_valid_bus(bus)) - return -1; - - // already opened? - if (i2c_bus[bus] >= 0) - return 0; - - // open i2c bus and store file descriptor - sprintf(bus_name, "/dev/i2c-%u", bus); - - if ((i2c_bus[bus] = open(bus_name, O_RDWR)) < 0) - return -1; - - return 0; -} - -/** close I2C bus file descriptor */ -int li2c_close(uint8_t bus) -{ - if (!is_valid_bus(bus)) - return -1; - - if (i2c_bus[bus] >= 0) - close(i2c_bus[bus]); - i2c_bus[bus] = -1; - - return 0; -} - -/** select I2C device for li2c_write() calls */ -int li2c_select(uint8_t bus, uint8_t slave) -{ - if (!is_valid_bus(bus) || (i2c_bus[bus] < 0)) - return -1; - - return ioctl(i2c_bus[bus], I2C_SLAVE, slave); -} - -/** write to I2C device selected by li2c_select() */ -int li2c_write(uint8_t bus, const uint8_t *data, uint32_t len) -{ - if (!is_valid_bus(bus) || (i2c_bus[bus] < 0)) - return -1; - - if (write(i2c_bus[bus], data, len) != (ssize_t)len) - return -1; - - return 0; -} diff --git a/li2c.h b/li2c.h deleted file mode 100644 index bd3a242..0000000 --- a/li2c.h +++ /dev/null @@ -1,72 +0,0 @@ -/* BSD License - Copyright (c) 2015 Andrey Chilikin https://github.com/achilikin - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - Basic Linux I2C wrapper for Raspberry Pi and Intel Edison, - only write is supported - - For Raspberry Pi make sure that RPi i2c driver is enabled, check following - files: - /etc/modprobe.d/raspi-blacklist.conf - #blacklist i2c-bcm2708 - /etc/modules - i2c-dev - /etc/modprobe.d/i2c.conf - options i2c_bcm2708 baudrate=400000 -*/ - -#ifndef __LI2C_H__ -#define __LI2C_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define PI2C_BUS0 0 /*< P5 header I2C bus */ -#define PI2C_BUS1 1 /*< P1 header I2C bus */ -#define PI2C_MAX_BUS PI2C_BUS1 - -#define EDI2C_BUS1 1 -#define EDI2C_BUS6 6 -#define EDI2C_MAX_BUS EDI2C_BUS6 - -#define LI2C_MAX_BUS 8 - -typedef enum li2c_mode { LI2C_RPI, LI2C_EDISON } li2c_mode_t; - -int li2c_init(li2c_mode_t mode); /*< init I2C bus */ -int li2c_open(uint8_t bus); /*< open I2C bus */ -int li2c_close(uint8_t bus); /*< close I2C bus */ -int li2c_select(uint8_t bus, uint8_t slave); /*< select I2C slave */ -int li2c_write(uint8_t bus, const uint8_t *data, uint32_t len); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/main.c b/main.c index a5a29ef..1a35891 100644 --- a/main.c +++ b/main.c @@ -35,9 +35,7 @@ #include #include "bdf.h" -#include "li2c.h" #include "rterm.h" -#include "ossd_i2c.h" #define DISPLAY_FONT 0x80000000 @@ -65,11 +63,6 @@ static void usage(const char *name) printf(" all: print all glyphs, not just 32-126\n"); printf(" native: do not adjust font height 8 pixels\n"); printf(" ascender H: add extra ascender of H pixels per glyph\n"); - printf(" rotate: rotate glyphs' bitmaps CCW\n"); - printf(" display show converted font on SSD1306 compatible display\n"); - printf(" i2c_bus B: I2C bus for SSD1306 compatible display (default 1)\n"); - printf(" i2c_addr A: I2C address for SSD1306 compatible display (default 0x3C)\n"); - printf(" updown: display orientation is upside down\n"); } int main(int argc, char **argv) @@ -77,11 +70,6 @@ int main(int argc, char **argv) char *file; bdfe_t *font; int flags = 0; - uint8_t driver = OSSD_SSD1306; - uint8_t i2c_bus = 1; - uint8_t i2c_address = 0x3C; - uint8_t orientation = 0; - uint32_t gidx = 0; unsigned ascender = 0; unsigned gmin = 32, gmax = 126; @@ -137,31 +125,8 @@ int main(int argc, char **argv) if (arg_is(argv[i], "-r", "rotate")) flags |= BDF_ROTATE; - if (arg_is(argv[i], "-3", "ssd1306")) - driver = OSSD_SSD1306; - - if (arg_is(argv[i], "-1", "sh1106")) - driver = OSSD_SH1106; - - if (arg_is(argv[i], "-B", "i2c_bus")) { - i++; - uint32_t i2bus = strtoul(argv[i], NULL, 16); - if (i2bus && (i2bus < LI2C_MAX_BUS)) - i2c_bus = i2bus; - } - - if (arg_is(argv[i], "-A", "i2c_addr")) { - i++; - uint32_t i2ca = strtoul(argv[i], NULL, 16); - if (i2ca && (i2ca < 0x78)) - i2c_address = i2ca; - } - if (arg_is(argv[i], "-d", "display")) flags |= DISPLAY_FONT; - - if (arg_is(argv[i], "-u", "updown")) - orientation = OSSD_UPDOWN; } file = argv[argc - 1]; @@ -172,71 +137,6 @@ int main(int argc, char **argv) return -1; } - if (!(flags & DISPLAY_FONT)) { - free(font); - return 0; - } - - if (i2c_bus > PI2C_MAX_BUS) - li2c_init(LI2C_EDISON); - else - li2c_init(LI2C_RPI); - - if (li2c_open(i2c_bus) < 0) { - fprintf(stderr, "Unable to open i2c bus %d\n", i2c_bus); - free(font); - return -1; - } - if (li2c_select(i2c_bus, i2c_address) < 0) { - fprintf(stderr, "Unable to open select device at %02X\n", i2c_address); - free(font); - return -1; - } - - ossd_font_t of; - of.gw = font->gw; - of.gh = font->bpg; - of.go = (uint8_t)gmin; - of.gn = (uint8_t)font->chars; - of.font = font->font; - - ossd_init(driver, i2c_bus, orientation); - ossd_set_user_font(&of, NULL); - ossd_select_font(OSSD_FONT_USER); - - int gh = (of.gh + 7)/8; // glyph height in lines - - char buf[16]; - sprintf(buf, "%dx%d", of.gw, of.gh); - file = basename(file); - ossd_putlx(0, -1, file, OSSD_TEXT_REVERSE); - ossd_putlx(8 - gh, -1, buf, OSSD_TEXT_UNDERLINE | OSSD_TEXT_OVERLINE); - buf[1] = '\0'; - - stdin_mode(TERM_MODE_RAW); - fprintf(stderr, "Press any key to continue, 'q' to exit\n"); - if (stdin_getch(-1) == 'q') goto exit; - - ossd_fill_screen(0); - - do { - if (gidx > 0) { - fprintf(stderr, "Press any key to continue, 'q' to exit\n"); - if (stdin_getch(-1) == 'q') break; - ossd_fill_screen(0); - } - for(int line = 0, l = 0; line < 8; line += gh, l++) { - for(int i = 0; i < (128/of.gw) && gidx < font->chars; i++, gidx++) { - buf[0] = gidx + of.go; - ossd_putlx(line, i*of.gw, (const char *)buf, 0); - } - } - } while(gidx < font->chars); - -exit: - stdin_mode(TERM_MODE_CAN); - li2c_close(i2c_bus); free(font); - return 0; } diff --git a/ossd_i2c.c b/ossd_i2c.c deleted file mode 100644 index 6e2e151..0000000 --- a/ossd_i2c.c +++ /dev/null @@ -1,399 +0,0 @@ -/* BSD License - Copyright (c) 2015 Andrey Chilikin https://github.com/achilikin - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - Limited set of functions for SSD1306 / SH1106 compatible OLED 128x64 displays - in text mode to minimize memory footprint if used on Atmel AVRs chips - with low memory. -*/ - -#include - -#include "ossd_i2c.h" - -#if (OSSD_TARGET == OSSD_IF_AVR) - #include - #include - #include - #include "i2cmaster.h" -#else - #define PROGMEM - #define pgm_read_byte(x) (*((uint8_t *)x)) - #include - #include - #if (OSSD_TARGET == OSSD_IF_WIRE) - #include "wi2c.h" - #else - #include "li2c.h" -#endif -#endif - -#define OSSD_CMD 0x00 -#define OSSD_DATA 0x40 - -#define OSSD_SET_ADDR_MODE 0x20 -#define OSSD_ADDR_MODE_PAGE 0x10 -#define OSSD_ADDR_MODE_HOR 0x00 -#define OSSD_ADDR_MODE_VER 0x01 - -#define OSSD_SET_COL_ADDR 0x21 -#define OSSD_SET_PAGE_ADDR 0x22 - -#define OSSD_SET_START_LINE 0x40 - -#define OSSD_SET_START_PAGE 0xB0 -#define OSSD_SET_START_LCOL 0x00 -#define OSSD_SET_START_HCOL 0x10 - -#define OSSD_SET_MUX_RATIO 0xA8 -#define OSSD_SET_DISP_OFFSET 0xD3 - -#define OSSD_SET_CONTRAST 0x81 - -#define OSSD_SET_SEG_REMAP 0xA0 -#define OSSD_SEG_REMAP_R2L 0x01 - -#define OSSD_SET_COM_DIR 0xC0 -#define OSSD_COM_DIR_UPDOWN 0x08 - -#define OSSD_SET_COM_CONFIG 0xDA -#define OSSD_COM_ALT 0x12 -#define OSSD_COM_LR_REMAP 0x22 - -#define OSSD_SET_SLEEP_ON 0xAE -#define OSSD_SET_SLEEP_OFF 0xAF - -#define OSSD_SET_INVERSE_ON 0xA7 -#define OSSD_SET_INVERSE_OFF 0xA6 - -#define OSSD_SET_OUTPUT_RAM 0xA4 -#define OSSD_SET_OUTPUT_ON 0xA5 - -#define OSSD_SET_DISP_CLOCK 0xD5 - -#define OSSD_SET_PRECHARGE 0xD9 - -#define OSSD_SET_VCOMH_LEVEL 0xDB -#define OSSD_VCOMH_L065 0x00 -#define OSSD_VCOMH_L077 0x20 -#define OSSD_VCOMH_L083 0x30 - -#define OSSD_SET_CHARGE_PUMP 0x8D -#define OSSD_CHARGE_PUMP_ON 0x14 -#define OSSD_CHARGE_PUMP_OFF 0x10 - -#define OSSD_SET_DC_DC 0xAD -#define OSSD_DC_DC_DISABLE 0x8A -#define OSSD_DC_DC_ENABLE 0x8B - -#define OSSD_SET_PUMP_VPP 0x30 -#define OSSD_VPP_V74 0x00 // 7.4V -#define OSSD_VPP_V80 0x01 // 8.0V -#define OSSD_VPP_V84 0x02 // 8.4V -#define OSSD_VPP_V90 0x03 // 9.0V - -static const uint8_t font68[] PROGMEM = { -#include "font6x8.h" -}; - -static const uint8_t font88[] PROGMEM = { -#include "font88.h" -}; - -static const uint8_t font816[] PROGMEM = { -#include "font816.h" -}; - -static ossd_font_t _ofont[OSSD_FONT_MAX+1] = { - { 6, 8, 32, 127-32, font68 }, - { 8, 8, 32, 127-32, font88 }, - { 8, 16, 32, 127-32, font816 }, - { 0, 0, 0, 0, NULL } -}; - -static uint8_t _cfont; -static uint8_t _offset; -static uint8_t _i2c_val; - -uint8_t ossd_select_font(uint8_t font) -{ - uint8_t fret = _cfont; - if (font <= OSSD_FONT_MAX) - _cfont = font; - return fret; -} - -void ossd_set_user_font(ossd_font_t *nfont, ossd_font_t *ofont) -{ - if (ofont) { - ofont->gw = _ofont[OSSD_FONT_USER].gw; - ofont->gh = _ofont[OSSD_FONT_USER].gh; - ofont->go = _ofont[OSSD_FONT_USER].go; - ofont->gn = _ofont[OSSD_FONT_USER].gn; - ofont->font = _ofont[OSSD_FONT_USER].font; - } - _ofont[OSSD_FONT_USER].gw = nfont->gw; - _ofont[OSSD_FONT_USER].gh = nfont->gh; - _ofont[OSSD_FONT_USER].go = nfont->go; - _ofont[OSSD_FONT_USER].gn = nfont->gn; - _ofont[OSSD_FONT_USER].font = nfont->font; -} - -#if (OSSD_TARGET == OSSD_IF_LINUX) - -static void ossd_send_byte(uint8_t dc, uint8_t data) -{ - uint8_t buf[2]; - buf[0] = dc; - buf[1] = data; - - li2c_write(_i2c_val, buf, 2); -} - -static void ossd_cmd_arg(uint8_t cmd, uint8_t arg) -{ - uint8_t data[3]; - data[0] = OSSD_CMD; - data[1] = cmd; - data[2] = arg; - li2c_write(_i2c_val, data, 3); -} - -static void ossd_fill_line(uint8_t data, uint8_t num) -{ - uint8_t *buf = (uint8_t *)alloca(num+1); - memset(buf, data, num+1); - buf[0] = OSSD_DATA; - li2c_write(_i2c_val, buf, num+1); -} - -#else - -static void ossd_send_byte(uint8_t dc, uint8_t data) -{ - i2c_start(_i2c_val); - i2c_write(dc); - i2c_write(data); - i2c_stop(); -} - -static void ossd_cmd_arg(uint8_t cmd, uint8_t arg) -{ - i2c_start(_i2c_val); - i2c_write(OSSD_CMD); - i2c_write(cmd); - i2c_write(arg); - i2c_stop(); -} - -#if (OSSD_TARGET == OSSD_IF_AVR) - -static void ossd_fill_line(uint8_t data, uint8_t num) -{ - uint8_t i; - i2c_start(_i2c_val); - i2c_write(OSSD_DATA); - for(i = 0; i < num; i++) - i2c_write(data); - i2c_stop(); -} - -#else - -static inline void ossd_data(uint8_t cmd); - -static void ossd_fill_line(uint8_t data, uint8_t num) -{ - uint8_t i; - for(i = 0; i < num; i++) - ossd_data(data); -} -#endif - -#endif - -static inline void ossd_cmd(uint8_t cmd) -{ - ossd_send_byte(OSSD_CMD, cmd); -} - -static inline void ossd_data(uint8_t data) -{ - ossd_send_byte(OSSD_DATA, data); -} - -void ossd_goto(uint8_t line, uint8_t x) -{ - x += _offset; - ossd_cmd(OSSD_SET_START_PAGE | (line & 0x07)); - ossd_cmd(OSSD_SET_START_LCOL | (x & 0x0F)); - ossd_cmd(OSSD_SET_START_HCOL | (x >> 4)); -} - -void ossd_fill_screen(uint8_t data) -{ - // fill full screen line by line - uint8_t line; - for(line = 0; line < 8; line++) { - ossd_goto(line, 0); - ossd_fill_line(data, 128); - } -} - -void ossd_sleep(uint8_t on_off) -{ - if (on_off) - ossd_cmd(OSSD_SET_SLEEP_ON); - else - ossd_cmd(OSSD_SET_SLEEP_OFF); -} - -void ossd_set_contrast(uint8_t val) -{ - ossd_cmd_arg(OSSD_SET_CONTRAST, val); -} - -static void ossd_put_centre(uint8_t line, const char *str, uint8_t atr) -{ - uint16_t len; - uint8_t x = 0; - uint8_t gw = _ofont[_cfont].gw; - uint8_t gh = _ofont[_cfont].gh; - for(len = 0; str[x]; len+=gw, x++); - if (len > 128) - x = 0; - else - x = (128 - len) / 2; - - // in case if new text is shorter than previous one - // we clean line up to x position - if (x) { - uint8_t i; - for(i = 0; i < (gh+7)/8; i++) { - ossd_goto(line + i, 0); - ossd_fill_line(0, x); - } - } - - // recursive call of ossd_putlx() - ossd_putlx(line, x, str, atr); - - // in case if new text is shorter than previous one - // we clean to the end of the line - if (x) { - uint8_t i; - for(i = 0; i < (gh+7)/8; i++) { - ossd_goto(line + i, x + len); - ossd_fill_line(0, x); - } - } -} - -void ossd_putlx(uint8_t line, int8_t x, const char *str, uint8_t atr) -{ - line &= 0x07; - - // try to put this text in the middle of the line: - // ossd_put_centre() will calculate proper x coordinate - if (x < 0) { - ossd_put_centre(line, str, atr); - return; - } - - uint8_t rev = 0; - uint8_t over = 0; - uint8_t under = 0; - if (atr & OSSD_TEXT_REVERSE) - rev = ~rev; - if (atr & OSSD_TEXT_OVERLINE) - over = 0x01; - if (atr & OSSD_TEXT_UNDERLINE) - under = 0x80; - - uint8_t gw = _ofont[_cfont].gw; - uint8_t gh = _ofont[_cfont].gh; - uint8_t go = _ofont[_cfont].go; - uint8_t gb = gw*(gh / 8); // bytes per glyph - const uint8_t *font = _ofont[_cfont].font; - for(; *str != '\0'; str++, x += gw) { - uint16_t idx = (*str - go) * gb; - if ((uint8_t)x > (128 - gw)) { - x = 0; - line = (line + (gh+7)/8) & 0x07; - } - ossd_goto(line, x); - uint8_t i; - for(i = 0; i < gb; i++) { - if ((gh > 8) && (i == 8)) - ossd_goto(line + 1, x); - uint8_t d = pgm_read_byte(&font[idx+i]); - d ^= rev; - if (under && (gh == 8 || i > (gw - 1))) - d ^= under; - if (i < gw) - d ^= over; - ossd_data(d); - } - } -} - -void ossd_init(uint8_t driver, uint8_t i2c_val, uint8_t orientation) -{ - _offset = 0; - _i2c_val = i2c_val; -#if (OSSD_TARGET == OSSD_IF_AVR) - _i2c_val = (_i2c_val << 1) | I2C_WRITE; -#endif - /* set all default values */ - ossd_cmd(OSSD_SET_SLEEP_ON); - ossd_cmd_arg(OSSD_SET_MUX_RATIO, 63); - ossd_cmd_arg(OSSD_SET_DISP_OFFSET, 0); - ossd_cmd(OSSD_SET_START_PAGE); - ossd_cmd(OSSD_SET_START_LINE | 0); - ossd_cmd(OSSD_SET_START_LCOL | 2); - ossd_cmd(OSSD_SET_START_HCOL | 0); - ossd_cmd(OSSD_SET_SEG_REMAP | (orientation & OSSD_SEG_REMAP_R2L)); - ossd_cmd(OSSD_SET_COM_DIR | (orientation & OSSD_COM_DIR_UPDOWN)); - ossd_cmd_arg(OSSD_SET_COM_CONFIG, OSSD_COM_ALT); - ossd_cmd_arg(OSSD_SET_CONTRAST, 0x7F); - ossd_cmd(OSSD_SET_OUTPUT_RAM); - ossd_cmd_arg(OSSD_SET_DISP_CLOCK, 0x80); - ossd_cmd_arg(OSSD_SET_PRECHARGE, 0x22); - ossd_cmd_arg(OSSD_SET_VCOMH_LEVEL, OSSD_VCOMH_L077); - ossd_cmd(OSSD_SET_INVERSE_OFF); - - if (driver != OSSD_SH1106) - ossd_cmd_arg(OSSD_SET_CHARGE_PUMP, OSSD_CHARGE_PUMP_ON); - else { - ossd_cmd_arg(OSSD_SET_DC_DC, OSSD_DC_DC_ENABLE); /* POR */ - ossd_cmd(OSSD_SET_PUMP_VPP | OSSD_VPP_V74); - _offset = 2; - } - - ossd_fill_screen(0x00); - ossd_cmd(OSSD_SET_SLEEP_OFF); - ossd_goto(0, 0); -} diff --git a/ossd_i2c.h b/ossd_i2c.h deleted file mode 100644 index c462622..0000000 --- a/ossd_i2c.h +++ /dev/null @@ -1,136 +0,0 @@ -/* BSD License - Copyright (c) 2015 Andrey Chilikin https://github.com/achilikin - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ -#ifndef __OLED_SSD1306_I2C__ -#define __OLED_SSD1306_I2C__ - -/** - Limited set of functions for SSD1306 / SH1106 compatible OLED 128x64 displays - in text mode to minimize memory footprint if used on Atmel AVRs chips - with low memory. -*/ - -#ifdef __cplusplus -extern "C" { -#if 0 -} // dummy bracket for Visual Assist -#endif -#endif - -/** Target interface */ -#define OSSD_IF_AVR 1 /*< AVR compiler */ -#define OSSD_IF_LINUX 2 /*< Linux native Intel Edison or Raspberry Pi */ -#define OSSD_IF_WIRE 3 /*< Arduino Wire Interface on Intel Edison */ - -#ifndef OSSD_TARGET -#ifdef __AVR_ARCH__ - #define OSSD_TARGET OSSD_IF_AVR -#else - #define OSSD_TARGET OSSD_IF_LINUX -#endif -#endif - -#if (OSSD_TARGET != OSSD_IF_AVR) - #include -#endif - -#define OSSD_FONT_6x8 0 -#define OSSD_FONT_8x8 1 -#define OSSD_FONT_8x16 2 -#define OSSD_FONT_USER 3 -#define OSSD_FONT_MAX OSSD_FONT_USER - -typedef struct ossd_font_s -{ - uint8_t gw; /*< glyph width */ - uint8_t gh; /*< glyph height */ - uint8_t go; /*< font offset, first glyph index */ - uint8_t gn; /*< number of glyphs presented */ - const uint8_t *font; -} ossd_font_t; - -/** - Most common OLED drivers SSD1306 and SH1106 are supported - */ -#define OSSD_SH1106 0 -#define OSSD_SSD1306 1 - -/** - flat cable connected at the top - use ossd_init(OSSD_UPDOWN) to rotate screen - */ -#define OSSD_UPDOWN 0x09 -#define OSSD_NORMAL 0x00 - -/** - set default parameters - driver: OSSD_SSD1306 or OSSD_SH1106 - i2c_val: I2C address for AVR - I2C bus for Linux (Edison, RPi) - */ -void ossd_init(uint8_t driver, uint8_t i2c_val, uint8_t orientation); - -/** fill screen with specified pattern */ -void ossd_fill_screen(uint8_t data); - -/** set display to sleep mode */ -void ossd_sleep(uint8_t on_off); - -/** set display contrast */ -void ossd_set_contrast(uint8_t val); - -/** select one of three fonts for following ossd_putlx() calls */ -uint8_t ossd_select_font(uint8_t font); - -/** - set user font selectable by OSSD_FONT_USER to nfont - store current user font in ofont (if not NULL) - */ -void ossd_set_user_font(ossd_font_t *nfont, ossd_font_t *ofont); - -/** text attributes */ -#define OSSD_TEXT_REVERSE 0x01 -#define OSSD_TEXT_UNDERLINE 0x02 -#define OSSD_TEXT_OVERLINE 0x04 - -/** - output string up to 64 chars in length - line: 0-7 - x: 0-127, or -1 for centre of the line - str: output string - atr: OSSD_TEXT_* - */ -void ossd_putlx(uint8_t line, int8_t x, const char *str, uint8_t atr); - -/** void screen */ -static inline void ossd_cls(void) { - ossd_fill_screen(0); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/wi2c.cpp b/wi2c.cpp deleted file mode 100644 index 1db24f1..0000000 --- a/wi2c.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -#include "wi2c.h" - -int i2c_start(uint8_t address) -{ - Wire.beginTransmission(address); -} - -int i2c_write(uint8_t data) -{ - Wire.write(data); -} - -int i2c_stop(void) -{ - Wire.endTransmission(); -} diff --git a/wi2c.h b/wi2c.h deleted file mode 100644 index aff17bd..0000000 --- a/wi2c.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef WIRE_TO_I2C_HEADER -#define WIRE_TO_I2C_HEADER - -#ifdef __cplusplus -extern "C" { -#endif - -int i2c_start(uint8_t address); -int i2c_write(uint8_t data); -int i2c_stop(void); - -#ifdef __cplusplus -} -#endif - -#endif -- 2.39.5