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