diff options
Diffstat (limited to 'lib/chibios/os/hal/boards/NGX_BB_LPC11U14')
-rw-r--r-- | lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.c | 60 | ||||
-rw-r--r-- | lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.h | 125 | ||||
-rw-r--r-- | lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.mk | 9 |
3 files changed, 194 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.c b/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.c new file mode 100644 index 000000000..65c164809 --- /dev/null +++ b/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = { | ||
26 | {VAL_GPIO0DATA, VAL_GPIO0DIR}, | ||
27 | {VAL_GPIO1DATA, VAL_GPIO1DIR} | ||
28 | }; | ||
29 | #endif | ||
30 | |||
31 | /* | ||
32 | * Early initialization code. | ||
33 | * This initialization must be performed just after stack setup and before | ||
34 | * any other initialization. | ||
35 | */ | ||
36 | __inline void __early_init(void) { | ||
37 | |||
38 | lpc_clock_init(); | ||
39 | } | ||
40 | |||
41 | /* | ||
42 | * Board-specific initialization code. | ||
43 | */ | ||
44 | __inline void boardInit(void) { | ||
45 | |||
46 | /* LCD */ | ||
47 | LPC_IOCON->TMS_PIO0_12 = 0x91; /* LCD_EN: GPIO - pull-up */ | ||
48 | LPC_IOCON->TDO_PIO0_13 = 0x81; /* LCD_RW: GPIO - No pull-up */ | ||
49 | LPC_IOCON->TRST_PIO0_14 = 0x81; /* LCD_RS: GPIO - No pull-up */ | ||
50 | |||
51 | /* USART */ | ||
52 | LPC_IOCON->PIO0_18 = 0x81; /* RDX: RXD - No pull-up */ | ||
53 | LPC_IOCON->PIO0_19 = 0x81; /* TDX: TXD - No pull-up */ | ||
54 | |||
55 | /* Test LEDs */ | ||
56 | LPC_IOCON->PIO0_22 = 0x80; /* LED_TEST1: GPIO - No pull-up */ | ||
57 | LPC_IOCON->PIO0_23 = 0x80; /* LED_TEST2: GPIO - No pull-up */ | ||
58 | |||
59 | } | ||
60 | |||
diff --git a/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.h b/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.h new file mode 100644 index 000000000..15d9dce2a --- /dev/null +++ b/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for NGX BlueBoard LPC11U14. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifiers. | ||
26 | */ | ||
27 | #define BOARD_NGX_BB_LPC11U14 | ||
28 | #define BOARD_NAME "NGX BlueBoard LPC11U14" | ||
29 | |||
30 | /* | ||
31 | * Board frequencies. | ||
32 | */ | ||
33 | #define SYSOSCCLK 12000000 | ||
34 | |||
35 | /* | ||
36 | * Pin definitions. | ||
37 | */ | ||
38 | |||
39 | /* GPIO Port0 */ | ||
40 | #define BUTTON_ISP_PORT GPIO0 | ||
41 | #define BUTTON_ISP 1 | ||
42 | |||
43 | #define LCD_ERD_PORT GPIO0 | ||
44 | #define LCD_ERD 12 | ||
45 | |||
46 | #define LCD_RWR_PORT GPIO0 | ||
47 | #define LCD_RWR 13 | ||
48 | |||
49 | #define LCD_RS_PORT GPIO0 | ||
50 | #define LCD_RS 14 | ||
51 | |||
52 | #define LED_PORT GPIO0 | ||
53 | #define LED_TEST1 22 | ||
54 | #define LED_TEST2 23 | ||
55 | |||
56 | /* GPIO Port1 */ | ||
57 | #define LCD_RST_PORT GPIO1 | ||
58 | #define LCD_RST 0 | ||
59 | |||
60 | #define LCD_CS_PORT GPIO1 | ||
61 | #define LCD_CS 13 | ||
62 | |||
63 | #define LCD_BL_PORT GPIO1 | ||
64 | #define LCD_BL 14 | ||
65 | #define LCD_VCCEN_PORT GPIO1 | ||
66 | #define LCD_VCCEN 14 | ||
67 | |||
68 | #define WHEEL_SENSOR_PORT GPIO0 | ||
69 | #define WHEEL_SENSOR 21 | ||
70 | |||
71 | #define LCD_DATA_PORT GPIO1 | ||
72 | #define LCD_D0 19 | ||
73 | #define LCD_D1 20 | ||
74 | #define LCD_D2 21 | ||
75 | #define LCD_D3 22 | ||
76 | #define LCD_D4 26 | ||
77 | #define LCD_D5 27 | ||
78 | #define LCD_D6 28 | ||
79 | #define LCD_D7 31 | ||
80 | |||
81 | #define LCD_DATA_MASK PAL_PORT_BIT(LCD_D0) | \ | ||
82 | PAL_PORT_BIT(LCD_D1) | \ | ||
83 | PAL_PORT_BIT(LCD_D2) | \ | ||
84 | PAL_PORT_BIT(LCD_D3) | \ | ||
85 | PAL_PORT_BIT(LCD_D4) | \ | ||
86 | PAL_PORT_BIT(LCD_D5) | \ | ||
87 | PAL_PORT_BIT(LCD_D6) | \ | ||
88 | PAL_PORT_BIT(LCD_D7) | ||
89 | |||
90 | /* | ||
91 | * GPIO 0 initial setup. | ||
92 | */ | ||
93 | #define VAL_GPIO0DIR PAL_PORT_BIT(LCD_ERD) | \ | ||
94 | PAL_PORT_BIT(LCD_RWR) | \ | ||
95 | PAL_PORT_BIT(LCD_RS) | \ | ||
96 | PAL_PORT_BIT(LED_TEST1) | \ | ||
97 | PAL_PORT_BIT(LED_TEST2) | ||
98 | |||
99 | #define VAL_GPIO0DATA PAL_PORT_BIT(LCD_ERD) | \ | ||
100 | PAL_PORT_BIT(LCD_RWR) | \ | ||
101 | PAL_PORT_BIT(LED_TEST1) | \ | ||
102 | PAL_PORT_BIT(LED_TEST2) | ||
103 | |||
104 | /* | ||
105 | * GPIO 1 initial setup. | ||
106 | */ | ||
107 | #define VAL_GPIO1DIR PAL_PORT_BIT(LCD_RST) | \ | ||
108 | PAL_PORT_BIT(LCD_CS) | \ | ||
109 | PAL_PORT_BIT(LCD_BL) | \ | ||
110 | LCD_DATA_MASK | ||
111 | |||
112 | #define VAL_GPIO1DATA 0x00000000 | ||
113 | |||
114 | |||
115 | #if !defined(_FROM_ASM_) | ||
116 | #ifdef __cplusplus | ||
117 | extern "C" { | ||
118 | #endif | ||
119 | void boardInit(void); | ||
120 | #ifdef __cplusplus | ||
121 | } | ||
122 | #endif | ||
123 | #endif | ||
124 | |||
125 | #endif | ||
diff --git a/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.mk b/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.mk new file mode 100644 index 000000000..33e91044b --- /dev/null +++ b/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/NGX_BB_LPC11U14/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/NGX_BB_LPC11U14 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||