![](/media/cache/profiles/5f55d0baa59f4bc1dc393149183f1492.jpg.50x50_q85.jpg)
Changes to enabled on-line compiler
platform/ezconnect/README.md@0:082731ede69f, 2018-05-30 (annotated)
- Committer:
- JMF
- Date:
- Wed May 30 20:59:51 2018 +0000
- Revision:
- 0:082731ede69f
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JMF | 0:082731ede69f | 1 | # EZ Connect - A derivative of ARM's Easy-Connect to easily add supported for Avnet connectivity solutions to your mbed OS project |
JMF | 0:082731ede69f | 2 | |
JMF | 0:082731ede69f | 3 | |
JMF | 0:082731ede69f | 4 | Give your application the ability to switch between connectivity methods. The NetworkInterface API makes this easy, but you need a mechanism for the user to chooce the method. EZ Connect handles all of this for you. Just declare the desired connectivity method in the mbed_app.json file and call easy_connect() from your application. |
JMF | 0:082731ede69f | 5 | |
JMF | 0:082731ede69f | 6 | ## Specifying the connectivity method |
JMF | 0:082731ede69f | 7 | |
JMF | 0:082731ede69f | 8 | Add the following to your `mbed_app.json` file: |
JMF | 0:082731ede69f | 9 | |
JMF | 0:082731ede69f | 10 | ```json |
JMF | 0:082731ede69f | 11 | { |
JMF | 0:082731ede69f | 12 | "config": { |
JMF | 0:082731ede69f | 13 | "network-interface":{ |
JMF | 0:082731ede69f | 14 | "help": "options are ETHERNET, CELLULAR_WNC14A2A, CELLULAR_BG96", |
JMF | 0:082731ede69f | 15 | "value": "ETHERNET" |
JMF | 0:082731ede69f | 16 | } |
JMF | 0:082731ede69f | 17 | } |
JMF | 0:082731ede69f | 18 | } |
JMF | 0:082731ede69f | 19 | ``` |
JMF | 0:082731ede69f | 20 | |
JMF | 0:082731ede69f | 21 | |
JMF | 0:082731ede69f | 22 | ## Using EZ Connect from your application |
JMF | 0:082731ede69f | 23 | |
JMF | 0:082731ede69f | 24 | EZ Connect has just one function that returns either a `NetworkInterface`-pointer or `NULL`: |
JMF | 0:082731ede69f | 25 | |
JMF | 0:082731ede69f | 26 | ```cpp |
JMF | 0:082731ede69f | 27 | #include "easy-connect.h" |
JMF | 0:082731ede69f | 28 | |
JMF | 0:082731ede69f | 29 | int main(int, char**) { |
JMF | 0:082731ede69f | 30 | NetworkInterface* network = easy_connect(true); /* has 1 argument, enable_logging (pass in true to log to serial port) */ |
JMF | 0:082731ede69f | 31 | if (!network) { |
JMF | 0:082731ede69f | 32 | printf("Connecting to the network failed... See serial output.\r\n"); |
JMF | 0:082731ede69f | 33 | return 1; |
JMF | 0:082731ede69f | 34 | } |
JMF | 0:082731ede69f | 35 | |
JMF | 0:082731ede69f | 36 | // Rest of your program |
JMF | 0:082731ede69f | 37 | } |
JMF | 0:082731ede69f | 38 | ``` |
JMF | 0:082731ede69f | 39 | ## BG96 overrides |
JMF | 0:082731ede69f | 40 | If you need to change the pins used by the BG96 driver, you can enter the following into your `mbed_app.json`: |
JMF | 0:082731ede69f | 41 | |
JMF | 0:082731ede69f | 42 | ```json |
JMF | 0:082731ede69f | 43 | "target_overrides": { |
JMF | 0:082731ede69f | 44 | "*": { |
JMF | 0:082731ede69f | 45 | "platform.bg96-library.bg96-tx": "D8", |
JMF | 0:082731ede69f | 46 | "platform.bg96-library.bg96-rx": "D2", |
JMF | 0:082731ede69f | 47 | "platform.bg96-library.bg96-reset": "D7", |
JMF | 0:082731ede69f | 48 | "platform.bg96-library.bg96-wake": "D11", |
JMF | 0:082731ede69f | 49 | "platform.bg96-library.bg96-pwrkey": "D10" |
JMF | 0:082731ede69f | 50 | } |
JMF | 0:082731ede69f | 51 | } |
JMF | 0:082731ede69f | 52 | ``` |
JMF | 0:082731ede69f | 53 | |
JMF | 0:082731ede69f | 54 | ## CR/LF in serial output |
JMF | 0:082731ede69f | 55 | |
JMF | 0:082731ede69f | 56 | If you want to avoid using `\r\n` in your printouts and just use normal C style `\n` instead, please specify these to your `mbed_app.json`: |
JMF | 0:082731ede69f | 57 | |
JMF | 0:082731ede69f | 58 | ```json |
JMF | 0:082731ede69f | 59 | "target_overrides": { |
JMF | 0:082731ede69f | 60 | "*": { |
JMF | 0:082731ede69f | 61 | "platform.stdio-baud-rate": 115200, |
JMF | 0:082731ede69f | 62 | "platform.stdio-convert-newlines": true |
JMF | 0:082731ede69f | 63 | } |
JMF | 0:082731ede69f | 64 | } |
JMF | 0:082731ede69f | 65 | ``` |
JMF | 0:082731ede69f | 66 | |
JMF | 0:082731ede69f | 67 | ## Extra defines |
JMF | 0:082731ede69f | 68 | |
JMF | 0:082731ede69f | 69 | If you'd like to use EZ Connect with mbed Client then you're in luck. EZ Connect automatically defines the `MBED_SERVER_ADDRESS` macro depending on your connectivity method (either IPv4 or IPv6 address). Use this address to connect to the right instance of mbed Device Connector. |