Skip to content

Commit 09b5551

Browse files
committed
[BEETLE] Add initial Beetle HAL files
This patch adds support for BEETLE SoC Target into the HAL layer. It contains: * Beetle Platform Configuration * I2C API * SPI API * Serial API * Port API * us Ticker API Signed-off-by: Vincenzo Frascino <[email protected]>
1 parent 44be062 commit 09b5551

19 files changed

+2743
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2015 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+
#include "i2c_def.h"
21+
#include "spi_def.h"
22+
23+
#ifdef __cplusplus
24+
extern "C" {
25+
#endif
26+
27+
typedef enum {
28+
UART_0 = (int)CMSDK_UART0_BASE,
29+
UART_1 = (int)CMSDK_UART1_BASE
30+
} UARTName;
31+
32+
typedef enum {
33+
I2C_0 = (int)I2C0_BASE,
34+
I2C_1 = (int)I2C1_BASE
35+
36+
} I2CName;
37+
38+
typedef enum {
39+
ADC0_0 = 0,
40+
ADC0_1,
41+
ADC0_2,
42+
ADC0_3,
43+
ADC0_4,
44+
ADC0_5
45+
} ADCName;
46+
47+
typedef enum {
48+
SPI_0 = (int)SPI0_BASE,
49+
SPI_1 = (int)SPI1_BASE
50+
} SPIName;
51+
52+
typedef enum {
53+
PWM_1 = 0,
54+
PWM_2,
55+
PWM_3,
56+
PWM_4,
57+
PWM_5,
58+
PWM_6,
59+
PWM_7,
60+
PWM_8,
61+
PWM_9,
62+
PWM_10,
63+
PWM_11
64+
} PWMName;
65+
66+
#define STDIO_UART_TX UART_TX1
67+
#define STDIO_UART_RX UART_RX1
68+
#define STDIO_UART UART_1
69+
70+
#define MBED_UART0 UART_TX0, UART_RX0
71+
#define MBED_UART1 UART_TX1, UART_RX1
72+
#define MBED_UARTUSB UART_TX1, UART_RX1
73+
74+
//USB UART
75+
#define USBTX UART_TX1
76+
#define USBRX UART_RX1
77+
78+
#ifdef __cplusplus
79+
}
80+
#endif
81+
82+
#endif
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2015 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_PINNAMES_H
17+
#define MBED_PINNAMES_H
18+
19+
#include "cmsis.h"
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
typedef enum {
26+
PIN_INPUT,
27+
PIN_OUTPUT
28+
} PinDirection;
29+
30+
#define PORT_SHIFT 5
31+
32+
typedef enum {
33+
/* BEETLE Pin Names */
34+
/* GPIO0 */
35+
P0_0 = 0,
36+
P0_1 = 1,
37+
P0_2 = 2,
38+
P0_3 = 3,
39+
P0_4 = 4,
40+
P0_5 = 5,
41+
P0_6 = 6,
42+
P0_7 = 7,
43+
P0_8 = 8,
44+
P0_9 = 9,
45+
P0_10 = 10,
46+
P0_11 = 11,
47+
P0_12 = 12,
48+
P0_13 = 13,
49+
P0_14 = 14,
50+
P0_15 = 15,
51+
52+
/* GPIO1 */
53+
P1_0 = 16,
54+
P1_1 = 17,
55+
P1_2 = 18,
56+
P1_3 = 19,
57+
P1_4 = 20,
58+
P1_5 = 21,
59+
P1_6 = 22,
60+
P1_7 = 23,
61+
P1_8 = 24,
62+
P1_9 = 25,
63+
P1_10 = 26,
64+
P1_11 = 27,
65+
P1_12 = 28,
66+
P1_13 = 29,
67+
P1_14 = 30,
68+
P1_15 = 31,
69+
70+
/* Arduino Connector Namings */
71+
A0 = 600,
72+
A1 = 601,
73+
A2 = 602,
74+
A3 = 603,
75+
A4 = 604,
76+
A5 = 605,
77+
D0 = P0_0,
78+
D1 = P0_1,
79+
D2 = P0_2,
80+
D3 = P0_3,
81+
D4 = P0_4,
82+
D5 = P0_5,
83+
D6 = P0_6,
84+
D7 = P0_7,
85+
D8 = P0_8,
86+
D9 = P0_9,
87+
D10 = P0_10,
88+
D11 = P0_11,
89+
D12 = P0_12,
90+
D13 = P0_13,
91+
D14 = P0_14,
92+
D15 = P0_15,
93+
94+
/* TRACE Ports */
95+
TRACECLK = P0_2,
96+
TRACED0 = P0_6,
97+
TRACED1 = P0_7,
98+
TRACED2 = P0_8,
99+
TRACED3 = P0_9,
100+
101+
/* Other BEETLE Pin Names */
102+
103+
//Shield SPI
104+
SHIELD_SPI_SCK = 320,
105+
SHIELD_SPI_MOSI = 321,
106+
SHIELD_SPI_MISO = 322,
107+
SHIELD_SPI_nCS = 323,
108+
109+
//ADC SPI
110+
ADC_SPI_MOSI = 650,
111+
ADC_SPI_MISO = 651,
112+
ADC_SPI_SCK = 652,
113+
ADC_SPI_nCS = 653,
114+
115+
//Uart
116+
UART_TX0 = 400,
117+
UART_RX0 = 401,
118+
UART_TX1 = 402,
119+
UART_RX1 = 403,
120+
121+
//Shield I2C
122+
SHIELD_SDA = 504,
123+
SHIELD_SCL = 505,
124+
125+
// Internal I2C for temperature and acceleromter sensor
126+
SENSOR_SDA = 506,
127+
SENSOR_SCL = 507,
128+
129+
// Not connected
130+
NC = (int)0xFFFFFFFF,
131+
// LEDS not connected
132+
LED1 = NC,
133+
LED2 = NC,
134+
LED3 = NC,
135+
LED4 = NC,
136+
} PinName;
137+
138+
typedef enum {
139+
PullUp = 2,
140+
PullDown = 1,
141+
PullNone = 0,
142+
Repeater = 3,
143+
OpenDrain = 4,
144+
PullDefault = PullDown
145+
} PinMode;
146+
147+
#ifdef __cplusplus
148+
}
149+
#endif
150+
151+
#endif
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2015 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_PORTNAMES_H
17+
#define MBED_PORTNAMES_H
18+
19+
#ifdef __cplusplus
20+
extern "C" {
21+
#endif
22+
23+
typedef enum {
24+
Port0 = 0,
25+
Port1 = 1
26+
} PortName;
27+
28+
#ifdef __cplusplus
29+
}
30+
#endif
31+
#endif
32+

0 commit comments

Comments
 (0)