ISSDK  1.7
IoT Sensing Software Development Kit
frdm_kl27z.c
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2016, Freescale Semiconductor, Inc.
4  * Copyright 2016-2017 NXP
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,
8  * are permitted (subject to the limitations in the disclaimer below) provided
9  * that the following conditions are met:
10  *
11  * o Redistributions of source code must retain the above copyright notice, this list
12  * of conditions and the following disclaimer.
13  *
14  * o Redistributions in binary form must reproduce the above copyright notice, this
15  * list of conditions and the following disclaimer in the documentation and/or
16  * other materials provided with the distribution.
17  *
18  * o Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 /**
36  * @file frdm_kl27z.c
37  * @brief The frdm_kl27z.c file defines GPIO pins for FRDM-KL27Z board
38  */
39 
40 #include "frdm_kl27z.h"
41 
42 // I2C1 Pin Handles
44  .portBase = PORTD,
45  .pinNumber = 7,
46  .mask = 1 << (7),
47  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
48  .clockName = kCLOCK_PortD,
49  .portNumber = PORTD_NUM};
51  .portBase = PORTD,
52  .pinNumber = 6,
53  .mask = 1 << (6),
54  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
55  .clockName = kCLOCK_PortD,
56  .portNumber = PORTD_NUM};
57 
58 // I2C0 Handle
59 gpioHandleKSDK_t A5 = {.base = GPIOB,
60  .portBase = PORTB,
61  .pinNumber = 0,
62  .mask = 1 << (0),
63  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
64  .clockName = kCLOCK_PortB,
65  .portNumber = PORTB_NUM};
66 gpioHandleKSDK_t A4 = {.base = GPIOB,
67  .portBase = PORTB,
68  .pinNumber = 1,
69  .mask = 1 << (1),
70  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
71  .clockName = kCLOCK_PortB,
72  .portNumber = PORTB_NUM};
73 
74 // SPI1 Handle
76  .portBase = PORTC,
77  .pinNumber = 5,
78  .mask = 1 << (5),
79  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
80  .clockName = kCLOCK_PortC,
81  .portNumber = PORTC_NUM};
83  .portBase = PORTC,
84  .pinNumber = 6,
85  .mask = 1 << (6),
86  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
87  .clockName = kCLOCK_PortC,
88  .portNumber = PORTC_NUM};
90  .portBase = PORTC,
91  .pinNumber = 7,
92  .mask = 1 << (7),
93  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
94  .clockName = kCLOCK_PortC,
95  .portNumber = PORTC_NUM};
96 
97 // LPUART0 Handle
98 gpioHandleKSDK_t D0 = {.base = GPIOA,
99  .portBase = PORTA,
100  .pinNumber = 1,
101  .mask = 1 << (1),
102  .irq = PORTA_IRQn,
103  .clockName = kCLOCK_PortA,
104  .portNumber = PORTA_NUM};
106  .portBase = PORTA,
107  .pinNumber = 2,
108  .mask = 1 << (2),
109  .irq = PORTA_IRQn,
110  .clockName = kCLOCK_PortA,
111  .portNumber = PORTA_NUM};
112 
113 // FRDM-KL27Z Arduino Connector Pin Defintion
115  .portBase = PORTE,
116  .pinNumber = 16,
117  .mask = 1 << (16),
118  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
119  .clockName = kCLOCK_PortE,
120  .portNumber = PORTE_NUM};
122  .portBase = PORTC,
123  .pinNumber = 0,
124  .mask = 1 << (0),
125  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
126  .clockName = kCLOCK_PortC,
127  .portNumber = PORTC_NUM};
129  .portBase = PORTE,
130  .pinNumber = 20,
131  .mask = 1 << (20),
132  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
133  .clockName = kCLOCK_PortE,
134  .portNumber = PORTE_NUM};
136  .portBase = PORTE,
137  .pinNumber = 21,
138  .mask = 1 << (21),
139  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
140  .clockName = kCLOCK_PortE,
141  .portNumber = PORTE_NUM};
143  .portBase = PORTA,
144  .pinNumber = 12,
145  .mask = 1 << (12),
146  .irq = PORTA_IRQn,
147  .clockName = kCLOCK_PortA,
148  .portNumber = PORTA_NUM};
150  .portBase = PORTE,
151  .pinNumber = 25,
152  .mask = 1 << (25),
153  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
154  .clockName = kCLOCK_PortE,
155  .portNumber = PORTE_NUM};
157  .portBase = PORTA,
158  .pinNumber = 13,
159  .mask = 1 << (13),
160  .irq = PORTA_IRQn,
161  .clockName = kCLOCK_PortA,
162  .portNumber = PORTA_NUM};
164  .portBase = PORTE,
165  .pinNumber = 24,
166  .mask = 1 << (24),
167  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
168  .clockName = kCLOCK_PortE,
169  .portNumber = PORTE_NUM};
171  .portBase = PORTC,
172  .pinNumber = 9,
173  .mask = 1 << (9),
174  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
175  .clockName = kCLOCK_PortC,
176  .portNumber = PORTC_NUM};
178  .portBase = PORTC,
179  .pinNumber = 8,
180  .mask = 1 << (8),
181  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
182  .clockName = kCLOCK_PortC,
183  .portNumber = PORTC_NUM};
185  .portBase = PORTE,
186  .pinNumber = 31,
187  .mask = 1 << (30),
188  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
189  .clockName = kCLOCK_PortE,
190  .portNumber = PORTE_NUM};
192  .portBase = PORTA,
193  .pinNumber = 5,
194  .mask = 1 << (5),
195  .irq = PORTA_IRQn,
196  .clockName = kCLOCK_PortA,
197  .portNumber = PORTA_NUM};
199  .portBase = PORTC,
200  .pinNumber = 4,
201  .mask = 1 << (4),
202  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
203  .clockName = kCLOCK_PortC,
204  .portNumber = PORTC_NUM};
205 
206 // FRDM-KL27Z Internal Peripheral Pin Definitions
208  .portBase = PORTB,
209  .pinNumber = 18,
210  .mask = 1 << (18),
211  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
212  .clockName = kCLOCK_PortB,
213  .portNumber = PORTB_NUM};
215  .portBase = PORTB,
216  .pinNumber = 19,
217  .mask = 1 << (19),
218  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
219  .clockName = kCLOCK_PortB,
220  .portNumber = PORTB_NUM};
222  .portBase = PORTA,
223  .pinNumber = 13,
224  .mask = 1 << (13),
225  .irq = PORTA_IRQn,
226  .clockName = kCLOCK_PortA,
227  .portNumber = PORTA_NUM};
228 
229 // FRDM-KL27Z I2C Inertial Sensor Pin Definitions
231  .portBase = PORTC,
232  .pinNumber = 3,
233  .mask = 1 << (3),
234  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
235  .clockName = kCLOCK_PortC,
236  .portNumber = PORTC_NUM};
238  .portBase = PORTC,
239  .pinNumber = 2,
240  .mask = 1 << (2),
241  .irq = PORTB_PORTC_PORTD_PORTE_IRQn,
242  .clockName = kCLOCK_PortC,
243  .portNumber = PORTC_NUM};
244 
245 /*! @brief Determines the Clock Frequency feature.
246  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
247  * @param[in] void
248  * @Constraints None
249  * @Reentrant Yes
250  * @return uint32_t Returns the clock frequency .
251  */
252 uint32_t LPUART0_GetFreq(void)
253 {
254  CLOCK_SetLpuart0Clock(1);
255  return CLOCK_GetPeriphClkFreq();
256 }
257 
258 /*! @brief Determines the Clock Frequency feature.
259  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
260  * @param[in] void
261  * @Constraints None
262  * @Reentrant Yes
263  * @return uint32_t Returns the clock frequency .
264  */
265 uint32_t LPUART1_GetFreq(void)
266 {
267  CLOCK_SetLpuart1Clock(1);
268  return CLOCK_GetPeriphClkFreq();
269 }
270 
271 /*! @brief Determines the Clock Frequency feature.
272  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
273  * @param[in] void
274  * @Constraints None
275  * @Reentrant Yes
276  * @return uint32_t Returns the clock frequency .
277  */
278 uint32_t UART2_GetFreq(void)
279 {
280  return CLOCK_GetFreq(UART2_CLK_SRC);
281 }
282 
283 /*! @brief Determines the Clock Frequency feature.
284  * @details The Clock Frequecny computation API required by fsl_i2c_cmsis.c.
285  * @param[in] void
286  * @Constraints None
287  * @Reentrant Yes
288  * @return uint32_t Returns the clock frequency .
289  */
290 uint32_t I2C0_GetFreq(void)
291 {
292  return CLOCK_GetFreq(I2C0_CLK_SRC);
293 }
294 
295 /*! @brief Determines the Clock Frequency feature.
296  * @details The Clock Frequecny computation API required by fsl_i2c_cmsis.c.
297  * @param[in] void
298  * @Constraints None
299  * @Reentrant Yes
300  * @return uint32_t Returns the clock frequency .
301  */
302 uint32_t I2C1_GetFreq(void)
303 {
304  return CLOCK_GetFreq(I2C1_CLK_SRC);
305 }
306 
307 /*! @brief Determines the Clock Frequency feature.
308  * @details The Clock Frequecny computation API required by fsl_spi_cmsis.c.
309  * @param[in] void
310  * @Constraints None
311  * @Reentrant Yes
312  * @return uint32_t Returns the clock frequency .
313  */
314 uint32_t SPI0_GetFreq(void)
315 {
316  return CLOCK_GetBusClkFreq();
317 }
318 
319 /*! @brief Determines the Clock Frequency feature.
320  * @details The Clock Frequecny computation API required by fsl_spi_cmsis.c.
321  * @param[in] void
322  * @Constraints None
323  * @Reentrant Yes
324  * @return uint32_t Returns the clock frequency .
325  */
326 uint32_t SPI1_GetFreq(void)
327 {
328  return CLOCK_GetBusClkFreq();
329 }
gpioHandleKSDK_t D3
Definition: frdm_kl27z.c:149
gpioHandleKSDK_t INT2
Definition: frdm_kl27z.c:237
gpioHandleKSDK_t D11
Definition: frdm_kl27z.c:82
gpioHandleKSDK_t A3
Definition: frdm_kl27z.c:135
gpioHandleKSDK_t D10
Definition: frdm_kl27z.c:198
uint32_t LPUART0_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl27z.c:252
The GPIO pin handle for KSDK.
Definition: gpio_driver.h:75
gpioHandleKSDK_t D1
Definition: frdm_kl27z.c:105
uint32_t I2C1_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl27z.c:302
gpioHandleKSDK_t D13
Definition: frdm_kl27z.c:75
gpioHandleKSDK_t BLUE_LED
Definition: frdm_kl27z.c:221
gpioHandleKSDK_t GREEN_LED
Definition: frdm_kl27z.c:214
gpioHandleKSDK_t A0
Definition: frdm_kl27z.c:114
uint32_t SPI0_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl27z.c:314
gpioHandleKSDK_t D5
Definition: frdm_kl27z.c:163
gpioHandleKSDK_t D15
Definition: frdm_kl27z.c:43
gpioHandleKSDK_t D9
Definition: frdm_kl27z.c:191
gpioHandleKSDK_t D14
Definition: frdm_kl27z.c:50
gpioHandleKSDK_t D4
Definition: frdm_kl27z.c:156
gpioHandleKSDK_t RED_LED
Definition: frdm_kl27z.c:207
gpioHandleKSDK_t INT1
Definition: frdm_kl27z.c:230
gpioHandleKSDK_t D6
Definition: frdm_kl27z.c:170
uint32_t I2C0_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl27z.c:290
gpioHandleKSDK_t D0
Definition: frdm_kl27z.c:98
gpioHandleKSDK_t D12
Definition: frdm_kl27z.c:89
uint32_t UART2_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl27z.c:278
The frdm_kl27z.h file defines GPIO pins for FRDM-KL27Z board.
uint32_t SPI1_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl27z.c:326
gpioHandleKSDK_t D7
Definition: frdm_kl27z.c:177
gpioHandleKSDK_t A2
Definition: frdm_kl27z.c:128
gpioHandleKSDK_t A5
Definition: frdm_kl27z.c:59
gpioHandleKSDK_t A4
Definition: frdm_kl27z.c:66
gpioHandleKSDK_t D2
Definition: frdm_kl27z.c:142
GPIO_Type * base
Definition: gpio_driver.h:77
gpioHandleKSDK_t D8
Definition: frdm_kl27z.c:184
gpioHandleKSDK_t A1
Definition: frdm_kl27z.c:121
uint32_t LPUART1_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl27z.c:265