diff options
Diffstat (limited to 'lib/chibios-contrib/testhal/KINETIS/KL27Z/BLINK/board/board.c')
-rw-r--r-- | lib/chibios-contrib/testhal/KINETIS/KL27Z/BLINK/board/board.c | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/lib/chibios-contrib/testhal/KINETIS/KL27Z/BLINK/board/board.c b/lib/chibios-contrib/testhal/KINETIS/KL27Z/BLINK/board/board.c new file mode 100644 index 000000000..959fe85ef --- /dev/null +++ b/lib/chibios-contrib/testhal/KINETIS/KL27Z/BLINK/board/board.c | |||
@@ -0,0 +1,158 @@ | |||
1 | /* | ||
2 | ChibiOS - (C) 2015-2016 flabbergast <[email protected]> | ||
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 "ch.h" | ||
18 | #include "hal.h" | ||
19 | |||
20 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
21 | /** | ||
22 | * @brief PAL setup. | ||
23 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
24 | * This variable is used by the HAL when initializing the PAL driver. | ||
25 | */ | ||
26 | const PALConfig pal_default_config = | ||
27 | { | ||
28 | .ports = { | ||
29 | { | ||
30 | /* | ||
31 | * PORTA setup. | ||
32 | * | ||
33 | * on pads: PTA1, PTA2, PTA5, PTA18, PTA19 | ||
34 | * | ||
35 | * PTA0/3 SWD (default SWD, ALT_7: SWD, ALT_1: PTA0/3) | ||
36 | * PTA4 NMI button (default NMI_b, ALT_1: PTA4) | ||
37 | * PTA20 RESET button (default RESET, ALT_7: RESET, ALT_1: PTA20) | ||
38 | */ | ||
39 | .port = IOPORT1, | ||
40 | .pads = { | ||
41 | PAL_MODE_ALTERNATIVE_7, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, | ||
42 | PAL_MODE_ALTERNATIVE_7, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, | ||
43 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
44 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
45 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
46 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
47 | PAL_MODE_INPUT_ANALOG, PAL_MODE_INPUT_ANALOG, PAL_MODE_ALTERNATIVE_7, | ||
48 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
49 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
50 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
51 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
52 | }, | ||
53 | }, | ||
54 | { | ||
55 | /* | ||
56 | * PORTB setup. | ||
57 | * | ||
58 | * on pads: PTB0, PTB1 | ||
59 | * LED: PTB18 | ||
60 | */ | ||
61 | .port = IOPORT2, | ||
62 | .pads = { | ||
63 | PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED, | ||
64 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
65 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
66 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
67 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
68 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
69 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
70 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
71 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
72 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
73 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
74 | }, | ||
75 | }, | ||
76 | { | ||
77 | /* | ||
78 | * PORTC setup. | ||
79 | * | ||
80 | * on pads: PTC1, PTC2, PTC3, PTC6, PTC7, PTC8, PTC9 | ||
81 | */ | ||
82 | .port = IOPORT3, | ||
83 | .pads = { | ||
84 | PAL_MODE_UNCONNECTED, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, | ||
85 | PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
86 | PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, | ||
87 | PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
88 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
89 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
90 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
91 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
92 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
93 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
94 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
95 | }, | ||
96 | }, | ||
97 | { | ||
98 | /* | ||
99 | * PORTD setup. | ||
100 | * | ||
101 | * on pads: PTD0 - PTD7 | ||
102 | */ | ||
103 | .port = IOPORT4, | ||
104 | .pads = { | ||
105 | PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, | ||
106 | PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, | ||
107 | PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED, | ||
108 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
109 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
110 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
111 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
112 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
113 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
114 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
115 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
116 | }, | ||
117 | }, | ||
118 | { | ||
119 | /* | ||
120 | * PORTE setup. | ||
121 | * | ||
122 | * on pads: PTE0, PTE1, PTE24, PTE25, PTE29, PTE30 | ||
123 | */ | ||
124 | .port = IOPORT5, | ||
125 | .pads = { | ||
126 | PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED, | ||
127 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
128 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
129 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
130 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
131 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
132 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, | ||
133 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
134 | PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED, | ||
135 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_INPUT_PULLUP, | ||
136 | PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED, | ||
137 | }, | ||
138 | }, | ||
139 | }, | ||
140 | }; | ||
141 | #endif | ||
142 | |||
143 | /** | ||
144 | * @brief Early initialization code. | ||
145 | * @details This initialization must be performed just after stack setup | ||
146 | * and before any other initialization. | ||
147 | */ | ||
148 | void __early_init(void) { | ||
149 | |||
150 | kl2x_clock_init(); | ||
151 | } | ||
152 | |||
153 | /** | ||
154 | * @brief Board-specific initialization code. | ||
155 | * @todo Add your board-specific code, if any. | ||
156 | */ | ||
157 | void boardInit(void) { | ||
158 | } | ||