Graphical demo for the LPC4088 Experiment Base Board with one of the Display Expansion Kits. This program displays how to write text in different fonts.

Dependencies:   EALib mbed

Committer:
embeddedartists
Date:
Thu Jun 25 10:30:15 2015 +0000
Revision:
0:5e5e9ec91fc8
First version

Who changed what in which revision?

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