Skip to content

Commit 269d151

Browse files
author
Ari Parkkila
committed
Cellular: Default modem drivers with FF_ARDUINO
1 parent 75caa75 commit 269d151

File tree

37 files changed

+164
-99
lines changed

37 files changed

+164
-99
lines changed

features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void GEMALTO_CINTERION::init_module_ems31()
135135
_module = ModuleEMS31;
136136
}
137137

138-
#if MBED_CONF_GEMALTO_CINTERION_DEFAULT_CELLULAR_DEVICE
138+
#if MBED_CONF_GEMALTO_CINTERION_PROVIDE_DEFAULT
139139
#include "UARTSerial.h"
140140
CellularDevice *CellularDevice::get_default_instance()
141141
{

features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,21 @@
1818
#ifndef GEMALTO_CINTERION_H_
1919
#define GEMALTO_CINTERION_H_
2020

21+
#ifdef TARGET_FF_ARDUINO
22+
#ifndef MBED_CONF_GEMALTO_CINTERION_TX
23+
#define MBED_CONF_GEMALTO_CINTERION_TX D1
24+
#endif
25+
#ifndef MBED_CONF_GEMALTO_CINTERION_RX
26+
#define MBED_CONF_GEMALTO_CINTERION_RX D0
27+
#endif
28+
#endif /* TARGET_FF_ARDUINO */
29+
2130
#include "AT_CellularDevice.h"
2231

2332
namespace mbed {
2433

2534
class GEMALTO_CINTERION : public AT_CellularDevice {
2635
public:
27-
2836
GEMALTO_CINTERION(FileHandle *fh);
2937

3038
/** Actual model of cellular module is needed to make AT command adaptation at runtime

features/cellular/framework/targets/GEMALTO/CINTERION/mbed_lib.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"name": "GEMALTO_CINTERION",
33
"config": {
44
"tx": {
5-
"help": "TX pin for serial connection",
5+
"help": "TX pin for serial connection. D1 assumed if Arduino Form Factor, needs to be set/overwritten otherwise.",
66
"value": null
77
},
88
"rx": {
9-
"help": "RX pin for serial connection",
9+
"help": "RX pin for serial connection. D0 assumed if Arduino Form Factor, needs to be set/overwritten otherwise.",
1010
"value": null
1111
},
1212
"rts": {
@@ -21,15 +21,9 @@
2121
"help": "Serial connection baud rate",
2222
"value": 115200
2323
},
24-
"default-cellular-device": {
24+
"provide-default": {
2525
"help": "Provide as default CellularDevice [true/false]",
2626
"value": false
2727
}
28-
},
29-
"target_overrides": {
30-
"K64F": {
31-
"rx": "D0",
32-
"tx": "D1"
33-
}
3428
}
3529
}

features/cellular/framework/targets/GENERIC/GENERIC_AT3GPP/GENERIC_AT3GPP.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ GENERIC_AT3GPP::GENERIC_AT3GPP(FileHandle *fh) : AT_CellularDevice(fh)
3838
AT_CellularBase::set_cellular_properties(cellular_properties);
3939
}
4040

41-
GENERIC_AT3GPP::~GENERIC_AT3GPP()
41+
#if MBED_CONF_GENERIC_AT3GPP_PROVIDE_DEFAULT
42+
#include "UARTSerial.h"
43+
CellularDevice *CellularDevice::get_default_instance()
4244
{
45+
static UARTSerial serial(MBED_CONF_GENERIC_AT3GPP_TX, MBED_CONF_GENERIC_AT3GPP_RX, MBED_CONF_GENERIC_AT3GPP_BAUDRATE);
46+
#if defined (MBED_CONF_GENERIC_AT3GPP_RTS) && defined(MBED_CONF_GENERIC_AT3GPP_CTS)
47+
tr_info("GENERIC_AT3GPP flow control: RTS %d CTS %d", MBED_CONF_GENERIC_AT3GPP_RTS, MBED_CONF_GENERIC_AT3GPP_CTS);
48+
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_GENERIC_AT3GPP_RTS, MBED_CONF_GENERIC_AT3GPP_CTS);
49+
#endif
50+
static GENERIC_AT3GPP device(&serial);
51+
return &device;
4352
}
53+
#endif

features/cellular/framework/targets/GENERIC/GENERIC_AT3GPP/GENERIC_AT3GPP.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
#ifndef GENERIC_AT3GPP_H_
1919
#define GENERIC_AT3GPP_H_
2020

21+
#ifdef TARGET_FF_ARDUINO
22+
#ifndef MBED_CONF_GENERIC_AT3GPP_TX
23+
#define MBED_CONF_GENERIC_AT3GPP_TX D1
24+
#endif
25+
#ifndef MBED_CONF_GENERIC_AT3GPP_RX
26+
#define MBED_CONF_GENERIC_AT3GPP_RX D0
27+
#endif
28+
#endif /* TARGET_FF_ARDUINO */
29+
2130
#include "AT_CellularDevice.h"
2231

2332
namespace mbed {
@@ -38,8 +47,6 @@ namespace mbed {
3847
class GENERIC_AT3GPP : public AT_CellularDevice {
3948
public:
4049
GENERIC_AT3GPP(FileHandle *fh);
41-
virtual ~GENERIC_AT3GPP();
42-
4350
};
4451
} // namespace mbed
4552
#endif // GENERIC_AT3GPP_H_
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "GENERIC_AT3GPP",
3+
"config": {
4+
"tx": {
5+
"help": "TX pin for serial connection. D1 assumed if Arduino Form Factor, needs to be set/overwritten otherwise.",
6+
"value": null
7+
},
8+
"rx": {
9+
"help": "RX pin for serial connection. D0 assumed if Arduino Form Factor, needs to be set/overwritten otherwise.",
10+
"value": null
11+
},
12+
"rts": {
13+
"help": "RTS pin for serial connection",
14+
"value": null
15+
},
16+
"cts": {
17+
"help": "CTS pin for serial connection",
18+
"value": null
19+
},
20+
"baudrate" : {
21+
"help": "Serial connection baud rate",
22+
"value": 115200
23+
},
24+
"provide-default": {
25+
"help": "Provide as default CellularDevice [true/false]",
26+
"value": false
27+
}
28+
}
29+
}

features/cellular/framework/targets/MultiTech/DragonflyNano/PPP/SARA4_PPP.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,12 @@ SARA4_PPP::SARA4_PPP(FileHandle *fh) : AT_CellularDevice(fh)
3838
AT_CellularBase::set_cellular_properties(cellular_properties);
3939
}
4040

41-
SARA4_PPP::~SARA4_PPP()
42-
{
43-
}
44-
4541
AT_CellularNetwork *SARA4_PPP::open_network_impl(ATHandler &at)
4642
{
4743
return new SARA4_PPP_CellularNetwork(at);
4844
}
4945

50-
#if MBED_CONF_SARA4_PPP_DEFAULT_CELLULAR_DEVICE
46+
#if MBED_CONF_SARA4_PPP_PROVIDE_DEFAULT
5147
#include "UARTSerial.h"
5248
CellularDevice *CellularDevice::get_default_instance()
5349
{

features/cellular/framework/targets/MultiTech/DragonflyNano/PPP/SARA4_PPP.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
#ifndef SARA4_PPP_H_
1919
#define SARA4_PPP_H_
2020

21+
#ifdef TARGET_FF_ARDUINO
22+
#ifndef MBED_CONF_SARA4_PPP_TX
23+
#define MBED_CONF_SARA4_PPP_TX D1
24+
#endif
25+
#ifndef MBED_CONF_SARA4_PPP_RX
26+
#define MBED_CONF_SARA4_PPP_RX D0
27+
#endif
28+
#endif /* TARGET_FF_ARDUINO */
29+
2130
#include "AT_CellularDevice.h"
2231

2332
namespace mbed {
@@ -26,7 +35,6 @@ class SARA4_PPP : public AT_CellularDevice {
2635

2736
public:
2837
SARA4_PPP(FileHandle *fh);
29-
virtual ~SARA4_PPP();
3038

3139
public: // CellularDevice
3240
virtual AT_CellularNetwork *open_network_impl(ATHandler &at);

features/cellular/framework/targets/MultiTech/DragonflyNano/PPP/mbed_lib.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"name": "SARA4_PPP",
33
"config": {
44
"tx": {
5-
"help": "TX pin for serial connection",
5+
"help": "TX pin for serial connection. D1 assumed if Arduino Form Factor, needs to be set/overwritten otherwise.",
66
"value": null
77
},
88
"rx": {
9-
"help": "RX pin for serial connection",
9+
"help": "RX pin for serial connection. D0 assumed if Arduino Form Factor, needs to be set/overwritten otherwise.",
1010
"value": null
1111
},
1212
"rts": {
@@ -21,7 +21,7 @@
2121
"help": "Serial connection baud rate",
2222
"value": 115200
2323
},
24-
"default-cellular-device": {
24+
"provide-default": {
2525
"help": "Provide as default CellularDevice [true/false]",
2626
"value": false
2727
}

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ QUECTEL_BC95::QUECTEL_BC95(FileHandle *fh) : AT_CellularDevice(fh)
4545
AT_CellularBase::set_cellular_properties(cellular_properties);
4646
}
4747

48-
QUECTEL_BC95::~QUECTEL_BC95()
49-
{
50-
}
51-
5248
nsapi_error_t QUECTEL_BC95::get_sim_state(SimState &state)
5349
{
5450
_at->lock();
@@ -105,7 +101,7 @@ nsapi_error_t QUECTEL_BC95::reset()
105101
return _at->unlock_return_error();
106102
}
107103

108-
#if MBED_CONF_QUECTEL_BC95_DEFAULT_CELLULAR_DEVICE
104+
#if MBED_CONF_QUECTEL_BC95_PROVIDE_DEFAULT
109105
#include "UARTSerial.h"
110106
CellularDevice *CellularDevice::get_default_instance()
111107
{

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,22 @@
1818
#ifndef QUECTEL_BC95_H_
1919
#define QUECTEL_BC95_H_
2020

21+
#ifdef TARGET_FF_ARDUINO
22+
#ifndef MBED_CONF_QUECTEL_BC95_TX
23+
#define MBED_CONF_QUECTEL_BC95_TX D1
24+
#endif
25+
#ifndef MBED_CONF_QUECTEL_BC95_RX
26+
#define MBED_CONF_QUECTEL_BC95_RX D0
27+
#endif
28+
#endif /* TARGET_FF_ARDUINO */
29+
2130
#include "AT_CellularDevice.h"
2231

2332
namespace mbed {
2433

2534
class QUECTEL_BC95 : public AT_CellularDevice {
2635
public:
2736
QUECTEL_BC95(FileHandle *fh);
28-
virtual ~QUECTEL_BC95();
2937

3038
public: // AT_CellularDevice
3139
virtual nsapi_error_t get_sim_state(SimState &state);

features/cellular/framework/targets/QUECTEL/BC95/mbed_lib.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"name": "QUECTEL_BC95",
33
"config": {
44
"tx": {
5-
"help": "TX pin for serial connection",
5+
"help": "TX pin for serial connection. D1 assumed if Arduino Form Factor, needs to be set/overwritten otherwise.",
66
"value": null
77
},
88
"rx": {
9-
"help": "RX pin for serial connection",
9+
"help": "RX pin for serial connection. D0 assumed if Arduino Form Factor, needs to be set/overwritten otherwise.",
1010
"value": null
1111
},
1212
"rts": {
@@ -21,7 +21,7 @@
2121
"help": "Serial connection baud rate",
2222
"value": 9600
2323
},
24-
"default-cellular-device": {
24+
"provide-default": {
2525
"help": "Provide as default CellularDevice [true/false]",
2626
"value": false
2727
}

features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ QUECTEL_BG96::QUECTEL_BG96(FileHandle *fh) : AT_CellularDevice(fh)
4848
AT_CellularBase::set_cellular_properties(cellular_properties);
4949
}
5050

51-
QUECTEL_BG96::~QUECTEL_BG96()
52-
{
53-
}
54-
5551
AT_CellularNetwork *QUECTEL_BG96::open_network_impl(ATHandler &at)
5652
{
5753
return new QUECTEL_BG96_CellularNetwork(at);
@@ -72,7 +68,7 @@ void QUECTEL_BG96::set_ready_cb(Callback<void()> callback)
7268
_at->set_urc_handler(DEVICE_READY_URC, callback);
7369
}
7470

75-
#if MBED_CONF_QUECTEL_BG96_DEFAULT_CELLULAR_DEVICE
71+
#if MBED_CONF_QUECTEL_BG96_PROVIDE_DEFAULT
7672
#include "UARTSerial.h"
7773
CellularDevice *CellularDevice::get_default_instance()
7874
{

features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,22 @@
1818
#ifndef QUECTEL_BG96_H_
1919
#define QUECTEL_BG96_H_
2020

21+
#ifdef TARGET_FF_ARDUINO
22+
#ifndef MBED_CONF_QUECTEL_BG96_TX
23+
#define MBED_CONF_QUECTEL_BG96_TX D1
24+
#endif
25+
#ifndef MBED_CONF_QUECTEL_BG96_RX
26+
#define MBED_CONF_QUECTEL_BG96_RX D0
27+
#endif
28+
#endif /* TARGET_FF_ARDUINO */
29+
2130
#include "AT_CellularDevice.h"
2231

2332
namespace mbed {
2433

2534
class QUECTEL_BG96 : public AT_CellularDevice {
2635
public:
2736
QUECTEL_BG96(FileHandle *fh);
28-
virtual ~QUECTEL_BG96();
2937

3038
protected: // AT_CellularDevice
3139
virtual AT_CellularNetwork *open_network_impl(ATHandler &at);
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "QUECTEL_BB96",
2+
"name": "QUECTEL_BG96",
33
"config": {
44
"tx": {
5-
"help": "TX pin for serial connection",
5+
"help": "TX pin for serial connection. D1 assumed if Arduino Form Factor, needs to be set/overwritten otherwise.",
66
"value": null
77
},
88
"rx": {
9-
"help": "RX pin for serial connection",
9+
"help": "RX pin for serial connection. D0 assumed if Arduino Form Factor, needs to be set/overwritten otherwise.",
1010
"value": null
1111
},
1212
"rts": {
@@ -21,15 +21,9 @@
2121
"help": "Serial connection baud rate",
2222
"value": 115200
2323
},
24-
"default-cellular-device": {
24+
"provide-default": {
2525
"help": "Provide as default CellularDevice [true/false]",
2626
"value": false
2727
}
28-
},
29-
"target_overrides": {
30-
"K64F": {
31-
"rx": "PTC16",
32-
"tx": "PTC17"
33-
}
3428
}
3529
}

features/cellular/framework/targets/QUECTEL/UG96/QUECTEL_UG96.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,12 @@ QUECTEL_UG96::QUECTEL_UG96(FileHandle *fh) : AT_CellularDevice(fh)
4444
AT_CellularBase::set_cellular_properties(cellular_properties);
4545
}
4646

47-
QUECTEL_UG96::~QUECTEL_UG96()
48-
{
49-
}
50-
5147
AT_CellularContext *QUECTEL_UG96::create_context_impl(ATHandler &at, const char *apn, bool cp_req, bool nonip_req)
5248
{
5349
return new QUECTEL_UG96_CellularContext(at, this, apn, cp_req, nonip_req);
5450
}
5551

56-
#if MBED_CONF_QUECTEL_UG96_DEFAULT_CELLULAR_DEVICE
52+
#if MBED_CONF_QUECTEL_UG96_PROVIDE_DEFAULT
5753
#include "UARTSerial.h"
5854
CellularDevice *CellularDevice::get_default_instance()
5955
{

features/cellular/framework/targets/QUECTEL/UG96/QUECTEL_UG96.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
#ifndef QUECTEL_UG96_H_
1919
#define QUECTEL_UG96_H_
2020

21+
#ifdef TARGET_FF_ARDUINO
22+
#ifndef MBED_CONF_QUECTEL_UG96_TX
23+
#define MBED_CONF_QUECTEL_UG96_TX D1
24+
#endif
25+
#ifndef MBED_CONF_QUECTEL_UG96_RX
26+
#define MBED_CONF_QUECTEL_UG96_RX D0
27+
#endif
28+
#endif /* TARGET_FF_ARDUINO */
29+
2130
#include "AT_CellularDevice.h"
2231

2332
namespace mbed {
@@ -33,7 +42,6 @@ namespace mbed {
3342
class QUECTEL_UG96 : public AT_CellularDevice {
3443
public:
3544
QUECTEL_UG96(FileHandle *fh);
36-
virtual ~QUECTEL_UG96();
3745

3846
protected: // AT_CellularDevice
3947
virtual nsapi_error_t power_on();

0 commit comments

Comments
 (0)