Sy Hoang Mai
/
Ethernet-try-power-tracing
MBED_SLEEP_TRACING_ENABLED caused problem
main.cpp@0:adb782d42c64, 2018-12-31 (annotated)
- Committer:
- sh114203
- Date:
- Mon Dec 31 15:31:37 2018 +0000
- Revision:
- 0:adb782d42c64
initial-commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sh114203 | 0:adb782d42c64 | 1 | // ---------------------------------------------------------------------------- |
sh114203 | 0:adb782d42c64 | 2 | // Copyright 2016-2018 ARM Ltd. |
sh114203 | 0:adb782d42c64 | 3 | // |
sh114203 | 0:adb782d42c64 | 4 | // SPDX-License-Identifier: Apache-2.0 |
sh114203 | 0:adb782d42c64 | 5 | // |
sh114203 | 0:adb782d42c64 | 6 | // Licensed under the Apache License, Version 2.0 (the "License"); |
sh114203 | 0:adb782d42c64 | 7 | // you may not use this file except in compliance with the License. |
sh114203 | 0:adb782d42c64 | 8 | // You may obtain a copy of the License at |
sh114203 | 0:adb782d42c64 | 9 | // |
sh114203 | 0:adb782d42c64 | 10 | // http://www.apache.org/licenses/LICENSE-2.0 |
sh114203 | 0:adb782d42c64 | 11 | // |
sh114203 | 0:adb782d42c64 | 12 | // Unless required by applicable law or agreed to in writing, software |
sh114203 | 0:adb782d42c64 | 13 | // distributed under the License is distributed on an "AS IS" BASIS, |
sh114203 | 0:adb782d42c64 | 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
sh114203 | 0:adb782d42c64 | 15 | // See the License for the specific language governing permissions and |
sh114203 | 0:adb782d42c64 | 16 | // limitations under the License. |
sh114203 | 0:adb782d42c64 | 17 | // ---------------------------------------------------------------------------- |
sh114203 | 0:adb782d42c64 | 18 | #ifndef MBED_TEST_MODE |
sh114203 | 0:adb782d42c64 | 19 | |
sh114203 | 0:adb782d42c64 | 20 | #include "mbed.h" |
sh114203 | 0:adb782d42c64 | 21 | |
sh114203 | 0:adb782d42c64 | 22 | NetworkInterface *net; |
sh114203 | 0:adb782d42c64 | 23 | |
sh114203 | 0:adb782d42c64 | 24 | int main(void) { |
sh114203 | 0:adb782d42c64 | 25 | printf("Starting program, connecting to network\n"); |
sh114203 | 0:adb782d42c64 | 26 | |
sh114203 | 0:adb782d42c64 | 27 | net = NetworkInterface::get_default_instance(); |
sh114203 | 0:adb782d42c64 | 28 | nsapi_error_t status = net->connect(); |
sh114203 | 0:adb782d42c64 | 29 | if (status != 0) { |
sh114203 | 0:adb782d42c64 | 30 | printf("Connecting to the network failed %d!\n", status); |
sh114203 | 0:adb782d42c64 | 31 | return -1; //should be something more "realistic approach", not this childlish behavior |
sh114203 | 0:adb782d42c64 | 32 | } |
sh114203 | 0:adb782d42c64 | 33 | printf("Connected to the network successfully. IP address: %s\n", net->get_ip_address()); |
sh114203 | 0:adb782d42c64 | 34 | return 0; |
sh114203 | 0:adb782d42c64 | 35 | } |
sh114203 | 0:adb782d42c64 | 36 | #endif |