ISSDK  1.7
IoT Sensing Software Development Kit
frdm_k64f.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_k64f.c
37  * @brief The frdm_k64f.c file defines GPIO pins and I2C CMSIS utilities for FRDM-K64F board.
38  */
39 
40 #include "frdm_k64f.h"
41 
42 // I2C0 Pin Handles
44  .portBase = PORTE,
45  .pinNumber = 24,
46  .mask = 1 << (24),
47  .irq = PORTE_IRQn,
48  .clockName = kCLOCK_PortE,
49  .portNumber = PORTE_NUM};
51  .portBase = PORTE,
52  .pinNumber = 25,
53  .mask = 1 << (25),
54  .irq = PORTE_IRQn,
55  .clockName = kCLOCK_PortE,
56  .portNumber = PORTE_NUM};
57 
58 // I2C1 Handle
59 gpioHandleKSDK_t A5 = {.base = GPIOC,
60  .portBase = PORTC,
61  .pinNumber = 10,
62  .mask = 1 << (10),
63  .irq = PORTC_IRQn,
64  .clockName = kCLOCK_PortC,
65  .portNumber = PORTC_NUM};
66 gpioHandleKSDK_t A4 = {.base = GPIOC,
67  .portBase = PORTC,
68  .pinNumber = 11,
69  .mask = 1 << (11),
70  .irq = PORTC_IRQn,
71  .clockName = kCLOCK_PortC,
72  .portNumber = PORTC_NUM};
73 
74 // SPI0 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 // UART3 Handle
98 gpioHandleKSDK_t D0 = {.base = GPIOC,
99  .portBase = PORTC,
100  .pinNumber = 16,
101  .mask = 1 << (16),
102  .irq = PORTC_IRQn,
103  .clockName = kCLOCK_PortC,
104  .portNumber = PORTC_NUM};
106  .portBase = PORTC,
107  .pinNumber = 17,
108  .mask = 1 << (17),
109  .irq = PORTC_IRQn,
110  .clockName = kCLOCK_PortC,
111  .portNumber = PORTC_NUM};
112 
113 // FRDM-K64F Arduino Connector Pin Defintion
115  .portBase = PORTB,
116  .pinNumber = 2,
117  .mask = 1 << (2),
118  .irq = PORTB_IRQn,
119  .clockName = kCLOCK_PortB,
120  .portNumber = PORTB_NUM};
122  .portBase = PORTB,
123  .pinNumber = 3,
124  .mask = 1 << (3),
125  .irq = PORTB_IRQn,
126  .clockName = kCLOCK_PortB,
127  .portNumber = PORTB_NUM};
129  .portBase = PORTB,
130  .pinNumber = 10,
131  .mask = 1 << (10),
132  .irq = PORTB_IRQn,
133  .clockName = kCLOCK_PortB,
134  .portNumber = PORTB_NUM};
136  .portBase = PORTB,
137  .pinNumber = 11,
138  .mask = 1 << (11),
139  .irq = PORTB_IRQn,
140  .clockName = kCLOCK_PortB,
141  .portNumber = PORTB_NUM};
143  .portBase = PORTB,
144  .pinNumber = 9,
145  .mask = 1 << (9),
146  .irq = PORTB_IRQn,
147  .clockName = kCLOCK_PortB,
148  .portNumber = PORTB_NUM};
150  .portBase = PORTA,
151  .pinNumber = 1,
152  .mask = 1 << (1),
153  .irq = PORTA_IRQn,
154  .clockName = kCLOCK_PortA,
155  .portNumber = PORTA_NUM};
157  .portBase = PORTB,
158  .pinNumber = 23,
159  .mask = 1 << (23),
160  .irq = PORTB_IRQn,
161  .clockName = kCLOCK_PortB,
162  .portNumber = PORTB_NUM};
164  .portBase = PORTA,
165  .pinNumber = 2,
166  .mask = 1 << (2),
167  .irq = PORTA_IRQn,
168  .clockName = kCLOCK_PortA,
169  .portNumber = PORTA_NUM};
171  .portBase = PORTC,
172  .pinNumber = 2,
173  .mask = 1 << (2),
174  .irq = PORTC_IRQn,
175  .clockName = kCLOCK_PortC,
176  .portNumber = PORTC_NUM};
178  .portBase = PORTC,
179  .pinNumber = 3,
180  .mask = 1 << (3),
181  .irq = PORTC_IRQn,
182  .clockName = kCLOCK_PortC,
183  .portNumber = PORTC_NUM};
185  .portBase = PORTA,
186  .pinNumber = 0,
187  .mask = 1 << (0),
188  .irq = PORTA_IRQn,
189  .clockName = kCLOCK_PortA,
190  .portNumber = PORTA_NUM};
192  .portBase = PORTC,
193  .pinNumber = 4,
194  .mask = 1 << (4),
195  .irq = PORTC_IRQn,
196  .clockName = kCLOCK_PortC,
197  .portNumber = PORTC_NUM};
199  .portBase = PORTD,
200  .pinNumber = 0,
201  .mask = 1 << (0),
202  .irq = PORTD_IRQn,
203  .clockName = kCLOCK_PortD,
204  .portNumber = PORTD_NUM};
205 
206 // FRDM-K64F Internal Peripheral Pin Definitions
208  .portBase = PORTB,
209  .pinNumber = 22,
210  .mask = 1 << (22),
211  .irq = PORTB_IRQn,
212  .clockName = kCLOCK_PortB,
213  .portNumber = PORTB_NUM};
215  .portBase = PORTE,
216  .pinNumber = 26,
217  .mask = 1 << (26),
218  .irq = PORTE_IRQn,
219  .clockName = kCLOCK_PortE,
220  .portNumber = PORTE_NUM};
222  .portBase = PORTB,
223  .pinNumber = 21,
224  .mask = 1 << (21),
225  .irq = PORTB_IRQn,
226  .clockName = kCLOCK_PortB,
227  .portNumber = PORTB_NUM};
228 
229 // FRDM-K64F I2C Inertial Sensor Pin Definitions
231  .portBase = PORTC,
232  .pinNumber = 6,
233  .mask = 1 << (6),
234  .irq = PORTC_IRQn,
235  .clockName = kCLOCK_PortC,
236  .portNumber = PORTC_NUM};
238  .portBase = PORTC,
239  .pinNumber = 13,
240  .mask = 1 << (13),
241  .irq = PORTC_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 UART0_GetFreq(void)
253 {
254  return CLOCK_GetFreq(UART0_CLK_SRC);
255 }
256 
257 /*! @brief Determines the Clock Frequency feature.
258  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
259  * @param[in] void
260  * @Constraints None
261  * @Reentrant Yes
262  * @return uint32_t Returns the clock frequency .
263  */
264 uint32_t UART1_GetFreq(void)
265 {
266  return CLOCK_GetFreq(UART1_CLK_SRC);
267 }
268 
269 /*! @brief Determines the Clock Frequency feature.
270  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
271  * @param[in] void
272  * @Constraints None
273  * @Reentrant Yes
274  * @return uint32_t Returns the clock frequency .
275  */
276 uint32_t UART2_GetFreq(void)
277 {
278  return CLOCK_GetFreq(UART2_CLK_SRC);
279 }
280 
281 /*! @brief Determines the Clock Frequency feature.
282  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
283  * @param[in] void
284  * @Constraints None
285  * @Reentrant Yes
286  * @return uint32_t Returns the clock frequency .
287  */
288 uint32_t UART3_GetFreq(void)
289 {
290  return CLOCK_GetFreq(UART3_CLK_SRC);
291 }
292 
293 /*! @brief Determines the Clock Frequency feature.
294  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
295  * @param[in] void
296  * @Constraints None
297  * @Reentrant Yes
298  * @return uint32_t Returns the clock frequency .
299  */
300 uint32_t UART4_GetFreq(void)
301 {
302  return CLOCK_GetFreq(UART4_CLK_SRC);
303 }
304 
305 /*! @brief Determines the Clock Frequency feature.
306  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
307  * @param[in] void
308  * @Constraints None
309  * @Reentrant Yes
310  * @return uint32_t Returns the clock frequency .
311  */
312 uint32_t UART5_GetFreq(void)
313 {
314  return CLOCK_GetFreq(UART5_CLK_SRC);
315 }
316 
317 /*! @brief Determines the Clock Frequency feature.
318  * @details The Clock Frequecny computation API required by fsl_i2c_cmsis.c.
319  * @param[in] void
320  * @Constraints None
321  * @Reentrant Yes
322  * @return uint32_t Returns the clock frequency .
323  */
324 uint32_t I2C0_GetFreq(void)
325 {
326  return CLOCK_GetFreq(I2C0_CLK_SRC);
327 }
328 
329 /*! @brief Determines the Clock Frequency feature.
330  * @details The Clock Frequecny computation API required by fsl_i2c_cmsis.c.
331  * @param[in] void
332  * @Constraints None
333  * @Reentrant Yes
334  * @return uint32_t Returns the clock frequency .
335  */
336 uint32_t I2C1_GetFreq(void)
337 {
338  return CLOCK_GetFreq(I2C1_CLK_SRC);
339 }
340 
341 /*! @brief Determines the Clock Frequency feature.
342  * @details The Clock Frequecny computation API required by fsl_i2c_cmsis.c.
343  * @param[in] void
344  * @Constraints None
345  * @Reentrant Yes
346  * @return uint32_t Returns the clock frequency .
347  */
348 uint32_t I2C2_GetFreq(void)
349 {
350  return CLOCK_GetFreq(I2C2_CLK_SRC);
351 }
352 
353 /*! @brief Determines the Clock Frequency feature.
354  * @details The Clock Frequecny computation API required by fsl_spi_cmsis.c.
355  * @param[in] void
356  * @Constraints None
357  * @Reentrant Yes
358  * @return uint32_t Returns the clock frequency .
359  */
360 uint32_t DSPI0_GetFreq(void)
361 {
362  return CLOCK_GetBusClkFreq();
363 }
364 
365 /*! @brief Determines the Clock Frequency feature.
366  * @details The Clock Frequecny computation API required by fsl_spi_cmsis.c.
367  * @param[in] void
368  * @Constraints None
369  * @Reentrant Yes
370  * @return uint32_t Returns the clock frequency .
371  */
372 uint32_t DSPI1_GetFreq(void)
373 {
374  return CLOCK_GetBusClkFreq();
375 }
376 
377 /*! @brief Determines the Clock Frequency feature.
378  * @details The Clock Frequecny computation API required by fsl_spi_cmsis.c.
379  * @param[in] void
380  * @Constraints None
381  * @Reentrant Yes
382  * @return uint32_t Returns the clock frequency .
383  */
384 uint32_t DSPI2_GetFreq(void)
385 {
386  return CLOCK_GetBusClkFreq();
387 }
uint32_t DSPI0_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_k64f.c:360
gpioHandleKSDK_t D14
Definition: frdm_k64f.c:50
uint32_t UART5_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_k64f.c:312
gpioHandleKSDK_t INT1
Definition: frdm_k64f.c:230
gpioHandleKSDK_t D1
Definition: frdm_k64f.c:105
The GPIO pin handle for KSDK.
Definition: gpio_driver.h:75
gpioHandleKSDK_t D13
Definition: frdm_k64f.c:75
gpioHandleKSDK_t BLUE_LED
Definition: frdm_k64f.c:221
uint32_t DSPI1_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_k64f.c:372
uint32_t DSPI2_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_k64f.c:384
gpioHandleKSDK_t D15
Definition: frdm_k64f.c:43
gpioHandleKSDK_t D11
Definition: frdm_k64f.c:82
uint32_t I2C2_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_k64f.c:348
gpioHandleKSDK_t D10
Definition: frdm_k64f.c:198
uint32_t UART2_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_k64f.c:276
uint32_t UART3_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_k64f.c:288
uint32_t UART1_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_k64f.c:264
gpioHandleKSDK_t D8
Definition: frdm_k64f.c:184
gpioHandleKSDK_t A5
Definition: frdm_k64f.c:59
uint32_t I2C0_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_k64f.c:324
gpioHandleKSDK_t D0
Definition: frdm_k64f.c:98
gpioHandleKSDK_t A4
Definition: frdm_k64f.c:66
gpioHandleKSDK_t D6
Definition: frdm_k64f.c:170
gpioHandleKSDK_t GREEN_LED
Definition: frdm_k64f.c:214
gpioHandleKSDK_t D12
Definition: frdm_k64f.c:89
gpioHandleKSDK_t D9
Definition: frdm_k64f.c:191
gpioHandleKSDK_t A1
Definition: frdm_k64f.c:121
gpioHandleKSDK_t A0
Definition: frdm_k64f.c:114
gpioHandleKSDK_t D2
Definition: frdm_k64f.c:142
gpioHandleKSDK_t A3
Definition: frdm_k64f.c:135
uint32_t I2C1_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_k64f.c:336
gpioHandleKSDK_t A2
Definition: frdm_k64f.c:128
gpioHandleKSDK_t RED_LED
Definition: frdm_k64f.c:207
gpioHandleKSDK_t D5
Definition: frdm_k64f.c:163
uint32_t UART0_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_k64f.c:252
GPIO_Type * base
Definition: gpio_driver.h:77
gpioHandleKSDK_t INT2
Definition: frdm_k64f.c:237
The frdm_k64f.h file defines GPIO pin mappings for FRDM-K64F board.
uint32_t UART4_GetFreq(void)
Determines the Clock Frequency feature.
Definition: frdm_k64f.c:300
gpioHandleKSDK_t D7
Definition: frdm_k64f.c:177
gpioHandleKSDK_t D4
Definition: frdm_k64f.c:156
gpioHandleKSDK_t D3
Definition: frdm_k64f.c:149