Library for interacting with seeedstudio epaper

Dependents:   display-puck display-puck

Files at this revision

API Documentation at this revision

Comitter:
sigveseb
Date:
Fri Jul 18 09:20:24 2014 +0000
Parent:
0:6ac5ba1343bf
Commit message:
clean up;

Changed in this revision

EPD.cpp Show annotated file Show diff for this revision Revisions of this file
EPD.h Show annotated file Show diff for this revision Revisions of this file
diff -r 6ac5ba1343bf -r 2f62e2b80305 EPD.cpp
--- a/EPD.cpp	Thu Jul 17 14:15:53 2014 +0000
+++ b/EPD.cpp	Fri Jul 18 09:20:24 2014 +0000
@@ -1,3 +1,5 @@
+// TODO: update copyright notice
+
 // Copyright 2013 Pervasive Displays, Inc.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,10 +21,6 @@
 #include "EPD.h"
 #include <mbed.h>
 
-// delays - more consistent naming
-#define Delay_ms(ms) delay(ms)
-#define Delay_us(us) delayMicroseconds(us)
-
 // inline arrays
 #define ARRAY(type, ...) ((type[]){__VA_ARGS__})
 #define CU8(...) (ARRAY(const uint8_t, __VA_ARGS__))
@@ -30,9 +28,6 @@
 Timer timer;
 SPI spi(p20, p22, p25);
 
-
-Serial pq(USBTX, USBRX);
-
 static void SPI_put(uint8_t c);
 static void SPI_put_wait(uint8_t c, DigitalIn busy_pin);
 static void SPI_send(DigitalOut cs_pin, const uint8_t *buffer, uint16_t length);
@@ -145,13 +140,8 @@
     wait_ms(5);
 
     // wait for COG to become ready
-
-    
-    pq.printf("waiting...");
     while (this->EPD_Pin_BUSY) {
     }
-    
-    pq.printf(" OK!\n");
 
     // channel select
     wait_us(10);
@@ -390,7 +380,7 @@
 {
     for (uint8_t line = from_line; line < to_line; line++) 
     {
-        this->line(line, &image[line * this->bytes_per_line], 0, true, stage);
+        this->line(line, &image[(line - from_line) * this->bytes_per_line], 0, true, stage);
     }
 }
 
@@ -476,12 +466,10 @@
             }
             
             SPI_put_wait(pixels, this->EPD_Pin_BUSY);
-            //wait_us(1);
         } 
         else
         {
             SPI_put_wait(fixed_value, this->EPD_Pin_BUSY);
-            //wait_ms(1);
         }   
     }
 
@@ -496,7 +484,6 @@
         {
             SPI_put_wait(0x00, this->EPD_Pin_BUSY);
         }
-        //wait_ms(10);
     }
 
     // odd pixels
@@ -533,7 +520,6 @@
         {
             SPI_put_wait(fixed_value, this->EPD_Pin_BUSY);
         }
-        //wait_ms(10);
     }
 
     if (this->filler) 
diff -r 6ac5ba1343bf -r 2f62e2b80305 EPD.h
--- a/EPD.h	Thu Jul 17 14:15:53 2014 +0000
+++ b/EPD.h	Fri Jul 18 09:20:24 2014 +0000
@@ -12,16 +12,12 @@
 // express or implied.  See the License for the specific language
 // governing permissions and limitations under the License.
 
-#if !defined(EPD_H)
-#define EPD_H 1
+#ifndef __EPD_H__
+#define __EPD_H__
 
 #include <SPI.h>
 #include <mbed.h>
 
-
-// if more SRAM available (8 kBytes)
-#define EPD_ENABLE_EXTRA_SRAM 1
-
 typedef enum {
     EPD_1_44,        // 128 x 96
     EPD_2_0,         // 200 x 96
@@ -92,7 +88,7 @@
         this->frame_fixed_repeat(0xaa, EPD_normal, from_line, to_line);
     }
 
-    // assuming a clear (white) screen output an image (PROGMEM data)
+    // assuming a clear (white) screen output an image
     void image(const uint8_t *image, int from_line = 0, int to_line = -1)
     {
         if(to_line == -1){
@@ -104,25 +100,6 @@
         this->frame_data_repeat(image, EPD_normal, from_line, to_line);
     }
 
-#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega328P__)
-    void image_sd()
-    {
-        this->frame_fixed_repeat(0xaa, EPD_compensate);
-        this->frame_fixed_repeat(0xaa, EPD_white);
-        this->frame_data_repeat_sd(EPD_inverse);
-        this->frame_data_repeat_sd(EPD_normal);
-    }
-#endif
-    // change from old image to new image (PROGMEM data)
-    /*
-    void image(const uint8_t *old_image, const uint8_t *new_image)
-    {
-        this->frame_data_repeat(old_image, EPD_compensate);
-        this->frame_data_repeat(old_image, EPD_white);
-        this->frame_data_repeat(new_image, EPD_inverse);
-        this->frame_data_repeat(new_image, EPD_normal);
-    }
-    */
 
 
     // Low level API calls
@@ -131,38 +108,18 @@
     // single frame refresh
     void frame_fixed(uint8_t fixed_value, EPD_stage stage, int from_line, int to_line);
     void frame_data(const uint8_t *new_image, EPD_stage stage, int from_line, int to_line);
-#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega328P__)
-    void frame_data_sd(EPD_stage stage);
-#endif
-
-#if defined(EPD_ENABLE_EXTRA_SRAM)
-    void frame_sram(const uint8_t *new_image, EPD_stage stage);
-#endif
-    void frame_cb(uint32_t address, EPD_reader *reader, EPD_stage stage);
 
     // stage_time frame refresh
     void frame_fixed_repeat(uint8_t fixed_value, EPD_stage stage, int from_line, int to_line);
     void frame_data_repeat(const uint8_t *new_image, EPD_stage stage, int from_line, int to_line);
-#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega328P__)
-    void frame_data_repeat_sd(EPD_stage stage);
-#endif
-
-#if defined(EPD_ENABLE_EXTRA_SRAM)
-    void frame_sram_repeat(const uint8_t *new_image, EPD_stage stage);
-#endif
-    void frame_cb_repeat(uint32_t address, EPD_reader *reader, EPD_stage stage);
 
     // convert temperature to compensation factor
     int temperature_to_factor_10x(int temperature);
 
     // single line display - very low-level
-    // also has to handle AVR progmem
     void line(uint16_t line, const uint8_t *data, uint8_t fixed_value, bool read_progmem, EPD_stage stage);
-#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega328P__)
-    void line_sd(uint16_t line, const uint8_t *data, uint8_t fixed_value, bool read_progmem, EPD_stage stage);
-#endif
 };
 
 extern EPD_Class EPD;
 
-#endif
+#endif
\ No newline at end of file