xpl lib
Dependents: XPL-App4_cleanup XPL-App5
xPL_utils.cpp@0:23c0d0e1c31d, 2018-10-09 (annotated)
- Committer:
- richnash
- Date:
- Tue Oct 09 17:37:05 2018 +0000
- Revision:
- 0:23c0d0e1c31d
ready to move to cli to explore D11 pin fix
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
richnash | 0:23c0d0e1c31d | 1 | /* |
richnash | 0:23c0d0e1c31d | 2 | * xPL.Arduino v0.1, xPL Implementation for Arduino |
richnash | 0:23c0d0e1c31d | 3 | * |
richnash | 0:23c0d0e1c31d | 4 | * This code is parsing a xPL message stored in 'received' buffer |
richnash | 0:23c0d0e1c31d | 5 | * - isolate and store in 'line' buffer each part of the message -> detection of EOL character (DEC 10) |
richnash | 0:23c0d0e1c31d | 6 | * - analyse 'line', function of its number and store information in xpl_header memory |
richnash | 0:23c0d0e1c31d | 7 | * - check for each step if the message respect xPL protocol |
richnash | 0:23c0d0e1c31d | 8 | * - parse each command line |
richnash | 0:23c0d0e1c31d | 9 | * |
richnash | 0:23c0d0e1c31d | 10 | * Copyright (C) 2012 johan@pirlouit.ch, olivier.lebrun@gmail.com |
richnash | 0:23c0d0e1c31d | 11 | * Original version by Gromain59@gmail.com |
richnash | 0:23c0d0e1c31d | 12 | * |
richnash | 0:23c0d0e1c31d | 13 | * This program is free software; you can redistribute it and/or |
richnash | 0:23c0d0e1c31d | 14 | * modify it under the terms of the GNU General Public License |
richnash | 0:23c0d0e1c31d | 15 | * as published by the Free Software Foundation; either version 2 |
richnash | 0:23c0d0e1c31d | 16 | * of the License, or (at your option) any later version. |
richnash | 0:23c0d0e1c31d | 17 | * |
richnash | 0:23c0d0e1c31d | 18 | * This program is distributed in the hope that it will be useful, |
richnash | 0:23c0d0e1c31d | 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
richnash | 0:23c0d0e1c31d | 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
richnash | 0:23c0d0e1c31d | 21 | * GNU General Public License for more details. |
richnash | 0:23c0d0e1c31d | 22 | * |
richnash | 0:23c0d0e1c31d | 23 | * You should have received a copy of the GNU General Public License |
richnash | 0:23c0d0e1c31d | 24 | * along with this program; if not, write to the Free Software |
richnash | 0:23c0d0e1c31d | 25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
richnash | 0:23c0d0e1c31d | 26 | */ |
richnash | 0:23c0d0e1c31d | 27 | |
richnash | 0:23c0d0e1c31d | 28 | #include "xPL_utils.h" |
richnash | 0:23c0d0e1c31d | 29 | |
richnash | 0:23c0d0e1c31d | 30 | // Function to clear a string |
richnash | 0:23c0d0e1c31d | 31 | void clearStr (char* str) |
richnash | 0:23c0d0e1c31d | 32 | { |
richnash | 0:23c0d0e1c31d | 33 | int len = strlen(str); |
richnash | 0:23c0d0e1c31d | 34 | for (short c = 0; c < len; c++) |
richnash | 0:23c0d0e1c31d | 35 | { |
richnash | 0:23c0d0e1c31d | 36 | str[c] = 0; |
richnash | 0:23c0d0e1c31d | 37 | } |
richnash | 0:23c0d0e1c31d | 38 | } |