mbed support for LPC4088 Display Module

Dependencies:   DM_FATFileSystem DM_HttpServer DM_USBHost EthernetInterface USBDevice mbed-rpc mbed-rtos mbed-src

Dependents:   emptyProgram

Fork of DMSupport by Embedded Artists

Committer:
redbird
Date:
Sat Mar 26 22:50:45 2016 +0000
Revision:
48:2f574ffa8b96
Parent:
31:d47cffcb0a3e
changed pin names to make more sense

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 4:6fdcdf7aff8d 1 /*
embeddedartists 4:6fdcdf7aff8d 2 * Copyright 2014 Embedded Artists AB
embeddedartists 4:6fdcdf7aff8d 3 *
embeddedartists 4:6fdcdf7aff8d 4 * Licensed under the Apache License, Version 2.0 (the "License");
embeddedartists 4:6fdcdf7aff8d 5 * you may not use this file except in compliance with the License.
embeddedartists 4:6fdcdf7aff8d 6 * You may obtain a copy of the License at
embeddedartists 4:6fdcdf7aff8d 7 *
embeddedartists 4:6fdcdf7aff8d 8 * http://www.apache.org/licenses/LICENSE-2.0
embeddedartists 4:6fdcdf7aff8d 9 *
embeddedartists 4:6fdcdf7aff8d 10 * Unless required by applicable law or agreed to in writing, software
embeddedartists 4:6fdcdf7aff8d 11 * distributed under the License is distributed on an "AS IS" BASIS,
embeddedartists 4:6fdcdf7aff8d 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
embeddedartists 4:6fdcdf7aff8d 13 * See the License for the specific language governing permissions and
embeddedartists 4:6fdcdf7aff8d 14 * limitations under the License.
embeddedartists 4:6fdcdf7aff8d 15 */
embeddedartists 4:6fdcdf7aff8d 16
embeddedartists 4:6fdcdf7aff8d 17 #ifndef _MEAS_H_
embeddedartists 4:6fdcdf7aff8d 18 #define _MEAS_H_
embeddedartists 4:6fdcdf7aff8d 19
embeddedartists 4:6fdcdf7aff8d 20 /******************************************************************************
embeddedartists 4:6fdcdf7aff8d 21 * Includes
embeddedartists 4:6fdcdf7aff8d 22 *****************************************************************************/
embeddedartists 4:6fdcdf7aff8d 23
embeddedartists 4:6fdcdf7aff8d 24 #include "mbed.h"
embeddedartists 4:6fdcdf7aff8d 25 #include "dm_board_config.h"
embeddedartists 4:6fdcdf7aff8d 26
embeddedartists 4:6fdcdf7aff8d 27 /******************************************************************************
embeddedartists 4:6fdcdf7aff8d 28 * Typedefs and defines
embeddedartists 4:6fdcdf7aff8d 29 *****************************************************************************/
embeddedartists 4:6fdcdf7aff8d 30
embeddedartists 31:d47cffcb0a3e 31 // Enable extra measuring pins, at the expense of peripheral access.
embeddedartists 31:d47cffcb0a3e 32 // For example MEAS pins 5-9 will prevent use of UART4/SPI2 and some timers.
embeddedartists 31:d47cffcb0a3e 33 //#define EXTRA_PINS
embeddedartists 31:d47cffcb0a3e 34
embeddedartists 4:6fdcdf7aff8d 35 // Internal macros, don't use directly
embeddedartists 4:6fdcdf7aff8d 36 #if defined(DM_BOARD_ENABLE_MEASSURING_PINS)
embeddedartists 4:6fdcdf7aff8d 37 #define _INTERNAL_SET_MEAS_PIN(__port, __pin) ((LPC_GPIO ## __port)->SET = (1UL << (__pin)))
embeddedartists 4:6fdcdf7aff8d 38 #define _INTERNAL_CLR_MEAS_PIN(__port, __pin) ((LPC_GPIO ## __port)->CLR = (1UL << (__pin)))
embeddedartists 4:6fdcdf7aff8d 39 #else
embeddedartists 4:6fdcdf7aff8d 40 #define _INTERNAL_SET_MEAS_PIN(__port, __pin) do {} while(0)
embeddedartists 4:6fdcdf7aff8d 41 #define _INTERNAL_CLR_MEAS_PIN(__port, __pin) do {} while(0)
embeddedartists 4:6fdcdf7aff8d 42 #endif
embeddedartists 4:6fdcdf7aff8d 43
embeddedartists 4:6fdcdf7aff8d 44 // Manipulates measurement pin 1 which is GPIO1[24], available on J10-7
embeddedartists 4:6fdcdf7aff8d 45 #define SET_MEAS_PIN_1() _INTERNAL_SET_MEAS_PIN(1, 24)
embeddedartists 4:6fdcdf7aff8d 46 #define CLR_MEAS_PIN_1() _INTERNAL_CLR_MEAS_PIN(1, 24)
embeddedartists 4:6fdcdf7aff8d 47
embeddedartists 4:6fdcdf7aff8d 48 // Manipulates measurement pin 2 which is GPIO1[23], available on J10-8
embeddedartists 4:6fdcdf7aff8d 49 #define SET_MEAS_PIN_2() _INTERNAL_SET_MEAS_PIN(1, 23)
embeddedartists 4:6fdcdf7aff8d 50 #define CLR_MEAS_PIN_2() _INTERNAL_CLR_MEAS_PIN(1, 23)
embeddedartists 4:6fdcdf7aff8d 51
embeddedartists 4:6fdcdf7aff8d 52 // Manipulates measurement pin 3 which is GPIO1[20], available on J10-9
embeddedartists 4:6fdcdf7aff8d 53 #define SET_MEAS_PIN_3() _INTERNAL_SET_MEAS_PIN(1, 20)
embeddedartists 4:6fdcdf7aff8d 54 #define CLR_MEAS_PIN_3() _INTERNAL_CLR_MEAS_PIN(1, 20)
embeddedartists 4:6fdcdf7aff8d 55
embeddedartists 4:6fdcdf7aff8d 56 // Manipulates measurement pin 4 which is GPIO1[19], available on J10-10
embeddedartists 4:6fdcdf7aff8d 57 #define SET_MEAS_PIN_4() _INTERNAL_SET_MEAS_PIN(1, 19)
embeddedartists 4:6fdcdf7aff8d 58 #define CLR_MEAS_PIN_4() _INTERNAL_CLR_MEAS_PIN(1, 19)
embeddedartists 4:6fdcdf7aff8d 59
embeddedartists 31:d47cffcb0a3e 60 #ifdef EXTRA_PINS
embeddedartists 31:d47cffcb0a3e 61 // Manipulates measurement pin 5 which is GPIO5[0], available on J10-15
embeddedartists 31:d47cffcb0a3e 62 #define SET_MEAS_PIN_5() _INTERNAL_SET_MEAS_PIN(5, 0)
embeddedartists 31:d47cffcb0a3e 63 #define CLR_MEAS_PIN_5() _INTERNAL_CLR_MEAS_PIN(5, 0)
embeddedartists 31:d47cffcb0a3e 64
embeddedartists 31:d47cffcb0a3e 65 // Manipulates measurement pin 6 which is GPIO5[1], available on J10-16
embeddedartists 31:d47cffcb0a3e 66 #define SET_MEAS_PIN_6() _INTERNAL_SET_MEAS_PIN(5, 1)
embeddedartists 31:d47cffcb0a3e 67 #define CLR_MEAS_PIN_6() _INTERNAL_CLR_MEAS_PIN(5, 1)
embeddedartists 31:d47cffcb0a3e 68
embeddedartists 31:d47cffcb0a3e 69 // Manipulates measurement pin 7 which is GPIO5[2], available on J10-17
embeddedartists 31:d47cffcb0a3e 70 #define SET_MEAS_PIN_7() _INTERNAL_SET_MEAS_PIN(5, 2)
embeddedartists 31:d47cffcb0a3e 71 #define CLR_MEAS_PIN_7() _INTERNAL_CLR_MEAS_PIN(5, 2)
embeddedartists 31:d47cffcb0a3e 72
embeddedartists 31:d47cffcb0a3e 73 // Manipulates measurement pin 8 which is GPIO5[3], available on J10-18
embeddedartists 31:d47cffcb0a3e 74 #define SET_MEAS_PIN_8() _INTERNAL_SET_MEAS_PIN(5, 3)
embeddedartists 31:d47cffcb0a3e 75 #define CLR_MEAS_PIN_8() _INTERNAL_CLR_MEAS_PIN(5, 3)
embeddedartists 31:d47cffcb0a3e 76
embeddedartists 31:d47cffcb0a3e 77 // Manipulates measurement pin 9 which is GPIO5[4], available on J10-19
embeddedartists 31:d47cffcb0a3e 78 #define SET_MEAS_PIN_9() _INTERNAL_SET_MEAS_PIN(5, 4)
embeddedartists 31:d47cffcb0a3e 79 #define CLR_MEAS_PIN_9() _INTERNAL_CLR_MEAS_PIN(5, 4)
embeddedartists 31:d47cffcb0a3e 80
embeddedartists 31:d47cffcb0a3e 81 #define _INTERNAL_EXTRA_INIT_MEAS() do {\
embeddedartists 31:d47cffcb0a3e 82 LPC_IOCON->P5_0 &= ~0x7; \
embeddedartists 31:d47cffcb0a3e 83 LPC_IOCON->P5_1 &= ~0x7; \
embeddedartists 31:d47cffcb0a3e 84 LPC_IOCON->P5_2 &= ~0x7; \
embeddedartists 31:d47cffcb0a3e 85 LPC_IOCON->P5_3 &= ~0x7; \
embeddedartists 31:d47cffcb0a3e 86 LPC_IOCON->P5_4 &= ~0x7; \
embeddedartists 31:d47cffcb0a3e 87 LPC_GPIO5->DIR |= (1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<4); \
embeddedartists 31:d47cffcb0a3e 88 CLR_MEAS_PIN_5(); \
embeddedartists 31:d47cffcb0a3e 89 CLR_MEAS_PIN_6(); \
embeddedartists 31:d47cffcb0a3e 90 CLR_MEAS_PIN_7(); \
embeddedartists 31:d47cffcb0a3e 91 CLR_MEAS_PIN_8(); \
embeddedartists 31:d47cffcb0a3e 92 CLR_MEAS_PIN_9(); \
embeddedartists 31:d47cffcb0a3e 93 } while(0)
embeddedartists 31:d47cffcb0a3e 94 #else
embeddedartists 31:d47cffcb0a3e 95 #define _INTERNAL_EXTRA_INIT_MEAS() do {} while(false)
embeddedartists 31:d47cffcb0a3e 96 #endif
embeddedartists 4:6fdcdf7aff8d 97
embeddedartists 4:6fdcdf7aff8d 98 #if defined(DM_BOARD_ENABLE_MEASSURING_PINS)
embeddedartists 4:6fdcdf7aff8d 99 #define _INTERNAL_INIT_MEAS() do {\
embeddedartists 4:6fdcdf7aff8d 100 LPC_IOCON->P1_19 &= ~0x7; \
embeddedartists 4:6fdcdf7aff8d 101 LPC_IOCON->P1_20 &= ~0x7; \
embeddedartists 4:6fdcdf7aff8d 102 LPC_IOCON->P1_23 &= ~0x7; \
embeddedartists 4:6fdcdf7aff8d 103 LPC_IOCON->P1_24 &= ~0x7; \
embeddedartists 4:6fdcdf7aff8d 104 LPC_GPIO1->DIR |= (1<<19) | (1<<20) | (1<<23) | (1<<24); \
embeddedartists 4:6fdcdf7aff8d 105 CLR_MEAS_PIN_1(); \
embeddedartists 4:6fdcdf7aff8d 106 CLR_MEAS_PIN_2(); \
embeddedartists 4:6fdcdf7aff8d 107 CLR_MEAS_PIN_3(); \
embeddedartists 4:6fdcdf7aff8d 108 CLR_MEAS_PIN_4(); \
embeddedartists 31:d47cffcb0a3e 109 _INTERNAL_EXTRA_INIT_MEAS(); \
embeddedartists 4:6fdcdf7aff8d 110 } while(0)
embeddedartists 4:6fdcdf7aff8d 111 #else
embeddedartists 4:6fdcdf7aff8d 112 #define _INTERNAL_INIT_MEAS() do {} while(0)
embeddedartists 4:6fdcdf7aff8d 113 #endif
embeddedartists 4:6fdcdf7aff8d 114
embeddedartists 4:6fdcdf7aff8d 115 /******************************************************************************
embeddedartists 4:6fdcdf7aff8d 116 * Global Variables
embeddedartists 4:6fdcdf7aff8d 117 *****************************************************************************/
embeddedartists 4:6fdcdf7aff8d 118
embeddedartists 4:6fdcdf7aff8d 119 #endif /* end _MEAS_H_ */
embeddedartists 4:6fdcdf7aff8d 120