Skip to content

Commit 769b725

Browse files
committed
PSOC6: add BSPs for Cypress kits
1 parent 432c29d commit 769b725

File tree

61 files changed

+28283
-0
lines changed

Some content is hidden

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

61 files changed

+28283
-0
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
/*
2+
* mbed Microcontroller Library
3+
* Copyright (c) 2017-2018 Future Electronics
4+
* Copyright (c) 2019 Cypress Semiconductor Corporation
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+
20+
#ifndef MBED_PERIPHERALNAMES_H
21+
#define MBED_PERIPHERALNAMES_H
22+
23+
#include "cmsis.h"
24+
#include "PinNames.h"
25+
26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
29+
30+
typedef enum {
31+
UART_0 = (int)SCB0_BASE,
32+
UART_1 = (int)SCB1_BASE,
33+
UART_2 = (int)SCB2_BASE,
34+
UART_3 = (int)SCB3_BASE,
35+
UART_4 = (int)SCB4_BASE,
36+
UART_5 = (int)SCB5_BASE,
37+
UART_6 = (int)SCB6_BASE,
38+
UART_7 = (int)SCB7_BASE,
39+
/* SCB_8 does not support UART mode */
40+
UART_9 = (int)SCB9_BASE,
41+
UART_10 = (int)SCB10_BASE,
42+
UART_11 = (int)SCB11_BASE,
43+
UART_12 = (int)SCB12_BASE,
44+
} UARTName;
45+
46+
47+
typedef enum {
48+
SPI_0 = (int)SCB0_BASE,
49+
SPI_1 = (int)SCB1_BASE,
50+
SPI_2 = (int)SCB2_BASE,
51+
SPI_3 = (int)SCB3_BASE,
52+
SPI_4 = (int)SCB4_BASE,
53+
SPI_5 = (int)SCB5_BASE,
54+
SPI_6 = (int)SCB6_BASE,
55+
SPI_7 = (int)SCB7_BASE,
56+
SPI_8 = (int)SCB8_BASE,
57+
/* SCB_9 - SCB_12 does not support UART mode */
58+
} SPIName;
59+
60+
typedef enum {
61+
I2C_0 = (int)SCB0_BASE,
62+
I2C_1 = (int)SCB1_BASE,
63+
I2C_2 = (int)SCB2_BASE,
64+
I2C_3 = (int)SCB3_BASE,
65+
I2C_4 = (int)SCB4_BASE,
66+
I2C_5 = (int)SCB5_BASE,
67+
I2C_6 = (int)SCB6_BASE,
68+
I2C_7 = (int)SCB7_BASE,
69+
I2C_8 = (int)SCB8_BASE,
70+
I2C_9 = (int)SCB9_BASE,
71+
I2C_10 = (int)SCB10_BASE,
72+
I2C_11 = (int)SCB11_BASE,
73+
I2C_12 = (int)SCB12_BASE,
74+
} I2CName;
75+
76+
typedef enum {
77+
PWM_32b_0 = TCPWM0_BASE,
78+
PWM_32b_1,
79+
PWM_32b_2,
80+
PWM_32b_3,
81+
PWM_32b_4,
82+
PWM_32b_5,
83+
PWM_32b_6,
84+
PWM_32b_7,
85+
PWM_16b_0 = TCPWM1_BASE,
86+
PWM_16b_1,
87+
PWM_16b_2,
88+
PWM_16b_3,
89+
PWM_16b_4,
90+
PWM_16b_5,
91+
PWM_16b_6,
92+
PWM_16b_7,
93+
PWM_16b_8,
94+
PWM_16b_9,
95+
PWM_16b_10,
96+
PWM_16b_11,
97+
PWM_16b_12,
98+
PWM_16b_13,
99+
PWM_16b_14,
100+
PWM_16b_15,
101+
PWM_16b_16,
102+
PWM_16b_17,
103+
PWM_16b_18,
104+
PWM_16b_19,
105+
PWM_16b_20,
106+
PWM_16b_21,
107+
PWM_16b_22,
108+
PWM_16b_23,
109+
} PWMName;
110+
111+
typedef enum {
112+
ADC_0 = (int)SAR_BASE,
113+
} ADCName;
114+
115+
#ifdef __cplusplus
116+
}
117+
#endif
118+
119+
#endif

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_4343W/PeripheralPins.c

Lines changed: 465 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
/*
2+
* mbed Microcontroller Library
3+
* Copyright (c) 2017-2018 Future Electronics
4+
* Copyright (c) 2019 Cypress Semiconductor Corporation
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+
20+
#ifndef MBED_PINNAMES_H
21+
#define MBED_PINNAMES_H
22+
23+
#include "cmsis.h"
24+
#include "PinNamesTypes.h"
25+
#include "PortNames.h"
26+
27+
// PinName[15-0] = Port[15-8] + Pin[7-0]
28+
typedef enum {
29+
P0_0 = (Port0 << 8) + 0x00,
30+
P0_1 = (Port0 << 8) + 0x01,
31+
P0_2 = (Port0 << 8) + 0x02,
32+
P0_3 = (Port0 << 8) + 0x03,
33+
P0_4 = (Port0 << 8) + 0x04,
34+
P0_5 = (Port0 << 8) + 0x05,
35+
P0_6 = (Port0 << 8) + 0x06,
36+
P0_7 = (Port0 << 8) + 0x07,
37+
38+
P1_0 = (Port1 << 8) + 0x00,
39+
P1_1 = (Port1 << 8) + 0x01,
40+
P1_2 = (Port1 << 8) + 0x02,
41+
P1_3 = (Port1 << 8) + 0x03,
42+
P1_4 = (Port1 << 8) + 0x04,
43+
P1_5 = (Port1 << 8) + 0x05,
44+
P1_6 = (Port1 << 8) + 0x06,
45+
P1_7 = (Port1 << 8) + 0x07,
46+
47+
P2_0 = (Port2 << 8) + 0x00,
48+
P2_1 = (Port2 << 8) + 0x01,
49+
P2_2 = (Port2 << 8) + 0x02,
50+
P2_3 = (Port2 << 8) + 0x03,
51+
P2_4 = (Port2 << 8) + 0x04,
52+
P2_5 = (Port2 << 8) + 0x05,
53+
P2_6 = (Port2 << 8) + 0x06,
54+
P2_7 = (Port2 << 8) + 0x07,
55+
56+
P3_0 = (Port3 << 8) + 0x00,
57+
P3_1 = (Port3 << 8) + 0x01,
58+
P3_2 = (Port3 << 8) + 0x02,
59+
P3_3 = (Port3 << 8) + 0x03,
60+
P3_4 = (Port3 << 8) + 0x04,
61+
P3_5 = (Port3 << 8) + 0x05,
62+
P3_6 = (Port3 << 8) + 0x06,
63+
P3_7 = (Port3 << 8) + 0x07,
64+
65+
P4_0 = (Port4 << 8) + 0x00,
66+
P4_1 = (Port4 << 8) + 0x01,
67+
P4_2 = (Port4 << 8) + 0x02,
68+
P4_3 = (Port4 << 8) + 0x03,
69+
P4_4 = (Port4 << 8) + 0x04,
70+
P4_5 = (Port4 << 8) + 0x05,
71+
P4_6 = (Port4 << 8) + 0x06,
72+
P4_7 = (Port4 << 8) + 0x07,
73+
74+
P5_0 = (Port5 << 8) + 0x00,
75+
P5_1 = (Port5 << 8) + 0x01,
76+
P5_2 = (Port5 << 8) + 0x02,
77+
P5_3 = (Port5 << 8) + 0x03,
78+
P5_4 = (Port5 << 8) + 0x04,
79+
P5_5 = (Port5 << 8) + 0x05,
80+
P5_6 = (Port5 << 8) + 0x06,
81+
P5_7 = (Port5 << 8) + 0x07,
82+
83+
P6_0 = (Port6 << 8) + 0x00,
84+
P6_1 = (Port6 << 8) + 0x01,
85+
P6_2 = (Port6 << 8) + 0x02,
86+
P6_3 = (Port6 << 8) + 0x03,
87+
P6_4 = (Port6 << 8) + 0x04,
88+
P6_5 = (Port6 << 8) + 0x05,
89+
P6_6 = (Port6 << 8) + 0x06,
90+
P6_7 = (Port6 << 8) + 0x07,
91+
92+
P7_0 = (Port7 << 8) + 0x00,
93+
P7_1 = (Port7 << 8) + 0x01,
94+
P7_2 = (Port7 << 8) + 0x02,
95+
P7_3 = (Port7 << 8) + 0x03,
96+
P7_4 = (Port7 << 8) + 0x04,
97+
P7_5 = (Port7 << 8) + 0x05,
98+
P7_6 = (Port7 << 8) + 0x06,
99+
P7_7 = (Port7 << 8) + 0x07,
100+
101+
P8_0 = (Port8 << 8) + 0x00,
102+
P8_1 = (Port8 << 8) + 0x01,
103+
P8_2 = (Port8 << 8) + 0x02,
104+
P8_3 = (Port8 << 8) + 0x03,
105+
P8_4 = (Port8 << 8) + 0x04,
106+
P8_5 = (Port8 << 8) + 0x05,
107+
P8_6 = (Port8 << 8) + 0x06,
108+
P8_7 = (Port8 << 8) + 0x07,
109+
110+
P9_0 = (Port9 << 8) + 0x00,
111+
P9_1 = (Port9 << 8) + 0x01,
112+
P9_2 = (Port9 << 8) + 0x02,
113+
P9_3 = (Port9 << 8) + 0x03,
114+
P9_4 = (Port9 << 8) + 0x04,
115+
P9_5 = (Port9 << 8) + 0x05,
116+
P9_6 = (Port9 << 8) + 0x06,
117+
P9_7 = (Port9 << 8) + 0x07,
118+
119+
P10_0 = (Port10 << 8) + 0x00,
120+
P10_1 = (Port10 << 8) + 0x01,
121+
P10_2 = (Port10 << 8) + 0x02,
122+
P10_3 = (Port10 << 8) + 0x03,
123+
P10_4 = (Port10 << 8) + 0x04,
124+
P10_5 = (Port10 << 8) + 0x05,
125+
P10_6 = (Port10 << 8) + 0x06,
126+
P10_7 = (Port10 << 8) + 0x07,
127+
128+
P11_0 = (Port11 << 8) + 0x00,
129+
P11_1 = (Port11 << 8) + 0x01,
130+
P11_2 = (Port11 << 8) + 0x02,
131+
P11_3 = (Port11 << 8) + 0x03,
132+
P11_4 = (Port11 << 8) + 0x04,
133+
P11_5 = (Port11 << 8) + 0x05,
134+
P11_6 = (Port11 << 8) + 0x06,
135+
P11_7 = (Port11 << 8) + 0x07,
136+
137+
P12_0 = (Port12 << 8) + 0x00,
138+
P12_1 = (Port12 << 8) + 0x01,
139+
P12_2 = (Port12 << 8) + 0x02,
140+
P12_3 = (Port12 << 8) + 0x03,
141+
P12_4 = (Port12 << 8) + 0x04,
142+
P12_5 = (Port12 << 8) + 0x05,
143+
P12_6 = (Port12 << 8) + 0x06,
144+
P12_7 = (Port12 << 8) + 0x07,
145+
146+
P13_0 = (Port13 << 8) + 0x00,
147+
P13_1 = (Port13 << 8) + 0x01,
148+
P13_2 = (Port13 << 8) + 0x02,
149+
P13_3 = (Port13 << 8) + 0x03,
150+
P13_4 = (Port13 << 8) + 0x04,
151+
P13_5 = (Port13 << 8) + 0x05,
152+
P13_6 = (Port13 << 8) + 0x06,
153+
P13_7 = (Port13 << 8) + 0x07,
154+
155+
// Not connected
156+
NC = (int)0xFFFFFFFF,
157+
158+
// Arduino connector namings
159+
A0 = P10_0,
160+
A1 = P10_1,
161+
A2 = P10_2,
162+
A3 = P10_3,
163+
A4 = P10_4,
164+
A5 = P10_5,
165+
166+
D0 = P5_0,
167+
D1 = P5_1,
168+
D2 = P5_2,
169+
D3 = P5_3,
170+
D4 = P5_4,
171+
D5 = P5_5,
172+
D6 = P5_6,
173+
D7 = P0_2,
174+
D8 = P13_0,
175+
D9 = P13_1,
176+
D10 = P12_3,
177+
D11 = P12_0,
178+
D12 = P12_1,
179+
D13 = P12_2,
180+
D14 = P6_1,
181+
D15 = P6_0,
182+
183+
// Generic signal names
184+
185+
I2C_SCL = P6_0,
186+
I2C_SDA = P6_1,
187+
188+
SPI_MOSI = P12_0,
189+
SPI_MISO = P12_1,
190+
SPI_CLK = P12_2,
191+
SPI_CS = P12_4,
192+
193+
UART_RX = P5_0,
194+
UART_TX = P5_1,
195+
UART_RTS = P5_2,
196+
UART_CTS = P5_3,
197+
198+
BT_UART_RX = P3_0,
199+
BT_UART_TX = P3_1,
200+
BT_UART_CTS = P3_3,
201+
BT_UART_RTS = P3_2,
202+
203+
BT_PIN_POWER = P3_4,
204+
BT_PIN_HOST_WAKE = P3_5,
205+
BT_PIN_DEVICE_WAKE = P4_0,
206+
// Reset pin unavailable
207+
208+
209+
SWITCH2 = P0_4,
210+
LED1 = P0_3,
211+
LED2 = P1_1,
212+
LED3 = P11_1,
213+
LED4 = P1_5,
214+
LED5 = P13_7,
215+
216+
LED_RED = LED1,
217+
LED_BLUE = LED3,
218+
LED_GREEN = LED2,
219+
220+
USER_BUTTON = SWITCH2,
221+
BUTTON1 = USER_BUTTON,
222+
223+
QSPI_CLK = P11_7,
224+
QSPI_IO_0 = P11_6,
225+
QSPI_IO_1 = P11_5,
226+
QSPI_IO_2 = P11_4,
227+
QSPI_IO_3 = P11_3,
228+
QSPI_SEL = P11_2,
229+
230+
// Standardized interfaces names
231+
STDIO_UART_TX = UART_TX,
232+
STDIO_UART_RX = UART_RX,
233+
STDIO_UART_CTS = UART_CTS,
234+
STDIO_UART_RTS = UART_RTS,
235+
236+
CY_STDIO_UART_RX = STDIO_UART_RX,
237+
CY_STDIO_UART_TX = STDIO_UART_TX,
238+
CY_STDIO_UART_CTS = STDIO_UART_CTS,
239+
CY_STDIO_UART_RTS = STDIO_UART_RTS,
240+
241+
CY_BT_UART_RX = BT_UART_RX,
242+
CY_BT_UART_TX = BT_UART_TX,
243+
CY_BT_UART_CTS = BT_UART_CTS,
244+
CY_BT_UART_RTS = BT_UART_RTS,
245+
246+
CY_BT_PIN_POWER = BT_PIN_POWER,
247+
CY_BT_PIN_HOST_WAKE = BT_PIN_HOST_WAKE,
248+
CY_BT_PIN_DEVICE_WAKE = BT_PIN_DEVICE_WAKE,
249+
250+
251+
USBTX = UART_TX,
252+
USBRX = UART_RX,
253+
254+
// Not connected
255+
AOUT = (int)0xFFFFFFFF
256+
} PinName;
257+
258+
// PinName[15-0] = Port[15-8] + Pin[4-0]
259+
static inline unsigned CY_PIN(PinName pin)
260+
{
261+
return pin & 0x07;
262+
}
263+
264+
static inline unsigned CY_PORT(PinName pin)
265+
{
266+
return (pin >> 8) & 0xFF;
267+
}
268+
269+
// Because MBED pin mapping API does not allow to map multiple instances of the PWM
270+
// to be mapped to the same pin, we create special pin names to force 32-bit PWM unit
271+
// usage instead of standard 16-bit PWM.
272+
273+
#define PWM32(pin) CY_PIN_FORCE_PWM_32(pin)
274+
275+
276+
#endif

0 commit comments

Comments
 (0)