1 /*
2  * Copyright (c) 2016, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 /**
10  * @file frdm_k32w042.h
11  * @brief The frdm_k32w042.h file defines GPIO pin mappings for FRDM-K64F board
12 */
13 
14 #ifndef FRDM_K32W042_H_
15 #define FRDM_K32W042_H_
16 
17 #include "pin_mux.h"
18 #include "fsl_msmc.h"
19 #include "RTE_Device.h"
20 #include "gpio_driver.h"
21 #include "K32W042S1M2_cm4.h"
22 
23 // I2C0 Pin Handles
24 extern gpioHandleKSDK_t D15;
25 extern gpioHandleKSDK_t D14;
26 
27 // I2C3 Handle
28 extern gpioHandleKSDK_t A5;
29 extern gpioHandleKSDK_t A4;
30 
31 // SPI0 Handle
32 extern gpioHandleKSDK_t D13;
33 extern gpioHandleKSDK_t D11;
34 extern gpioHandleKSDK_t D12;
35 
36 // UART1 Handle
37 extern gpioHandleKSDK_t D0;
38 extern gpioHandleKSDK_t D1;
39 
40 // K3S Arduino Connector Pin Defintion
41 extern gpioHandleKSDK_t A0;
42 extern gpioHandleKSDK_t A1;
43 extern gpioHandleKSDK_t A2;
44 extern gpioHandleKSDK_t A3;
45 extern gpioHandleKSDK_t D2;
46 extern gpioHandleKSDK_t D3;
47 extern gpioHandleKSDK_t D4;
48 extern gpioHandleKSDK_t D5;
49 extern gpioHandleKSDK_t D6;
50 extern gpioHandleKSDK_t D6;
51 extern gpioHandleKSDK_t D8;
52 extern gpioHandleKSDK_t D9;
53 extern gpioHandleKSDK_t D10;
54 
55 // K3S Internal Peripheral Pin Definitions
56 extern gpioHandleKSDK_t RED_LED;
57 extern gpioHandleKSDK_t GREEN_LED;
58 extern gpioHandleKSDK_t BLUE_LED;
59 extern gpioHandleKSDK_t INT1;
60 extern gpioHandleKSDK_t INT2;
61 
62 // I2C_S1: Pin mapping and driver information for default I2C brought to shield
63 #define I2C_S1_SCL_PIN D15
64 #define I2C_S1_SDA_PIN D14
65 #define I2C_S1_DRIVER Driver_I2C0
66 #define I2C_S1_DEVICE_INDEX I2C0_INDEX
67 #define I2C_S1_SIGNAL_EVENT I2C0_SignalEvent_t
68 
69 // I2C_S2: Pin mapping and driver information for other I2C brought to shield
70 #define I2C_S2_SCL_PIN A5
71 #define I2C_S2_SDA_PIN A4
72 #define I2C_S2_DRIVER Driver_I2C3
73 #define I2C_S2_DEVICE_INDEX I2C3_INDEX
74 #define I2C_S2_SIGNAL_EVENT I2C3_SignalEvent_t
75 
76 // I2C_B: Pin mapping and driver information for I2C routed on base board
77 #define I2C_BB_SCL_PIN A5
78 #define I2C_BB_SDA_PIN A4
79 #define I2C_BB_DRIVER Driver_I2C3
80 #define I2C_BB_DEVICE_INDEX I2C3_INDEX
81 #define I2C_BB_SIGNAL_EVENT I2C3_SignalEvent_t
82 
83 // SPIS: Pin mapping and driver information default SPI brought to shield
84 #define SPI_S_SCLK D13
85 #define SPI_S_MISO D12
86 #define SPI_S_MOSI D11
87 #define SPI_S_DRIVER Driver_SPI0
88 #define SPI_S_BAUDRATE 500000U ///< Transfer baudrate - 500k
89 #define SPI_S_DEVICE_INDEX SPI0_INDEX
90 #define SPI_S_SIGNAL_EVENT SPI0_SignalEvent_t
91 
92 // UART: Driver information for default UART to communicate with HOST PC.
93 #define HOST_S_DRIVER Driver_USART0
94 #define HOST_S_SIGNAL_EVENT HOST_SignalEvent_t
95 
96 // Bluetooth: Driver information for default UART to communicate with HOST PC.
97 #define HOST_B_DRIVER Driver_USART1
98 #define HOST_B_SIGNAL_EVENT HOST_SignalEvent_t
99 
100 // On-Board FXOS8700 Sensor Information
101 #define FXOS8700_BB_I2C_ADDR 0x1E
102 #define FXOS8700_BB_INT1 INT1
103 #define FXOS8700_BB_INT2 INT2
104 
105 /* @brief  Ask use input to resume after specified samples have been processed. */
106 #define ASK_USER_TO_RESUME(x)                                                          \
107     static volatile bool askResume = true;                                             \
108     static uint16_t samplesToProcess = x - 1;                                          \
109     if (askResume && !samplesToProcess--)                                              \
110     {                                                                                  \
111         PRINTF("\r\n Specified samples processed, press any key to continue... \r\n"); \
112         GETCHAR();                                                                     \
113         askResume = false;                                                             \
114     }
115 
116 // Miscellaneous Hardware Configuration Parameters
117 #define ADS_NVM_ADDR 0x000BF000 ///< start of the next to last 4K (sector size) of the 768K flash
118 #define FLASH_SECTOR_SIZE_PROPERTY kFLASH_PropertyPflashSectorSize
119 
120 /* Compatability definitions for K32W042 */
121 #define SMC SMC0
122 #define I2C0 LPI2C0
123 #define I2C3 LPI2C3
124 #define I2C_Type LPI2C_Type
125 #define I2C_BASE_PTRS LPI2C_BASE_PTRS
126 #define SPI0 LPSPI0
127 #define SPI_Type LPSPI_Type
128 #define SPI_BASE_PTRS LPSPI_BASE_PTRS
129 
130 #endif /* FRDM_K32W042_H_ */
131