ThingPlug Test
Dependents: WizFi310_ThingPlug_Test WizFi310_ThingPlug_Test_P
Fork of WizFi310Interface by
WizFi310/WizFi310_ifc.cpp@12:77cd2133312c, 2017-11-15 (annotated)
- Committer:
- cliff1
- Date:
- Wed Nov 15 06:28:23 2017 +0000
- Revision:
- 12:77cd2133312c
- Parent:
- 0:df571f8f8c03
20171115_2;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jehoon | 0:df571f8f8c03 | 1 | /* WizFi310 |
jehoon | 0:df571f8f8c03 | 2 | * Copyright (c) 2015 ARM Limited |
jehoon | 0:df571f8f8c03 | 3 | * |
jehoon | 0:df571f8f8c03 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
jehoon | 0:df571f8f8c03 | 5 | * you may not use this file except in compliance with the License. |
jehoon | 0:df571f8f8c03 | 6 | * You may obtain a copy of the License at |
jehoon | 0:df571f8f8c03 | 7 | * |
jehoon | 0:df571f8f8c03 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
jehoon | 0:df571f8f8c03 | 9 | * |
jehoon | 0:df571f8f8c03 | 10 | * Unless required by applicable law or agreed to in writing, software |
jehoon | 0:df571f8f8c03 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
jehoon | 0:df571f8f8c03 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jehoon | 0:df571f8f8c03 | 13 | * See the License for the specific language governing permissions and |
jehoon | 0:df571f8f8c03 | 14 | * limitations under the License. |
jehoon | 0:df571f8f8c03 | 15 | */ |
jehoon | 0:df571f8f8c03 | 16 | #include "WizFi310.h" |
jehoon | 0:df571f8f8c03 | 17 | |
jehoon | 0:df571f8f8c03 | 18 | bool WizFi310::startup(void) |
jehoon | 0:df571f8f8c03 | 19 | { |
jehoon | 0:df571f8f8c03 | 20 | reset(); |
jehoon | 0:df571f8f8c03 | 21 | |
jehoon | 0:df571f8f8c03 | 22 | cmdAT(); |
jehoon | 0:df571f8f8c03 | 23 | if( cmdMECHO(false) == -1) return false; |
jehoon | 0:df571f8f8c03 | 24 | //if( cmdMECHO(true) == -1) return false; |
jehoon | 0:df571f8f8c03 | 25 | if(_cts != NULL && _rts != NULL) |
jehoon | 0:df571f8f8c03 | 26 | { |
jehoon | 0:df571f8f8c03 | 27 | if( cmdUSET(_baud,"HW") == -1) return false; |
jehoon | 0:df571f8f8c03 | 28 | } |
jehoon | 0:df571f8f8c03 | 29 | else |
jehoon | 0:df571f8f8c03 | 30 | { |
jehoon | 0:df571f8f8c03 | 31 | if( cmdUSET(_baud,"N") == -1) return false; |
jehoon | 0:df571f8f8c03 | 32 | } |
jehoon | 0:df571f8f8c03 | 33 | wait_ms(1000); |
jehoon | 0:df571f8f8c03 | 34 | if( cmdAT() == -1) return false; |
jehoon | 0:df571f8f8c03 | 35 | |
jehoon | 0:df571f8f8c03 | 36 | return true; |
jehoon | 0:df571f8f8c03 | 37 | } |
jehoon | 0:df571f8f8c03 | 38 | |
jehoon | 0:df571f8f8c03 | 39 | bool WizFi310::reset(void) |
jehoon | 0:df571f8f8c03 | 40 | { |
jehoon | 0:df571f8f8c03 | 41 | _reset = 0; |
jehoon | 0:df571f8f8c03 | 42 | wait_ms(500); |
jehoon | 0:df571f8f8c03 | 43 | _reset = 1; |
jehoon | 0:df571f8f8c03 | 44 | |
jehoon | 0:df571f8f8c03 | 45 | return true; |
jehoon | 0:df571f8f8c03 | 46 | } |