ISSDK  1.7
IoT Sensing Software Development Kit
frdm_kl25z.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_kl25z.c
37  * @brief The frdm_kl25z.c file defines GPIO pins for FRDM-KL25Z board
38  */
39 
40 #include "frdm_kl25z.h"
41 
42 // I2C0 Pin Handles
44  .portBase = PORTE,
45  .pinNumber = 1,
46  .mask = 1 << (1),
47  .irq = NotAvail_IRQn,
48  .clockName = kCLOCK_PortE,
49  .portNumber = PORTE_NUM};
51  .portBase = PORTE,
52  .pinNumber = 0,
53  .mask = 1 << (0),
54  .irq = NotAvail_IRQn,
55  .clockName = kCLOCK_PortE,
56  .portNumber = PORTE_NUM};
57 
58 // I2C1 Handle
59 gpioHandleKSDK_t A5 = {.base = GPIOC,
60  .portBase = PORTC,
61  .pinNumber = 1,
62  .mask = 1 << (1),
63  .irq = NotAvail_IRQn,
64  .clockName = kCLOCK_PortC,
65  .portNumber = PORTC_NUM};
66 gpioHandleKSDK_t A4 = {.base = GPIOC,
67  .portBase = PORTC,
68  .pinNumber = 2,
69  .mask = 1 << (2),
70  .irq = NotAvail_IRQn,
71  .clockName = kCLOCK_PortC,
72  .portNumber = PORTC_NUM};
73 
74 // SPI1 Handle
76  .portBase = PORTD,
77  .pinNumber = 1,
78  .mask = 1 << (1),
79  .irq = PORTD_IRQn,
80  .clockName = kCLOCK_PortD,
81  .portNumber = PORTD_NUM};
83  .portBase = PORTD,
84  .pinNumber = 2,
85  .mask = 1 << (2),
86  .irq = PORTD_IRQn,
87  .clockName = kCLOCK_PortD,
88  .portNumber = PORTD_NUM};
90  .portBase = PORTD,
91  .pinNumber = 3,
92  .mask = 1 << (3),
93  .irq = PORTD_IRQn,
94  .clockName = kCLOCK_PortD,
95  .portNumber = PORTD_NUM};
96 
97 // UART2 Handle
98 gpioHandleKSDK_t D0 = {.base = GPIOA,
99  .portBase = PORTA,
100  .pinNumber = 2,
101  .mask = 1 << (2),
102  .irq = PORTA_IRQn,
103  .clockName = kCLOCK_PortA,
104  .portNumber = PORTA_NUM};
106  .portBase = PORTA,
107  .pinNumber = 1,
108  .mask = 1 << (1),
109  .irq = PORTA_IRQn,
110  .clockName = kCLOCK_PortA,
111  .portNumber = PORTA_NUM};
112 
113 // FRDM-KL25Z Arduino Connector Pin Defintion
115  .portBase = PORTB,
116  .pinNumber = 1,
117  .mask = 1 << (1),
118  .irq = NotAvail_IRQn,
119  .clockName = kCLOCK_PortB,
120  .portNumber = PORTB_NUM};
122  .portBase = PORTB,
123  .pinNumber = 2,
124  .mask = 1 << (2),
125  .irq = NotAvail_IRQn,
126  .clockName = kCLOCK_PortB,
127  .portNumber = PORTB_NUM};
129  .portBase = PORTB,
130  .pinNumber = 3,
131  .mask = 1 << (3),
132  .irq = NotAvail_IRQn,
133  .clockName = kCLOCK_PortB,
134  .portNumber = PORTB_NUM};
136  .portBase = PORTD,
137  .pinNumber = 4,
138  .mask = 1 << (4),
139  .irq = PORTD_IRQn,
140  .clockName = kCLOCK_PortD,
141  .portNumber = PORTD_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 = PORTA,
151  .pinNumber = 4,
152  .mask = 1 << (4),
153  .irq = PORTA_IRQn,
154  .clockName = kCLOCK_PortA,
155  .portNumber = PORTA_NUM};
157  .portBase = PORTA,
158  .pinNumber = 5,
159  .mask = 1 << (5),
160  .irq = PORTA_IRQn,
161  .clockName = kCLOCK_PortA,
162  .portNumber = PORTA_NUM};
164  .portBase = PORTC,
165  .pinNumber = 8,
166  .mask = 1 << (8),
167  .irq = NotAvail_IRQn,
168  .clockName = kCLOCK_PortC,
169  .portNumber = PORTC_NUM};
171  .portBase = PORTC,
172  .pinNumber = 9,
173  .mask = 1 << (9),
174  .irq = NotAvail_IRQn,
175  .clockName = kCLOCK_PortC,
176  .portNumber = PORTC_NUM};
178  .portBase = PORTA,
179  .pinNumber = 13,
180  .mask = 1 << (13),
181  .irq = PORTA_IRQn,
182  .clockName = kCLOCK_PortA,
183  .portNumber = PORTA_NUM};
185  .portBase = PORTD,
186  .pinNumber = 5,
187  .mask = 1 << (5),
188  .irq = PORTD_IRQn,
189  .clockName = kCLOCK_PortD,
190  .portNumber = PORTD_NUM};
192  .portBase = PORTD,
193  .pinNumber = 0,
194  .mask = 1 << (0),
195  .irq = PORTD_IRQn,
196  .clockName = kCLOCK_PortD,
197  .portNumber = PORTD_NUM};
198 
199 // FRDM-KL25Z Internal Peripheral Pin Definitions
201  .portBase = PORTB,
202  .pinNumber = 18,
203  .mask = 1 << (18),
204  .irq = NotAvail_IRQn,
205  .clockName = kCLOCK_PortB,
206  .portNumber = PORTB_NUM};
208  .portBase = PORTB,
209  .pinNumber = 19,
210  .mask = 1 << (19),
211  .irq = NotAvail_IRQn,
212  .clockName = kCLOCK_PortB,
213  .portNumber = PORTB_NUM};
215  .portBase = PORTD,
216  .pinNumber = 1,
217  .mask = 1 << (1),
218  .irq = PORTD_IRQn,
219  .clockName = kCLOCK_PortD,
220  .portNumber = PORTD_NUM};
221 
222 // FRDM-KL25Z I2C Inertial Sensor Pin Definitions
224  .portBase = PORTE,
225  .pinNumber = 24,
226  .mask = 1 << (24),
227  .irq = NotAvail_IRQn,
228  .clockName = kCLOCK_PortE,
229  .portNumber = PORTE_NUM};
231  .portBase = PORTE,
232  .pinNumber = 25,
233  .mask = 1 << (25),
234  .irq = NotAvail_IRQn,
235  .clockName = kCLOCK_PortE,
236  .portNumber = PORTE_NUM};
237 
239  .portBase = PORTA,
240  .pinNumber = 14,
241  .mask = 1 << (14),
242  .irq = PORTA_IRQn,
243  .clockName = kCLOCK_PortA,
244  .portNumber = PORTA_NUM};
246  .portBase = PORTA,
247  .pinNumber = 15,
248  .mask = 1 << (15),
249  .irq = PORTA_IRQn,
250  .clockName = kCLOCK_PortA,
251  .portNumber = PORTA_NUM};
252 
253 /*! @brief Determines the Clock Frequency feature.
254  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
255  * @param[in] void
256  * @Constraints None
257  * @Reentrant Yes
258  * @return uint32_t Returns the clock frequency .
259  */
260 uint32_t UART0_GetFreq(void)
261 {
262  CLOCK_SetLpsci0Clock(1);
263  return CLOCK_GetFreq(kCLOCK_CoreSysClk);
264 }
265 
266 /*! @brief Determines the Clock Frequency feature.
267  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
268  * @param[in] void
269  * @Constraints None
270  * @Reentrant Yes
271  * @return uint32_t Returns the clock frequency .
272  */
273 uint32_t UART1_GetFreq(void)
274 {
275  return CLOCK_GetFreq(UART1_CLK_SRC);
276 }
277 
278 /*! @brief Determines the Clock Frequency feature.
279  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
280  * @param[in] void
281  * @Constraints None
282  * @Reentrant Yes
283  * @return uint32_t Returns the clock frequency .
284  */
285 uint32_t UART2_GetFreq(void)
286 {
287  return CLOCK_GetFreq(UART2_CLK_SRC);
288 }
289 
290 /*! @brief Determines the Clock Frequency feature.
291  * @details The Clock Frequecny computation API required by fsl_i2c_cmsis.c.
292  * @param[in] void
293  * @Constraints None
294  * @Reentrant Yes
295  * @return uint32_t Returns the clock frequency .
296  */
297 uint32_t I2C0_GetFreq(void)
298 {
299  return CLOCK_GetFreq(I2C0_CLK_SRC);
300 }
301 
302 /*! @brief Determines the Clock Frequency feature.
303  * @details The Clock Frequecny computation API required by fsl_i2c_cmsis.c.
304  * @param[in] void
305  * @Constraints None
306  * @Reentrant Yes
307  * @return uint32_t Returns the clock frequency .
308  */
309 uint32_t I2C1_GetFreq(void)
310 {
311  return CLOCK_GetFreq(I2C1_CLK_SRC);
312 }
313 
314 /*! @brief Determines the Clock Frequency feature.
315  * @details The Clock Frequecny computation API required by fsl_spi_cmsis.c.
316  * @param[in] void
317  * @Constraints None
318  * @Reentrant Yes
319  * @return uint32_t Returns the clock frequency .
320  */
321 uint32_t SPI0_GetFreq(void)
322 {
323  return CLOCK_GetBusClkFreq();
324 }
325 
326 /*! @brief Determines the Clock Frequency feature.
327  * @details The Clock Frequecny computation API required by fsl_spi_cmsis.c.
328  * @param[in] void
329  * @Constraints None
330  * @Reentrant Yes
331  * @return uint32_t Returns the clock frequency .
332  */
333 uint32_t SPI1_GetFreq(void)
334 {
335  return CLOCK_GetBusClkFreq();
336 }
gpioHandleKSDK_t D3
Definition: frdm_kl25z.c:142
gpioHandleKSDK_t INT2
Definition: frdm_kl25z.c:245
gpioHandleKSDK_t D11
Definition: frdm_kl25z.c:82
gpioHandleKSDK_t A3
Definition: frdm_kl25z.c:128
gpioHandleKSDK_t D10
Definition: frdm_kl25z.c:191
The GPIO pin handle for KSDK.
Definition: gpio_driver.h:75
gpioHandleKSDK_t D1
Definition: frdm_kl25z.c:105
uint32_t I2C1_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl25z.c:309
gpioHandleKSDK_t D13
Definition: frdm_kl25z.c:75
gpioHandleKSDK_t BLUE_LED
Definition: frdm_kl25z.c:214
gpioHandleKSDK_t GREEN_LED
Definition: frdm_kl25z.c:207
uint32_t SPI0_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl25z.c:321
uint32_t UART1_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl25z.c:273
uint32_t UART0_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl25z.c:260
gpioHandleKSDK_t D5
Definition: frdm_kl25z.c:156
gpioHandleKSDK_t D15
Definition: frdm_kl25z.c:43
gpioHandleKSDK_t D9
Definition: frdm_kl25z.c:184
gpioHandleKSDK_t D14
Definition: frdm_kl25z.c:50
gpioHandleKSDK_t D4
Definition: frdm_kl25z.c:149
gpioHandleKSDK_t RED_LED
Definition: frdm_kl25z.c:200
gpioHandleKSDK_t INT1
Definition: frdm_kl25z.c:238
gpioHandleKSDK_t D6
Definition: frdm_kl25z.c:163
gpioHandleKSDK_t ACCEL_SCL
Definition: frdm_kl25z.c:223
uint32_t I2C0_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl25z.c:297
gpioHandleKSDK_t D0
Definition: frdm_kl25z.c:98
gpioHandleKSDK_t D12
Definition: frdm_kl25z.c:89
uint32_t UART2_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl25z.c:285
uint32_t SPI1_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_kl25z.c:333
gpioHandleKSDK_t D7
Definition: frdm_kl25z.c:170
gpioHandleKSDK_t ACCEL_SDA
Definition: frdm_kl25z.c:230
gpioHandleKSDK_t A2
Definition: frdm_kl25z.c:121
gpioHandleKSDK_t A5
Definition: frdm_kl25z.c:59
gpioHandleKSDK_t D2
Definition: frdm_kl25z.c:135
gpioHandleKSDK_t A4
Definition: frdm_kl25z.c:66
The frdm_kl25z.h file defines GPIO pin mappings for FRDM-KL25Z board.
GPIO_Type * base
Definition: gpio_driver.h:77
gpioHandleKSDK_t D8
Definition: frdm_kl25z.c:177
gpioHandleKSDK_t A1
Definition: frdm_kl25z.c:114