Skip to content

Commit 91c4fac

Browse files
author
Reda Maher
committed
[Riot Micro] Add Riot Micro cellular module targets
1 parent 5b06f23 commit 91c4fac

File tree

7 files changed

+553
-0
lines changed

7 files changed

+553
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2018 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+
17+
#if MBED_CONF_NSAPI_PRESENT
18+
19+
#include "ONBOARD_RM1000_AT.h"
20+
#include "cellular/onboard_modem_api.h"
21+
#include "UARTSerial.h"
22+
23+
#include "mbed-trace/mbed_trace.h"
24+
#ifndef TRACE_GROUP
25+
#define TRACE_GROUP "RIOTMICRO"
26+
#endif // TRACE_GROUP
27+
28+
using namespace mbed;
29+
30+
ONBOARD_RM1000_AT::ONBOARD_RM1000_AT(FileHandle *fh) : RM1000_AT(fh)
31+
{
32+
}
33+
34+
nsapi_error_t ONBOARD_RM1000_AT::hard_power_on()
35+
{
36+
tr_debug("Calling ONBOARD_RM1000_AT::hard_power_on");
37+
38+
return NSAPI_ERROR_OK;
39+
}
40+
41+
nsapi_error_t ONBOARD_RM1000_AT::hard_power_off()
42+
{
43+
tr_debug("Calling ONBOARD_RM1000_AT::hard_power_off");
44+
45+
return NSAPI_ERROR_OK;
46+
}
47+
48+
nsapi_error_t ONBOARD_RM1000_AT::soft_power_on()
49+
{
50+
tr_debug("Calling ONBOARD_RM1000_AT::soft_power_on");
51+
52+
::onboard_modem_init();
53+
return NSAPI_ERROR_OK;
54+
}
55+
56+
nsapi_error_t ONBOARD_RM1000_AT::soft_power_off()
57+
{
58+
tr_debug("Calling ONBOARD_RM1000_AT::soft_power_off");
59+
60+
::onboard_modem_deinit();
61+
return NSAPI_ERROR_OK;
62+
}
63+
64+
CellularDevice *CellularDevice::get_target_default_instance()
65+
{
66+
tr_debug("Calling CellularDevice::get_target_default_instance from ONBOARD_RM1000_AT");
67+
68+
static UARTSerial serial(MDM_UART3_TXD, MDM_UART3_RXD, 230400);
69+
#if DEVICE_SERIAL_FC
70+
if (MDM_UART3_RTS != NC && MDM_UART3_CTS != NC) {
71+
tr_debug("Modem flow control: RTS %d CTS %d", MDM_UART3_RTS, MDM_UART3_CTS);
72+
serial.set_flow_control(SerialBase::RTSCTS, MDM_UART3_RTS, MDM_UART3_CTS);
73+
}
74+
#endif
75+
static ONBOARD_RM1000_AT device(&serial);
76+
return &device;
77+
}
78+
79+
#endif // MBED_CONF_NSAPI_PRESENT
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2018 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+
17+
#ifndef ONBOARD_RM1000_AT_
18+
#define ONBOARD_RM1000_AT_
19+
20+
#include "RM1000_AT.h"
21+
22+
namespace mbed
23+
{
24+
25+
class ONBOARD_RM1000_AT : public RM1000_AT
26+
{
27+
public:
28+
ONBOARD_RM1000_AT(FileHandle *fh);
29+
30+
virtual nsapi_error_t hard_power_on();
31+
virtual nsapi_error_t hard_power_off();
32+
virtual nsapi_error_t soft_power_on();
33+
virtual nsapi_error_t soft_power_off();
34+
};
35+
36+
} // namespace mbed
37+
38+
#endif // ONBOARD_RM1000_AT_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#ifndef MBED_PINNAMES_H
2+
#define MBED_PINNAMES_H
3+
4+
#include "cmsis.h"
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
typedef enum {
11+
PIN_INPUT,
12+
PIN_OUTPUT
13+
} PinDirection;
14+
15+
#define PORT_SHIFT 3
16+
17+
typedef enum {
18+
// nRF52 pin names
19+
p0 = 0,
20+
p1 = 1,
21+
p2 = 2,
22+
p3 = 3,
23+
p4 = 4,
24+
p5 = 5,
25+
p6 = 6,
26+
p7 = 7,
27+
p8 = 8,
28+
p9 = 9,
29+
p10 = 10,
30+
p11 = 11,
31+
p12 = 12,
32+
p13 = 13,
33+
p14 = 14,
34+
p15 = 15,
35+
p16 = 16,
36+
p17 = 17,
37+
p18 = 18,
38+
p19 = 19,
39+
p20 = 20,
40+
p21 = 21,
41+
p22 = 22,
42+
p23 = 23,
43+
p24 = 24,
44+
p25 = 25,
45+
p26 = 26,
46+
p27 = 27,
47+
p28 = 28,
48+
p29 = 29,
49+
p30 = 30,
50+
p31 = 31,
51+
NC = (int)0xFFFFFFFF, // Not connected
52+
53+
P0_0 = p0,
54+
P0_1 = p1,
55+
P0_2 = p2,
56+
P0_3 = p3,
57+
P0_4 = p4,
58+
P0_5 = p5,
59+
P0_6 = p6,
60+
P0_7 = p7,
61+
62+
P0_8 = p8,
63+
P0_9 = p9,
64+
P0_10 = p10,
65+
P0_11 = p11,
66+
P0_12 = p12,
67+
P0_13 = p13,
68+
P0_14 = p14,
69+
P0_15 = p15,
70+
71+
P0_16 = p16,
72+
P0_17 = p17,
73+
P0_18 = p18,
74+
P0_19 = p19,
75+
P0_20 = p20,
76+
P0_21 = p21,
77+
P0_22 = p22,
78+
P0_23 = p23,
79+
80+
P0_24 = p24,
81+
P0_25 = p25,
82+
P0_26 = p26,
83+
P0_27 = p27,
84+
P0_28 = p28,
85+
P0_29 = p29,
86+
P0_30 = p30,
87+
P0_31 = p31,
88+
89+
MDMCHEN = p13,
90+
MDMREMAP = p14,
91+
MDMRST = p25,
92+
93+
MDM_UART0_TXD = p15,
94+
MDM_UART0_RXD = p16,
95+
MDM_UART1_TXD = p17,
96+
MDM_UART1_RXD = p18,
97+
98+
MDM_UART3_TXD = p19,
99+
MDM_UART3_RXD = p20,
100+
MDM_UART3_RTS = NC,
101+
MDM_UART3_CTS = NC,
102+
103+
LED1 = NC,
104+
105+
RX_PIN_NUMBER = NC,
106+
TX_PIN_NUMBER = NC,
107+
CTS_PIN_NUMBER = NC,
108+
RTS_PIN_NUMBER = NC,
109+
110+
// mBed interface Pins
111+
USBTX = TX_PIN_NUMBER,
112+
USBRX = RX_PIN_NUMBER,
113+
STDIO_UART_TX = TX_PIN_NUMBER,
114+
STDIO_UART_RX = RX_PIN_NUMBER,
115+
STDIO_UART_CTS = CTS_PIN_NUMBER,
116+
STDIO_UART_RTS = RTS_PIN_NUMBER,
117+
118+
A0 = NC,
119+
A1 = p4,
120+
A2 = p28,
121+
A3 = p29,
122+
A4 = p30,
123+
A5 = p31,
124+
} PinName;
125+
126+
typedef enum {
127+
PullNone = 0,
128+
PullDown = 1,
129+
PullUp = 3,
130+
PullDefault = PullUp
131+
} PinMode;
132+
133+
#ifdef __cplusplus
134+
}
135+
136+
#endif
137+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#ifndef MBED_PINNAMES_H
2+
#define MBED_PINNAMES_H
3+
4+
#include "cmsis.h"
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
typedef enum {
11+
PIN_INPUT,
12+
PIN_OUTPUT
13+
} PinDirection;
14+
15+
#define PORT_SHIFT 3
16+
17+
typedef enum {
18+
// nRF52 pin names
19+
p0 = 0,
20+
p1 = 1,
21+
p2 = 2,
22+
p3 = 3,
23+
p4 = 4,
24+
p5 = 5,
25+
p6 = 6,
26+
p7 = 7,
27+
p8 = 8,
28+
p9 = 9,
29+
p10 = 10,
30+
p11 = 11,
31+
p12 = 12,
32+
p13 = 13,
33+
p14 = 14,
34+
p15 = 15,
35+
p16 = 16,
36+
p17 = 17,
37+
p18 = 18,
38+
p19 = 19,
39+
p20 = 20,
40+
p21 = 21,
41+
p22 = 22,
42+
p23 = 23,
43+
p24 = 24,
44+
p25 = 25,
45+
p26 = 26,
46+
p27 = 27,
47+
p28 = 28,
48+
p29 = 29,
49+
p30 = 30,
50+
p31 = 31,
51+
NC = (int)0xFFFFFFFF, // Not connected
52+
53+
P0_0 = p0,
54+
P0_1 = p1,
55+
P0_2 = p2,
56+
P0_3 = p3,
57+
P0_4 = p4,
58+
P0_5 = p5,
59+
P0_6 = p6,
60+
P0_7 = p7,
61+
62+
P0_8 = p8,
63+
P0_9 = p9,
64+
P0_10 = p10,
65+
P0_11 = p11,
66+
P0_12 = p12,
67+
P0_13 = p13,
68+
P0_14 = p14,
69+
P0_15 = p15,
70+
71+
P0_16 = p16,
72+
P0_17 = p17,
73+
P0_18 = p18,
74+
P0_19 = p19,
75+
P0_20 = p20,
76+
P0_21 = p21,
77+
P0_22 = p22,
78+
P0_23 = p23,
79+
80+
P0_24 = p24,
81+
P0_25 = p25,
82+
P0_26 = p26,
83+
P0_27 = p27,
84+
P0_28 = p28,
85+
P0_29 = p29,
86+
P0_30 = p30,
87+
P0_31 = p31,
88+
89+
MDMCHEN = p13,
90+
MDMREMAP = p14,
91+
MDMRST = p25,
92+
93+
MDM_UART0_TXD = p15,
94+
MDM_UART0_RXD = p16,
95+
MDM_UART1_TXD = p17,
96+
MDM_UART1_RXD = p18,
97+
98+
MDM_UART3_TXD = p19,
99+
MDM_UART3_RXD = p20,
100+
MDM_UART3_RTS = NC,
101+
MDM_UART3_CTS = NC,
102+
103+
LED1 = NC,
104+
105+
RX_PIN_NUMBER = NC,
106+
TX_PIN_NUMBER = NC,
107+
CTS_PIN_NUMBER = NC,
108+
RTS_PIN_NUMBER = NC,
109+
110+
// mBed interface Pins
111+
USBTX = TX_PIN_NUMBER,
112+
USBRX = RX_PIN_NUMBER,
113+
STDIO_UART_TX = TX_PIN_NUMBER,
114+
STDIO_UART_RX = RX_PIN_NUMBER,
115+
STDIO_UART_CTS = CTS_PIN_NUMBER,
116+
STDIO_UART_RTS = RTS_PIN_NUMBER,
117+
118+
I2C_SDA0 = p12,
119+
I2C_SCL0 = p11,
120+
121+
A0 = p2,
122+
A1 = p28,
123+
A2 = p4,
124+
A3 = p29,
125+
A4 = p30,
126+
A5 = p31,
127+
} PinName;
128+
129+
typedef enum {
130+
PullNone = 0,
131+
PullDown = 1,
132+
PullUp = 3,
133+
PullDefault = PullUp
134+
} PinMode;
135+
136+
#ifdef __cplusplus
137+
}
138+
139+
#endif
140+
#endif

0 commit comments

Comments
 (0)