Skip to content

Commit 6feb5ed

Browse files
committed
maintain support for micromint bambino and lpcxpresso boards
1 parent 6bb92b1 commit 6feb5ed

File tree

3 files changed

+140
-2
lines changed

3 files changed

+140
-2
lines changed
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2006-2013 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#ifndef MBED_PERIPHERALNAMES_H
17+
#define MBED_PERIPHERALNAMES_H
18+
19+
#include "cmsis.h"
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
typedef enum {
26+
UART_0 = (int)LPC_USART0_BASE,
27+
UART_1 = (int)LPC_UART1_BASE,
28+
UART_2 = (int)LPC_USART2_BASE,
29+
UART_3 = (int)LPC_USART3_BASE
30+
} UARTName;
31+
32+
typedef enum {
33+
ADC0_0 = 0,
34+
ADC0_1,
35+
ADC0_2,
36+
ADC0_3,
37+
ADC0_4,
38+
ADC0_5,
39+
ADC0_6,
40+
ADC0_7,
41+
ADC1_0,
42+
ADC1_1,
43+
ADC1_2,
44+
ADC1_3,
45+
ADC1_4,
46+
ADC1_5,
47+
ADC1_6,
48+
ADC1_7
49+
} ADCName;
50+
51+
typedef enum {
52+
DAC_0 = 0
53+
} DACName;
54+
55+
typedef enum {
56+
SPI_0 = (int)LPC_SSP0_BASE,
57+
SPI_1 = (int)LPC_SSP1_BASE
58+
} SPIName;
59+
60+
typedef enum {
61+
I2C_0 = (int)LPC_I2C0_BASE,
62+
I2C_1 = (int)LPC_I2C1_BASE
63+
} I2CName;
64+
65+
typedef enum {
66+
PWM_0,
67+
PWM_1,
68+
PWM_2,
69+
PWM_3,
70+
PWM_4,
71+
PWM_5,
72+
PWM_6,
73+
PWM_7,
74+
PWM_8,
75+
PWM_9,
76+
PWM_10,
77+
PWM_11,
78+
PWM_12,
79+
PWM_13,
80+
PWM_14,
81+
PWM_15
82+
} PWMName;
83+
84+
typedef enum {
85+
CAN_0 = (int)LPC_C_CAN0_BASE,
86+
CAN_1 = (int)LPC_C_CAN1_BASE
87+
} CANName;
88+
89+
#define STDIO_UART_TX USBTX
90+
#define STDIO_UART_RX USBRX
91+
#define STDIO_UART UART_2
92+
#define STDIO_BAUD 115200
93+
94+
// Default peripherals
95+
#define MBED_SPI0 SPI0_MOSI, SPI0_MISO, SPI0_SCK, SPI0_SSEL
96+
#define MBED_SPI1 SPI1_MOSI, SPI1_MISO, SPI1_SCK, SPI1_SSEL
97+
98+
#define MBED_UART0 UART0_TX, UART0_RX
99+
#define MBED_UART1 UART1_TX, UART1_RX
100+
#define MBED_UART2 UART2_TX, UART2_RX
101+
#define MBED_UART3 UART3_TX, UART3_RX
102+
#define MBED_UARTUSB USBTX, USBRX
103+
104+
#define COM1 MBED_UART0
105+
#define COM2 MBED_UART1
106+
#define COM3 MBED_UART2
107+
#define COM4 MBED_UART3
108+
109+
#define MBED_I2C0 I2C0_SDA, I2C0_SCL
110+
#define MBED_I2C1 I2C1_SDA, I2C1_SCL
111+
112+
#define MBED_CAN0 p30, p29
113+
114+
#define MBED_ANALOGOUT0 DAC0
115+
116+
#define MBED_ANALOGIN0 ADC0
117+
#define MBED_ANALOGIN1 ADC1
118+
#define MBED_ANALOGIN2 ADC2
119+
#define MBED_ANALOGIN3 ADC3
120+
#define MBED_ANALOGIN4 ADC4
121+
#define MBED_ANALOGIN5 ADC5
122+
#define MBED_ANALOGIN6 ADC6
123+
#define MBED_ANALOGIN7 ADC7
124+
125+
#define MBED_PWMOUT0 p26
126+
#define MBED_PWMOUT1 p25
127+
#define MBED_PWMOUT2 p24
128+
#define MBED_PWMOUT3 p23
129+
#define MBED_PWMOUT4 p22
130+
#define MBED_PWMOUT5 p21
131+
132+
#ifdef __cplusplus
133+
}
134+
#endif
135+
136+
#endif

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC43XX/PeripheralNames.h renamed to libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC43XX/TARGET_LPC4337/PeripheralNames.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ typedef enum {
8989
#define STDIO_UART_TX USBTX
9090
#define STDIO_UART_RX USBRX
9191
#define STDIO_UART UART_0
92+
#define STDIO_BAUD 9600
9293

9394
// Default peripherals
9495
#define MBED_SPI0 SPI0_MOSI, SPI0_MISO, SPI0_SCK, SPI0_SSEL

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC43XX/serial_api.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
134134
| 0 << 2; // Rx Line Status irq enable
135135

136136
// set default baud rate and format
137-
serial_baud (obj, 9600);
137+
serial_baud (obj, 9600);
138138
serial_format(obj, 8, ParityNone, 1);
139139

140140
// pinout the chosen uart
@@ -160,9 +160,10 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
160160
serial_set_flow_control(obj, FlowControlNone, NC, NC);
161161

162162
is_stdio_uart = (uart == STDIO_UART) ? (1) : (0);
163-
163+
164164
if (is_stdio_uart) {
165165
stdio_uart_inited = 1;
166+
serial_baud (obj, STDIO_BAUD);
166167
memcpy(&stdio_uart, obj, sizeof(serial_t));
167168
}
168169
}

0 commit comments

Comments
 (0)