/***********************************************
 * ep29.cpp
 * 2.9 inch E-Paper Driver
 * rev 1 - shabaz - December 2017
 * free for all non-commercial use
 *
 ***********************************************/

#include "mbed.h"
#include "ep29.h"

// Definitions

// these constants are taken from Waveshare source code:
#define DRIVER_OUT_CTRL                    0x01
#define BOOST_SOFT_START_CTRL              0x0c
#define GATE_SCAN_START_POS                0x0f
#define DEEP_SLEEP                         0x10
#define DATA_ENTRY_MODE_SET                0x11
#define SW_RESET                           0x12
#define TEMP_SENSOR_CTRL                   0x1a
#define MASTER_ACTIVATION                  0x20
#define DISPLAY_UPDATE_CTRL_1              0x21
#define DISPLAY_UPDATE_CTRL_2              0x22
#define WRITE_RAM                          0x24
#define WRITE_VCOM_REG                     0x2c
#define WRITE_LUT_REG                      0x32
#define SET_DUMMY_LINE_PERIOD              0x3a
#define SET_GATE_TIME                      0x3b
#define BORDER_WAVEFORM_CTRL               0x3c
#define SET_RAM_X_ADDRESS_START_END_POS    0x44
#define SET_RAM_Y_ADDRESS_START_END_POS    0x45
#define SET_RAM_X_ADDRESS_CTR              0x4e
#define SET_RAM_Y_ADDRESS_CTR              0x4f
#define TERM_FRAME_READ_WRITE              0xff

#define EP_RST_LOW ep_rst=0
#define EP_RST_HIGH ep_rst=1
#define EP_DC_LOW ep_dc=0
#define EP_DC_HIGH ep_dc=1
#define EP_DC_CMD ep_dc=0
#define EP_DC_DATA ep_dc=1
#define EP_CS_LOW ep_cs=0
#define EP_CS_HIGH ep_cs=1
#define EP_BUSY (ep_busy.read()==1)
#define EP_NOT_BUSY (ep_busy.read()==0)

// Constants
// The array here is taken from http://paulbourke.net/dataformats/hershey/

const int8_t simplex[95][112] = {
    0,16, /* Ascii 32 */
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,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-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   26,20, /* Ascii 36 */
    8,25, 8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21, 8,21, 5,20, 3,
   18, 3,16, 4,14, 5,13, 7,12,13,10,15, 9,16, 8,17, 6,17, 3,15, 1,12, 0,
    8, 0, 5, 1, 3, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   31,24, /* Ascii 37 */
   21,21, 3, 0,-1,-1, 8,21,10,19,10,17, 9,15, 7,14, 5,14, 3,16, 3,18, 4,
   20, 6,21, 8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17, 7,15, 6,14, 4,
   14, 2,16, 0,18, 0,20, 1,21, 3,21, 5,19, 7,17, 7,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   34,26, /* Ascii 38 */
   23,12,23,13,22,14,21,14,20,13,19,11,17, 6,15, 3,13, 1,11, 0, 7, 0, 5,
    1, 4, 2, 3, 4, 3, 6, 4, 8, 5, 9,12,13,13,14,14,16,14,18,13,20,11,21,
    9,20, 8,18, 8,16, 9,13,11,10,16, 3,18, 1,20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-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   17,20, /* Ascii 48 */
    9,21, 6,20, 4,17, 3,12, 3, 9, 4, 4, 6, 1, 9, 0,11, 0,14, 1,16, 4,17,
    9,17,12,16,17,14,20,11,21, 9,21,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
    4,20, /* Ascii 49 */
    6,17, 8,18,11,21,11, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   14,20, /* Ascii 50 */
    4,16, 4,17, 5,19, 6,20, 8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,
   10, 3, 0,17, 0,-1,-1,-1,-1,-1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 3, 4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   23,20, /* Ascii 54 */
   16,18,15,20,12,21,10,21, 7,20, 5,17, 4,12, 4, 7, 5, 3, 7, 1,10, 0,11,
    0,14, 1,16, 3,17, 6,17, 7,16,10,14,12,11,13,10,13, 7,12, 5,10, 4, 7,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
    5,20, /* Ascii 55 */
   17,21, 7, 0,-1,-1, 3,21,17,21,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   29,20, /* Ascii 56 */
    8,21, 5,20, 4,18, 4,16, 5,14, 7,13,11,12,14,11,16, 9,17, 7,17, 4,16,
    2,15, 1,12, 0, 8, 0, 5, 1, 4, 2, 3, 4, 3, 7, 4, 9, 6,11, 9,12,13,13,
   15,14,16,16,16,18,15,20,12,21, 8,21,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   23,20, /* Ascii 57 */
   16,14,15,11,13, 9,10, 8, 9, 8, 6, 9, 4,11, 3,14, 3,15, 4,18, 6,20, 9,
   21,10,21,13,20,15,18,16,14,16, 9,15, 4,13, 1,10, 0, 8, 0, 5, 1, 4, 3,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   11,10, /* Ascii 58 */
    5,14, 4,13, 5,12, 6,13, 5,14,-1,-1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   14,10, /* Ascii 59 */
    5,14, 4,13, 5,12, 6,13, 5,14,-1,-1, 6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6,
   -1, 5,-3, 4,-4,-1,-1,-1,-1,-1,-1,-1,-1,-1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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   20,18, /* Ascii 63 */
    3,16, 3,17, 4,19, 5,20, 7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,
   12, 9,10, 9, 7,-1,-1, 9, 2, 8, 1, 9, 0,10, 1, 9, 2,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   55,27, /* Ascii 64 */
   18,13,17,15,15,16,12,16,10,15, 9,14, 8,11, 8, 8, 9, 6,11, 5,14, 5,16,
    6,17, 8,-1,-1,12,16,10,14, 9,11, 9, 8,10, 6,11, 5,-1,-1,18,16,17, 8,
   17, 6,19, 5,21, 5,23, 7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,
   21, 9,20, 7,19, 5,17, 4,15, 3,12, 3, 9, 4, 6, 5, 4, 7, 2, 9, 1,12, 0,
   15, 0,18, 1,20, 2,21, 3,-1,-1,19,16,18, 8,18, 6,19, 5,
    8,18, /* Ascii 65 */
    9,21, 1, 0,-1,-1, 9,21,17, 0,-1,-1, 4, 7,14, 7,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   23,21, /* Ascii 66 */
    4,21, 4, 0,-1,-1, 4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,
   11,-1,-1, 4,11,13,11,16,10,17, 9,18, 7,18, 4,17, 2,16, 1,13, 0, 4, 0,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   18,21, /* Ascii 67 */
   18,16,17,18,15,20,13,21, 9,21, 7,20, 5,18, 4,16, 3,13, 3, 8, 4, 5, 5,
    3, 7, 1, 9, 0,13, 0,15, 1,17, 3,18, 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   15,21, /* Ascii 68 */
    4,21, 4, 0,-1,-1, 4,21,11,21,14,20,16,18,17,16,18,13,18, 8,17, 5,16,
    3,14, 1,11, 0, 4, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1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-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
    8,22, /* Ascii 78 */
    4,21, 4, 0,-1,-1, 4,21,18, 0,-1,-1,18,21,18, 0,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   21,22, /* Ascii 79 */
    9,21, 7,20, 5,18, 4,16, 3,13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0,13, 0,15,
    1,17, 3,18, 5,19, 8,19,13,18,16,17,18,15,20,13,21, 9,21,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   13,21, /* Ascii 80 */
    4,21, 4, 0,-1,-1, 4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,
   10, 4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   24,22, /* Ascii 81 */
    9,21, 7,20, 5,18, 4,16, 3,13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0,13, 0,15,
    1,17, 3,18, 5,19, 8,19,13,18,16,17,18,15,20,13,21, 9,21,-1,-1,12, 4,
   18,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   16,21, /* Ascii 82 */
    4,21, 4, 0,-1,-1, 4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,
   11, 4,11,-1,-1,11,11,18, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   20,20, /* Ascii 83 */
   17,18,15,20,12,21, 8,21, 5,20, 3,18, 3,16, 4,14, 5,13, 7,12,13,10,15,
    9,16, 8,17, 6,17, 3,15, 1,12, 0, 8, 0, 5, 1, 3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
    4,21, 4, 0,-1,-1, 4,11, 6,13, 8,14,11,14,13,13,15,11,16, 8,16, 6,15,
    3,13, 1,11, 0, 8, 0, 6, 1, 4, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   14,18, /* Ascii 99 */
   15,11,13,13,11,14, 8,14, 6,13, 4,11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0,11,
    0,13, 1,15, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   17,19, /* Ascii 100 */
   15,21,15, 0,-1,-1,15,11,13,13,11,14, 8,14, 6,13, 4,11, 3, 8, 3, 6, 4,
    3, 6, 1, 8, 0,11, 0,13, 1,15, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   17,18, /* Ascii 101 */
    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,-1,-1,-1,-1,-1,
   10,19, /* Ascii 110 */
    4,14, 4, 0,-1,-1, 4,10, 7,13, 9,14,12,14,14,13,15,10,15, 0,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   17,19, /* Ascii 111 */
    8,14, 6,13, 4,11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0,11, 0,13, 1,15, 3,16,
    6,16, 8,15,11,13,13,11,14, 8,14,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   17,19, /* Ascii 112 */
    4,14, 4,-7,-1,-1, 4,11, 6,13, 8,14,11,14,13,13,15,11,16, 8,16, 6,15,
    3,13, 1,11, 0, 8, 0, 6, 1, 4, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-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1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   39,14, /* Ascii 125 */
    5,25, 7,24, 8,23, 9,21, 9,19, 8,17, 7,16, 6,14, 6,12, 8,10,-1,-1, 7,
   24, 8,22, 8,20, 7,18, 6,17, 5,15, 5,13, 6,11,10, 9, 6, 7, 5, 5, 5, 3,
    6, 1, 7, 0, 8,-2, 8,-4, 7,-6,-1,-1, 8, 8, 6, 6, 6, 4, 7, 2, 8, 1, 9,
   -1, 9,-3, 8,-5, 7,-6, 5,-7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   23,24, /* Ascii 126 */
    3, 6, 3, 8, 4,11, 6,12, 8,12,10,11,14, 8,16, 7,18, 7,20, 8,21,10,-1,
   -1, 3, 8, 4,10, 6,11, 8,11,10,10,14, 7,16, 6,18, 6,20, 7,21,10,21,12,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
   -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
};



// Extern variables

// Global variables
// Hardware Input/Output
SPI ep_spi(PTD2, PTD3, PTD1); // mosi, miso, sclk
DigitalOut ep_cs(PTD7);
DigitalOut ep_dc(PTD6);
DigitalOut ep_rst(PTA17);
DigitalIn ep_busy(PTA16);

// Function prototypes
void ep_blob(unsigned char* frame, int x, int y, unsigned char col);

// Functions
void ep_spi_init(void)
{
    EP_RST_HIGH;
    EP_CS_HIGH;
    ep_spi.format(8,0);
}

void ep_reset(void)
{
    EP_RST_LOW;
    wait(0.2);
    EP_RST_HIGH;
    wait(0.2);
}

void ep_cmd(unsigned char cmd)
{
    EP_DC_CMD;
    EP_CS_LOW;
    ep_spi.write(cmd);
    EP_CS_HIGH;
}

void ep_data(unsigned char data)
{
    EP_DC_DATA;
    EP_CS_LOW;
    ep_spi.write(data);
    EP_CS_HIGH;
}

void ep_wait(void)
{
    while(EP_BUSY);
    wait(0.1);
}

void ep_sleep(void)
{
    ep_cmd(DEEP_SLEEP);
    ep_wait();
}

void
ep_init(unsigned char* lut)
{
    int i;
    unsigned char* lutptr=(unsigned char*)lut;
    ep_reset();
    ep_cmd(DRIVER_OUT_CTRL);
    ep_data((EP_HEIGHT-1)&0xff);
    ep_data(((EP_HEIGHT-1)>>8)&0xff);
    ep_data(0x00);
    ep_cmd(BOOST_SOFT_START_CTRL);
    ep_data(0xd7);
    ep_data(0xd6);
    ep_data(0x9d);
    ep_cmd(WRITE_VCOM_REG);
    ep_data(0xa8);
    ep_cmd(SET_DUMMY_LINE_PERIOD);
    ep_data(0x1a);
    ep_cmd(SET_GATE_TIME);
    ep_data(0x08);
    ep_cmd(DATA_ENTRY_MODE_SET);
    ep_data(0x03);
    ep_cmd(WRITE_LUT_REG);
    for (i=0; i<30; i++)
    {
        ep_data(*lutptr);
        lutptr++;   
    }
}

void
ep_memptr(int x, int y)
{
    ep_cmd(SET_RAM_X_ADDRESS_CTR);
    ep_data((x>>3) & 0xff);
    ep_cmd(SET_RAM_Y_ADDRESS_CTR);
    ep_data(y & 0xff);
    ep_data((y>>8) & 0xff);
    ep_wait();
}

void
ep_memarea(int xs, int ys, int xf, int yf)
{
    ep_cmd(SET_RAM_X_ADDRESS_START_END_POS);
    ep_data((xs>>3) & 0xff);
    ep_data((xf>>3) & 0xff);
    ep_cmd(SET_RAM_Y_ADDRESS_START_END_POS);
    ep_data(ys & 0xff);
    ep_data((ys>>8) & 0xff);
    ep_data(yf & 0xff);
    ep_data((yf>>8) & 0xff);
}

void
ep_displayframe(void)
{
    ep_cmd(DISPLAY_UPDATE_CTRL_2);
    ep_data(0xc4);
    ep_cmd(MASTER_ACTIVATION);
    ep_cmd(TERM_FRAME_READ_WRITE);
    ep_wait();
}

void
ep_clearframe(unsigned char col8=ALL_WHITE)
{
    int i;
    ep_memarea(0,0, EP_WIDTH-1, EP_HEIGHT-1);
    ep_memptr(0,0);
    ep_cmd(WRITE_RAM);
    for (i=0; i<EP_FRAMEMEMSIZE; i++)
    {
        ep_data(col8);
    }
}

void
ep_setframe(unsigned char* frame, int x, int y, int width, int height)
{
    int xf, yf;
    int xx, yy;
    int width8;
    
    x=x & 0xf8;
    width=width & 0xf8;
    width8=width/8;
    xf=x+width-1;
    yf=y+height-1;
    ep_memarea(x,y, xf,yf);
    ep_memptr(x,y);
    ep_cmd(WRITE_RAM);
    for (yy=0; yy<height; yy++)
    {
        for (xx=0; xx<width8; xx++)
        {
            ep_data(frame[xx+yy*width8]);
        }
    } 
    
}

void
ep_plot_raw(unsigned char* frame, int x, int y, unsigned char col)
{  
    if ((x<0) || (x>=EP_WIDTH) || (y<0) || (y>=EP_HEIGHT))
        return;
    switch(col)
    {
        case COL_WHITE:
            frame[(x+y*EP_WIDTH)/8] |= (0x80 >> (x%8));
            break;
        case COL_BLACK:
            frame[(x+y*EP_WIDTH)/8] &= ~(0x80 >> (x%8));
            break;
        default:
            break;
    }
}

void
ep_plot(unsigned char* frame, int x, int y, unsigned char col)
{  
    int tx, ty;
    tx=y;
    ty=x;
    
    if ((x<0) || (x>=EP_HEIGHT) || (y<0) || (y>=EP_WIDTH))
        return;
    switch(col)
    {
        case COL_WHITE:
            frame[(tx+ty*EP_WIDTH)/8] |= (0x80 >> (tx%8));
            break;
        case COL_BLACK:
            frame[(tx+ty*EP_WIDTH)/8] &= ~(0x80 >> (tx%8));
            break;
        default:
            break;
    }
}

void
ep_setbg(unsigned char* frame, unsigned char col8)
{
    int i;
    unsigned char* fptr;
    fptr=frame;
    for (i=0; i<EP_WIDTH8*EP_HEIGHT; i++)
    {
        *fptr=col8;
        fptr++;
    }
}

void
ep_line(unsigned char* frame, int x, int y, int x2, int y2, unsigned char col, char weight)
{
    int dx, dy;
    int sx, sy, err, e2;
    
    if (x>x2)
        dx=x-x2;
    else
        dx=x2-x;
    if (y>y2)
        dy=y-y2;
    else
        dy=y2-y;

    if (x<x2)
        sx=1;
    else
        sx=-1;
  
    if (y<y2)
        sy=1;
    else
        sy=-1;
        
    err=dx-dy;
 
    while(1)
    {
        ep_plot(frame, x, y, col);
        switch(weight)
        {
            case PEN_THIN:
                break;
            case PEN_MED:
                if (EP_HEIGHT-1>=x+1)
                    ep_plot(frame, x+1, y, col);
                if (0<=x-1)
                    ep_plot(frame, x-1, y, col);
                if (EP_WIDTH-1>=y+1)
                    ep_plot(frame, x, y+1, col);
                if (0<=y-1)
                    ep_plot(frame, x, y-1, col);
                break;
            case PEN_THICK:
                ep_blob(frame, x, y, col);
                break;
            default:
                break;
        }
        if ((x==x2) && (y==y2))
            break;
        e2=2*err;
        if (e2>-dy)
        {
            err=err-dy;
            x=x+/*(unsigned char)*/sx;
        }
        if ((x==x2) && (y==y2))
        { 
            ep_plot(frame, x, y, col);
            switch(weight)
            {
                case PEN_THIN:
                    break;
                case PEN_MED:
                    if (EP_HEIGHT-1>=x+1)
                        ep_plot(frame, x+1, y, col);
                    if (0<=x-1)
                        ep_plot(frame, x-1, y, col);
                    if (EP_WIDTH-1>=y+1)
                        ep_plot(frame, x, y+1, col);
                    if (0<=y-1)
                        ep_plot(frame, x, y-1, col);
                    break;
                case PEN_THICK:
                    ep_blob(frame, x, y, col);
                    break;
                default:
                    break;
            }
            break;
        }
        if (e2<dx)
        { 
            err=err+dx;
            y=y+/*(unsigned char)*/sy; 
        }
    } // end while(1)
    
}

void
ep_blob(unsigned char* frame, int x, int y, unsigned char col)
{
    ep_line(frame, x-1,y+2,  x+1,y+2, col);
    ep_line(frame, x-2,y+1,  x+2,y+1, col);
    ep_line(frame, x-2,y,  x+2,y, col);
    ep_line(frame, x-2,y-1,  x+2,y-1, col);
    ep_line(frame, x-1,y-2,  x+1,y-2, col);
}

int
ep_write_text(unsigned char* frame, char* text, int x, int y, unsigned char col,
                double xscale, double yscale, unsigned int* dy, char weight)
{
    int xx, mdy;
    int wt;
    int i, im;
    int ci=0;
    unsigned char c;
    int nv;
    int /*int8_t*/ w;
    int ipx, ipy;
    int px, py;
    int ox, oy;
    int old=0;
    int do_scale=0;
    int not_finished=1;
    mdy=0;
    
    ox=0; oy=0;
    wt=0;
    
    if ((xscale>1.01) || (xscale<1.01) || (yscale>1.01) || (yscale<1.01))
        do_scale=1;
    
    xx=x;
    while(not_finished)
    {
        c=text[ci];
        ci++;
        if (c=='\0')
            break;
        if ((c>126) || (c<32))
            continue;
        c=c-32;
        nv=simplex[c][0];
        w=simplex[c][1];
        if (w<0)
            w=0-w;
        if (nv==0)
        {
            xx=xx+w;
            wt=wt+w;
            continue;
        }
        im=2+(nv*2);
        old=0;
        for (i=2; i<im; i=i+2)
        {
            ipx=simplex[c][i];
            ipy=simplex[c][i+1];
            if (ipx>=0)
            {
                px=ipx;
            }
            else
            {
                px=0-ipx;
            }
            if (ipy>=0)
            {
                py=ipy;
            }
            else
            {
                if (py==-1)
                {
                    py=32767;
                }
                else
                {
                    py=0-ipy;
                }
            }
            
            if (do_scale)
            {
                //px=(unsigned int)(((double)ipx)*xscale);
                //py=(unsigned int)(((double)ipy)*yscale);
                px=((double)px)*xscale;
                py=((double)py)*yscale;
            }
            if ((py!=32767) && (py>mdy))
                mdy=py+1;
            if ((ipx==-1) && (ipy==-1)) // pen up
            {
                old=0;
            }
            else
            {
                if (old) // a previous point is stored in ox, oy
                {
                    if (((ox+xx)>(EP_HEIGHT-1)) || ((px+xx)>(EP_HEIGHT-1)))
                    {
                        not_finished=0;
                        break;
                    }
                    ep_line(frame, ox+xx, oy+y, px+xx, py+y, col, weight);
                    ox=px; oy=py;
                }
                else
                {
                    ox=px; oy=py;
                    old=1;
                }
            }
        }
        if (do_scale)
        {
            xx=xx+(unsigned int)(((double)w)*xscale);
            wt=wt+(unsigned int)(((double)w)*xscale);
        }
        else
        {
            xx=xx+w;
            wt=wt+w;
        }
    }

    if (dy!=NULL)
        *dy=mdy;
    return(wt+1);
}