tempcommit 13/05

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers epdif.h Source File

epdif.h

00001 /**
00002  *  @filename   :   epdif.h
00003  *  @brief      :   Header file of epdif.cpp providing EPD interface functions
00004  *                  Users have to implement all the functions in epdif.cpp
00005  *  @author     :   Yehui from Waveshare
00006  *
00007  *  Copyright (C) Waveshare     August 10 2017
00008  *
00009  * Permission is hereby granted, free of charge, to any person obtaining a copy
00010  * of this software and associated documnetation files (the "Software"), to deal
00011  * in the Software without restriction, including without limitation the rights
00012  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013  * copies of the Software, and to permit persons to  whom the Software is
00014  * furished to do so, subject to the following conditions:
00015  *
00016  * The above copyright notice and this permission notice shall be included in
00017  * all copies or substantial portions of the Software.
00018  *
00019  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021  * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023  * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025  * THE SOFTWARE.
00026  */
00027 
00028 #ifndef EPDIF_H
00029 #define EPDIF_H
00030 
00031 #define LOW 0;
00032 #define HIGH 1;
00033 
00034 #include "mbed.h"
00035 
00036 /*
00037 // Pin definition
00038 #define RST_PIN         DigitalOut reset_pin (A2)//rst
00039 #define DC_PIN          DigitalOut dc_pin (A5) //SCL pin on mbed shield
00040 #define CS_PIN          DigitalOut cs_pin (D9)
00041 #define BUSY_PIN        DigitalOut busy_pin (D3)//int
00042 */
00043 //DigitalOut mosi_pin(D11);
00044 //DigitalOut miso_pin(D12);
00045 //DigitalOut sclk_pin(A5);
00046 //DigitalOut ssel_pin(D9);
00047 
00048 class EpdIf
00049 {
00050 public:
00051     EpdIf(void);
00052     ~EpdIf(void);
00053 
00054     int  IfInit(void);
00055     void DigitalWrite(DigitalOut &pin, int value);
00056     int  DigitalRead(PinName &pin);
00057     void DelayMs(unsigned int delaytime);
00058     void SpiTransfer(unsigned char data);
00059 private:
00060     char rx_buffer[256];
00061     char tx_buffer[256];
00062     SPI _spi;
00063     DigitalOut _cs;
00064     DigitalOut reset_pin;
00065     DigitalOut dc_pin;
00066     DigitalOut busy_pin;
00067     
00068     
00069 };
00070 
00071 #endif