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.
Dependents: app_epaper_EM027BS013_LPC1549 lpc4088_ebb_epaper EaEpaper_EM027BS013 app_epaper_EM027BS013 ... more
EPD_hardware_gpio.cpp
00001 /** 00002 * \file 00003 * 00004 * \brief The functions of EPD GPIO 00005 * 00006 * Copyright (c) 2012-2014 Pervasive Displays Inc. All rights reserved. 00007 * 00008 * Authors: Pervasive Displays Inc. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 00014 * 1. Redistributions of source code must retain the above copyright 00015 * notice, this list of conditions and the following disclaimer. 00016 * 2. Redistributions in binary form must reproduce the above copyright 00017 * notice, this list of conditions and the following disclaimer in 00018 * the documentation and/or other materials provided with the 00019 * distribution. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00024 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00025 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00026 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00027 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00028 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00029 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 */ 00033 00034 00035 #include "EPD_hardware_gpio.h" 00036 00037 #include "mbed.h" 00038 00039 extern PinName SEC06; 00040 extern PinName SEC07; 00041 extern PinName SEC08; 00042 extern PinName SEC11; 00043 extern PinName SEC12; 00044 extern PinName SEC13; 00045 extern PinName SEC14; 00046 00047 static DigitalOut* pinEpdCS = NULL; 00048 static DigitalIn* pinEpdBusy = NULL; 00049 static DigitalOut* pinEpdBorder = NULL; 00050 static DigitalOut* pinFlashCS = NULL; 00051 static DigitalOut* pinEpdReset = NULL; 00052 static DigitalOut* pinEpdPanelOn = NULL; 00053 static DigitalOut* pinEpdDischarge = NULL; 00054 00055 /** 00056 * \brief Set EPD_CS pin to high 00057 */ 00058 void EPD_cs_high (void) { 00059 //set_gpio_high(EPD_CS_PORT,EPD_CS_PIN); 00060 *pinEpdCS = 1; 00061 } 00062 00063 /** 00064 * \brief Set EPD_CS pin to low 00065 */ 00066 void EPD_cs_low (void) { 00067 // set_gpio_low(EPD_CS_PORT,EPD_CS_PIN); 00068 *pinEpdCS = 0; 00069 } 00070 00071 /** 00072 * \brief Set Flash_CS pin to high 00073 */ 00074 void EPD_flash_cs_high(void) { 00075 // set_gpio_high(Flash_CS_PORT,Flash_CS_PIN); 00076 *pinFlashCS = 1; 00077 } 00078 00079 /** 00080 * \brief Set Flash_CS pin to low 00081 */ 00082 void EPD_flash_cs_low (void) { 00083 // set_gpio_low(Flash_CS_PORT,Flash_CS_PIN); 00084 *pinFlashCS = 0; 00085 } 00086 00087 /** 00088 * \brief Set /RESET pin to high 00089 */ 00090 void EPD_rst_high (void) { 00091 // set_gpio_high(EPD_RST_PORT,EPD_RST_PIN); 00092 *pinEpdReset = 1; 00093 } 00094 00095 /** 00096 * \brief Set /RESET pin to low 00097 */ 00098 void EPD_rst_low (void) { 00099 // set_gpio_low(EPD_RST_PORT,EPD_RST_PIN); 00100 *pinEpdReset = 0; 00101 } 00102 00103 /** 00104 * \brief Set DISCHARGE pin to high 00105 */ 00106 void EPD_discharge_high (void) { 00107 // set_gpio_high(EPD_DISCHARGE_PORT,EPD_DISCHARGE_PIN); 00108 *pinEpdDischarge = 1; 00109 } 00110 00111 /** 00112 * \brief Set DISCHARGE pin to low 00113 */ 00114 void EPD_discharge_low (void) { 00115 // set_gpio_low(EPD_DISCHARGE_PORT,EPD_DISCHARGE_PIN); 00116 *pinEpdDischarge = 0; 00117 } 00118 00119 /** 00120 * \brief Set Vcc (PANEL_ON) to high 00121 */ 00122 void EPD_Vcc_turn_on (void) { 00123 // set_gpio_high(EPD_PANELON_PORT,EPD_PANELON_PIN); 00124 *pinEpdPanelOn = 1; 00125 } 00126 00127 /** 00128 * \brief Set Vcc (PANEL_ON) to low 00129 */ 00130 void EPD_Vcc_turn_off (void) { 00131 // set_gpio_low(EPD_PANELON_PORT,EPD_PANELON_PIN); 00132 *pinEpdPanelOn = 0; 00133 } 00134 00135 /** 00136 * \brief Set BORDER_CONTROL pin to high 00137 */ 00138 void EPD_border_high(void) { 00139 // set_gpio_high(EPD_PANELON_PORT,EPD_BORDER_PIN); 00140 *pinEpdBorder = 1; 00141 } 00142 00143 /** 00144 * \brief Set BORDER_CONTROL pin to low 00145 */ 00146 void EPD_border_low (void) { 00147 // set_gpio_low(EPD_PANELON_PORT,EPD_BORDER_PIN); 00148 *pinEpdBorder = 0; 00149 } 00150 00151 /** 00152 * \brief Set PWM pin to high 00153 */ 00154 void EPD_pwm_high(void) { 00155 // set_gpio_high(PWM_PORT,PWM_PIN); 00156 00157 // Not in use 00158 } 00159 00160 /** 00161 * \brief Set PWM pin to low 00162 */ 00163 void EPD_pwm_low (void) { 00164 // config_gpio_dir_o(SPIMISO_PORT,SPIMISO_PIN); 00165 // set_gpio_low(PWM_PORT,PWM_PIN); 00166 00167 // Not in use 00168 } 00169 00170 /** 00171 * \brief Set MISO pin of SPI to low 00172 */ 00173 void SPIMISO_low(void) { 00174 // config_gpio_dir_o(SPIMISO_PORT,SPIMISO_PIN); 00175 // set_gpio_low(SPIMISO_PORT,SPIMISO_PIN); 00176 00177 // Not in use 00178 } 00179 00180 /** 00181 * \brief Set MOSI pin of SPI to low 00182 */ 00183 void SPIMOSI_low(void) { 00184 // set_gpio_low(SPIMOSI_PORT,SPIMOSI_PIN); 00185 00186 // Not in use 00187 } 00188 00189 /** 00190 * \brief Set Clock of SPI to low 00191 */ 00192 void SPICLK_low(void) { 00193 // set_gpio_low(SPICLK_PORT,SPICLK_PIN); 00194 00195 // Not in use 00196 } 00197 00198 /** 00199 * \brief Get BUSY pin status 00200 */ 00201 bool EPD_IsBusy(void) { 00202 // return (bool)input_get(EPD_BUSY_PORT,EPD_BUSY_PIN); 00203 return pinEpdBusy->read(); 00204 } 00205 00206 /** 00207 * \brief Configure GPIO 00208 */ 00209 void EPD_initialize_gpio(void) { 00210 00211 pinEpdCS = new DigitalOut(SEC06); // SEC-06 Requires J14 9-10 to NOT be connected 00212 pinEpdBusy = new DigitalIn(SEC07); // SEC-07 00213 pinEpdBorder = new DigitalOut(SEC08); // SEC-08 00214 pinFlashCS = new DigitalOut(SEC11); // SEC-11 00215 pinEpdReset = new DigitalOut(SEC12); // SEC-12 00216 pinEpdPanelOn = new DigitalOut(SEC13); // SEC-13 00217 pinEpdDischarge = new DigitalOut(SEC14); // SEC-14 00218 00219 // config_gpio_dir_i( EPD_BUSY_PORT,EPD_BUSY_PIN); 00220 // //Set Xin to GPIO 00221 // BITCLR (CS_PORT_SEL, EPD_CS_PIN); 00222 // BITCLR (CS_PORT_SEL2,EPD_CS_PIN); 00223 // //Set Xout to GPIO 00224 // BITCLR (Flash_CS_PORT_SEL, Flash_CS_PIN); 00225 // BITCLR (Flash_CS_PORT_SEL2,Flash_CS_PIN); 00226 // 00227 // config_gpio_dir_o( EPD_CS_PORT,EPD_CS_PIN); 00228 // config_gpio_dir_o( EPD_RST_PORT,EPD_RST_PIN); 00229 // config_gpio_dir_o( EPD_PANELON_PORT,EPD_PANELON_PIN); 00230 // config_gpio_dir_o( EPD_DISCHARGE_PORT,EPD_DISCHARGE_PIN); 00231 // config_gpio_dir_o( EPD_BORDER_PORT,EPD_BORDER_PIN); 00232 // config_gpio_dir_o( Flash_CS_PORT,Flash_CS_PIN); 00233 // config_gpio_dir_o( PWM_PORT,PWM_PIN); 00234 // config_gpio_dir_i( Temper_PORT,Temper_PIN); 00235 EPD_flash_cs_high(); 00236 EPD_border_low(); 00237 } 00238
Generated on Thu Jul 14 2022 17:10:35 by
1.7.2