Skip to content

Commit 61989e1

Browse files
committed
K64F: Fix pin names and migrate to Arduino Uno form factor
Fix pin names of K64F with the following from the latest guidelines: * LEDs and buttons are defined as macros, digital and analog pins as enums. * No duplicated pin names with the same value. * The Arduino form factor is deprecated in favour of Arduino Uno. Note: The pins `SPI_xxx` are for SD card only, but the names are kept for backward compatibility (i.e. no breaking change until the next Mbed OS major version). The general purpose Arduino Uno SPI pins (`ARDUINO_UNO_SPI_xxx`) are different and also available.
1 parent 5ca8aec commit 61989e1

File tree

2 files changed

+56
-50
lines changed

2 files changed

+56
-50
lines changed

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

Lines changed: 55 additions & 49 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-2021 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -198,63 +198,37 @@ typedef enum {
198198
PTE30 = (4 << GPIO_PORT_SHIFT | 30),
199199
PTE31 = (4 << GPIO_PORT_SHIFT | 31),
200200

201-
LED_RED = PTB22,
202-
LED_GREEN = PTE26,
203-
LED_BLUE = PTB21,
204-
205-
// mbed original LED naming
206-
LED1 = LED_RED,
207-
LED2 = LED_GREEN,
208-
LED3 = LED_BLUE,
209-
LED4 = LED_RED,
210-
211-
//Push buttons
212-
SW2 = PTC6,
213-
SW3 = PTA4,
214-
// Standardized button names
215-
BUTTON1 = SW2,
216-
BUTTON2 = SW3,
217-
218201
// USB Pins
219202
CONSOLE_TX = PTB17,
220203
CONSOLE_RX = PTB16,
221204

222205
// Arduino Headers
223-
D0 = PTC16,
224-
D1 = PTC17,
225-
D2 = PTB9,
226-
D3 = PTA1,
227-
D4 = PTB23,
228-
D5 = PTA2,
229-
D6 = PTC2,
230-
D7 = PTC3,
231-
D8 = PTC12,
232-
D9 = PTC4,
233-
D10 = PTD0,
234-
D11 = PTD2,
235-
D12 = PTD3,
236-
D13 = PTD1,
237-
D14 = PTE25,
238-
D15 = PTE24,
239-
240-
I2C_SCL = D15,
241-
I2C_SDA = D14,
206+
ARDUINO_UNO_D0 = PTC16,
207+
ARDUINO_UNO_D1 = PTC17,
208+
ARDUINO_UNO_D2 = PTB9,
209+
ARDUINO_UNO_D3 = PTA1,
210+
ARDUINO_UNO_D4 = PTB23,
211+
ARDUINO_UNO_D5 = PTA2,
212+
ARDUINO_UNO_D6 = PTC2,
213+
ARDUINO_UNO_D7 = PTC3,
214+
ARDUINO_UNO_D8 = PTC12,
215+
ARDUINO_UNO_D9 = PTC4,
216+
ARDUINO_UNO_D10 = PTD0,
217+
ARDUINO_UNO_D11 = PTD2,
218+
ARDUINO_UNO_D12 = PTD3,
219+
ARDUINO_UNO_D13 = PTD1,
220+
ARDUINO_UNO_D14 = PTE25,
221+
ARDUINO_UNO_D15 = PTE24,
242222

243-
A0 = PTB2,
244-
A1 = PTB3,
245-
A2 = PTB10,
246-
A3 = PTB11,
247-
A4 = PTC11,
248-
A5 = PTC10,
223+
ARDUINO_UNO_A0 = PTB2,
224+
ARDUINO_UNO_A1 = PTB3,
225+
ARDUINO_UNO_A2 = PTB10,
226+
ARDUINO_UNO_A3 = PTB11,
227+
ARDUINO_UNO_A4 = PTC11,
228+
ARDUINO_UNO_A5 = PTC10,
249229

250230
DAC0_OUT = 0xFEFE, /* DAC does not have Pin Name in RM */
251231

252-
//SPI Pins configuration
253-
SPI_MOSI = PTE3,
254-
SPI_MISO = PTE1,
255-
SPI_SCK = PTE2,
256-
SPI_CS = PTE4,
257-
258232
// Not connected
259233
NC = (int)0xFFFFFFFF
260234
} PinName;
@@ -267,6 +241,38 @@ typedef enum {
267241
PullDefault = PullUp
268242
} PinMode;
269243

244+
245+
// LEDs
246+
#define LED_RED PTB22
247+
#define LED_GREEN PTE26
248+
#define LED_BLUE PTB21
249+
250+
// Standardized LED names
251+
#define LED1 LED_RED
252+
#define LED2 LED_GREEN
253+
#define LED3 LED_BLUE
254+
255+
256+
//Push buttons
257+
#define SW2 PTC6
258+
#define SW3 PTA4
259+
260+
// Standardized button names
261+
#define BUTTON1 SW2
262+
#define BUTTON2 SW3
263+
264+
265+
// SPI Pins for SD card.
266+
// Note: They are different from the Arduino Uno SPI pins
267+
// (ARDUINO_UNO_SPI_xxx) for general purpose uses.
268+
// By default, Mbed OS maps those alias to Arduino Uno pins, but
269+
// for backward compatibility we map them to the SD card SPI.
270+
#define SPI_MOSI PTE3
271+
#define SPI_MISO PTE1
272+
#define SPI_SCK PTE2
273+
#define SPI_CS PTE4
274+
275+
270276
#ifdef __cplusplus
271277
}
272278
#endif

targets/targets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@
760760
},
761761
"K64F": {
762762
"supported_form_factors": [
763-
"ARDUINO"
763+
"ARDUINO_UNO"
764764
],
765765
"components_add": [
766766
"SD",

0 commit comments

Comments
 (0)