Skip to content

Commit 15d64c9

Browse files
committed
Add support for FRDM-KW41
Signed-off-by: Mahadevan Mahesh <[email protected]>
1 parent 9d8ec61 commit 15d64c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

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

0 commit comments

Comments
 (0)