Skip to content

Commit ee52f90

Browse files
authored
Merge pull request ARMmbed#5892 from OSHChip/master
add OSHChip as an mbed target
2 parents f9cd95f + 1fe0933 commit ee52f90

File tree

3 files changed

+245
-0
lines changed

3 files changed

+245
-0
lines changed
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
/*
2+
* Copyright (c) 2013 Nordic Semiconductor ASA
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without modification,
6+
* are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice, this list
9+
* of conditions and the following disclaimer.
10+
*
11+
* 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
12+
* integrated circuit in a product or a software update for such product, must reproduce
13+
* the above copyright notice, this list of conditions and the following disclaimer in
14+
* the documentation and/or other materials provided with the distribution.
15+
*
16+
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
17+
* used to endorse or promote products derived from this software without specific prior
18+
* written permission.
19+
*
20+
* 4. This software, with or without modification, must only be used with a
21+
* Nordic Semiconductor ASA integrated circuit.
22+
*
23+
* 5. Any software provided in binary or object form under this license must not be reverse
24+
* engineered, decompiled, modified and/or disassembled.
25+
*
26+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
30+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
33+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
*
37+
*/
38+
39+
#ifndef MBED_PINNAMES_H
40+
#define MBED_PINNAMES_H
41+
42+
#include "cmsis.h"
43+
44+
#ifdef __cplusplus
45+
extern "C" {
46+
#endif
47+
48+
typedef enum {
49+
PIN_INPUT,
50+
PIN_OUTPUT
51+
} PinDirection;
52+
53+
#define PORT_SHIFT 3
54+
55+
typedef enum {
56+
p0 = 0,
57+
p1 = 1,
58+
p2 = 2,
59+
p3 = 3,
60+
p4 = 4,
61+
p5 = 5,
62+
p6 = 6,
63+
p7 = 7,
64+
p8 = 8,
65+
p9 = 9,
66+
p10 = 10,
67+
p11 = 11,
68+
p12 = 12,
69+
p13 = 13,
70+
p14 = 14,
71+
p15 = 15,
72+
p16 = 16,
73+
p17 = 17,
74+
p18 = 18,
75+
p19 = 19,
76+
p20 = 20,
77+
p21 = 21,
78+
p22 = 22,
79+
p23 = 23,
80+
p24 = 24,
81+
p25 = 25,
82+
p26 = 26,
83+
p27 = 27,
84+
p28 = 28,
85+
p29 = 29,
86+
p30 = 30,
87+
88+
P0_0 = p0,
89+
P0_1 = p1,
90+
P0_2 = p2,
91+
P0_3 = p3,
92+
P0_4 = p4,
93+
P0_5 = p5,
94+
P0_6 = p6,
95+
P0_7 = p7,
96+
97+
P0_8 = p8,
98+
P0_9 = p9,
99+
P0_10 = p10,
100+
P0_11 = p11,
101+
P0_12 = p12,
102+
P0_13 = p13,
103+
P0_14 = p14,
104+
P0_15 = p15,
105+
106+
P0_16 = p16,
107+
P0_17 = p17,
108+
P0_18 = p18,
109+
P0_19 = p19,
110+
P0_20 = p20,
111+
P0_21 = p21,
112+
P0_22 = p22,
113+
P0_23 = p23,
114+
115+
P0_24 = p24,
116+
P0_25 = p25,
117+
P0_26 = p26,
118+
P0_27 = p27,
119+
P0_28 = p28,
120+
P0_29 = p29,
121+
P0_30 = p30,
122+
/*
123+
┏━━━━━━━━━━┓
124+
UART┬── TX D0 ╶┨ 1 ╒╕ 16 ┠╴ VCC
125+
└── RX D1 ╶┨ 2 ╘╛ 15 ┠╴ D8 SCL ─┬I²C
126+
D2 ╶┨ 3 14 ┠╴ D7 SDA ─┘
127+
SPI┬ MOSI D3 ╶┨ 4 13 ┠╴ A0
128+
│ MISO D4 ╶┨ 5 ┌──┐12 ┠╴ A1
129+
│ SEL D5 ╶┨ 6 └──┘11 ┠╴ D9 AREF
130+
└─ CLK D4 ╶┨ 7 10 ┠╴ A2
131+
GND ╶┨ 8 :: 9 ┠╴ A3
132+
┗━━━━━━━━━━┛
133+
*/
134+
135+
OSHCHIP_PIN_1 = p20,
136+
OSHCHIP_PIN_2 = p18,
137+
OSHCHIP_PIN_3 = p16,
138+
OSHCHIP_PIN_4 = p15,
139+
OSHCHIP_PIN_5 = p12,
140+
OSHCHIP_PIN_6 = p11,
141+
OSHCHIP_PIN_7 = p9,
142+
OSHCHIP_PIN_9 = p1,
143+
OSHCHIP_PIN_10 = p2,
144+
OSHCHIP_PIN_11 = p0,
145+
OSHCHIP_PIN_12 = p27,
146+
OSHCHIP_PIN_13 = p26,
147+
OSHCHIP_PIN_14 = p24,
148+
OSHCHIP_PIN_15 = p21,
149+
150+
LED1 = p8,
151+
LED2 = p5,
152+
LED3 = p3,
153+
154+
LED_RED = LED1,
155+
LED_GREEN = LED2,
156+
LED_BLUE = LED3,
157+
158+
RX_PIN_NUMBER = OSHCHIP_PIN_2,
159+
TX_PIN_NUMBER = OSHCHIP_PIN_1,
160+
CTS_PIN_NUMBER = (int)0xFFFFFFFF, //no connection
161+
RTS_PIN_NUMBER = (int)0xFFFFFFFF, //no connection
162+
163+
// mBed interface Pins
164+
USBTX = TX_PIN_NUMBER,
165+
USBRX = RX_PIN_NUMBER,
166+
167+
SPI_PSELMOSI0 = OSHCHIP_PIN_4,
168+
SPI_PSELMISO0 = OSHCHIP_PIN_5,
169+
SPI_PSELSS0 = OSHCHIP_PIN_6,
170+
SPI_PSELSCK0 = OSHCHIP_PIN_7,
171+
172+
SPI_PSELMOSI1 = OSHCHIP_PIN_4,
173+
SPI_PSELMISO1 = OSHCHIP_PIN_5,
174+
SPI_PSELSS1 = OSHCHIP_PIN_6,
175+
SPI_PSELSCK1 = OSHCHIP_PIN_7,
176+
177+
SPIS_PSELMOSI = OSHCHIP_PIN_4,
178+
SPIS_PSELMISO = OSHCHIP_PIN_5,
179+
SPIS_PSELSS = OSHCHIP_PIN_6,
180+
SPIS_PSELSCK = OSHCHIP_PIN_7,
181+
182+
I2C_SDA0 = OSHCHIP_PIN_14,
183+
I2C_SCL0 = OSHCHIP_PIN_15,
184+
185+
D0 = OSHCHIP_PIN_1,
186+
D1 = OSHCHIP_PIN_2,
187+
D2 = OSHCHIP_PIN_3,
188+
D3 = OSHCHIP_PIN_4,
189+
D4 = OSHCHIP_PIN_5,
190+
D5 = OSHCHIP_PIN_6,
191+
D6 = OSHCHIP_PIN_7,
192+
D7 = OSHCHIP_PIN_15,
193+
D8 = OSHCHIP_PIN_14,
194+
D9 = OSHCHIP_PIN_11,
195+
196+
A0 = OSHCHIP_PIN_13,
197+
A1 = OSHCHIP_PIN_12,
198+
A2 = OSHCHIP_PIN_10,
199+
A3 = OSHCHIP_PIN_9,
200+
201+
// Not connected
202+
NC = (int)0xFFFFFFFF
203+
} PinName;
204+
205+
typedef enum {
206+
PullNone = 0,
207+
PullDown = 1,
208+
PullUp = 3,
209+
PullDefault = PullUp
210+
} PinMode;
211+
212+
#ifdef __cplusplus
213+
}
214+
#endif
215+
216+
#endif
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches.
2+
// Check the 'features' section of the target description in 'targets.json' for more details.
3+
/* mbed Microcontroller Library
4+
* Copyright (c) 2006-2013 ARM Limited
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
#ifndef MBED_DEVICE_H
19+
#define MBED_DEVICE_H
20+
21+
#include "objects.h"
22+
23+
#endif

targets/targets.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3433,6 +3433,12 @@
34333433
"device_has": ["I2C", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE"],
34343434
"release_versions": ["2", "5"]
34353435
},
3436+
"OSHCHIP": {
3437+
"inherits": ["MCU_NRF51_32K_UNIFIED"],
3438+
"overrides": {"lf_clock_src": "NRF_LF_SRC_RC"},
3439+
"device_has": ["ANALOGIN", "I2C", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
3440+
"device_name": "nRF51822_xxAC"
3441+
},
34363442
"MCU_NRF52": {
34373443
"inherits": ["Target"],
34383444
"core": "Cortex-M4F",

0 commit comments

Comments
 (0)