Skip to content

Commit 1b894aa

Browse files
author
Filip Jagodzinski
committed
K64F: Add gpio_get_capabilities()
Remove the gpio_pinmap() for this target. GPIO tests are skipped based on pin's capabilities.
1 parent ce65a80 commit 1b894aa

File tree

4 files changed

+18
-125
lines changed

4 files changed

+18
-125
lines changed

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/TARGET_FRDM/PeripheralNames.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2020 ARM Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,10 +22,6 @@
2222
extern "C" {
2323
#endif
2424

25-
typedef enum {
26-
GPIO_X = 0, // dummy peripheral used instead of GPIO_A..GPIO_E
27-
} GPIOName;
28-
2925
typedef enum {
3026
OSC32KCLK = 0,
3127
} RTCName;

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/TARGET_FRDM/PeripheralPinMaps.h

Lines changed: 1 addition & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2020 ARM Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,118 +19,6 @@
1919

2020
#include <mstd_cstddef>
2121

22-
/************GPIO***************/
23-
MSTD_CONSTEXPR_OBJ_11 PinMap PinMap_GPIO[] = {
24-
{PTA0, GPIO_X, 1},
25-
{PTA1, GPIO_X, 1},
26-
{PTA2, GPIO_X, 1},
27-
{PTA3, GPIO_X, 1},
28-
{PTA4, GPIO_X, 1},
29-
{PTA5, GPIO_X, 1},
30-
{PTA6, GPIO_X, 1},
31-
{PTA7, GPIO_X, 1},
32-
{PTA8, GPIO_X, 1},
33-
{PTA9, GPIO_X, 1},
34-
{PTA10, GPIO_X, 1},
35-
{PTA11, GPIO_X, 1},
36-
{PTA12, GPIO_X, 1},
37-
{PTA13, GPIO_X, 1},
38-
{PTA14, GPIO_X, 1},
39-
{PTA15, GPIO_X, 1},
40-
{PTA16, GPIO_X, 1},
41-
{PTA17, GPIO_X, 1},
42-
{PTA18, GPIO_X, 1},
43-
{PTA19, GPIO_X, 1},
44-
{PTA24, GPIO_X, 1},
45-
{PTA25, GPIO_X, 1},
46-
{PTA26, GPIO_X, 1},
47-
{PTA27, GPIO_X, 1},
48-
{PTA28, GPIO_X, 1},
49-
{PTA29, GPIO_X, 1},
50-
51-
{PTB0, GPIO_X, 1},
52-
{PTB1, GPIO_X, 1},
53-
{PTB2, GPIO_X, 1},
54-
{PTB3, GPIO_X, 1},
55-
{PTB4, GPIO_X, 1},
56-
{PTB5, GPIO_X, 1},
57-
{PTB6, GPIO_X, 1},
58-
{PTB7, GPIO_X, 1},
59-
{PTB8, GPIO_X, 1},
60-
{PTB9, GPIO_X, 1},
61-
{PTB10, GPIO_X, 1},
62-
{PTB11, GPIO_X, 1},
63-
{PTB12, GPIO_X, 1},
64-
{PTB13, GPIO_X, 1},
65-
{PTB16, GPIO_X, 1},
66-
{PTB17, GPIO_X, 1},
67-
{PTB18, GPIO_X, 1},
68-
{PTB19, GPIO_X, 1},
69-
{PTB20, GPIO_X, 1},
70-
{PTB21, GPIO_X, 1},
71-
{PTB22, GPIO_X, 1},
72-
{PTB23, GPIO_X, 1},
73-
74-
{PTC0, GPIO_X, 1},
75-
{PTC1, GPIO_X, 1},
76-
{PTC2, GPIO_X, 1},
77-
{PTC3, GPIO_X, 1},
78-
{PTC4, GPIO_X, 1},
79-
{PTC5, GPIO_X, 1},
80-
{PTC6, GPIO_X, 1},
81-
{PTC7, GPIO_X, 1},
82-
{PTC8, GPIO_X, 1},
83-
{PTC9, GPIO_X, 1},
84-
{PTC10, GPIO_X, 1},
85-
{PTC11, GPIO_X, 1},
86-
{PTC12, GPIO_X, 1},
87-
{PTC13, GPIO_X, 1},
88-
{PTC14, GPIO_X, 1},
89-
{PTC15, GPIO_X, 1},
90-
{PTC16, GPIO_X, 1},
91-
{PTC17, GPIO_X, 1},
92-
{PTC18, GPIO_X, 1},
93-
{PTC19, GPIO_X, 1},
94-
95-
{PTD0, GPIO_X, 1},
96-
{PTD1, GPIO_X, 1},
97-
{PTD2, GPIO_X, 1},
98-
{PTD3, GPIO_X, 1},
99-
{PTD4, GPIO_X, 1},
100-
{PTD5, GPIO_X, 1},
101-
{PTD6, GPIO_X, 1},
102-
{PTD7, GPIO_X, 1},
103-
{PTD8, GPIO_X, 1},
104-
{PTD9, GPIO_X, 1},
105-
{PTD10, GPIO_X, 1},
106-
{PTD11, GPIO_X, 1},
107-
{PTD12, GPIO_X, 1},
108-
{PTD13, GPIO_X, 1},
109-
{PTD14, GPIO_X, 1},
110-
{PTD15, GPIO_X, 1},
111-
112-
{PTE0, GPIO_X, 1},
113-
{PTE1, GPIO_X, 1},
114-
{PTE2, GPIO_X, 1},
115-
{PTE3, GPIO_X, 1},
116-
{PTE4, GPIO_X, 1},
117-
{PTE5, GPIO_X, 1},
118-
{PTE6, GPIO_X, 1},
119-
{PTE7, GPIO_X, 1},
120-
{PTE8, GPIO_X, 1},
121-
{PTE9, GPIO_X, 1},
122-
{PTE10, GPIO_X, 1},
123-
{PTE11, GPIO_X, 1},
124-
{PTE12, GPIO_X, 1},
125-
// {PTE24, GPIO_X, 1}, // fixed pull-up (for I2C)
126-
// {PTE25, GPIO_X, 1}, // fixed pull-up (for I2C)
127-
{PTE26, GPIO_X, 1},
128-
{PTE27, GPIO_X, 1},
129-
{PTE28, GPIO_X, 1},
130-
131-
{NC, NC, 0}
132-
};
133-
13422
/************RTC***************/
13523
MSTD_CONSTEXPR_OBJ_11 PinMap PinMap_RTC[] = {
13624
{NC, OSC32KCLK, 0},

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/TARGET_FRDM/PeripheralPins.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2020 ARM Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,8 +16,20 @@
1616

1717
#include "PeripheralPins.h"
1818
#include "PeripheralPinMaps.h"
19+
#include "mbed_assert.h"
20+
#include "hal/gpio_api.h"
1921

20-
const PinMap *gpio_pinmap()
22+
void gpio_get_capabilities(gpio_t *obj, gpio_capabilities_t *cap)
2123
{
22-
return PinMap_GPIO;
24+
MBED_ASSERT(obj->pin != (PinName)NC);
25+
// fixed pull-ups (for I2C)
26+
if (obj->pin == PTE24 || obj->pin == PTE25) {
27+
cap->pull_none = 0;
28+
cap->pull_down = 0;
29+
cap->pull_up = 0;
30+
} else {
31+
cap->pull_none = 1;
32+
cap->pull_down = 1;
33+
cap->pull_up = 1;
34+
}
2335
}

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/PeripheralPins.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2020 ARM Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,9 +20,6 @@
2020
#include "pinmap.h"
2121
#include "PeripheralNames.h"
2222

23-
/************GPIO***************/
24-
extern const PinMap PinMap_GPIO[];
25-
2623
/************RTC***************/
2724
extern const PinMap PinMap_RTC[];
2825

0 commit comments

Comments
 (0)