src/gpio.h
00001 /*
00002  * gpio.h
00003  *
00004  *  Created on: 2011/07/27
00005  *      Author: lynxeyed
00006  */
00007 #ifndef GPIO_H_
00008 #define GPIO_H_
00009 
00010 //#if defined (__USE_CMSIS)
00011 #include "LPC11xx.h"
00012 //#endif
00013 //=======================================
00014 // Define LPC_GPIO[4] (each top address)
00015 //=======================================
00016 static LPC_GPIO_TypeDef (* const LPC_GPIO[4]) = { LPC_GPIO0, LPC_GPIO1, LPC_GPIO2, LPC_GPIO3 };
00017 
00018 /*      =======================================
00019 *       Macros and functions for Defining MARY's GPIO Assign
00020 *
00021 *       CN1_7,8         :       (PIO1_2,PIO1_1)
00022 *                                       should be C17,C18
00023 *
00024 *       CN2_1...8       :       (PIO1_4,PIO1_11,PIO1_7,PIO1_5,PIO3_2,PIO2_0,PIO1_6,PIO0_1)
00025 *                                       should be C21,C22,C23,C24,C25,C26,C27,C28
00026 *
00027 *       CN3_1...8       :       (PIO1_8,PIO0_3,PIO0_2,PIO3_4,PIO0_4,PIO3_5,PIO0_5,PIO1_7)
00028 *                                       should be C31,C32,C33,C34,C35,C36,C37,C38
00029 *
00030 *       CN4_1...7       :       (PIO1_9,PIO1_10,PIO0_6,PIO0_11,PIO0_8,PIO1_0,PIO0_9)
00031 *                                       should be C41,C42,C43,C44,C45,C46,C47
00032 *       =======================================
00033 */
00034 #define C17     (100)
00035 #define C18     (101)
00036 #define C21 (102)
00037 #define C22 (103)
00038 #define C23 (104)
00039 #define C24 (105)
00040 #define C25 (106)
00041 #define C26 (107)
00042 #define C27 (108)
00043 #define C28 (109)
00044 #define C31 (110)
00045 #define C32 (111)
00046 #define C33 (112)
00047 #define C34 (113)
00048 #define C35 (114)
00049 #define C36 (115)
00050 #define C37 (116)
00051 #define C38 (117)
00052 #define C41 (118)
00053 #define C42 (119)
00054 #define C43 (120)
00055 #define C44 (121)
00056 #define C45 (122)
00057 #define C46 (123)
00058 #define C47 (124)
00059 #define GLED (125)
00060 #define BLED (126)
00061 #define RLED (127)
00062 
00063 #define _BIT0 (1U << 0)
00064 #define _BIT1 (1U << 1)
00065 #define _BIT2 (1U << 2)
00066 #define _BIT3 (1U << 3)
00067 #define _BIT4 (1U << 4)
00068 #define _BIT5 (1U << 5)
00069 #define _BIT6 (1U << 6)
00070 #define _BIT7 (1U << 7)
00071 #define _BIT8 (1U << 8)
00072 #define _BIT9 (1U << 9)
00073 #define _BIT10 (1U << 10)
00074 #define _BIT11 (1U << 11)
00075 
00076 const unsigned int mary_pinAssign[] =
00077 {
00078                 1, _BIT2,       //CN1_7
00079                 1, _BIT1,       //CN1_8
00080 
00081                 1, _BIT4,       //CN2_1
00082                 1, _BIT11,      //CN2_2
00083                 1, _BIT7,       //CN2_3
00084                 1, _BIT5,       //CN2_4
00085                 3, _BIT2,       //CN2_5
00086                 2, _BIT0,       //CN2_6
00087                 1, _BIT6,       //CN2_7
00088                 0, _BIT1,       //CN2_8
00089 
00090                 1, _BIT8,       //CN3_1
00091                 0, _BIT3,       //CN3_2
00092                 0, _BIT2,       //CN3_3
00093                 3, _BIT4,       //CN3_4
00094                 0, _BIT4,       //CN3_5
00095                 3, _BIT5,       //CN3_6
00096                 0, _BIT5,       //CN3_7
00097                 1, _BIT7,       //CN3_8
00098 
00099                 1, _BIT9,       //CN4_1
00100                 1, _BIT10,      //CN4_2
00101                 0, _BIT6,       //CN4_3
00102                 0, _BIT11,      //CN4_4
00103                 0, _BIT8,       //CN4_5
00104                 1, _BIT0,       //CN4_6
00105                 0, _BIT9,       //CN4_7
00106                 0, _BIT7,       //GLED
00107                 1, _BIT5,       //BLED
00108                 2, _BIT0        //RLED
00109 };
00110 
00111 /*
00112 // Arduino's pins assign
00113 const unsigned int arduino_pinAssign[] =
00114 {
00115 
00116 };
00117 */
00118 
00119 typedef enum {INPUT, OUTPUT}pinModeState;
00120 typedef enum {LOW, HIGH}digitalWriteState;
00121 
00122 void pinMode(int pin,pinModeState state);
00123 void digitalWrite(int pin,digitalWriteState state);
00124 int digitalRead(int pin);
00125 
00126 
00127 
00128 
00129 #endif /* GPIO_H_ */
 全て クラス ファイル 関数 変数 列挙型 列挙型の値 マクロ定義