Smart

Dependencies:   Hexi_KW40Z

Committer:
Team_Eta_MBED
Date:
Wed Feb 28 16:34:40 2018 +0000
Revision:
0:69293b19ee19
Smart Baby Monitor Foundations

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Team_Eta_MBED 0:69293b19ee19 1 /** OLED Types
Team_Eta_MBED 0:69293b19ee19 2 * This file contains OLED-related data structures.
Team_Eta_MBED 0:69293b19ee19 3 *
Team_Eta_MBED 0:69293b19ee19 4 * Redistribution and use in source and binary forms, with or without modification,
Team_Eta_MBED 0:69293b19ee19 5 * are permitted provided that the following conditions are met:
Team_Eta_MBED 0:69293b19ee19 6 *
Team_Eta_MBED 0:69293b19ee19 7 * Redistributions of source code must retain the above copyright notice, this list
Team_Eta_MBED 0:69293b19ee19 8 * of conditions and the following disclaimer.
Team_Eta_MBED 0:69293b19ee19 9 *
Team_Eta_MBED 0:69293b19ee19 10 * Redistributions in binary form must reproduce the above copyright notice, this
Team_Eta_MBED 0:69293b19ee19 11 * list of conditions and the following disclaimer in the documentation and/or
Team_Eta_MBED 0:69293b19ee19 12 * other materials provided with the distribution.
Team_Eta_MBED 0:69293b19ee19 13 *
Team_Eta_MBED 0:69293b19ee19 14 * Neither the name of NXP, nor the names of its
Team_Eta_MBED 0:69293b19ee19 15 * contributors may be used to endorse or promote products derived from this
Team_Eta_MBED 0:69293b19ee19 16 * software without specific prior written permission.
Team_Eta_MBED 0:69293b19ee19 17 *
Team_Eta_MBED 0:69293b19ee19 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
Team_Eta_MBED 0:69293b19ee19 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Team_Eta_MBED 0:69293b19ee19 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Team_Eta_MBED 0:69293b19ee19 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
Team_Eta_MBED 0:69293b19ee19 22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
Team_Eta_MBED 0:69293b19ee19 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
Team_Eta_MBED 0:69293b19ee19 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
Team_Eta_MBED 0:69293b19ee19 25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Team_Eta_MBED 0:69293b19ee19 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Team_Eta_MBED 0:69293b19ee19 27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Team_Eta_MBED 0:69293b19ee19 28 *
Team_Eta_MBED 0:69293b19ee19 29 * visit: http://www.mikroe.com and http://www.nxp.com
Team_Eta_MBED 0:69293b19ee19 30 *
Team_Eta_MBED 0:69293b19ee19 31 * get support at: http://www.mikroe.com/forum and https://community.nxp.com
Team_Eta_MBED 0:69293b19ee19 32 *
Team_Eta_MBED 0:69293b19ee19 33 * Project HEXIWEAR, 2015
Team_Eta_MBED 0:69293b19ee19 34 */
Team_Eta_MBED 0:69293b19ee19 35
Team_Eta_MBED 0:69293b19ee19 36
Team_Eta_MBED 0:69293b19ee19 37 /**
Team_Eta_MBED 0:69293b19ee19 38 * OLED-related data structures
Team_Eta_MBED 0:69293b19ee19 39 * Project HEXIWEAR, 2015
Team_Eta_MBED 0:69293b19ee19 40 */
Team_Eta_MBED 0:69293b19ee19 41
Team_Eta_MBED 0:69293b19ee19 42 #ifndef HG_OLED_TYPES
Team_Eta_MBED 0:69293b19ee19 43 #define HG_OLED_TYPES
Team_Eta_MBED 0:69293b19ee19 44
Team_Eta_MBED 0:69293b19ee19 45 #include <stdint.h>
Team_Eta_MBED 0:69293b19ee19 46
Team_Eta_MBED 0:69293b19ee19 47 typedef enum
Team_Eta_MBED 0:69293b19ee19 48 {
Team_Eta_MBED 0:69293b19ee19 49 OLED_TRANSITION_NONE,
Team_Eta_MBED 0:69293b19ee19 50 OLED_TRANSITION_TOP_DOWN,
Team_Eta_MBED 0:69293b19ee19 51 OLED_TRANSITION_DOWN_TOP,
Team_Eta_MBED 0:69293b19ee19 52 OLED_TRANSITION_LEFT_RIGHT,
Team_Eta_MBED 0:69293b19ee19 53 OLED_TRANSITION_RIGHT_LEFT
Team_Eta_MBED 0:69293b19ee19 54
Team_Eta_MBED 0:69293b19ee19 55 } oled_transition_t;
Team_Eta_MBED 0:69293b19ee19 56
Team_Eta_MBED 0:69293b19ee19 57 typedef enum
Team_Eta_MBED 0:69293b19ee19 58 {
Team_Eta_MBED 0:69293b19ee19 59 OLED_STATUS_SUCCESS, // success
Team_Eta_MBED 0:69293b19ee19 60 OLED_STATUS_ERROR, // fail
Team_Eta_MBED 0:69293b19ee19 61 OLED_STATUS_PROTOCOL_ERROR, // SPI failure
Team_Eta_MBED 0:69293b19ee19 62 OLED_STATUS_INIT_ERROR, // initialization error
Team_Eta_MBED 0:69293b19ee19 63 OLED_STATUS_DEINIT_ERROR // deinitialization error
Team_Eta_MBED 0:69293b19ee19 64
Team_Eta_MBED 0:69293b19ee19 65 } oled_status_t;
Team_Eta_MBED 0:69293b19ee19 66
Team_Eta_MBED 0:69293b19ee19 67
Team_Eta_MBED 0:69293b19ee19 68 #if 0
Team_Eta_MBED 0:69293b19ee19 69 typedef struct
Team_Eta_MBED 0:69293b19ee19 70 {
Team_Eta_MBED 0:69293b19ee19 71 /**
Team_Eta_MBED 0:69293b19ee19 72 * SPI relevant information
Team_Eta_MBED 0:69293b19ee19 73 */
Team_Eta_MBED 0:69293b19ee19 74 genericSpiHandle_t protocol;
Team_Eta_MBED 0:69293b19ee19 75
Team_Eta_MBED 0:69293b19ee19 76 } handleOLED_t;
Team_Eta_MBED 0:69293b19ee19 77 #endif
Team_Eta_MBED 0:69293b19ee19 78
Team_Eta_MBED 0:69293b19ee19 79
Team_Eta_MBED 0:69293b19ee19 80 typedef uint16_t* oled_pixel_t;
Team_Eta_MBED 0:69293b19ee19 81
Team_Eta_MBED 0:69293b19ee19 82 typedef struct
Team_Eta_MBED 0:69293b19ee19 83 {
Team_Eta_MBED 0:69293b19ee19 84 uint32_t DCpin;
Team_Eta_MBED 0:69293b19ee19 85 uint32_t CSpin;
Team_Eta_MBED 0:69293b19ee19 86 uint32_t RSTpin;
Team_Eta_MBED 0:69293b19ee19 87 // uint32_t RWpin;
Team_Eta_MBED 0:69293b19ee19 88 uint32_t ENpin;
Team_Eta_MBED 0:69293b19ee19 89
Team_Eta_MBED 0:69293b19ee19 90 } settingsOLED_t;
Team_Eta_MBED 0:69293b19ee19 91
Team_Eta_MBED 0:69293b19ee19 92 typedef enum
Team_Eta_MBED 0:69293b19ee19 93 {
Team_Eta_MBED 0:69293b19ee19 94 OLED_TEXT_ALIGN_NONE = 0,
Team_Eta_MBED 0:69293b19ee19 95
Team_Eta_MBED 0:69293b19ee19 96 OLED_TEXT_ALIGN_LEFT = 0x1,
Team_Eta_MBED 0:69293b19ee19 97 OLED_TEXT_ALIGN_RIGHT = 0x2,
Team_Eta_MBED 0:69293b19ee19 98 OLED_TEXT_ALIGN_CENTER = 0x3,
Team_Eta_MBED 0:69293b19ee19 99
Team_Eta_MBED 0:69293b19ee19 100 OLED_TEXT_VALIGN_TOP = 0x10,
Team_Eta_MBED 0:69293b19ee19 101 OLED_TEXT_VALIGN_BOTTOM = 0x20,
Team_Eta_MBED 0:69293b19ee19 102 OLED_TEXT_VALIGN_CENTER = 0x30
Team_Eta_MBED 0:69293b19ee19 103
Team_Eta_MBED 0:69293b19ee19 104 } oled_text_align_t;
Team_Eta_MBED 0:69293b19ee19 105
Team_Eta_MBED 0:69293b19ee19 106 typedef struct
Team_Eta_MBED 0:69293b19ee19 107 {
Team_Eta_MBED 0:69293b19ee19 108 int8_t xCrd;
Team_Eta_MBED 0:69293b19ee19 109 int8_t yCrd;
Team_Eta_MBED 0:69293b19ee19 110 uint8_t width;
Team_Eta_MBED 0:69293b19ee19 111 uint8_t height;
Team_Eta_MBED 0:69293b19ee19 112 oled_pixel_t areaBuffer;
Team_Eta_MBED 0:69293b19ee19 113
Team_Eta_MBED 0:69293b19ee19 114 } oled_dynamic_area_t;
Team_Eta_MBED 0:69293b19ee19 115
Team_Eta_MBED 0:69293b19ee19 116 typedef struct
Team_Eta_MBED 0:69293b19ee19 117 {
Team_Eta_MBED 0:69293b19ee19 118 const uint8_t* font;
Team_Eta_MBED 0:69293b19ee19 119 uint16_t fontColor;
Team_Eta_MBED 0:69293b19ee19 120 oled_text_align_t alignParam;
Team_Eta_MBED 0:69293b19ee19 121 const uint8_t* background;
Team_Eta_MBED 0:69293b19ee19 122
Team_Eta_MBED 0:69293b19ee19 123 } oled_text_properties_t;
Team_Eta_MBED 0:69293b19ee19 124
Team_Eta_MBED 0:69293b19ee19 125
Team_Eta_MBED 0:69293b19ee19 126 /** color chart */
Team_Eta_MBED 0:69293b19ee19 127 typedef enum
Team_Eta_MBED 0:69293b19ee19 128 {
Team_Eta_MBED 0:69293b19ee19 129 COLOR_BLACK = 0x0000,
Team_Eta_MBED 0:69293b19ee19 130 COLOR_BLUE_1 = 0x06FF,
Team_Eta_MBED 0:69293b19ee19 131 COLOR_BLUE = 0x001F,
Team_Eta_MBED 0:69293b19ee19 132 COLOR_RED = 0xF800,
Team_Eta_MBED 0:69293b19ee19 133 COLOR_GREEN = 0x07E0,
Team_Eta_MBED 0:69293b19ee19 134 COLOR_CYAN = 0x07FF,
Team_Eta_MBED 0:69293b19ee19 135 COLOR_MAGENTA = 0xF81F,
Team_Eta_MBED 0:69293b19ee19 136 COLOR_YELLOW = 0xFFE0,
Team_Eta_MBED 0:69293b19ee19 137 COLOR_GRAY = 0x528A,
Team_Eta_MBED 0:69293b19ee19 138 COLOR_WHITE = 0xFFFF
Team_Eta_MBED 0:69293b19ee19 139
Team_Eta_MBED 0:69293b19ee19 140 } Color_t;
Team_Eta_MBED 0:69293b19ee19 141
Team_Eta_MBED 0:69293b19ee19 142 typedef struct _init_cmd_tag
Team_Eta_MBED 0:69293b19ee19 143 {
Team_Eta_MBED 0:69293b19ee19 144 uint32_t cmd;
Team_Eta_MBED 0:69293b19ee19 145 uint8_t type;
Team_Eta_MBED 0:69293b19ee19 146 } init_cmd_t;
Team_Eta_MBED 0:69293b19ee19 147
Team_Eta_MBED 0:69293b19ee19 148 #endif
Team_Eta_MBED 0:69293b19ee19 149