A basic graphics package for the LPC4088 Display Module.

Dependents:   lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI lpc4088_displaymodule_fs_aid ... more

Fork of DMBasicGUI by EmbeddedArtists AB

Committer:
embeddedartists
Date:
Mon Nov 04 14:31:50 2019 +0000
Revision:
22:f0d00f29bfeb
Parent:
0:4977187e90c7
More updates related to mbed OS 5

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 0:4977187e90c7 1 /*
embeddedartists 0:4977187e90c7 2 * @brief Common types used in LPC functions
embeddedartists 0:4977187e90c7 3 *
embeddedartists 0:4977187e90c7 4 * @note
embeddedartists 0:4977187e90c7 5 * Copyright(C) NXP Semiconductors, 2012
embeddedartists 0:4977187e90c7 6 * All rights reserved.
embeddedartists 0:4977187e90c7 7 *
embeddedartists 0:4977187e90c7 8 * @par
embeddedartists 0:4977187e90c7 9 * Software that is described herein is for illustrative purposes only
embeddedartists 0:4977187e90c7 10 * which provides customers with programming information regarding the
embeddedartists 0:4977187e90c7 11 * LPC products. This software is supplied "AS IS" without any warranties of
embeddedartists 0:4977187e90c7 12 * any kind, and NXP Semiconductors and its licensor disclaim any and
embeddedartists 0:4977187e90c7 13 * all warranties, express or implied, including all implied warranties of
embeddedartists 0:4977187e90c7 14 * merchantability, fitness for a particular purpose and non-infringement of
embeddedartists 0:4977187e90c7 15 * intellectual property rights. NXP Semiconductors assumes no responsibility
embeddedartists 0:4977187e90c7 16 * or liability for the use of the software, conveys no license or rights under any
embeddedartists 0:4977187e90c7 17 * patent, copyright, mask work right, or any other intellectual property rights in
embeddedartists 0:4977187e90c7 18 * or to any products. NXP Semiconductors reserves the right to make changes
embeddedartists 0:4977187e90c7 19 * in the software without notification. NXP Semiconductors also makes no
embeddedartists 0:4977187e90c7 20 * representation or warranty that such application will be suitable for the
embeddedartists 0:4977187e90c7 21 * specified use without further testing or modification.
embeddedartists 0:4977187e90c7 22 *
embeddedartists 0:4977187e90c7 23 * @par
embeddedartists 0:4977187e90c7 24 * Permission to use, copy, modify, and distribute this software and its
embeddedartists 0:4977187e90c7 25 * documentation is hereby granted, under NXP Semiconductors' and its
embeddedartists 0:4977187e90c7 26 * licensor's relevant copyrights in the software, without fee, provided that it
embeddedartists 0:4977187e90c7 27 * is used in conjunction with NXP Semiconductors microcontrollers. This
embeddedartists 0:4977187e90c7 28 * copyright, permission, and disclaimer notice must appear in all copies of
embeddedartists 0:4977187e90c7 29 * this code.
embeddedartists 0:4977187e90c7 30 */
embeddedartists 0:4977187e90c7 31
embeddedartists 0:4977187e90c7 32 #ifndef __LPC_TYPES_H_
embeddedartists 0:4977187e90c7 33 #define __LPC_TYPES_H_
embeddedartists 0:4977187e90c7 34
embeddedartists 0:4977187e90c7 35 #include <stdint.h>
embeddedartists 0:4977187e90c7 36 #include <stdbool.h>
embeddedartists 0:4977187e90c7 37
embeddedartists 0:4977187e90c7 38 /** @defgroup LPC_Types CHIP: LPC Common Types
embeddedartists 0:4977187e90c7 39 * @ingroup CHIP_Common
embeddedartists 0:4977187e90c7 40 * @{
embeddedartists 0:4977187e90c7 41 */
embeddedartists 0:4977187e90c7 42
embeddedartists 0:4977187e90c7 43 /** @defgroup LPC_Types_Public_Types LPC Public Types
embeddedartists 0:4977187e90c7 44 * @{
embeddedartists 0:4977187e90c7 45 */
embeddedartists 0:4977187e90c7 46
embeddedartists 0:4977187e90c7 47 /**
embeddedartists 0:4977187e90c7 48 * @brief Boolean Type definition
embeddedartists 0:4977187e90c7 49 */
embeddedartists 0:4977187e90c7 50 typedef enum {FALSE = 0, TRUE = !FALSE} Bool;
embeddedartists 0:4977187e90c7 51
embeddedartists 0:4977187e90c7 52 /**
embeddedartists 0:4977187e90c7 53 * @brief Boolean Type definition
embeddedartists 0:4977187e90c7 54 */
embeddedartists 0:4977187e90c7 55 #if !defined(__cplusplus)
embeddedartists 0:4977187e90c7 56 // typedef enum {false = 0, true = !false} bool;
embeddedartists 0:4977187e90c7 57 #endif
embeddedartists 0:4977187e90c7 58
embeddedartists 0:4977187e90c7 59 /**
embeddedartists 0:4977187e90c7 60 * @brief Flag Status and Interrupt Flag Status type definition
embeddedartists 0:4977187e90c7 61 */
embeddedartists 0:4977187e90c7 62 typedef enum {RESET = 0, SET = !RESET} FlagStatus, IntStatus, SetState;
embeddedartists 0:4977187e90c7 63 #define PARAM_SETSTATE(State) ((State == RESET) || (State == SET))
embeddedartists 0:4977187e90c7 64
embeddedartists 0:4977187e90c7 65 /**
embeddedartists 0:4977187e90c7 66 * @brief Functional State Definition
embeddedartists 0:4977187e90c7 67 */
embeddedartists 0:4977187e90c7 68 typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
embeddedartists 0:4977187e90c7 69 #define PARAM_FUNCTIONALSTATE(State) ((State == DISABLE) || (State == ENABLE))
embeddedartists 0:4977187e90c7 70
embeddedartists 0:4977187e90c7 71 /**
embeddedartists 0:4977187e90c7 72 * @ Status type definition
embeddedartists 0:4977187e90c7 73 */
embeddedartists 0:4977187e90c7 74 typedef enum {ERROR = 0, SUCCESS = !ERROR} Status;
embeddedartists 0:4977187e90c7 75
embeddedartists 0:4977187e90c7 76 /**
embeddedartists 0:4977187e90c7 77 * Read/Write transfer type mode (Block or non-block)
embeddedartists 0:4977187e90c7 78 */
embeddedartists 0:4977187e90c7 79 typedef enum {
embeddedartists 0:4977187e90c7 80 NONE_BLOCKING = 0, /**< None Blocking type */
embeddedartists 0:4977187e90c7 81 BLOCKING, /**< Blocking type */
embeddedartists 0:4977187e90c7 82 } TRANSFER_BLOCK_T;
embeddedartists 0:4977187e90c7 83
embeddedartists 0:4977187e90c7 84 /** Pointer to Function returning Void (any number of parameters) */
embeddedartists 0:4977187e90c7 85 typedef void (*PFV)();
embeddedartists 0:4977187e90c7 86
embeddedartists 0:4977187e90c7 87 /** Pointer to Function returning int32_t (any number of parameters) */
embeddedartists 0:4977187e90c7 88 typedef int32_t (*PFI)();
embeddedartists 0:4977187e90c7 89
embeddedartists 0:4977187e90c7 90 /**
embeddedartists 0:4977187e90c7 91 * @}
embeddedartists 0:4977187e90c7 92 */
embeddedartists 0:4977187e90c7 93
embeddedartists 0:4977187e90c7 94 /** @defgroup LPC_Types_Public_Macros LPC Public Macros
embeddedartists 0:4977187e90c7 95 * @{
embeddedartists 0:4977187e90c7 96 */
embeddedartists 0:4977187e90c7 97
embeddedartists 0:4977187e90c7 98 /* _BIT(n) sets the bit at position "n"
embeddedartists 0:4977187e90c7 99 * _BIT(n) is intended to be used in "OR" and "AND" expressions:
embeddedartists 0:4977187e90c7 100 * e.g., "(_BIT(3) | _BIT(7))".
embeddedartists 0:4977187e90c7 101 */
embeddedartists 0:4977187e90c7 102 #undef _BIT
embeddedartists 0:4977187e90c7 103 /* Set bit macro */
embeddedartists 0:4977187e90c7 104 #define _BIT(n) (1 << (n))
embeddedartists 0:4977187e90c7 105
embeddedartists 0:4977187e90c7 106 /* _SBF(f,v) sets the bit field starting at position "f" to value "v".
embeddedartists 0:4977187e90c7 107 * _SBF(f,v) is intended to be used in "OR" and "AND" expressions:
embeddedartists 0:4977187e90c7 108 * e.g., "((_SBF(5,7) | _SBF(12,0xF)) & 0xFFFF)"
embeddedartists 0:4977187e90c7 109 */
embeddedartists 0:4977187e90c7 110 #undef _SBF
embeddedartists 0:4977187e90c7 111 /* Set bit field macro */
embeddedartists 0:4977187e90c7 112 #define _SBF(f, v) ((v) << (f))
embeddedartists 0:4977187e90c7 113
embeddedartists 0:4977187e90c7 114 /* _BITMASK constructs a symbol with 'field_width' least significant
embeddedartists 0:4977187e90c7 115 * bits set.
embeddedartists 0:4977187e90c7 116 * e.g., _BITMASK(5) constructs '0x1F', _BITMASK(16) == 0xFFFF
embeddedartists 0:4977187e90c7 117 * The symbol is intended to be used to limit the bit field width
embeddedartists 0:4977187e90c7 118 * thusly:
embeddedartists 0:4977187e90c7 119 * <a_register> = (any_expression) & _BITMASK(x), where 0 < x <= 32.
embeddedartists 0:4977187e90c7 120 * If "any_expression" results in a value that is larger than can be
embeddedartists 0:4977187e90c7 121 * contained in 'x' bits, the bits above 'x - 1' are masked off. When
embeddedartists 0:4977187e90c7 122 * used with the _SBF example above, the example would be written:
embeddedartists 0:4977187e90c7 123 * a_reg = ((_SBF(5,7) | _SBF(12,0xF)) & _BITMASK(16))
embeddedartists 0:4977187e90c7 124 * This ensures that the value written to a_reg is no wider than
embeddedartists 0:4977187e90c7 125 * 16 bits, and makes the code easier to read and understand.
embeddedartists 0:4977187e90c7 126 */
embeddedartists 0:4977187e90c7 127 #undef _BITMASK
embeddedartists 0:4977187e90c7 128 /* Bitmask creation macro */
embeddedartists 0:4977187e90c7 129 #define _BITMASK(field_width) ( _BIT(field_width) - 1)
embeddedartists 0:4977187e90c7 130
embeddedartists 0:4977187e90c7 131 /* NULL pointer */
embeddedartists 0:4977187e90c7 132 #ifndef NULL
embeddedartists 0:4977187e90c7 133 #define NULL ((void *) 0)
embeddedartists 0:4977187e90c7 134 #endif
embeddedartists 0:4977187e90c7 135
embeddedartists 0:4977187e90c7 136 /* Number of elements in an array */
embeddedartists 0:4977187e90c7 137 #define NELEMENTS(array) (sizeof(array) / sizeof(array[0]))
embeddedartists 0:4977187e90c7 138
embeddedartists 0:4977187e90c7 139 /* Static data/function define */
embeddedartists 0:4977187e90c7 140 #define STATIC static
embeddedartists 0:4977187e90c7 141 /* External data/function define */
embeddedartists 0:4977187e90c7 142 #define EXTERN extern
embeddedartists 0:4977187e90c7 143
embeddedartists 0:4977187e90c7 144 #if !defined(MAX)
embeddedartists 0:4977187e90c7 145 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
embeddedartists 0:4977187e90c7 146 #endif
embeddedartists 0:4977187e90c7 147 #if !defined(MIN)
embeddedartists 0:4977187e90c7 148 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
embeddedartists 0:4977187e90c7 149 #endif
embeddedartists 0:4977187e90c7 150
embeddedartists 0:4977187e90c7 151 /**
embeddedartists 0:4977187e90c7 152 * @}
embeddedartists 0:4977187e90c7 153 */
embeddedartists 0:4977187e90c7 154
embeddedartists 0:4977187e90c7 155 /* Old Type Definition compatibility */
embeddedartists 0:4977187e90c7 156 /** @addtogroup LPC_Types_Public_Types
embeddedartists 0:4977187e90c7 157 * @{
embeddedartists 0:4977187e90c7 158 */
embeddedartists 0:4977187e90c7 159
embeddedartists 0:4977187e90c7 160 /** LPC type for character type */
embeddedartists 0:4977187e90c7 161 typedef char CHAR;
embeddedartists 0:4977187e90c7 162
embeddedartists 0:4977187e90c7 163 /** LPC type for 8 bit unsigned value */
embeddedartists 0:4977187e90c7 164 typedef uint8_t UNS_8;
embeddedartists 0:4977187e90c7 165
embeddedartists 0:4977187e90c7 166 /** LPC type for 8 bit signed value */
embeddedartists 0:4977187e90c7 167 typedef int8_t INT_8;
embeddedartists 0:4977187e90c7 168
embeddedartists 0:4977187e90c7 169 /** LPC type for 16 bit unsigned value */
embeddedartists 0:4977187e90c7 170 typedef uint16_t UNS_16;
embeddedartists 0:4977187e90c7 171
embeddedartists 0:4977187e90c7 172 /** LPC type for 16 bit signed value */
embeddedartists 0:4977187e90c7 173 typedef int16_t INT_16;
embeddedartists 0:4977187e90c7 174
embeddedartists 0:4977187e90c7 175 /** LPC type for 32 bit unsigned value */
embeddedartists 0:4977187e90c7 176 typedef uint32_t UNS_32;
embeddedartists 0:4977187e90c7 177
embeddedartists 0:4977187e90c7 178 /** LPC type for 32 bit signed value */
embeddedartists 0:4977187e90c7 179 typedef int32_t INT_32;
embeddedartists 0:4977187e90c7 180
embeddedartists 0:4977187e90c7 181 /** LPC type for 64 bit signed value */
embeddedartists 0:4977187e90c7 182 typedef int64_t INT_64;
embeddedartists 0:4977187e90c7 183
embeddedartists 0:4977187e90c7 184 /** LPC type for 64 bit unsigned value */
embeddedartists 0:4977187e90c7 185 typedef uint64_t UNS_64;
embeddedartists 0:4977187e90c7 186
embeddedartists 0:4977187e90c7 187 #ifdef __CODE_RED
embeddedartists 0:4977187e90c7 188 #define BOOL_32 bool
embeddedartists 0:4977187e90c7 189 #define BOOL_16 bool
embeddedartists 0:4977187e90c7 190 #define BOOL_8 bool
embeddedartists 0:4977187e90c7 191 #else
embeddedartists 0:4977187e90c7 192 /** 32 bit boolean type */
embeddedartists 0:4977187e90c7 193 typedef bool BOOL_32;
embeddedartists 0:4977187e90c7 194
embeddedartists 0:4977187e90c7 195 /** 16 bit boolean type */
embeddedartists 0:4977187e90c7 196 typedef bool BOOL_16;
embeddedartists 0:4977187e90c7 197
embeddedartists 0:4977187e90c7 198 /** 8 bit boolean type */
embeddedartists 0:4977187e90c7 199 typedef bool BOOL_8;
embeddedartists 0:4977187e90c7 200 #endif
embeddedartists 0:4977187e90c7 201
embeddedartists 0:4977187e90c7 202 #ifdef __CC_ARM
embeddedartists 0:4977187e90c7 203 #define INLINE __inline
embeddedartists 0:4977187e90c7 204 #else
embeddedartists 0:4977187e90c7 205 #define INLINE inline
embeddedartists 0:4977187e90c7 206 #endif
embeddedartists 0:4977187e90c7 207
embeddedartists 0:4977187e90c7 208 /**
embeddedartists 0:4977187e90c7 209 * @}
embeddedartists 0:4977187e90c7 210 */
embeddedartists 0:4977187e90c7 211
embeddedartists 0:4977187e90c7 212 /**
embeddedartists 0:4977187e90c7 213 * @}
embeddedartists 0:4977187e90c7 214 */
embeddedartists 0:4977187e90c7 215
embeddedartists 0:4977187e90c7 216 #endif /* __LPC_TYPES_H_ */
embeddedartists 0:4977187e90c7 217