ThingPlug Test
Dependents: WizFi310_ThingPlug_Test WizFi310_ThingPlug_Test_P
Fork of WizFi310Interface by
WizFi310/WizFi310_util.cpp@0:df571f8f8c03, 2016-10-05 (annotated)
- Committer:
- jehoon
- Date:
- Wed Oct 05 09:40:30 2016 +0000
- Revision:
- 0:df571f8f8c03
This is a WizFi310 Library. It supports new mbed5 features including NetworkInterfaceAPI.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jehoon | 0:df571f8f8c03 | 1 | /* |
jehoon | 0:df571f8f8c03 | 2 | * Copyright (C) 2013 gsfan, MIT License |
jehoon | 0:df571f8f8c03 | 3 | * |
jehoon | 0:df571f8f8c03 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
jehoon | 0:df571f8f8c03 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
jehoon | 0:df571f8f8c03 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
jehoon | 0:df571f8f8c03 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
jehoon | 0:df571f8f8c03 | 8 | * furnished to do so, subject to the following conditions: |
jehoon | 0:df571f8f8c03 | 9 | * |
jehoon | 0:df571f8f8c03 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
jehoon | 0:df571f8f8c03 | 11 | * substantial portions of the Software. |
jehoon | 0:df571f8f8c03 | 12 | * |
jehoon | 0:df571f8f8c03 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
jehoon | 0:df571f8f8c03 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
jehoon | 0:df571f8f8c03 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
jehoon | 0:df571f8f8c03 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
jehoon | 0:df571f8f8c03 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
jehoon | 0:df571f8f8c03 | 18 | */ |
jehoon | 0:df571f8f8c03 | 19 | /* Copyright (C) 2014 Wiznet, MIT License |
jehoon | 0:df571f8f8c03 | 20 | * port to the Wiznet Module WizFi310 |
jehoon | 0:df571f8f8c03 | 21 | */ |
jehoon | 0:df571f8f8c03 | 22 | |
jehoon | 0:df571f8f8c03 | 23 | #include "WizFi310.h" |
jehoon | 0:df571f8f8c03 | 24 | |
jehoon | 0:df571f8f8c03 | 25 | int WizFi310::x2i(char c) |
jehoon | 0:df571f8f8c03 | 26 | { |
jehoon | 0:df571f8f8c03 | 27 | if ( c >= '0' && c <= '9') |
jehoon | 0:df571f8f8c03 | 28 | { |
jehoon | 0:df571f8f8c03 | 29 | return c - '0'; |
jehoon | 0:df571f8f8c03 | 30 | } |
jehoon | 0:df571f8f8c03 | 31 | else if ( c >= 'A' && c <= 'F') |
jehoon | 0:df571f8f8c03 | 32 | { |
jehoon | 0:df571f8f8c03 | 33 | return c - 'A' + 10; |
jehoon | 0:df571f8f8c03 | 34 | } |
jehoon | 0:df571f8f8c03 | 35 | else if ( c >= 'a' && c <= 'f') |
jehoon | 0:df571f8f8c03 | 36 | { |
jehoon | 0:df571f8f8c03 | 37 | return c - 'a' + 10; |
jehoon | 0:df571f8f8c03 | 38 | } |
jehoon | 0:df571f8f8c03 | 39 | |
jehoon | 0:df571f8f8c03 | 40 | return 0; |
jehoon | 0:df571f8f8c03 | 41 | } |
jehoon | 0:df571f8f8c03 | 42 | |
jehoon | 0:df571f8f8c03 | 43 | int WizFi310::i2x(int i) |
jehoon | 0:df571f8f8c03 | 44 | { |
jehoon | 0:df571f8f8c03 | 45 | if ( i >= 0 && i <= 9 ) |
jehoon | 0:df571f8f8c03 | 46 | { |
jehoon | 0:df571f8f8c03 | 47 | return i + '0'; |
jehoon | 0:df571f8f8c03 | 48 | } |
jehoon | 0:df571f8f8c03 | 49 | else if ( i >= 10 && i <= 15 ) |
jehoon | 0:df571f8f8c03 | 50 | { |
jehoon | 0:df571f8f8c03 | 51 | return i - 10 + 'A'; |
jehoon | 0:df571f8f8c03 | 52 | } |
jehoon | 0:df571f8f8c03 | 53 | |
jehoon | 0:df571f8f8c03 | 54 | return 0; |
jehoon | 0:df571f8f8c03 | 55 | } |