paul@3 | 1 | // Copyright 2013 Pervasive Displays, Inc. |
paul@3 | 2 | // Copyright 2013 Embedded Artists AB |
paul@3 | 3 | // |
paul@3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
paul@3 | 5 | // you may not use this file except in compliance with the License. |
paul@3 | 6 | // You may obtain a copy of the License at: |
paul@3 | 7 | // |
paul@3 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
paul@3 | 9 | // |
paul@3 | 10 | // Unless required by applicable law or agreed to in writing, |
paul@3 | 11 | // software distributed under the License is distributed on an |
paul@3 | 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
paul@3 | 13 | // express or implied. See the License for the specific language |
paul@3 | 14 | // governing permissions and limitations under the License. |
paul@3 | 15 | |
paul@3 | 16 | #ifndef __EPD_H__ |
paul@3 | 17 | #define __EPD_H__ |
paul@3 | 18 | |
paul@3 | 19 | #include "bsp.h" |
paul@3 | 20 | |
paul@3 | 21 | //TODO |
paul@3 | 22 | #define PROGMEM /*const*/ |
paul@3 | 23 | |
paul@3 | 24 | // if more SRAM available (8 kBytes) |
paul@3 | 25 | #define EPD_ENABLE_EXTRA_SRAM 1 |
paul@3 | 26 | |
paul@3 | 27 | //typedef enum { |
paul@3 | 28 | // LOW=0, |
paul@3 | 29 | // HIGH=1 |
paul@3 | 30 | //} EPD_pinstate; |
paul@3 | 31 | |
paul@3 | 32 | typedef enum { |
paul@3 | 33 | EPD_1_44, // 128 x 96 |
paul@3 | 34 | EPD_2_0, // 200 x 96 |
paul@3 | 35 | EPD_2_7 // 264 x 176 |
paul@3 | 36 | } EPD_size; |
paul@3 | 37 | |
paul@3 | 38 | typedef enum { // Image pixel -> Display pixel |
paul@3 | 39 | EPD_compensate, // B -> W, W -> B (Current Image) |
paul@3 | 40 | EPD_white, // B -> N, W -> W (Current Image) |
paul@3 | 41 | EPD_inverse, // B -> N, W -> B (New Image) |
paul@3 | 42 | EPD_normal // B -> B, W -> W (New Image) |
paul@3 | 43 | } EPD_stage; |
paul@3 | 44 | |
paul@3 | 45 | typedef struct |
paul@3 | 46 | { |
paul@3 | 47 | EPD_size size; |
paul@3 | 48 | uint16_t stage_time; |
paul@3 | 49 | uint16_t factored_stage_time; |
paul@3 | 50 | uint16_t lines_per_display; |
paul@3 | 51 | uint16_t dots_per_line; |
paul@3 | 52 | uint16_t bytes_per_line; |
paul@3 | 53 | uint16_t bytes_per_scan; |
paul@3 | 54 | PROGMEM const uint8_t *gate_source; |
paul@3 | 55 | uint16_t gate_source_length; |
paul@3 | 56 | PROGMEM const uint8_t *channel_select; |
paul@3 | 57 | uint16_t channel_select_length; |
paul@3 | 58 | uint8_t filler; |
paul@3 | 59 | } COG_Parameters_t; |
paul@3 | 60 | |
paul@3 | 61 | |
paul@3 | 62 | void EPD_init(EPD_size size); |
paul@3 | 63 | void EPD_begin(void); |
paul@3 | 64 | void EPD_end(void); |
paul@3 | 65 | |
paul@3 | 66 | // set temperature |
paul@3 | 67 | void EPD_setFactor(int16_t temperature); |
paul@3 | 68 | |
paul@3 | 69 | // clear display (anything -> white) |
paul@3 | 70 | void EPD_clear(void); |
paul@3 | 71 | |
paul@3 | 72 | // assuming a clear (white) screen output an image (PROGMEM data) |
paul@3 | 73 | void EPD_image(PROGMEM const uint8_t *image); |
paul@3 | 74 | |
paul@3 | 75 | // change from old image to new image (PROGMEM data) |
paul@3 | 76 | void EPD_image_progmem(PROGMEM const uint8_t *old_image, PROGMEM const uint8_t *new_image); |
paul@3 | 77 | |
paul@3 | 78 | #if defined(EPD_ENABLE_EXTRA_SRAM) |
paul@3 | 79 | // change from old image to new image (SRAM version) |
paul@3 | 80 | void EPD_image_sram(const uint8_t *old_image, const uint8_t *new_image); |
paul@3 | 81 | #endif |
paul@3 | 82 | |
paul@3 | 83 | |
paul@3 | 84 | #endif //__EPD_H__ |
paul@3 | 85 | |
paul@3 | 86 | |