Put PeripheralPin constant values in .c files, definitions in .h

pull/156/head
Sissors 2014-01-30 18:19:34 +01:00
parent 67972d03af
commit fb3fe6003a
4 changed files with 88 additions and 56 deletions

View File

@ -0,0 +1,49 @@
/* 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_PERIPHERALPINS_H
#define MBED_PERIPHERALPINS_H
#include "pinmap.h"
#include "PeripheralNames.h"
/************RTC***************/
extern const PinMap PinMap_RTC[];
/************ADC***************/
extern const PinMap PinMap_ADC[];
/************DAC***************/
extern const PinMap PinMap_DAC[];
/************I2C***************/
extern const PinMap PinMap_I2C_SDA[];
extern const PinMap PinMap_I2C_SCL[];
/************UART***************/
extern const PinMap PinMap_UART_TX[];
extern const PinMap PinMap_UART_RX[];
/************SPI***************/
extern const PinMap PinMap_SPI_SCLK[];
extern const PinMap PinMap_SPI_MOSI[];
extern const PinMap PinMap_SPI_MISO[];
extern const PinMap PinMap_SPI_SSEL[];
/************PWM***************/
extern const PinMap PinMap_PWM[];
#endif

View File

@ -13,20 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_PERIPHERALPINS_H
#define MBED_PERIPHERALPINS_H
#include "pinmap.h"
#include "PeripheralNames.h"
#include "PeripheralPins.h"
/************RTC***************/
static const PinMap PinMap_RTC[] = {
const PinMap PinMap_RTC[] = {
{NC, OSC32KCLK, 0},
};
/************ADC***************/
static const PinMap PinMap_ADC[] = {
const PinMap PinMap_ADC[] = {
/* A0-A5 pins */
{PTA0, ADC0_SE12, 0},
{PTA8, ADC0_SE3, 0},
@ -47,55 +43,55 @@ static const PinMap PinMap_ADC[] = {
};
/************DAC***************/
static const PinMap PinMap_DAC[] = {
const PinMap PinMap_DAC[] = {
{PTB1, DAC_0, 0},
{NC , NC , 0}
};
/************I2C***************/
static const PinMap PinMap_I2C_SDA[] = {
const PinMap PinMap_I2C_SDA[] = {
{PTB4, I2C_0, 2},
{NC , NC , 0}
};
static const PinMap PinMap_I2C_SCL[] = {
const PinMap PinMap_I2C_SCL[] = {
{PTB3, I2C_0, 2},
{NC , NC , 0}
};
/************UART***************/
static const PinMap PinMap_UART_TX[] = {
const PinMap PinMap_UART_TX[] = {
{PTB1, UART_0, 2},
{NC , NC , 0}
};
static const PinMap PinMap_UART_RX[] = {
const PinMap PinMap_UART_RX[] = {
{PTB2, UART_0, 2},
{NC , NC , 0}
};
/************SPI***************/
static const PinMap PinMap_SPI_SCLK[] = {
const PinMap PinMap_SPI_SCLK[] = {
{PTB0, SPI_0, 3},
{NC , NC , 0}
};
static const PinMap PinMap_SPI_MOSI[] = {
const PinMap PinMap_SPI_MOSI[] = {
{PTA7, SPI_0, 3},
{NC , NC , 0}
};
static const PinMap PinMap_SPI_MISO[] = {
const PinMap PinMap_SPI_MISO[] = {
{PTA6, SPI_0, 3},
{NC , NC , 0}
};
static const PinMap PinMap_SPI_SSEL[] = {
const PinMap PinMap_SPI_SSEL[] = {
{PTA5, SPI_0, 3},
{NC , NC , 0}
};
/************PWM***************/
static const PinMap PinMap_PWM[] = {
const PinMap PinMap_PWM[] = {
// LEDs
{LED_RED , PWM_4 , 2}, // PTB8 , TPM0 CH3
{LED_GREEN, PWM_3, 2}, // PTB9 , TPM0 CH2
@ -113,4 +109,3 @@ static const PinMap PinMap_PWM[] = {
{NC , NC , 0}
};
#endif

View File

@ -15,19 +15,15 @@
* limitations under the License.
*/
#ifndef MBED_PERIPHERALPINS_H
#define MBED_PERIPHERALPINS_H
#include "pinmap.h"
#include "PeripheralNames.h"
#include "PeripheralPins.h"
/************RTC***************/
static const PinMap PinMap_RTC[] = {
const PinMap PinMap_RTC[] = {
{PTC1, RTC_CLKIN, 2},
};
/************ADC***************/
static const PinMap PinMap_ADC[] = {
const PinMap PinMap_ADC[] = {
{PTE20, ADC0_SE0, 0},
{PTE22, ADC0_SE3, 0},
{PTE21, ADC0_SE4a, 0},
@ -48,13 +44,13 @@ static const PinMap PinMap_ADC[] = {
};
/************DAC***************/
static const PinMap PinMap_DAC[] = {
const PinMap PinMap_DAC[] = {
{PTE30, DAC_0, 0},
{NC , NC , 0}
};
/************I2C***************/
static const PinMap PinMap_I2C_SDA[] = {
const PinMap PinMap_I2C_SDA[] = {
{PTE25, I2C_0, 5},
{PTC9, I2C_0, 2},
{PTE0, I2C_1, 6},
@ -66,7 +62,7 @@ static const PinMap PinMap_I2C_SDA[] = {
{NC , NC , 0}
};
static const PinMap PinMap_I2C_SCL[] = {
const PinMap PinMap_I2C_SCL[] = {
{PTE24, I2C_0, 5},
{PTC8, I2C_0, 2},
{PTE1, I2C_1, 6},
@ -78,7 +74,7 @@ static const PinMap PinMap_I2C_SCL[] = {
};
/************UART***************/
static const PinMap PinMap_UART_TX[] = {
const PinMap PinMap_UART_TX[] = {
{PTC4, UART_1, 3},
{PTA2, UART_0, 2},
{PTD5, UART_2, 3},
@ -90,7 +86,7 @@ static const PinMap PinMap_UART_TX[] = {
{NC , NC , 0}
};
static const PinMap PinMap_UART_RX[] = {
const PinMap PinMap_UART_RX[] = {
{PTC3, UART_1, 3},
{PTA1, UART_0, 2},
{PTD4, UART_2, 3},
@ -103,7 +99,7 @@ static const PinMap PinMap_UART_RX[] = {
};
/************SPI***************/
static const PinMap PinMap_SPI_SCLK[] = {
const PinMap PinMap_SPI_SCLK[] = {
{PTA15, SPI_0, 2},
{PTB11, SPI_1, 2},
{PTC5, SPI_0, 2},
@ -113,7 +109,7 @@ static const PinMap PinMap_SPI_SCLK[] = {
{NC , NC , 0}
};
static const PinMap PinMap_SPI_MOSI[] = {
const PinMap PinMap_SPI_MOSI[] = {
{PTA16, SPI_0, 2},
{PTA17, SPI_0, 5},
{PTB16, SPI_1, 2},
@ -129,7 +125,7 @@ static const PinMap PinMap_SPI_MOSI[] = {
{NC , NC , 0}
};
static const PinMap PinMap_SPI_MISO[] = {
const PinMap PinMap_SPI_MISO[] = {
{PTA16, SPI_0, 5},
{PTA17, SPI_0, 2},
{PTB16, SPI_1, 5},
@ -145,7 +141,7 @@ static const PinMap PinMap_SPI_MISO[] = {
{NC , NC , 0}
};
static const PinMap PinMap_SPI_SSEL[] = {
const PinMap PinMap_SPI_SSEL[] = {
{PTA14, SPI_0, 2},
{PTB10, SPI_1, 2},
{PTC4, SPI_0, 2},
@ -156,7 +152,7 @@ static const PinMap PinMap_SPI_SSEL[] = {
};
/************PWM***************/
static const PinMap PinMap_PWM[] = {
const PinMap PinMap_PWM[] = {
// LEDs
{LED_RED , PWM_9 , 3}, // PTB18, TPM2 CH0
{LED_GREEN, PWM_10, 3}, // PTB19, TPM2 CH1
@ -200,5 +196,3 @@ static const PinMap PinMap_PWM[] = {
{NC , NC , 0}
};
#endif

View File

@ -14,19 +14,15 @@
* limitations under the License.
*/
#ifndef MBED_PERIPHERALPINS_H
#define MBED_PERIPHERALPINS_H
#include "pinmap.h"
#include "PeripheralNames.h"
#include "PeripheralPins.h"
/************RTC***************/
static const PinMap PinMap_RTC[] = {
const PinMap PinMap_RTC[] = {
{PTC1, RTC_CLKIN, 2},
};
/************ADC***************/
static const PinMap PinMap_ADC[] = {
const PinMap PinMap_ADC[] = {
{PTE20, ADC0_SE0, 0},
{PTE22, ADC0_SE3, 0},
{PTE21, ADC0_SE4a, 0},
@ -47,13 +43,13 @@ static const PinMap PinMap_ADC[] = {
};
/************DAC***************/
static const PinMap PinMap_DAC[] = {
const PinMap PinMap_DAC[] = {
{PTE30, DAC_0, 0},
{NC , NC , 0}
};
/************I2C***************/
static const PinMap PinMap_I2C_SDA[] = {
const PinMap PinMap_I2C_SDA[] = {
{PTE25, I2C_0, 5},
{PTC9, I2C_0, 2},
{PTE0, I2C_1, 6},
@ -65,7 +61,7 @@ static const PinMap PinMap_I2C_SDA[] = {
{NC , NC , 0}
};
static const PinMap PinMap_I2C_SCL[] = {
const PinMap PinMap_I2C_SCL[] = {
{PTE24, I2C_0, 5},
{PTC8, I2C_0, 2},
{PTE1, I2C_1, 6},
@ -77,7 +73,7 @@ static const PinMap PinMap_I2C_SCL[] = {
};
/************UART***************/
static const PinMap PinMap_UART_TX[] = {
const PinMap PinMap_UART_TX[] = {
{PTA2, UART_0, 2},
{PTA14, UART_0, 3},
{PTC4, UART_1, 3},
@ -91,7 +87,7 @@ static const PinMap PinMap_UART_TX[] = {
{NC , NC , 0}
};
static const PinMap PinMap_UART_RX[] = {
const PinMap PinMap_UART_RX[] = {
{PTA1, UART_0, 2},
{PTA15, UART_0, 3},
{PTC3, UART_1, 3},
@ -106,7 +102,7 @@ static const PinMap PinMap_UART_RX[] = {
};
/************SPI***************/
static const PinMap PinMap_SPI_SCLK[] = {
const PinMap PinMap_SPI_SCLK[] = {
{PTA15, SPI_0, 2},
{PTB9, SPI_1, 2},
{PTB11, SPI_1, 2},
@ -118,7 +114,7 @@ static const PinMap PinMap_SPI_SCLK[] = {
{NC , NC , 0}
};
static const PinMap PinMap_SPI_MOSI[] = {
const PinMap PinMap_SPI_MOSI[] = {
{PTA16, SPI_0, 2},
{PTA17, SPI_0, 5},
{PTB16, SPI_1, 2},
@ -136,7 +132,7 @@ static const PinMap PinMap_SPI_MOSI[] = {
{NC , NC , 0}
};
static const PinMap PinMap_SPI_MISO[] = {
const PinMap PinMap_SPI_MISO[] = {
{PTA16, SPI_0, 5},
{PTA17, SPI_0, 2},
{PTB16, SPI_1, 5},
@ -154,7 +150,7 @@ static const PinMap PinMap_SPI_MISO[] = {
{NC , NC , 0}
};
static const PinMap PinMap_SPI_SSEL[] = {
const PinMap PinMap_SPI_SSEL[] = {
{PTA14, SPI_0, 2},
{PTB10, SPI_1, 2},
{PTC4, SPI_0, 2},
@ -166,7 +162,7 @@ static const PinMap PinMap_SPI_SSEL[] = {
};
/************PWM***************/
static const PinMap PinMap_PWM[] = {
const PinMap PinMap_PWM[] = {
// LEDs - only RED pin is PWM capable
{LED_RED, PWM_3, 3}, // PTE29, TPM0 CH2
@ -211,5 +207,3 @@ static const PinMap PinMap_PWM[] = {
{NC , NC , 0}
};
#endif