RT-AICHIP-sample
io.c
[詳解]
1 /* ------------------------------------------------------------ *
2 File io.c
3 
4 IOポートの設定
5 * ------------------------------------------------------------ */
6 #include "io.h"
7 #include "LPC13xx.h"
8 #include "core_cm3.h"
9 #include "type.h"
10 
11 /* ------------------------------------------------------------ *
12  Input void
13  Output void
14 
15  IOポートの設定.
16  SW1,SW2,LED1,LED2に繋がっているIOピンを設定
17 * ------------------------------------------------------------ */
18 void initIO (void)
19 {
20 
21  //SW1 (Left)
22  LPC_IOCON->PIO2_0 = 0x0000; //IOConfig PIO2_0
23  LPC_GPIO2->DIR &= 0xfffe; //Data Direction(1 output , 0 input) [0bit] SW1
24 
25  //SW2(Right)
26  LPC_IOCON->PIO0_1 = 0x0000; //IOConfig PIO0_1
27  LPC_GPIO0->DIR &= 0xfffd; //Data Direction(1 output , 0 input) [1bit] SW2
28 
29  //LED1 (GR)
30  LPC_IOCON->PIO1_8 = 0x0000; //IOConfig PIO1_8
31  LPC_GPIO1->DIR |= 0x0100; //Data Direction(1 output , 0 input) [8bit] LED1
32 
33  //LED2(RD)
34  LPC_IOCON->SWDIO_PIO1_3 = 0x00C1; //IOConfig PIO1_3
35  LPC_GPIO1->DIR |= 0x0008; //Data Direction(1 output , 0 input) [3bit] LED2
36 
37  //モータードライバ NSLEEP
38  LPC_IOCON->PIO1_11 = 0x00C8;//IOConfig NSLEEP
39  LPC_GPIO1->DIR |= 0x0800; //Data Direction(1 output , 0 input) [3bit] NSLEEP
40 
41  //モーターの正転/負転切り替え MOT_CW_CCW
42  LPC_IOCON->PIO0_7 = 0x0000;
43  LPC_GPIO0->DIR |=0x0080;
44 
45 };
46 /******************************************************************************
47 ** End Of File
48 ******************************************************************************/
void initIO(void)
Definition: io.c:18
CMSIS Cortex-M3 Core Peripheral Access Layer Header File.