Hexiwear OLED
Fork of Hexi_OLED_SSD1351 by
OLED_info.h@2:fc06b5b5bf6a, 2016-08-19 (annotated)
- Committer:
- khuang
- Date:
- Fri Aug 19 23:05:58 2016 +0000
- Revision:
- 2:fc06b5b5bf6a
- Parent:
- 1:3b5be0ee5f0c
- Child:
- 5:a5b4b36a1aed
Added Licensing and Reformatted Init Array for SSD1351 init
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
khuang | 0:06f42dd3eab3 | 1 | /** |
khuang | 2:fc06b5b5bf6a | 2 | * \file OLED_info.h |
khuang | 2:fc06b5b5bf6a | 3 | * \version 1.00 |
khuang | 2:fc06b5b5bf6a | 4 | * \brief OLED screen SSD1351-related info |
khuang | 2:fc06b5b5bf6a | 5 | * |
khuang | 2:fc06b5b5bf6a | 6 | * |
khuang | 2:fc06b5b5bf6a | 7 | * Redistribution and use in source and binary forms, with or without modification, |
khuang | 2:fc06b5b5bf6a | 8 | * are permitted provided that the following conditions are met: |
khuang | 2:fc06b5b5bf6a | 9 | * |
khuang | 2:fc06b5b5bf6a | 10 | * Redistributions of source code must retain the above copyright notice, this list |
khuang | 2:fc06b5b5bf6a | 11 | * of conditions and the following disclaimer. |
khuang | 2:fc06b5b5bf6a | 12 | * |
khuang | 2:fc06b5b5bf6a | 13 | * Redistributions in binary form must reproduce the above copyright notice, this |
khuang | 2:fc06b5b5bf6a | 14 | * list of conditions and the following disclaimer in the documentation and/or |
khuang | 2:fc06b5b5bf6a | 15 | * other materials provided with the distribution. |
khuang | 2:fc06b5b5bf6a | 16 | * |
khuang | 2:fc06b5b5bf6a | 17 | * Neither the name of NXP, nor the names of its |
khuang | 2:fc06b5b5bf6a | 18 | * contributors may be used to endorse or promote products derived from this |
khuang | 2:fc06b5b5bf6a | 19 | * software without specific prior written permission. |
khuang | 2:fc06b5b5bf6a | 20 | * |
khuang | 2:fc06b5b5bf6a | 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
khuang | 2:fc06b5b5bf6a | 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
khuang | 2:fc06b5b5bf6a | 23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
khuang | 2:fc06b5b5bf6a | 24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
khuang | 2:fc06b5b5bf6a | 25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
khuang | 2:fc06b5b5bf6a | 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
khuang | 2:fc06b5b5bf6a | 27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
khuang | 2:fc06b5b5bf6a | 28 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
khuang | 2:fc06b5b5bf6a | 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
khuang | 2:fc06b5b5bf6a | 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
khuang | 2:fc06b5b5bf6a | 31 | * |
khuang | 2:fc06b5b5bf6a | 32 | * visit: http://www.mikroe.com and http://www.nxp.com |
khuang | 2:fc06b5b5bf6a | 33 | * |
khuang | 2:fc06b5b5bf6a | 34 | * get support at: http://www.mikroe.com/forum and https://community.nxp.com |
khuang | 2:fc06b5b5bf6a | 35 | * |
khuang | 0:06f42dd3eab3 | 36 | * Project HEXIWEAR, 2015 |
khuang | 0:06f42dd3eab3 | 37 | */ |
khuang | 2:fc06b5b5bf6a | 38 | |
khuang | 2:fc06b5b5bf6a | 39 | |
khuang | 0:06f42dd3eab3 | 40 | |
khuang | 0:06f42dd3eab3 | 41 | #ifndef HG_OLED_INFO |
khuang | 0:06f42dd3eab3 | 42 | #define HG_OLED_INFO |
khuang | 0:06f42dd3eab3 | 43 | |
khuang | 0:06f42dd3eab3 | 44 | // command byte number |
khuang | 2:fc06b5b5bf6a | 45 | #define CMD_BYTE (1) |
khuang | 2:fc06b5b5bf6a | 46 | #define DATA_BYTE (0) |
khuang | 0:06f42dd3eab3 | 47 | |
khuang | 0:06f42dd3eab3 | 48 | #define OLED_COLUMN_OFFSET (16) |
khuang | 0:06f42dd3eab3 | 49 | #define OLED_ROW_OFFSET (0) |
khuang | 0:06f42dd3eab3 | 50 | |
khuang | 0:06f42dd3eab3 | 51 | #define OLED_SCREEN_WIDTH (96) |
khuang | 0:06f42dd3eab3 | 52 | #define OLED_SCREEN_HEIGHT (96) |
khuang | 0:06f42dd3eab3 | 53 | |
khuang | 0:06f42dd3eab3 | 54 | #define OLED_SCREEN_WIDTH_END ( (OLED_SCREEN_WIDTH-1) + OLED_COLUMN_OFFSET ) |
khuang | 0:06f42dd3eab3 | 55 | #define OLED_SCREEN_HEIGHT_END ( (OLED_SCREEN_HEIGHT-1) + OLED_ROW_OFFSET ) |
khuang | 0:06f42dd3eab3 | 56 | |
khuang | 0:06f42dd3eab3 | 57 | #define OLED_BYTES_PER_PIXEL ( 2 ) |
khuang | 0:06f42dd3eab3 | 58 | |
khuang | 0:06f42dd3eab3 | 59 | #define OLED_TRANSITION_STEP ( 1 ) |
khuang | 0:06f42dd3eab3 | 60 | #define OLED_ACTION_DCON ( 0xFE ) |
khuang | 0:06f42dd3eab3 | 61 | #define OLED_ACTION_DCOFF ( 0xFF ) |
khuang | 0:06f42dd3eab3 | 62 | |
khuang | 0:06f42dd3eab3 | 63 | #define OLED_CHAR_WIDTH_AUTO ( 0xFF ) |
khuang | 0:06f42dd3eab3 | 64 | #define OLED_CHAR_WIDTH_MAX ( 0xFE ) |
khuang | 0:06f42dd3eab3 | 65 | #define OLED_CHAR_WIDTH_NUM ( 0xFD ) |
khuang | 0:06f42dd3eab3 | 66 | #define OLED_CHAR_WIDTH_KEEP ( 0xFC ) |
khuang | 0:06f42dd3eab3 | 67 | #define OLED_CHAR_HEIGHT_AUTO ( 0xFB ) |
khuang | 0:06f42dd3eab3 | 68 | #define OLED_CHAR_HEIGHT_KEEP ( 0xFA ) |
khuang | 0:06f42dd3eab3 | 69 | |
khuang | 0:06f42dd3eab3 | 70 | #define OLED_SCREEN_SIZE ( OLED_SCREEN_WIDTH * OLED_SCREEN_HEIGHT ) |
khuang | 0:06f42dd3eab3 | 71 | #define OLED_GRAM_SIZE ( OLED_SCREEN_WIDTH * OLED_SCREEN_HEIGHT * OLED_BYTES_PER_PIXEL ) |
khuang | 0:06f42dd3eab3 | 72 | |
khuang | 0:06f42dd3eab3 | 73 | #define OLED_TEXT_HALIGN_SHIFT ( 0 ) |
khuang | 0:06f42dd3eab3 | 74 | #define OLED_TEXT_HALIGN_MASK ( 0x03 << OLED_TEXT_HALIGN_SHIFT ) |
khuang | 0:06f42dd3eab3 | 75 | |
khuang | 0:06f42dd3eab3 | 76 | #define OLED_TEXT_VALIGN_SHIFT ( 4 ) |
khuang | 0:06f42dd3eab3 | 77 | #define OLED_TEXT_VALIGN_MASK ( 0x03 << OLED_TEXT_VALIGN_SHIFT ) |
khuang | 0:06f42dd3eab3 | 78 | |
khuang | 0:06f42dd3eab3 | 79 | #define BMP_HEADER_BYTE_SIZE (6) |
khuang | 0:06f42dd3eab3 | 80 | |
khuang | 0:06f42dd3eab3 | 81 | |
khuang | 0:06f42dd3eab3 | 82 | |
khuang | 0:06f42dd3eab3 | 83 | /** |
khuang | 0:06f42dd3eab3 | 84 | * remap settings |
khuang | 0:06f42dd3eab3 | 85 | */ |
khuang | 0:06f42dd3eab3 | 86 | |
khuang | 0:06f42dd3eab3 | 87 | #define REMAP_HORIZONTAL_INCREMENT ( 0 ) |
khuang | 0:06f42dd3eab3 | 88 | #define REMAP_VERTICAL_INCREMENT ( 1 << 0 ) |
khuang | 0:06f42dd3eab3 | 89 | |
khuang | 0:06f42dd3eab3 | 90 | #define REMAP_COLUMNS_LEFT_TO_RIGHT ( 0 ) |
khuang | 0:06f42dd3eab3 | 91 | #define REMAP_COLUMNS_RIGHT_TO_LEFT ( 1 << 1 ) |
khuang | 0:06f42dd3eab3 | 92 | |
khuang | 0:06f42dd3eab3 | 93 | #define REMAP_ORDER_ABC ( 0 ) |
khuang | 0:06f42dd3eab3 | 94 | #define REMAP_ORDER_CBA ( 1 << 2 ) |
khuang | 0:06f42dd3eab3 | 95 | |
khuang | 0:06f42dd3eab3 | 96 | #define REMAP_SCAN_UP_TO_DOWN ( 0 ) |
khuang | 0:06f42dd3eab3 | 97 | #define REMAP_SCAN_DOWN_TO_UP ( 1 << 4 ) |
khuang | 0:06f42dd3eab3 | 98 | |
khuang | 0:06f42dd3eab3 | 99 | #define REMAP_COM_SPLIT_ODD_EVEN_DIS ( 0 ) |
khuang | 0:06f42dd3eab3 | 100 | #define REMAP_COM_SPLIT_ODD_EVEN_EN ( 1 << 5 ) |
khuang | 0:06f42dd3eab3 | 101 | |
khuang | 0:06f42dd3eab3 | 102 | #define REMAP_COLOR_RGB565 ( 1 << 6 ) |
khuang | 0:06f42dd3eab3 | 103 | |
khuang | 0:06f42dd3eab3 | 104 | #define OLED_REMAP_SETTINGS ( REMAP_ORDER_ABC | REMAP_COM_SPLIT_ODD_EVEN_EN | REMAP_COLOR_RGB565 | REMAP_COLUMNS_LEFT_TO_RIGHT | REMAP_SCAN_UP_TO_DOWN | REMAP_HORIZONTAL_INCREMENT ) |
khuang | 0:06f42dd3eab3 | 105 | |
khuang | 0:06f42dd3eab3 | 106 | /** |
khuang | 0:06f42dd3eab3 | 107 | * macros |
khuang | 0:06f42dd3eab3 | 108 | */ |
khuang | 0:06f42dd3eab3 | 109 | |
khuang | 0:06f42dd3eab3 | 110 | #define OLED_SwapMe(x) x = ( ( x & 0xFF00 ) >> 8 ) | ( ( x & 0x00FF ) << 8 ) |
khuang | 0:06f42dd3eab3 | 111 | #define OLED_AdjustRowOffset(y) y += OLED_ROW_OFFSET |
khuang | 0:06f42dd3eab3 | 112 | #define OLED_AdjustColumnOffset(x) x += OLED_COLUMN_OFFSET |
khuang | 0:06f42dd3eab3 | 113 | |
khuang | 0:06f42dd3eab3 | 114 | #define BMP_SkipHeader( imgPtr ) ( (const uint8_t*)(imgPtr) + BMP_HEADER_BYTE_SIZE ) |
khuang | 0:06f42dd3eab3 | 115 | |
khuang | 0:06f42dd3eab3 | 116 | |
khuang | 0:06f42dd3eab3 | 117 | #define CheckLimits( x, y, w, h ) ( ( ( x + w - 1 ) > OLED_SCREEN_WIDTH ) || ( x < 0 ) || ( ( y + h - 1 ) > OLED_SCREEN_HEIGHT ) || ( y < 0 ) ) |
khuang | 0:06f42dd3eab3 | 118 | #define AreCoordsValid( x, y, w, h ) ( 0 == CheckLimits( x, y, w ,h ) ) |
khuang | 0:06f42dd3eab3 | 119 | #define AreCoordsNotValid( x, y, w, h ) ( 0 != CheckLimits( x, y, w, h ) ) |
khuang | 0:06f42dd3eab3 | 120 | |
khuang | 0:06f42dd3eab3 | 121 | |
khuang | 0:06f42dd3eab3 | 122 | /** |
khuang | 0:06f42dd3eab3 | 123 | * set start/end column/row |
khuang | 0:06f42dd3eab3 | 124 | * the 2nd and 3rd byte represent the start and the end address, respectively |
khuang | 0:06f42dd3eab3 | 125 | */ |
khuang | 0:06f42dd3eab3 | 126 | #define OLED_CMD_SET_COLUMN ( 0x15 ) |
khuang | 0:06f42dd3eab3 | 127 | #define OLED_CMD_SET_ROW ( 0x75 ) |
khuang | 0:06f42dd3eab3 | 128 | |
khuang | 0:06f42dd3eab3 | 129 | /** |
khuang | 0:06f42dd3eab3 | 130 | * scanning direction |
khuang | 0:06f42dd3eab3 | 131 | */ |
khuang | 0:06f42dd3eab3 | 132 | |
khuang | 0:06f42dd3eab3 | 133 | #define OLED_DIRECTION_HORIZONTAL (0) |
khuang | 0:06f42dd3eab3 | 134 | #define OLED_DIRECTION_VERTICAL (1) |
khuang | 0:06f42dd3eab3 | 135 | |
khuang | 0:06f42dd3eab3 | 136 | /** |
khuang | 0:06f42dd3eab3 | 137 | * SPI-related |
khuang | 0:06f42dd3eab3 | 138 | */ |
khuang | 0:06f42dd3eab3 | 139 | |
khuang | 0:06f42dd3eab3 | 140 | #define OLED_SPI_CHUNK (511) |
khuang | 0:06f42dd3eab3 | 141 | |
khuang | 0:06f42dd3eab3 | 142 | /** |
khuang | 0:06f42dd3eab3 | 143 | * set display |
khuang | 0:06f42dd3eab3 | 144 | */ |
khuang | 0:06f42dd3eab3 | 145 | #define OLED_CMD_SET_DISPLAY_MODE_ALL_OFF (0xA4) |
khuang | 0:06f42dd3eab3 | 146 | #define OLED_CMD_SET_DISPLAY_MODE_ALL_ON (0xA5) |
khuang | 0:06f42dd3eab3 | 147 | #define OLED_CMD_SET_DISPLAY_MODE_NORMAL (0xA6) |
khuang | 0:06f42dd3eab3 | 148 | #define OLED_CMD_SET_DISPLAY_MODE_INVERSE (0xA7) |
khuang | 0:06f42dd3eab3 | 149 | |
khuang | 0:06f42dd3eab3 | 150 | /** |
khuang | 0:06f42dd3eab3 | 151 | * set lock command |
khuang | 0:06f42dd3eab3 | 152 | * the locked OLED driver MCU interface prohibits all commands |
khuang | 0:06f42dd3eab3 | 153 | * and memory access, except the 0xFD command |
khuang | 0:06f42dd3eab3 | 154 | */ |
khuang | 0:06f42dd3eab3 | 155 | #define OLED_CMD_SET_CMD_LOCK ( 0xFD /* << 8 */ ) |
khuang | 0:06f42dd3eab3 | 156 | // unlock OLED driver MCU interface for entering command (default upon reset) |
khuang | 0:06f42dd3eab3 | 157 | #define OLED_UNLOCK (0x12) |
khuang | 0:06f42dd3eab3 | 158 | // lock OLED driver MCU interface for entering command |
khuang | 0:06f42dd3eab3 | 159 | #define OLED_LOCK (0x16) |
khuang | 0:06f42dd3eab3 | 160 | // commands 0xA2, 0xB1, 0xB3, 0xBB, 0xBE, 0xC1 are inaccessible in both lock and unlock state (default upon reset) |
khuang | 0:06f42dd3eab3 | 161 | #define OLED_ACC_TO_CMD_NO (0xB0) |
khuang | 0:06f42dd3eab3 | 162 | // commands 0xA2, 0xB1, 0xB3, 0xBB, 0xBE, 0xC1 are accessible in unlock state |
khuang | 0:06f42dd3eab3 | 163 | #define OLED_ACC_TO_CMD_YES (0xB1) |
khuang | 0:06f42dd3eab3 | 164 | |
khuang | 0:06f42dd3eab3 | 165 | /** |
khuang | 0:06f42dd3eab3 | 166 | * NOP |
khuang | 0:06f42dd3eab3 | 167 | */ |
khuang | 0:06f42dd3eab3 | 168 | #define OLED_CMD_NOP (0xD1) // also, 0xE3 |
khuang | 0:06f42dd3eab3 | 169 | |
khuang | 0:06f42dd3eab3 | 170 | /** |
khuang | 0:06f42dd3eab3 | 171 | * set MUX ratio |
khuang | 0:06f42dd3eab3 | 172 | */ |
khuang | 0:06f42dd3eab3 | 173 | #define OLED_CMD_SET_MUX_RATIO (0xCA) |
khuang | 0:06f42dd3eab3 | 174 | |
khuang | 0:06f42dd3eab3 | 175 | /** |
khuang | 0:06f42dd3eab3 | 176 | * set re-map / color depth |
khuang | 0:06f42dd3eab3 | 177 | */ |
khuang | 0:06f42dd3eab3 | 178 | #define OLED_CMD_SET_REMAP ( 0xA0 ) |
khuang | 0:06f42dd3eab3 | 179 | |
khuang | 0:06f42dd3eab3 | 180 | // set horisontal or vertical increment |
khuang | 0:06f42dd3eab3 | 181 | #define OLED_ADDR_INC_HOR (0x00) |
khuang | 0:06f42dd3eab3 | 182 | #define OLED_ADDR_INC_VER (0x01) |
khuang | 0:06f42dd3eab3 | 183 | |
khuang | 0:06f42dd3eab3 | 184 | // column address mapping |
khuang | 0:06f42dd3eab3 | 185 | #define OLED_COLUMN_ADDR_REMAP_0_TO_SEG0 (0x00) |
khuang | 0:06f42dd3eab3 | 186 | #define OLED_COLUMN_ADDR_REMAP_127_TO_SEG0 (0x02) |
khuang | 0:06f42dd3eab3 | 187 | |
khuang | 0:06f42dd3eab3 | 188 | // color sequence order |
khuang | 0:06f42dd3eab3 | 189 | #define OLED_COLOR_SEQ_A_B_C (0x00) |
khuang | 0:06f42dd3eab3 | 190 | #define OLED_COLOR_SEQ_C_B_A (0x04) |
khuang | 0:06f42dd3eab3 | 191 | |
khuang | 0:06f42dd3eab3 | 192 | // scanning order (MR == MUX ratio) |
khuang | 0:06f42dd3eab3 | 193 | #define OLED_SCAN_FROM_COM_0_TO_MR (0x00) |
khuang | 0:06f42dd3eab3 | 194 | #define OLED_SCAN_FROM_COM_MR_TO_0 (0x10) |
khuang | 0:06f42dd3eab3 | 195 | |
khuang | 0:06f42dd3eab3 | 196 | // COM splitting to odd and even |
khuang | 0:06f42dd3eab3 | 197 | #define OLED_COM_SPLIT_DISABLE (0x00) |
khuang | 0:06f42dd3eab3 | 198 | #define OLED_COM_SPLIT_ENABLE (0x20) |
khuang | 0:06f42dd3eab3 | 199 | |
khuang | 0:06f42dd3eab3 | 200 | // screen color depth |
khuang | 0:06f42dd3eab3 | 201 | #define OLED_COLOR_DEPTH_256 (0x00) |
khuang | 0:06f42dd3eab3 | 202 | #define OLED_COLOR_DEPTH_65K (0x40) |
khuang | 0:06f42dd3eab3 | 203 | #define OLED_COLOR_DEPTH_262K_1 (0x80) |
khuang | 0:06f42dd3eab3 | 204 | #define OLED_COLOR_DEPTH_262K_2 (0xC0) |
khuang | 0:06f42dd3eab3 | 205 | |
khuang | 0:06f42dd3eab3 | 206 | /** |
khuang | 0:06f42dd3eab3 | 207 | * set reset (phase 1) / pre-charge (phase 2) period in [DCLK] |
khuang | 0:06f42dd3eab3 | 208 | * this command is locked by command 0xFD by default |
khuang | 0:06f42dd3eab3 | 209 | */ |
khuang | 0:06f42dd3eab3 | 210 | #define OLED_CMD_SET_RESET_AND_PRECHARGE_PERIOD (0xB1) |
khuang | 0:06f42dd3eab3 | 211 | |
khuang | 0:06f42dd3eab3 | 212 | #define OLED_RESET_PERIOD_5 (0x02) |
khuang | 0:06f42dd3eab3 | 213 | #define OLED_RESET_PERIOD_7 (0x03) |
khuang | 0:06f42dd3eab3 | 214 | #define OLED_RESET_PERIOD_9 (0x04) |
khuang | 0:06f42dd3eab3 | 215 | #define OLED_RESET_PERIOD_11 (0x05) |
khuang | 0:06f42dd3eab3 | 216 | #define OLED_RESET_PERIOD_13 (0x06) |
khuang | 0:06f42dd3eab3 | 217 | #define OLED_RESET_PERIOD_15 (0x07) |
khuang | 0:06f42dd3eab3 | 218 | #define OLED_RESET_PERIOD_17 (0x08) |
khuang | 0:06f42dd3eab3 | 219 | #define OLED_RESET_PERIOD_19 (0x09) |
khuang | 0:06f42dd3eab3 | 220 | #define OLED_RESET_PERIOD_21 (0x0A) |
khuang | 0:06f42dd3eab3 | 221 | #define OLED_RESET_PERIOD_23 (0x0B) |
khuang | 0:06f42dd3eab3 | 222 | #define OLED_RESET_PERIOD_25 (0x0C) |
khuang | 0:06f42dd3eab3 | 223 | #define OLED_RESET_PERIOD_27 (0x0D) |
khuang | 0:06f42dd3eab3 | 224 | #define OLED_RESET_PERIOD_29 (0x0E) |
khuang | 0:06f42dd3eab3 | 225 | #define OLED_RESET_PERIOD_31 (0x0F) |
khuang | 0:06f42dd3eab3 | 226 | |
khuang | 0:06f42dd3eab3 | 227 | #define OLED_PRECHARGE_PERIOD_3 (0x03) |
khuang | 0:06f42dd3eab3 | 228 | #define OLED_PRECHARGE_PERIOD_4 (0x04) |
khuang | 0:06f42dd3eab3 | 229 | #define OLED_PRECHARGE_PERIOD_5 (0x05) |
khuang | 0:06f42dd3eab3 | 230 | #define OLED_PRECHARGE_PERIOD_6 (0x06) |
khuang | 0:06f42dd3eab3 | 231 | #define OLED_PRECHARGE_PERIOD_7 (0x07) |
khuang | 0:06f42dd3eab3 | 232 | #define OLED_PRECHARGE_PERIOD_8 (0x08) |
khuang | 0:06f42dd3eab3 | 233 | #define OLED_PRECHARGE_PERIOD_9 (0x09) |
khuang | 0:06f42dd3eab3 | 234 | #define OLED_PRECHARGE_PERIOD_10 (0x0A) |
khuang | 0:06f42dd3eab3 | 235 | #define OLED_PRECHARGE_PERIOD_11 (0x0B) |
khuang | 0:06f42dd3eab3 | 236 | #define OLED_PRECHARGE_PERIOD_12 (0x0C) |
khuang | 0:06f42dd3eab3 | 237 | #define OLED_PRECHARGE_PERIOD_13 (0x0D) |
khuang | 0:06f42dd3eab3 | 238 | #define OLED_PRECHARGE_PERIOD_14 (0x0E) |
khuang | 0:06f42dd3eab3 | 239 | #define OLED_PRECHARGE_PERIOD_15 (0x0F) |
khuang | 0:06f42dd3eab3 | 240 | |
khuang | 0:06f42dd3eab3 | 241 | /** |
khuang | 0:06f42dd3eab3 | 242 | * set front clock divider (divset) / oscillator frequency |
khuang | 0:06f42dd3eab3 | 243 | * this command is locked by command 0xFD by default |
khuang | 0:06f42dd3eab3 | 244 | */ |
khuang | 0:06f42dd3eab3 | 245 | #define OLED_CMD_SET_OSC_FREQ_AND_CLOCKDIV (0xB3) |
khuang | 0:06f42dd3eab3 | 246 | |
khuang | 0:06f42dd3eab3 | 247 | // clock divider |
khuang | 0:06f42dd3eab3 | 248 | #define OLED_CLOCKDIV_1 (0x00) |
khuang | 0:06f42dd3eab3 | 249 | #define OLED_CLOCKDIV_2 (0x01) |
khuang | 0:06f42dd3eab3 | 250 | #define OLED_CLOCKDIV_4 (0x02) |
khuang | 0:06f42dd3eab3 | 251 | #define OLED_CLOCKDIV_8 (0x03) |
khuang | 0:06f42dd3eab3 | 252 | #define OLED_CLOCKDIV_16 (0x04) |
khuang | 0:06f42dd3eab3 | 253 | #define OLED_CLOCKDIV_32 (0x05) |
khuang | 0:06f42dd3eab3 | 254 | #define OLED_CLOCKDIV_64 (0x06) |
khuang | 0:06f42dd3eab3 | 255 | #define OLED_CLOCKDIV_128 (0x07) |
khuang | 0:06f42dd3eab3 | 256 | #define OLED_CLOCKDIV_256 (0x08) |
khuang | 0:06f42dd3eab3 | 257 | #define OLED_CLOCKDIV_512 (0x09) |
khuang | 0:06f42dd3eab3 | 258 | #define OLED_CLOCKDIV_1024 (0x0A) |
khuang | 0:06f42dd3eab3 | 259 | |
khuang | 0:06f42dd3eab3 | 260 | // oscillator frequency, frequency increases as level increases |
khuang | 0:06f42dd3eab3 | 261 | #define OLED_OSC_FREQ (0xB0) |
khuang | 0:06f42dd3eab3 | 262 | |
khuang | 0:06f42dd3eab3 | 263 | #define OLED_CMD_STARTLINE (0xA1) |
khuang | 0:06f42dd3eab3 | 264 | |
khuang | 0:06f42dd3eab3 | 265 | #define OLED_CMD_WRITERAM (0x5C) |
khuang | 0:06f42dd3eab3 | 266 | #define OLED_CMD_READRAM (0x5D) |
khuang | 0:06f42dd3eab3 | 267 | #define OLED_CMD_DISPLAYOFFSET (0xA2) |
khuang | 0:06f42dd3eab3 | 268 | #define OLED_CMD_DISPLAYALLOFF (0xA4) |
khuang | 0:06f42dd3eab3 | 269 | #define OLED_CMD_DISPLAYALLON (0xA5) |
khuang | 0:06f42dd3eab3 | 270 | #define OLED_CMD_NORMALDISPLAY (0xA6) |
khuang | 0:06f42dd3eab3 | 271 | #define OLED_CMD_INVERTDISPLAY (0xA7) |
khuang | 0:06f42dd3eab3 | 272 | #define OLED_CMD_FUNCTIONSELECT (0xAB) |
khuang | 0:06f42dd3eab3 | 273 | #define OLED_CMD_DISPLAYOFF (0xAE) |
khuang | 0:06f42dd3eab3 | 274 | #define OLED_CMD_DISPLAYON (0xAF) |
khuang | 0:06f42dd3eab3 | 275 | #define OLED_CMD_PRECHARGE (0xB1) |
khuang | 0:06f42dd3eab3 | 276 | #define OLED_CMD_DISPLAYENHANCE (0xB2) |
khuang | 0:06f42dd3eab3 | 277 | #define OLED_CMD_SETVSL (0xB4) |
khuang | 0:06f42dd3eab3 | 278 | #define OLED_CMD_SETGPIO (0xB5) |
khuang | 0:06f42dd3eab3 | 279 | #define OLED_CMD_PRECHARGE2 (0xB6) |
khuang | 0:06f42dd3eab3 | 280 | #define OLED_CMD_SETGRAY (0xB8) |
khuang | 0:06f42dd3eab3 | 281 | #define OLED_CMD_USELUT (0xB9) |
khuang | 0:06f42dd3eab3 | 282 | #define OLED_CMD_PRECHARGELEVEL (0xBB) |
khuang | 0:06f42dd3eab3 | 283 | #define OLED_CMD_VCOMH (0xBE) |
khuang | 0:06f42dd3eab3 | 284 | #define OLED_CMD_CONTRASTABC (0xC1) |
khuang | 0:06f42dd3eab3 | 285 | #define OLED_CMD_CONTRASTMASTER (0xC7) |
khuang | 0:06f42dd3eab3 | 286 | #define OLED_CMD_MUXRATIO (0xCA) |
khuang | 0:06f42dd3eab3 | 287 | #define OLED_CMD_COMMANDLOCK (0xFD) |
khuang | 0:06f42dd3eab3 | 288 | #define OLED_CMD_HORIZSCROLL (0x96) |
khuang | 0:06f42dd3eab3 | 289 | #define OLED_CMD_STOPSCROLL (0x9E) |
khuang | 0:06f42dd3eab3 | 290 | #define OLED_CMD_STARTSCROLL (0x9F) |
khuang | 0:06f42dd3eab3 | 291 | |
khuang | 0:06f42dd3eab3 | 292 | #endif |
khuang | 1:3b5be0ee5f0c | 293 |