1 /** 2 * \file 3 * 4 * \brief Haven Display UG 2832HSWEG04 display glue code for display controller 5 * 6 * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved. 7 * 8 * \asf_license_start 9 * 10 * \page License 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions are met: 14 * 15 * 1. Redistributions of source code must retain the above copyright notice, 16 * this list of conditions and the following disclaimer. 17 * 18 * 2. Redistributions in binary form must reproduce the above copyright notice, 19 * this list of conditions and the following disclaimer in the documentation 20 * and/or other materials provided with the distribution. 21 * 22 * 3. The name of Atmel may not be used to endorse or promote products derived 23 * from this software without specific prior written permission. 24 * 25 * 4. This software may only be redistributed and used in connection with an 26 * Atmel microcontroller product. 27 * 28 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * POSSIBILITY OF SUCH DAMAGE. 39 * 40 * \asf_license_stop 41 * 42 */ 43 /* 44 * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> 45 */ 46 47 #ifndef GFX_MONO_2832HSWEG04_H 48 #define GFX_MONO_2832HSWEG04_H 49 #include "compiler.h" 50 #include "ssd1306.h" 51 52 #include "gfx_mono.h" 53 #include "gfx_mono_framebuffer.h" 54 55 #ifdef __cplusplus 56 extern "C" { 57 #endif 58 59 /** 60 * \ingroup asfdoc_common2_gfx_mono 61 * \defgroup asfdoc_common2_gfx_mono_2832hsweg04_group 2832HSWEG04 graphic library abstraction 62 * 63 * This module is an abstraction layer between the graphic library and the 64 * 2832HSWEG04 monochrome LCD display connected to a SSD1306 LCD controller. 65 * 66 * As the controller does not provide any hardware accelerated graphic, all the 67 * graphic primitives are provided by the \ref asfdoc_common2_gfx_mono_generic_group service. 68 * 69 * \note Do not call the gfx_mono_ssd1306_ functions directly. use the gfx_mono 70 * names that are defined in this header and documented in \ref asfdoc_common2_gfx_mono . 71 * Ie. gfx_mono_draw_pixel() should be used, not gfx_mono_ssd1306_draw_pixel() 72 * @{ 73 */ 74 75 #define GFX_MONO_LCD_WIDTH 128 76 #ifndef GFX_MONO_LCD_HEIGHT 77 # define GFX_MONO_LCD_HEIGHT 32 78 #endif 79 #define GFX_MONO_LCD_PIXELS_PER_BYTE 8 80 #define GFX_MONO_LCD_PAGES (GFX_MONO_LCD_HEIGHT / \ 81 GFX_MONO_LCD_PIXELS_PER_BYTE) 82 #define GFX_MONO_LCD_FRAMEBUFFER_SIZE ((GFX_MONO_LCD_WIDTH * \ 83 GFX_MONO_LCD_HEIGHT) / GFX_MONO_LCD_PIXELS_PER_BYTE) 84 85 #define gfx_mono_draw_horizontal_line(x, y, length, color) \ 86 gfx_mono_generic_draw_horizontal_line(x, y, length, color) 87 88 #define gfx_mono_draw_vertical_line(x, y, length, color) \ 89 gfx_mono_generic_draw_vertical_line(x, y, length, color) 90 91 #define gfx_mono_draw_line(x1, y1, x2, y2, color) \ 92 gfx_mono_generic_draw_line(x1, y1, x2, y2, color) 93 94 #define gfx_mono_draw_rect(x, y, width, height, color) \ 95 gfx_mono_generic_draw_rect(x, y, width, height, color) 96 97 #define gfx_mono_draw_filled_rect(x, y, width, height, color) \ 98 gfx_mono_generic_draw_filled_rect(x, y, width, height, \ 99 color) 100 101 #define gfx_mono_draw_circle(x, y, radius, color, octant_mask) \ 102 gfx_mono_generic_draw_circle(x, y, radius, color, \ 103 octant_mask) 104 105 #define gfx_mono_draw_filled_circle(x, y, radius, color, quadrant_mask) \ 106 gfx_mono_generic_draw_filled_circle(x, y, radius, \ 107 color, quadrant_mask) 108 109 #define gfx_mono_put_bitmap(bitmap, x, y) \ 110 gfx_mono_generic_put_bitmap(bitmap, x, y) 111 112 #define gfx_mono_draw_pixel(x, y, color) \ 113 gfx_mono_ssd1306_draw_pixel(x, y, color) 114 115 #define gfx_mono_get_pixel(x, y) \ 116 gfx_mono_ssd1306_get_pixel(x, y) 117 118 #define gfx_mono_init() \ 119 gfx_mono_ssd1306_init() 120 121 #define gfx_mono_put_page(data, page, column, width) \ 122 gfx_mono_ssd1306_put_page(data, page, column, width) 123 124 #define gfx_mono_get_page(data, page, column, width) \ 125 gfx_mono_ssd1306_get_page(data, page, column, width) 126 127 #define gfx_mono_put_byte(page, column, data) \ 128 gfx_mono_ssd1306_put_byte(page, column, data, false) 129 130 #define gfx_mono_get_byte(page, column) \ 131 gfx_mono_ssd1306_get_byte(page, column) 132 133 #define gfx_mono_mask_byte(page, column, pixel_mask, color) \ 134 gfx_mono_ssd1306_mask_byte(page, column, pixel_mask, color) 135 136 #define gfx_mono_put_framebuffer() \ 137 gfx_mono_ssd1306_put_framebuffer() 138 139 void gfx_mono_ssd1306_put_framebuffer(void); 140 141 void gfx_mono_ssd1306_put_page(gfx_mono_color_t *data, gfx_coord_t page, 142 gfx_coord_t page_offset, gfx_coord_t width); 143 144 void gfx_mono_ssd1306_get_page(gfx_mono_color_t *data, gfx_coord_t page, 145 gfx_coord_t page_offset, gfx_coord_t width); 146 147 void gfx_mono_ssd1306_init(void); 148 149 void gfx_mono_ssd1306_draw_pixel(gfx_coord_t x, gfx_coord_t y, 150 gfx_mono_color_t color); 151 152 uint8_t gfx_mono_ssd1306_get_pixel(gfx_coord_t x, gfx_coord_t y); 153 154 void gfx_mono_ssd1306_put_byte(gfx_coord_t page, gfx_coord_t column, 155 uint8_t data, bool force); 156 157 uint8_t gfx_mono_ssd1306_get_byte(gfx_coord_t page, gfx_coord_t column); 158 159 void gfx_mono_ssd1306_mask_byte(gfx_coord_t page, gfx_coord_t column, 160 gfx_mono_color_t pixel_mask, gfx_mono_color_t color); 161 162 /** @} */ 163 164 #ifdef __cplusplus 165 } 166 #endif 167 168 #endif /* GFX_MONO_2832HSWEG04_H */ 169