Library to control the EM027BS013 ePaper display from Pervasive Display.

Dependencies:   LM75B

Dependents:   app_epaper_EM027BS013_LPC1549 lpc4088_ebb_epaper EaEpaper_EM027BS013 app_epaper_EM027BS013 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers EPD_controller.cpp Source File

EPD_controller.cpp

Go to the documentation of this file.
00001 /**
00002 * \file
00003 *
00004 * \brief The interface for external application wants to update EPD
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 #include  "EPD_controller.h"
00035 
00036 /**
00037  * \brief Initialize the EPD hardware setting 
00038  */
00039 void EPD_display_init(void) {
00040     EPD_init();
00041 }
00042 
00043 
00044 
00045 
00046 /**
00047  * \brief Show image from the pointer of memory array
00048  *
00049  * \param EPD_type_index The defined EPD size
00050  * \param previous_image_ptr The pointer of memory that stores previous image
00051  * \param new_image_ptr The pointer of memory that stores new image
00052  */
00053 void EPD_display_from_pointer(uint8_t EPD_type_index,uint8_t *previous_image_ptr,
00054     uint8_t *new_image_ptr) {
00055     /* Initialize EPD hardware */
00056     EPD_init();
00057     
00058     /* Power on COG Driver */
00059     EPD_power_on();
00060     
00061     /* Initialize COG Driver */
00062     EPD_initialize_driver(EPD_type_index);
00063     
00064     /* Display image data on EPD from image array */
00065     EPD_display_from_array_prt(EPD_type_index,previous_image_ptr,new_image_ptr);
00066     
00067     /* Power off COG Driver */
00068     EPD_power_off (EPD_type_index);
00069 }
00070 
00071 /**
00072  * \brief Show image from Flash memory
00073  *
00074  * \param EPD_type_index The defined EPD size
00075  * \param previous_image_address The address of memory that stores previous image
00076  * \param new_image_address The address of memory that stores new image
00077  * \param On_EPD_read_flash Developer needs to create an external function to read flash
00078  */
00079 void EPD_display_from_flash(uint8_t EPD_type_index,long previous_image_address,
00080 long new_image_address,EPD_read_flash_handler On_EPD_read_flash) {
00081     /* Initialize EPD hardware */
00082     EPD_init();
00083     
00084     /* Power on COG Driver */
00085     EPD_power_on();
00086     
00087     /* Initialize COG Driver */
00088     EPD_initialize_driver(EPD_type_index);
00089     
00090     /* Display image data on EPD from Flash memory */
00091     EPD_display_from_flash_prt(EPD_type_index,previous_image_address,
00092         new_image_address,On_EPD_read_flash);
00093     
00094     /* Power off COG Driver */
00095     EPD_power_off (EPD_type_index);
00096 }
00097 /**
00098  * \brief Initialize the EPD hardware setting and COG driver
00099  *
00100  * \param EPD_type_index The defined EPD size 
00101  */
00102 void EPD_power_init(uint8_t EPD_type_index) {
00103     EPD_init();
00104     EPD_power_on ();
00105     EPD_initialize_driver (EPD_type_index);
00106 }
00107 
00108 /**
00109  * \brief Show image from Flash memory when SPI is common used with COG and Flash
00110  *
00111  * \note
00112  * - This function must work with EPD_power_init when SPI is common used with
00113  *   COG and Flash, or the charge pump doesn't work correctly.
00114  * - EPD_power_init -> write data to flash (switch SPI) -> EPD_display_from_flash_Ex
00115  *
00116  * \param EPD_type_index The defined EPD size
00117  * \param previous_image_address The address of memory that stores previous image
00118  * \param new_image_address The address of memory that stores new image
00119  * \param On_EPD_read_flash Developer needs to create an external function to read flash
00120  */
00121 void EPD_display_from_flash_Ex(uint8_t EPD_type_index,long previous_image_address,
00122     long new_image_address,EPD_read_flash_handler On_EPD_read_flash) {
00123 
00124     /* Display image data on EPD from Flash memory */
00125     EPD_display_from_flash_prt(EPD_type_index,previous_image_address,
00126         new_image_address,On_EPD_read_flash);
00127     
00128     /* Power off COG Driver */
00129     EPD_power_off (EPD_type_index);
00130 }
00131 
00132 
00133 
00134