Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kw24 support #2966

Merged
merged 2 commits into from
Oct 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_PERIPHERALNAMES_H
#define MBED_PERIPHERALNAMES_H

#include "cmsis.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
OSC32KCLK = 0,
} RTCName;

typedef enum {
UART_0 = 0,
UART_1 = 1,
UART_2 = 2,
} UARTName;

#define STDIO_UART_TX USBTX
#define STDIO_UART_RX USBRX
#define STDIO_UART UART_1

/* SPI defines used to communicate with the MCR20 RF device */
#define MCR20A_SPI_MOSI PTB16
#define MCR20A_SPI_MISO PTB17
#define MCR20A_SPI_SCLK PTB11
#define MCR20A_SPI_CS PTB10
#define MCR20A_SPI_RST PTB19
#define MCR20A_SPI_IRQ PTB3

typedef enum {
I2C_0 = 0,
I2C_1 = 1,
} I2CName;

#define TPM_SHIFT 8
typedef enum {
PWM_0 = (0 << TPM_SHIFT) | (0), // FTM0 CH0
PWM_1 = (0 << TPM_SHIFT) | (1), // FTM0 CH1
PWM_2 = (0 << TPM_SHIFT) | (2), // FTM0 CH2
PWM_3 = (0 << TPM_SHIFT) | (3), // FTM0 CH3
PWM_4 = (0 << TPM_SHIFT) | (4), // FTM0 CH4
PWM_5 = (0 << TPM_SHIFT) | (5), // FTM0 CH5
PWM_6 = (0 << TPM_SHIFT) | (6), // FTM0 CH6
PWM_7 = (0 << TPM_SHIFT) | (7), // FTM0 CH7
PWM_8 = (1 << TPM_SHIFT) | (0), // FTM1 CH0
PWM_9 = (1 << TPM_SHIFT) | (1), // FTM1 CH1
PWM_10 = (2 << TPM_SHIFT) | (0), // FTM2 CH0
PWM_11 = (2 << TPM_SHIFT) | (1), // FTM2 CH1
} PWMName;

#define ADC_INSTANCE_SHIFT 8
#define ADC_B_CHANNEL_SHIFT 5
typedef enum {
ADC0_SE4a = (0 << ADC_INSTANCE_SHIFT) | 4,
ADC0_SE5a = (0 << ADC_INSTANCE_SHIFT) | 5,
ADC0_SE6a = (0 << ADC_INSTANCE_SHIFT) | 6,
ADC0_SE7a = (0 << ADC_INSTANCE_SHIFT) | 7,
ADC0_SE4b = (0 << ADC_INSTANCE_SHIFT) | (1 << ADC_B_CHANNEL_SHIFT) | 4,
ADC0_SE5b = (0 << ADC_INSTANCE_SHIFT) | (1 << ADC_B_CHANNEL_SHIFT) | 5,
ADC0_SE6b = (0 << ADC_INSTANCE_SHIFT) | (1 << ADC_B_CHANNEL_SHIFT) | 6,
ADC0_SE7b = (0 << ADC_INSTANCE_SHIFT) | (1 << ADC_B_CHANNEL_SHIFT) | 7,
ADC0_SE8 = (0 << ADC_INSTANCE_SHIFT) | 8,
ADC0_SE9 = (0 << ADC_INSTANCE_SHIFT) | 9,
ADC0_SE10 = (0 << ADC_INSTANCE_SHIFT) | 10,
ADC0_SE11 = (0 << ADC_INSTANCE_SHIFT) | 11,
ADC0_SE12 = (0 << ADC_INSTANCE_SHIFT) | 12,
ADC0_SE13 = (0 << ADC_INSTANCE_SHIFT) | 13,
ADC0_SE14 = (0 << ADC_INSTANCE_SHIFT) | 14,
ADC0_SE15 = (0 << ADC_INSTANCE_SHIFT) | 15,
ADC0_SE21 = (0 << ADC_INSTANCE_SHIFT) | 21,
ADC0_SE22 = (0 << ADC_INSTANCE_SHIFT) | 22,
ADC0_SE23 = (0 << ADC_INSTANCE_SHIFT) | 23,
} ADCName;

typedef enum {
DAC_0 = 0
} DACName;


typedef enum {
SPI_0 = 0,
SPI_1 = 1,
} SPIName;

#ifdef __cplusplus
}
#endif

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "PeripheralPins.h"

/************RTC***************/
const PinMap PinMap_RTC[] = {
{NC, OSC32KCLK, 0},
};

/************ADC***************/
const PinMap PinMap_ADC[] = {
{PTD1, ADC0_SE5b, 0},
{PTD4, ADC0_SE21, 0},
{PTD5, ADC0_SE6b, 0},
{PTD6, ADC0_SE7b, 0},
{PTD7, ADC0_SE22, 0},
{PTE0, ADC0_SE10, 0},
{PTE1, ADC0_SE11, 0},
{PTE16, ADC0_SE4a, 0},
{PTE17, ADC0_SE5a, 0},
{PTE18, ADC0_SE6a, 0},
{PTE19, ADC0_SE7a, 0},
{NC , NC , 0}
};

/************I2C***************/
const PinMap PinMap_I2C_SDA[] = {
{PTD3, I2C_0, 4},
{PTE0, I2C_1, 6},
{PTE18, I2C_0, 4},
{NC , NC , 0}
};

const PinMap PinMap_I2C_SCL[] = {
{PTD2, I2C_0, 4},
{PTE1, I2C_1, 6},
{PTE19, I2C_0, 4},
{NC , NC , 0}
};

/************UART***************/
const PinMap PinMap_UART_TX[] = {
{PTA2, UART_0, 2},
{PTD7, UART_0, 3},
{PTC4, UART_1, 3},
{PTE0, UART_1, 3},
{PTD3, UART_2, 3},
{PTE16, UART_2, 3},
{NC , NC , 0}
};

const PinMap PinMap_UART_RX[] = {
{PTA1, UART_0, 2},
{PTD6, UART_0, 3},
{PTE1, UART_1, 3},
{PTD2, UART_2, 3},
{PTE17, UART_2, 3},

{NC , NC , 0}
};

const PinMap PinMap_UART_CTS[] = {
{PTD1, UART_2, 3},
{PTD5, UART_0, 3},
{PTE2, UART_1, 3},
{PTE18, UART_2, 3},
{PTA0, UART_0, 2},
{NC , NC , 0}
};

const PinMap PinMap_UART_RTS[] = {
{PTD4, UART_0, 3},
{PTE3 , UART_1, 3},
{PTE19, UART_2, 3},
{PTA3, UART_0, 2},
{NC , NC , 0}
};

/************SPI***************/
const PinMap PinMap_SPI_SCLK[] = {
{PTC5, SPI_0, 2},
{PTD1, SPI_0, 2},
{PTE2, SPI_1, 2},
{PTE17, SPI_0, 2},
{NC , NC , 0}
};

const PinMap PinMap_SPI_MOSI[] = {
{PTC6, SPI_0, 2},
{PTD2, SPI_0, 2},
{PTE1, SPI_1, 2},
{PTE3, SPI_1, 7},
{PTE18, SPI_0, 2},
{NC , NC , 0}
};

const PinMap PinMap_SPI_MISO[] = {
{PTC7, SPI_0, 2},
{PTD3, SPI_0, 2},
{PTE1, SPI_1, 7},
{PTE3, SPI_1, 2},
{PTE19, SPI_0, 2},
{NC , NC , 0}
};

const PinMap PinMap_SPI_SSEL[] = {
{PTC4, SPI_0, 2},
{PTE4, SPI_1, 2},
{PTE16, SPI_0, 2},
{NC , NC , 0}
};

/************PWM***************/
const PinMap PinMap_PWM[] = {
{PTC4, PWM_3, 4},
{PTD4, PWM_4, 4},
{PTD5, PWM_5, 4},
{PTD6, PWM_6, 4},
{PTD7, PWM_7, 4},
{PTA0, PWM_5, 3},
{PTA1, PWM_6, 3},
{PTA2, PWM_7, 3},
{PTA3, PWM_0, 3},
{PTA4, PWM_1, 3},
{NC , NC , 0}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_PINNAMES_H
#define MBED_PINNAMES_H

#include "cmsis.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
PIN_INPUT,
PIN_OUTPUT
} PinDirection;

#define GPIO_PORT_SHIFT 12

typedef enum {
PTA0 = (0 << GPIO_PORT_SHIFT | 0 ),
PTA1 = (0 << GPIO_PORT_SHIFT | 1 ),
PTA2 = (0 << GPIO_PORT_SHIFT | 2 ),
PTA3 = (0 << GPIO_PORT_SHIFT | 3 ),
PTA4 = (0 << GPIO_PORT_SHIFT | 4 ),
PTA18 = (0 << GPIO_PORT_SHIFT | 18),
PTA19 = (0 << GPIO_PORT_SHIFT | 19),
PTB3 = (1 << GPIO_PORT_SHIFT | 3),
PTB10 = (1 << GPIO_PORT_SHIFT | 10),
PTB11 = (1 << GPIO_PORT_SHIFT | 11),
PTB16 = (1 << GPIO_PORT_SHIFT | 16),
PTB17 = (1 << GPIO_PORT_SHIFT | 17),
PTB19 = (1 << GPIO_PORT_SHIFT | 19),
PTC0 = (2 << GPIO_PORT_SHIFT | 0 ),
PTC1 = (2 << GPIO_PORT_SHIFT | 1 ),
PTC3 = (2 << GPIO_PORT_SHIFT | 3 ),
PTC4 = (2 << GPIO_PORT_SHIFT | 4 ),
PTC5 = (2 << GPIO_PORT_SHIFT | 5 ),
PTC6 = (2 << GPIO_PORT_SHIFT | 6 ),
PTC7 = (2 << GPIO_PORT_SHIFT | 7 ),
PTD1 = (3 << GPIO_PORT_SHIFT | 1 ),
PTD2 = (3 << GPIO_PORT_SHIFT | 2 ),
PTD3 = (3 << GPIO_PORT_SHIFT | 3 ),
PTD4 = (3 << GPIO_PORT_SHIFT | 4 ),
PTD5 = (3 << GPIO_PORT_SHIFT | 5 ),
PTD6 = (3 << GPIO_PORT_SHIFT | 6 ),
PTD7 = (3 << GPIO_PORT_SHIFT | 7 ),
PTE0 = (4 << GPIO_PORT_SHIFT | 0 ),
PTE1 = (4 << GPIO_PORT_SHIFT | 1 ),
PTE2 = (4 << GPIO_PORT_SHIFT | 2 ),
PTE3 = (4 << GPIO_PORT_SHIFT | 3 ),
PTE4 = (4 << GPIO_PORT_SHIFT | 4 ),
PTE16 = (4 << GPIO_PORT_SHIFT | 16),
PTE17 = (4 << GPIO_PORT_SHIFT | 17),
PTE18 = (4 << GPIO_PORT_SHIFT | 18),
PTE19 = (4 << GPIO_PORT_SHIFT | 19),

LED_RED = PTD4,
LED_GREEN = PTD5,
LED_BLUE = PTD6,

// mbed original LED naming
LED1 = LED_RED,
LED2 = LED_GREEN,
LED3 = LED_BLUE,
LED4 = PTD7,

//Push buttons
SW1 = PTE4,
SW2 = PTE3,
SW3 = PTD1,
SW4 = PTA19,

// USB Pins
USBTX = PTE0,
USBRX = PTE1,

// Arduino Headers
D0 = PTD7,
D1 = PTD6,
D2 = PTD5,
D3 = PTD4,
D6 = PTE4,
D7 = PTD1,
D8 = PTA19,
D9 = PTA18,
D10 = PTC4,
D11 = PTC6,
D12 = PTC7,
D13 = PTC5,
D14 = PTD3,
D15 = PTD2,

I2C_SCL = D15,
I2C_SDA = D14,

// Not connected
NC = (int)0xFFFFFFFF
} PinName;


typedef enum {
PullNone = 0,
PullDown = 1,
PullUp = 2,
PullDefault = PullUp
} PinMode;

#ifdef __cplusplus
}
#endif

#endif
Loading