Skip to content

Commit eda1952

Browse files
authored
Merge pull request #9053 from NXPmicro/Add-Support-RapidIoT-KW41Z
Rapid-IoT: Add support for the KW41Z side of the platform
2 parents 42f01f3 + 3d8d65b commit eda1952

File tree

8 files changed

+754
-4
lines changed

8 files changed

+754
-4
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2018 ARM Limited
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#ifndef MBED_PERIPHERALNAMES_H
18+
#define MBED_PERIPHERALNAMES_H
19+
20+
#include "cmsis.h"
21+
22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif
25+
26+
typedef enum {
27+
OSC32KCLK = 0
28+
} RTCName;
29+
30+
typedef enum {
31+
LPUART_0 = 0
32+
} UARTName;
33+
34+
#define STDIO_UART_TX USBTX
35+
#define STDIO_UART_RX USBRX
36+
#define STDIO_UART LPUART_0
37+
38+
typedef enum {
39+
I2C_0 = 0,
40+
I2C_1 = 1,
41+
} I2CName;
42+
43+
#define TPM_SHIFT 8
44+
typedef enum {
45+
PWM_1 = (0 << TPM_SHIFT) | (0), // TPM0 CH0
46+
PWM_2 = (0 << TPM_SHIFT) | (1), // TPM0 CH1
47+
PWM_3 = (0 << TPM_SHIFT) | (2), // TPM0 CH2
48+
PWM_4 = (0 << TPM_SHIFT) | (3), // TPM0 CH3
49+
PWM_5 = (1 << TPM_SHIFT) | (0), // TPM1 CH0
50+
PWM_6 = (1 << TPM_SHIFT) | (1) // TPM1 CH1
51+
} PWMName;
52+
53+
#define ADC_INSTANCE_SHIFT 8
54+
#define ADC_B_CHANNEL_SHIFT 5
55+
typedef enum {
56+
ADC0_SE1 = (0 << ADC_INSTANCE_SHIFT) | 1,
57+
ADC0_SE2 = (0 << ADC_INSTANCE_SHIFT) | 2,
58+
ADC0_SE3 = (0 << ADC_INSTANCE_SHIFT) | 3,
59+
ADC0_SE4 = (0 << ADC_INSTANCE_SHIFT) | 4,
60+
ADC0_SE5 = (0 << ADC_INSTANCE_SHIFT) | 5,
61+
} ADCName;
62+
63+
typedef enum {
64+
DAC_0 = 0
65+
} DACName;
66+
67+
68+
typedef enum {
69+
SPI_0 = 0,
70+
SPI_1 = 1,
71+
} SPIName;
72+
73+
#ifdef __cplusplus
74+
}
75+
#endif
76+
77+
#endif
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2018 ARM Limited
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "PeripheralPins.h"
19+
20+
/************RTC***************/
21+
const PinMap PinMap_RTC[] = {
22+
{NC, OSC32KCLK, 0},
23+
};
24+
25+
/************ADC***************/
26+
const PinMap PinMap_ADC[] = {
27+
{PTB1, ADC0_SE1, 0},
28+
{PTB3, ADC0_SE2, 0},
29+
{PTB2, ADC0_SE3, 0},
30+
{PTB18, ADC0_SE4, 0},
31+
{PTA19, ADC0_SE5, 0},
32+
{NC , NC , 0}
33+
};
34+
35+
/************DAC***************/
36+
const PinMap PinMap_DAC[] = {
37+
{DAC0_OUT, DAC_0, 0},
38+
{NC, NC, 0}
39+
};
40+
41+
/************I2C***************/
42+
const PinMap PinMap_I2C_SDA[] = {
43+
{PTB1, I2C_0, 3},
44+
{PTB17, I2C_1, 3},
45+
{PTC1, I2C_0, 3},
46+
{PTC3, I2C_1, 3},
47+
{PTC7, I2C_1, 3},
48+
{PTC16, I2C_0, 3},
49+
{PTC18, I2C_1, 3},
50+
{NC , NC , 0}
51+
};
52+
53+
const PinMap PinMap_I2C_SCL[] = {
54+
{PTB0, I2C_0, 3},
55+
{PTB16, I2C_1, 3},
56+
{PTB18, I2C_1, 3},
57+
{PTC2, I2C_1, 3},
58+
{PTC6, I2C_1, 3},
59+
{PTC17, I2C_1, 3},
60+
{PTC19, I2C_0, 3},
61+
{NC , NC , 0}
62+
};
63+
64+
/************UART***************/
65+
const PinMap PinMap_UART_TX[] = {
66+
{PTC3, LPUART_0, 4},
67+
{PTC7, LPUART_0, 4},
68+
{PTC18, LPUART_0, 4},
69+
{NC , NC , 0}
70+
};
71+
72+
const PinMap PinMap_UART_RX[] = {
73+
{PTC2, LPUART_0, 4},
74+
{PTC6, LPUART_0, 4},
75+
{PTC17, LPUART_0, 4},
76+
{NC , NC , 0}
77+
};
78+
79+
const PinMap PinMap_UART_CTS[] = {
80+
{PTC4, LPUART_0, 4},
81+
{PTC19, LPUART_0, 4},
82+
{NC , NC , 0}
83+
};
84+
85+
const PinMap PinMap_UART_RTS[] = {
86+
{PTC1, LPUART_0, 4},
87+
{PTC5, LPUART_0, 4},
88+
{PTC16, LPUART_0, 4},
89+
{NC , NC , 0}
90+
};
91+
92+
/************SPI***************/
93+
const PinMap PinMap_SPI_SCLK[] = {
94+
{PTA18, SPI_1, 2},
95+
{PTC16, SPI_0, 2},
96+
{NC , NC , 0}
97+
};
98+
99+
const PinMap PinMap_SPI_MOSI[] = {
100+
{PTA16, SPI_1, 2},
101+
{PTC17, SPI_0, 2},
102+
{NC , NC , 0}
103+
};
104+
105+
const PinMap PinMap_SPI_MISO[] = {
106+
{PTA17, SPI_1, 2},
107+
{PTC18, SPI_0, 2},
108+
{NC , NC , 0}
109+
};
110+
111+
const PinMap PinMap_SPI_SSEL[] = {
112+
{PTA1, SPI_1, 2},
113+
{PTA19, SPI_1, 2},
114+
{PTC19, SPI_0, 2},
115+
{NC , NC , 0}
116+
};
117+
118+
/************PWM***************/
119+
const PinMap PinMap_PWM[] = {
120+
/* TPM 0 */
121+
{PTA16, PWM_1, 5},
122+
{PTB0, PWM_2, 5},
123+
{PTB1, PWM_3, 5},
124+
{PTA2, PWM_4, 5},
125+
{PTB18, PWM_1, 5},
126+
{PTC3, PWM_2, 5},
127+
{PTC1, PWM_3, 5},
128+
{PTC16, PWM_4, 5},
129+
/* TPM 1 */
130+
{PTA0, PWM_5, 5},
131+
{PTA1, PWM_6, 5},
132+
{PTB2, PWM_5, 5},
133+
{PTB3, PWM_6, 5},
134+
{PTC4, PWM_5, 5},
135+
{PTC5, PWM_6, 5},
136+
{NC , NC , 0}
137+
};
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2018 ARM Limited
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#ifndef MBED_PINNAMES_H
18+
#define MBED_PINNAMES_H
19+
20+
#include "cmsis.h"
21+
22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif
25+
26+
typedef enum {
27+
PIN_INPUT,
28+
PIN_OUTPUT
29+
} PinDirection;
30+
31+
#define GPIO_PORT_SHIFT 12
32+
33+
typedef enum {
34+
PTA0 = (0 << GPIO_PORT_SHIFT | 0),
35+
PTA1 = (0 << GPIO_PORT_SHIFT | 1),
36+
PTA2 = (0 << GPIO_PORT_SHIFT | 2),
37+
PTA16 = (0 << GPIO_PORT_SHIFT | 16),
38+
PTA17 = (0 << GPIO_PORT_SHIFT | 17),
39+
PTA18 = (0 << GPIO_PORT_SHIFT | 18),
40+
PTA19 = (0 << GPIO_PORT_SHIFT | 19),
41+
PTB0 = (1 << GPIO_PORT_SHIFT | 0),
42+
PTB1 = (1 << GPIO_PORT_SHIFT | 1),
43+
PTB2 = (1 << GPIO_PORT_SHIFT | 2),
44+
PTB3 = (1 << GPIO_PORT_SHIFT | 3),
45+
PTB16 = (1 << GPIO_PORT_SHIFT | 16),
46+
PTB17 = (1 << GPIO_PORT_SHIFT | 17),
47+
PTB18 = (1 << GPIO_PORT_SHIFT | 18),
48+
PTC1 = (2 << GPIO_PORT_SHIFT | 1),
49+
PTC2 = (2 << GPIO_PORT_SHIFT | 2),
50+
PTC3 = (2 << GPIO_PORT_SHIFT | 3),
51+
PTC4 = (2 << GPIO_PORT_SHIFT | 4),
52+
PTC5 = (2 << GPIO_PORT_SHIFT | 5),
53+
PTC6 = (2 << GPIO_PORT_SHIFT | 6),
54+
PTC7 = (2 << GPIO_PORT_SHIFT | 7),
55+
PTC16 = (2 << GPIO_PORT_SHIFT | 16),
56+
PTC17 = (2 << GPIO_PORT_SHIFT | 17),
57+
PTC18 = (2 << GPIO_PORT_SHIFT | 18),
58+
PTC19 = (2 << GPIO_PORT_SHIFT | 19),
59+
60+
LED_RED = PTC1,
61+
LED_GREEN = PTA19,
62+
LED_BLUE = PTA18,
63+
64+
// mbed original LED naming
65+
LED1 = LED_RED,
66+
LED2 = LED_GREEN,
67+
LED3 = LED_BLUE,
68+
LED4 = LED_RED,
69+
70+
//Push buttons
71+
SW3 = PTC4,
72+
SW4 = PTC5,
73+
// Standardized button names
74+
BUTTON1 = SW3,
75+
BUTTON2 = SW4,
76+
77+
// USB Pins
78+
USBTX = PTC7,
79+
USBRX = PTC6,
80+
81+
// Arduino Headers
82+
D0 = PTC6,
83+
D1 = PTC7,
84+
D2 = PTC19,
85+
D3 = PTC16,
86+
D4 = PTC4,
87+
D5 = PTC17,
88+
D6 = PTC18,
89+
D7 = PTA1,
90+
D8 = PTA0,
91+
D9 = PTC1,
92+
D10 = PTA19,
93+
D11 = PTA16,
94+
D12 = PTA17,
95+
D13 = PTA18,
96+
D14 = PTC3,
97+
D15 = PTC2,
98+
99+
I2C_SCL = D15,
100+
I2C_SDA = D14,
101+
102+
DAC0_OUT = PTB18,
103+
104+
A1 = DAC0_OUT,
105+
A2 = PTB2,
106+
A3 = PTB3,
107+
A4 = PTB1,
108+
A5 = PTB0,
109+
110+
// Not connected
111+
NC = (int)0xFFFFFFFF
112+
} PinName;
113+
114+
115+
typedef enum {
116+
PullNone = 0,
117+
PullDown = 1,
118+
PullUp = 2,
119+
PullDefault = PullUp
120+
} PinMode;
121+
122+
#ifdef __cplusplus
123+
}
124+
#endif
125+
126+
#endif
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches.
2+
// Check the 'features' section of the target description in 'targets.json' for more details.
3+
/* mbed Microcontroller Library
4+
* Copyright (c) 2018 ARM Limited
5+
* SPDX-License-Identifier: Apache-2.0
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
#ifndef MBED_DEVICE_H
20+
#define MBED_DEVICE_H
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
31+
32+
#define DEVICE_ID_LENGTH 24
33+
34+
35+
36+
37+
38+
#include "objects.h"
39+
40+
#endif

0 commit comments

Comments
 (0)