Skip to content

Commit 1c48a6c

Browse files
vmedcyArto Kinnunen
authored andcommitted
PSOC6: update Cypress targets to use psoc6csp
1 parent 33ca061 commit 1c48a6c

Some content is hidden

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

59 files changed

+4089
-8818
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/PeripheralPins.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ extern const PinMap PinMap_SPI_SSEL[];
5353

5454
//*** QSPI ***
5555
#if DEVICE_QSPI
56-
extern const PinMap PinMap_QSPI_SCLK[];
56+
extern const PinMap PinMap_QSPI_SCLK[];
5757
extern const PinMap PinMap_QSPI_DATA[];
5858
extern const PinMap PinMap_QSPI_SSEL[];
5959
#endif
60-
60+
6161
//*** ADC ***
6262
#if DEVICE_ANALOGIN
6363
extern const PinMap PinMap_ADC[];
@@ -68,4 +68,13 @@ extern const PinMap PinMap_ADC[];
6868
extern const PinMap PinMap_DAC[];
6969
#endif
7070

71+
#if DEVICE_QSPI
72+
extern const PinMap PinMap_QSPI_SCLK[];
73+
extern const PinMap PinMap_QSPI_SSEL[];
74+
extern const PinMap PinMap_QSPI_DATA0[];
75+
extern const PinMap PinMap_QSPI_DATA1[];
76+
extern const PinMap PinMap_QSPI_DATA2[];
77+
extern const PinMap PinMap_QSPI_DATA3[];
78+
#endif
79+
7180
#endif

targets/TARGET_Cypress/TARGET_PSOC6/PinNamesTypes.h

Lines changed: 13 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -20,66 +20,26 @@
2020
#define MBED_PINNAMESTYPES_H
2121

2222
#include "cmsis.h"
23+
#include "cyhal_gpio.h"
24+
25+
#define PullNone CYHAL_GPIO_DRIVE_STRONG
26+
#define PullDefault CYHAL_GPIO_DRIVE_ANALOG
27+
#define PullDown CYHAL_GPIO_DRIVE_PULLDOWN
28+
#define PullUp CYHAL_GPIO_DRIVE_PULLUP
29+
30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
2333

2434
typedef enum {
2535
PIN_INPUT = 0,
2636
PIN_OUTPUT
2737
} PinDirection;
2838

29-
typedef enum {
30-
PullNone = 0,
31-
PullUp = 1,
32-
PullDown = 2,
33-
OpenDrainDriveLow = 3,
34-
OpenDrainDriveHigh = 4,
35-
OpenDrain = OpenDrainDriveLow,
36-
PushPull = 5,
37-
AnalogMode = 6,
38-
PullDefault = PullNone
39-
} PinMode;
40-
41-
typedef struct {
42-
en_hsiom_sel_t hsiom : 8;
43-
en_clk_dst_t clock : 8;
44-
PinMode mode : 4;
45-
PinDirection dir : 1;
46-
} PinFunction;
47-
48-
// Encode pin function.
49-
// Output function
50-
#define CY_PIN_FUNCTION(hsiom, clock, mode, dir) (int)(((dir) << 20) | ((mode) << 16) | ((clock) << 8) | (hsiom))
51-
#define CY_PIN_OUT_FUNCTION(hsiom, clock) CY_PIN_FUNCTION(hsiom, clock, PushPull, PIN_OUTPUT)
52-
#define CY_PIN_OD_FUNCTION(hsiom, clock) CY_PIN_FUNCTION(hsiom, clock, OpenDrain, PIN_OUTPUT)
53-
#define CY_PIN_IN_FUNCTION(hsiom, clock) CY_PIN_FUNCTION(hsiom, clock, PullDefault, PIN_INPUT)
54-
#define CY_PIN_PULLUP_FUNCTION(hsiom, clock) CY_PIN_FUNCTION(hsiom, clock, PullUp, PIN_INPUT)
55-
#define CY_PIN_ANALOG_FUNCTION(clock) CY_PIN_FUNCTION(HSIOM_SEL_GPIO, clock, AnalogMode, 0)
56-
57-
// Create unique name to force 32-bit PWM usage on a pin.
58-
#define CY_PIN_FORCE_PWM_32(pin) ((uint32_t)(pin) + 0x8000)
59-
60-
static inline en_hsiom_sel_t CY_PIN_HSIOM(int function)
61-
{
62-
return (en_hsiom_sel_t)(function & 0xFF);
63-
}
64-
65-
static inline en_clk_dst_t CY_PIN_CLOCK(int function)
66-
{
67-
return (en_clk_dst_t)((function >> 8) & 0xFF);
68-
}
69-
70-
static inline PinMode CY_PIN_MODE(int function)
71-
{
72-
return (PinMode)((function >> 16) & 0x0F);
73-
}
74-
75-
static inline PinDirection CY_PIN_DIRECTION(int function)
76-
{
77-
return (PinDirection)((function >> 20) & 1);
78-
}
39+
typedef cyhal_gpio_drive_mode_t PinMode;
7940

80-
static inline int CY_PERIPHERAL_BASE(int peripheral)
81-
{
82-
return peripheral & 0xffff0000;
41+
#ifdef __cplusplus
8342
}
43+
#endif
8444

8545
#endif

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/PeripheralNames.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ typedef enum {
3838
UART_7 = (int)SCB7_BASE,
3939
} UARTName;
4040

41+
#define DEVICE_SPI_COUNT CY_IP_MXSCB_INSTANCES
4142

4243
typedef enum {
4344
SPI_0 = (int)SCB0_BASE,

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/PeripheralPins.c

Lines changed: 290 additions & 290 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)