Skip to content

Add Support for TOSHIBA TMPM3HQ #8324

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

Merged
merged 4 commits into from Nov 9, 2018
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
130 changes: 130 additions & 0 deletions targets/TARGET_TOSHIBA/TARGET_TMPM3HQ/PeripheralNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/* mbed Microcontroller Library
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2018 All rights reserved
*
* 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 "PinNames.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
SERIAL_0 = 0,
SERIAL_1,
SERIAL_2,
SERIAL_3,
SERIAL_4,
SERIAL_5,
INVALID_SERIAL = (int)NC
} UARTName;

typedef enum {
ADC_AINA00 = 0,
ADC_AINA01,
ADC_AINA02,
ADC_AINA03,
ADC_AINA04,
ADC_AINA05,
ADC_AINA06,
ADC_AINA07,
ADC_AINA08,
ADC_AINA09,
ADC_AINA10,
ADC_AINA11,
ADC_AINA12,
ADC_AINA13,
ADC_AINA14,
ADC_AINA15,
ADC_AINA16,
ADC_AINA17,
ADC_AINA18,
ADC_AINA19,
ADC_AINA20,
INVALID_ADC = (int)NC
} ADCName;

typedef enum {
DAC_A0 = 0,
DAC_A1,
INVALID_DAC = (int)NC
} DACName;

typedef enum {
SPI_0 = 0,
SPI_1,
SPI_2,
SPI_3,
SPI_4,
INVALID_SPI = (int)NC
} SPIName;

typedef enum {
I2C_0 = 0,
I2C_1,
I2C_2,
I2C_3,
INVALID_I2C = (int)NC
} I2CName;

typedef enum {
PWM_0 = 0,
PWM_1,
PWM_2,
PWM_3,
PWM_4,
PWM_5,
PWM_6,
PWM_7,
INVALID_PWM = (int)NC
} PWMName;

typedef enum {
GPIO_IRQ_00 = 0,
GPIO_IRQ_01,
GPIO_IRQ_02,
GPIO_IRQ_03,
GPIO_IRQ_04,
GPIO_IRQ_05,
GPIO_IRQ_06,
GPIO_IRQ_07,
GPIO_IRQ_08,
GPIO_IRQ_09,
GPIO_IRQ_10,
GPIO_IRQ_11,
GPIO_IRQ_12,
GPIO_IRQ_13,
GPIO_IRQ_14,
GPIO_IRQ_15,
GPIO_IRQ_16,
GPIO_IRQ_17_18,
GPIO_IRQ_19_22,
GPIO_IRQ_23_26,
GPIO_IRQ_27_28,
GPIO_IRQ_29,
GPIO_IRQ_30_31,
INVALID_GPIO_IRQ = (int)NC
} gpio_irqname;

#define STDIO_UART_TX USBTX
#define STDIO_UART_RX USBRX
#define STDIO_UART SERIAL_1

#ifdef __cplusplus
}
#endif

#endif
145 changes: 145 additions & 0 deletions targets/TARGET_TOSHIBA/TARGET_TMPM3HQ/PinNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/* mbed Microcontroller Library
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2018 All rights reserved
*
* 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,
PIN_INOUT
} PinDirection;

typedef enum {
// TMPM3HQ Pin Names
PA0 = 0 << 3, PA1, PA2, PA3, PA4, PA5, PA6, PA7,
PB0 = 1 << 3, PB1, PB2, PB3, PB4, PB5, PB6, PB7,
PC0 = 2 << 3, PC1, PC2, PC3, PC4, PC5, PC6,
PD0 = 3 << 3, PD1, PD2, PD3, PD4, PD5,
PE0 = 4 << 3, PE1, PE2, PE3, PE4, PE5, PE6,
PF0 = 5 << 3, PF1, PF2, PF3, PF4, PF5, PF6, PF7,
PG0 = 6 << 3, PG1, PG2, PG3, PG4, PG5, PG6, PG7,
PH0 = 7 << 3, PH1, PH2, PH3, PH4, PH5, PH6, PH7,
PJ0 = 8 << 3, PJ1, PJ2, PJ3, PJ4, PJ5,
PK0 = 9 << 3, PK1, PK2, PK3, PK4, PK5, PK6, PK7,
PL0 = 10 << 3, PL1, PL2, PL3, PL4, PL5, PL6, PL7,
PM0 = 11 << 3, PM1, PM2, PM3, PM4, PM5, PM6, PM7,
PN0 = 12 << 3, PN1, PN2, PN3, PN4, PN5,
PP0 = 13 << 3, PP1, PP2, PP3, PP4, PP5, PP6, PP7,
PR0 = 14 << 3, PR1, PR2, PR3, PR4, PR5, PR6, PR7,
PT0 = 15 << 3, PT1, PT2, PT3, PT4, PT5, PT6, PT7,
PU0 = 16 << 3, PU1, PU2, PU3, PU4, PU5,
PV0 = 17 << 3, PV1, PV2, PV3, PV4, PV5, PV6, PV7,

// LED
LED1 = PK4,
LED2 = PK5,
LED3 = PK6,
LED4 = PK7,

// External data bus Pin Names
D0 = PV7,
D1 = PV6,
D2 = PC4,
D3 = PK2,
D4 = PC3,
D5 = PJ0,
D6 = PN0,
D7 = PM6,
D8 = PT0,
D9 = PG2,
D10 = PT1,
D11 = PT3,
D12 = PT4,
D13 = PT2,
D14 = PC1,
D15 = PC0,

// Analogue out pins
A0 = PF2,
A1 = PF3,
A2 = PF4,
A3 = PF5,
A4 = PF6,
A5 = PF7,

// DAC
DAC0 = PG0,
DAC1 = PG1,

// DAP_UART
USBTX = PJ1,
USBRX = PJ2,
MBEDIF_TXD = USBTX,
MBEDIF_RXD = USBRX,

// Push buttons
SW1 = PV0,
SW2 = PV1,
SW3 = PV2,
SW4 = PV3,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please create an alias for "USER_BUTTON" just to maintain consistency with other mbed targets? Thanks.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ashok-rao, added the alias for "USER_BUTTON".


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ganesh-ramachandran : No SPI pins brought out on the board?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ashok-rao, added the SPI pin definitions in PinNames.h

// Standardized button names
BUTTON1 = SW1,
BUTTON2 = SW2,
BUTTON3 = SW3,
BUTTON4 = SW4,

// TSPI2
MOSI = D11,
MISO = D12,
SCLK = D13,
CS = D10,

// SD Shield TSPI2
SD_SEL = CS, // Chip select
SD_CLK = SCLK, // SPI clock
SD_MISO = MISO, // Master in Salve out
SD_MOSI = MOSI, // Master out Salve in

// I2C pins
SDA = D14,
SCL = D15,
I2C_SDA = SDA,
I2C_SCL = SCL,

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

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

typedef enum {
DISABLE = 0,
ENABLE
} FunctionalState;

#ifdef __cplusplus
}
#endif

#endif
50 changes: 50 additions & 0 deletions targets/TARGET_TOSHIBA/TARGET_TMPM3HQ/PortNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* mbed Microcontroller Library
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2018 All rights reserved
*
* 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_PORTNAMES_H
#define MBED_PORTNAMES_H

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
PortA = 0,
PortB,
PortC,
PortD,
PortE,
PortF,
PortG,
PortH,
PortJ,
PortK,
PortL,
PortM,
PortN,
PortP,
PortR,
PortT,
PortU,
PortV
} PortName;

#define IS_GPIO_PORT(param) ((param) <= PortV) // parameter checking for port number

#ifdef __cplusplus
}
#endif

#endif
Loading