Hexiwear OLED Display Driver

Dependents:   Hexi_OLED_TextImage_Example Hexi_OLED_Text_Example Hexi_OLED_Image_Example security-console-app ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers OLED_types.h Source File

OLED_types.h

00001 /** OLED Types 
00002  *  This file contains OLED-related data structures.
00003  *
00004  * Redistribution and use in source and binary forms, with or without modification,
00005  * are permitted provided that the following conditions are met:
00006  *
00007  * Redistributions of source code must retain the above copyright notice, this list
00008  * of conditions and the following disclaimer.
00009  *
00010  * Redistributions in binary form must reproduce the above copyright notice, this
00011  * list of conditions and the following disclaimer in the documentation and/or
00012  * other materials provided with the distribution.
00013  *
00014  * Neither the name of NXP, nor the names of its
00015  * contributors may be used to endorse or promote products derived from this
00016  * software without specific prior written permission.
00017  *
00018  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00019  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00020  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00021  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
00022  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00023  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00024  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00025  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00026  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00027  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028  *
00029  * visit: http://www.mikroe.com and http://www.nxp.com
00030  *
00031  * get support at: http://www.mikroe.com/forum and https://community.nxp.com
00032  *
00033  * Project HEXIWEAR, 2015
00034  */
00035  
00036  
00037 /**
00038  * OLED-related data structures
00039  * Project HEXIWEAR, 2015
00040  */
00041 
00042 #ifndef HG_OLED_TYPES
00043 #define HG_OLED_TYPES
00044 
00045 #include <stdint.h>
00046 
00047 typedef enum
00048 {
00049   OLED_TRANSITION_NONE,
00050   OLED_TRANSITION_TOP_DOWN,
00051   OLED_TRANSITION_DOWN_TOP,
00052   OLED_TRANSITION_LEFT_RIGHT,
00053   OLED_TRANSITION_RIGHT_LEFT
00054 
00055 } oled_transition_t;
00056 
00057 typedef enum
00058 {
00059   OLED_STATUS_SUCCESS,        // success
00060   OLED_STATUS_ERROR,          // fail
00061   OLED_STATUS_PROTOCOL_ERROR, // SPI failure
00062   OLED_STATUS_INIT_ERROR,     // initialization error
00063   OLED_STATUS_DEINIT_ERROR    // deinitialization error
00064 
00065 } oled_status_t;
00066 
00067 
00068 #if 0 
00069 typedef struct
00070 {
00071   /**
00072    * SPI relevant information
00073    */
00074   genericSpiHandle_t protocol;
00075 
00076 } handleOLED_t;
00077 #endif
00078 
00079 
00080 typedef uint16_t* oled_pixel_t;
00081 
00082 typedef struct
00083 {
00084   uint32_t DCpin;
00085   uint32_t CSpin;
00086   uint32_t RSTpin;
00087 // uint32_t RWpin;
00088   uint32_t ENpin;
00089 
00090 } settingsOLED_t;
00091 
00092 typedef enum
00093 {
00094   OLED_TEXT_ALIGN_NONE = 0,
00095 
00096   OLED_TEXT_ALIGN_LEFT   = 0x1,
00097   OLED_TEXT_ALIGN_RIGHT  = 0x2,
00098   OLED_TEXT_ALIGN_CENTER = 0x3,
00099 
00100   OLED_TEXT_VALIGN_TOP    = 0x10,
00101   OLED_TEXT_VALIGN_BOTTOM = 0x20,
00102   OLED_TEXT_VALIGN_CENTER = 0x30
00103 
00104 } oled_text_align_t;
00105 
00106 typedef struct
00107 {
00108          int8_t xCrd;
00109          int8_t yCrd;
00110          uint8_t width;
00111          uint8_t height;
00112     oled_pixel_t areaBuffer;
00113 
00114 } oled_dynamic_area_t;
00115 
00116 typedef struct
00117 {
00118   const uint8_t* font;
00119   uint16_t fontColor;
00120   oled_text_align_t alignParam;
00121   const uint8_t* background;
00122 
00123 } oled_text_properties_t;
00124 
00125 
00126 /** color chart */
00127 typedef enum
00128 {
00129   COLOR_BLACK    = 0x0000,
00130   COLOR_BLUE_1   = 0x06FF,
00131   COLOR_BLUE     = 0x001F,
00132   COLOR_RED      = 0xF800,
00133   COLOR_GREEN    = 0x07E0,
00134   COLOR_CYAN     = 0x07FF,
00135   COLOR_MAGENTA  = 0xF81F,
00136   COLOR_YELLOW   = 0xFFE0,
00137   COLOR_GRAY     = 0x528A,
00138   COLOR_WHITE    = 0xFFFF
00139 
00140 } Color_t;     
00141 
00142 typedef struct _init_cmd_tag
00143 {
00144     uint32_t cmd;
00145     uint8_t  type;
00146 } init_cmd_t;
00147 
00148 #endif
00149