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.
epdif.cpp
00001 /** 00002 * @filename : epdif.cpp 00003 * @brief : Implements 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 #include "epdif.h" 00029 EpdIf::EpdIf(){ 00030 } 00031 EpdIf::EpdIf(PinName mosi, 00032 PinName miso, 00033 PinName sclk, 00034 PinName cs, 00035 PinName dc, 00036 PinName rst, 00037 PinName busy) { 00038 m_spi = new SPI(mosi, miso, sclk); 00039 m_cs = new DigitalOut(cs); 00040 m_dc = new DigitalOut(dc); 00041 m_rst = new DigitalOut(rst); 00042 m_busy = new DigitalIn(busy); 00043 } 00044 00045 EpdIf::~EpdIf() { 00046 } 00047 00048 void EpdIf::DigitalWrite(DigitalOut* pout, int value) { 00049 *pout = value; 00050 } 00051 00052 int EpdIf::DigitalRead(DigitalIn* pin) { 00053 int ret = *pin; 00054 return ret; 00055 } 00056 00057 void EpdIf::DelayMs(unsigned int delaytime) { 00058 wait_ms(delaytime); 00059 } 00060 00061 void EpdIf::SpiTransfer(unsigned char data) { 00062 *m_cs = 0; 00063 m_spi->write(data); 00064 *m_cs = 1; 00065 } 00066 00067 int EpdIf::IfInit(void){ 00068 m_spi->format(8,0); 00069 m_spi->frequency(2000000); 00070 return 0; 00071 } 00072 00073
Generated on Tue Jul 12 2022 21:25:46 by
1.7.2