Compare commits

...

158 Commits

Author SHA1 Message Date
ce1b32e4e9 Merge branch 'release/v0.9.0' 2014-12-01 23:04:54 +02:00
2bc68df958 Preparation for v0.9.0 2014-12-01 23:04:26 +02:00
ba00ee20c2 Switch to SF Storage 2014-12-01 22:45:53 +02:00
107a849f88 Correct dynamic library name 2014-12-01 16:40:46 +02:00
ddab7046ca Don't show obsolate version in =dev mode 2014-12-01 16:33:35 +02:00
e49d4e2722 Fix #28: bug with code builder and built-in Arduino libraries 2014-12-01 16:11:30 +02:00
3c9e809b58 Improve "init" command. Resolve #31 2014-11-30 18:14:18 +02:00
a82d09e816 Trim spaces 2014-11-30 18:13:45 +02:00
6b9cbde8eb Improve telemetry for run env command 2014-11-30 17:00:30 +02:00
22297b9cfd Implement "platformio settings" command 2014-11-29 22:58:10 +02:00
d8837e4756 Allow "upload_port" auto-detecting 2014-11-29 22:56:08 +02:00
bcfb007c90 Added Migration Manager which simplifies process with upgrading to a major release 2014-11-29 22:55:32 +02:00
33d87367e7 Add Telemetry Service 2014-11-29 22:48:15 +02:00
257f751dfa Implement ApplicationState Manager 2014-11-29 22:39:44 +02:00
e41226fcbc Remove copyrights from use's file 2014-11-27 22:25:40 +02:00
4efb798371 Add ready for compilers 2014-11-27 22:22:39 +02:00
f8f47886d3 Resolve issue #27 with LICENSE 2014-11-27 22:17:48 +02:00
dec78d29e8 Improve install/uninstall commands 2014-11-24 22:24:19 +02:00
102175215c Allow for search args to be empty 2014-11-24 21:59:25 +02:00
cd2cc16fcf Improve support for 3-rd party platforms 2014-11-24 21:36:44 +02:00
b103dc01c0 Refactored Package Manager 2014-11-22 23:55:17 +02:00
f8ed09c3ad Improve installation section 2014-11-21 21:06:32 +02:00
7f918da87d Fix SHA1 package verification under Cygwin Env. Resolve #26 2014-11-21 18:13:02 +02:00
32230c6b60 Add pic for colourful output 2014-11-15 20:18:50 +02:00
d8b00eef97 Improve PlatformIO ideas 2014-11-15 20:12:27 +02:00
2b1b64c5c1 Add 'sudo' notice 2014-11-14 00:17:09 +02:00
145fcb63e2 Improve installation 2014-11-14 00:12:23 +02:00
6748fb974b Add pics to IDE page 2014-11-12 19:33:35 +02:00
da234bf228 Update project title 2014-11-07 22:22:18 +02:00
c821cdefa4 Add logo, improve texts 2014-11-07 22:14:44 +02:00
7eb86305d4 Add "user Guide" shortcut to lib menu 2014-11-06 20:21:48 +02:00
66b5299b56 Update Twitter link 2014-11-05 20:58:35 +02:00
fcd0528a9e Fix trademark issues 2014-10-27 22:47:53 +02:00
99929d7fa6 Fix "repository" field and "type" attribute 2014-10-24 22:59:15 +03:00
6c7be9b339 Improve lib examples 2014-10-22 23:52:17 +03:00
73004d0ad8 Switch to 0.9.0-dev branch 2014-10-19 18:01:27 +03:00
c867f9a90a Merge branch 'release/v0.8.0' 2014-10-19 17:59:44 +03:00
7f7620a08c Merge branch 'release/v0.8.0' into develop 2014-10-19 17:59:44 +03:00
416bf8e7af Ready for v0.8.0 2014-10-19 17:58:35 +03:00
b3eebf717d Correct 7-th example for lib search command 2014-10-19 17:56:08 +03:00
baef85aed1 Fix PyLint warnings from the last CI build 2014-10-19 00:21:10 +03:00
2d6c0ef66d Avoid trademark issues in library.json; switch to PlatformIO Library Registry ID logic
Resolve issue #17
2014-10-19 00:14:11 +03:00
4f817a5b61 Describe new fields: frameworks, platforms, authors and dependencies 2014-10-18 20:03:38 +03:00
01d415cc7f Avoid trademarks issues 2014-10-15 22:33:23 +03:00
d13bf3325b Update "colorama" to 0.3.2 2014-10-08 23:10:34 +03:00
0e62ad1600 Cleanup citate 2014-10-08 17:44:20 +03:00
700c6c9b3e Improve citrate 2014-10-08 17:42:02 +03:00
ac02703f5f Disable checking for link anchors 2014-10-08 17:41:48 +03:00
1f80b6746e Fix links 2014-10-07 16:13:24 +03:00
9f87342e30 Add Arduino & Energia IDEs 2014-10-07 16:11:12 +03:00
13d6616b55 Update README.rst 2014-10-06 23:35:52 +03:00
81700523ed Update README.rst 2014-10-06 23:35:38 +03:00
7f1827f1e5 Switch to v0.8.0 2014-10-06 23:33:45 +03:00
8d491b4146 Merge branch 'release/v0.7.1' 2014-10-06 23:28:12 +03:00
0ea57b8bca Merge branch 'release/v0.7.1' into develop 2014-10-06 23:28:12 +03:00
466026b5c6 Update project description, history and etc 2014-10-06 23:27:49 +03:00
c90ef9919b Improve title 2014-10-06 16:21:24 +03:00
8649114546 Fix link to Web Library Search site 2014-10-06 16:15:40 +03:00
dcfa899520 Fix make directory operation for invalid library name 2014-10-06 14:09:22 +03:00
2e03d27d27 Update "requests" to 2.4.3 2014-10-06 13:57:40 +03:00
9ead140b6e Fix lib update crashing when no libs are installed (resolve issue #19) 2014-10-05 23:34:40 +03:00
719e03da16 Expand user path from lib_dir 2014-10-04 23:30:51 +03:00
6a775f3951 Skip "platformio" section from "run" process 2014-10-04 18:53:59 +03:00
7de5166694 Change "print" function to Py2.x 2014-10-03 19:54:02 +03:00
907a72d3bd Move to latest version of SCons 2014-10-03 19:48:17 +03:00
024be2e094 Automatic detection of port on upload (resolve #15) 2014-10-03 19:47:34 +03:00
1c4b97c2f2 Fix lint warning with anomalous backslash 2014-09-30 20:58:30 +03:00
2a7e67b8e4 Fix bug with order for "includes" in conversation from INO/PDE to CPP 2014-09-30 20:55:08 +03:00
09761004dd Ready for 0.8.0-dev 2014-09-24 22:33:40 +03:00
6404b02a5d Merge branch 'release/v0.7.0' 2014-09-24 22:25:58 +03:00
766bc44b23 Merge branch 'release/v0.7.0' into develop 2014-09-24 22:25:58 +03:00
c14dbb5ef1 Resolve #6. Ready for 0.7.0 2014-09-24 22:25:44 +03:00
9c2dbf73f3 Implement lib-search pagination, dependencies uninstalling 2014-09-24 22:18:19 +03:00
c0c3c8efcd Add 'examples' field 2014-09-24 21:40:37 +03:00
24ec2dc9e4 Update PlatformIO Website URLs 2014-09-12 19:27:56 +03:00
97a42a357a Merge branch 'develop' of https://github.com/ivankravets/platformio into develop 2014-09-12 19:19:46 +03:00
2dddbfc074 Correction 2014-09-12 19:18:49 +03:00
f77c195f3d Update "requests" to 2.4.1 2014-09-12 19:18:11 +03:00
70493a7721 Update PlatformIO Website URLs 2014-09-12 19:17:31 +03:00
1e1fac2fc1 Merge branch 'develop' of https://github.com/ivankravets/platformio into develop 2014-09-09 23:16:55 +03:00
fbe014f687 Corrections 2014-09-09 23:16:36 +03:00
fd2571da04 Updated "click" to 3.3 2014-09-08 22:15:05 +03:00
813c818477 Implement "lib register" command 2014-09-08 22:02:57 +03:00
c4b28ab252 Rename section of source location 2014-09-08 15:37:04 +03:00
ac66f62262 Rename to "creating" 2014-09-07 19:38:00 +03:00
727ec2f4dc Add citation block 2014-09-07 18:22:52 +03:00
995a25478b Improvements 2014-09-07 18:14:33 +03:00
5fa265374c Rename "create" page 2014-09-07 15:09:32 +03:00
369622f3fb Correct source code locations 2014-09-06 23:55:48 +03:00
6fdc47beda Describe how to create new library and share it 2014-09-06 23:51:28 +03:00
f316308860 Describe "dependencies" field from library.json 2014-09-06 22:27:33 +03:00
2ac4b9a590 Fill history with Library Manager record 2014-09-06 22:19:51 +03:00
23bc5188b3 Fill Library Config information 2014-09-06 22:13:16 +03:00
1631770b85 Describe "lib_dir" option 2014-09-06 18:46:19 +03:00
849a49f665 Add Library Manager documentation 2014-09-06 13:44:45 +03:00
be710cefd8 Implement installing dependence libs 2014-09-06 12:53:17 +03:00
a98dc5bc29 Implement --keyword and --author options for library search command 2014-09-06 12:12:13 +03:00
46fb576c9d Switch package manifest to dl.platformio 2014-09-05 21:55:47 +03:00
b370d38192 Merge branch 'feature/library-manager' into develop 2014-09-05 21:39:41 +03:00
716ff3df86 Merge branch 'develop' of https://github.com/ivankravets/platformio into feature/library-manager 2014-09-05 21:31:37 +03:00
c784c7ab47 Typo fix 2014-09-05 21:27:10 +03:00
bac0a5ebb1 Implement lib commands: install, uninstall, show, update, list 2014-09-04 18:58:12 +03:00
3c030edc38 Grammar fix 2014-09-04 18:57:13 +03:00
35e7c8b3a7 Seek for library in user's lib directory 2014-09-04 18:56:32 +03:00
855df959ee Parse .pde as .ino file 2014-09-04 18:55:56 +03:00
3d179fe1a7 Implement "lib search" command 2014-09-03 23:03:49 +03:00
69b73935d0 Updated "requests" to 2.4.0 2014-09-01 10:30:01 +03:00
a7bc72aa41 Improve installation section 2014-08-28 21:20:15 +03:00
5f539fdf7b Re-tested with Click 3.2 2014-08-23 11:51:18 +03:00
78bf6c0e23 Italic correction 2014-08-22 18:05:27 +03:00
768eea8a6d Implemented new `[platformio]` section for Configuration File | Resolve #14 2014-08-22 17:57:28 +03:00
e4ba030a0c Expand an URL to get-platformio.py 2014-08-13 16:36:38 +03:00
ad6acb28ae Disable PyLint stupid warning 2014-08-13 11:55:25 +03:00
63d9914652 Test passed with new click 3.1 2014-08-13 11:37:50 +03:00
c41be4b294 Add notice about examples on the web 2014-08-12 19:29:57 +03:00
9cec1069d6 Rename Miscellaneous section to Raspduino 2014-08-11 15:58:39 +03:00
1b359b7587 Add new examples to ProjectConfFile + improve Quickstart 2014-08-11 12:20:08 +03:00
80e21f61d3 Minor docs improvement 2014-08-09 23:40:32 +03:00
0323fe7b90 Preparation for 0.7.0-dev 2014-08-09 23:29:37 +03:00
e48c6744ed Merge branch 'release/v0.6.0' 2014-08-09 23:21:02 +03:00
fcef78ed0d Merge branch 'release/v0.6.0' into develop 2014-08-09 23:21:02 +03:00
fbab527ed3 Ready for 0.6.0 release 2014-08-09 23:20:45 +03:00
7bee016a7e Implement serialports monitor / resolve #10 2014-08-09 23:13:29 +03:00
c496b736ea Append SHELL/PATH correction for Makefile 2014-08-09 19:31:34 +03:00
1fb8c5dcab Add PDF version of docs 2014-08-09 18:06:56 +03:00
2f79b604c7 Clean Project Configuration file & README 2014-08-09 17:57:17 +03:00
628cf3b652 Simplify README 2014-08-09 17:49:37 +03:00
71c66b9171 Fix bug with auto-conversation from Arduino *.ino to *.cpp 2014-08-09 17:19:08 +03:00
a14a724836 Add "docs" env for CI 2014-08-09 17:11:45 +03:00
f83e052ea2 Initial version of docs 2014-08-09 16:39:00 +03:00
8961c2fad4 Merge docs + develop 2014-08-09 16:36:29 +03:00
7af95ab897 Merge branch 'develop' into feature/documentation 2014-08-09 16:34:36 +03:00
9a99409ae1 Initial version of docs 2014-08-09 16:31:20 +03:00
62ccafde23 Resolve issue #9: ImportError: No module named platformio.util 2014-08-05 14:18:16 +03:00
75c50ef213 Append PlatformIO info to request header 2014-08-04 12:43:09 +03:00
05908dc882 Continue on 1.0.0-dev 2014-08-04 12:09:04 +03:00
94faec9827 Fix links for testers 2014-08-04 12:00:47 +03:00
26e70ad2f9 Merge branch 'release/v0.5.0' 2014-08-04 11:56:43 +03:00
a2a13039ba Merge branch 'release/v0.5.0' into develop 2014-08-04 11:56:43 +03:00
6239b9d22a Ready for 0.5.0 release 2014-08-04 11:55:55 +03:00
47b8d32bbf Update with fixed bugs/issues and "thanks" part! 2014-08-04 11:51:04 +03:00
8e4520d6e0 Fix libs order when build nested dependencies 2014-08-04 11:38:00 +03:00
de37cc0518 Add static Adafruit_CC3000 library example 2014-08-04 11:14:46 +03:00
8c452851d2 Remove Adafruit submodule from examples 2014-08-04 11:13:54 +03:00
3d680e5351 Remove Adafruit submodule from examples 2014-08-04 11:12:47 +03:00
f7a4ee0d66 Fix bug with first-launching 2014-08-04 11:09:47 +03:00
2534db8c0e Merge branch 'feature/atmelavr-raspduino-reset' into develop 2014-08-04 09:31:17 +03:00
f006561113 Initial commit of docs 2014-08-04 09:23:57 +03:00
8b056efe64 Resolve #8: Implement "upgrade" command and "auto-check" for the latest version 2014-08-03 18:40:20 +03:00
a287d53520 Add Arduino example with external library (Adafruit CC3000) 2014-08-03 16:49:03 +03:00
00e51558db Resolve #7: add auto-conversation from *.ino to valid *.cpp for Arduino/Energia frameworks 2014-08-03 16:23:18 +03:00
1b75d3e461 Allow to clean dependent libraries 2014-08-02 21:07:35 +03:00
47edfdb043 Improve nested lookup for libraries 2014-08-02 20:47:05 +03:00
ce0c1f9f4a Disable default warning flag "-Wall" 2014-08-02 13:23:42 +03:00
eccba803b2 Initial version of "reset" operation for Raspduino 2014-08-01 16:19:54 +03:00
1b2339c3bd Fixed bug with platforms list 2014-07-31 16:58:49 +03:00
3f03143e5e Removed wheel support (need to rely on dynamic dependencies) 2014-07-31 16:58:03 +03:00
94cb62e4d9 Merge branch 'release/v0.4.0' into develop 2014-07-31 16:26:35 +03:00
131 changed files with 21772 additions and 960 deletions

2
.gitignore vendored
View File

@ -5,3 +5,5 @@
.sconsign.dblite
examples/ide-eclipse/.metadata
examples/ide-eclipse/RemoteSystemsTempFiles
docs/_build
dist

View File

@ -38,7 +38,7 @@ load-plugins=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=C0103,C0111,E0611,F0401,I0011,R0801,R0903
disable=C0103,C0111,E0611,F0401,I0011,R0801,R0903,R0922
[REPORTS]

View File

@ -1,24 +1,97 @@
Release History
===============
1.0.0 (?)
---------
0.9.0 (2014-12-01)
------------------
* Implemented `platformio settings <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_settings.html>`_ command
* Improved `platformio init <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_init.html>`_ command.
Added new option ``--project-dir`` where you can specify another path to
directory where new project will be initialized (`issue #31 <https://github.com/ivankravets/platformio/issues/31>`_)
* Added *Migration Manager* which simplifies process with upgrading to a
major release
* Added *Telemetry Service* which should help us make *PlatformIO* better
* Implemented *PlatformIO AppState Manager* which allow to have multiple
``.platformio`` states.
* Refactored *Package Manager*
* Download Manager: fixed SHA1 verification within *Cygwin Environment*
(`issue #26 <https://github.com/ivankravets/platformio/issues/26>`_)
* Fixed bug with code builder and built-in Arduino libraries
(`issue #28 <https://github.com/ivankravets/platformio/issues/28>`_)
0.8.0 (2014-10-19)
------------------
* Avoided trademark issues in `library.json <http://docs.platformio.ikravets.com/en/latest/librarymanager/config.html>`_
with the new fields: `frameworks <http://docs.platformio.ikravets.com/en/latest/librarymanager/config.html#frameworks>`_,
`platforms <http://docs.platformio.ikravets.com/en/latest/librarymanager/config.html#platforms>`_
and `dependencies <http://docs.platformio.ikravets.com/en/latest/librarymanager/config.html#dependencies>`_
(`issue #17 <https://github.com/ivankravets/platformio/issues/17>`_)
* Switched logic from "Library Name" to "Library Registry ID" for all
`platformio lib <http://docs.platformio.ikravets.com/en/latest/userguide/lib/index.html>`_
commands (install, uninstall, update and etc.)
* Renamed ``author`` field to `authors <http://docs.platformio.ikravets.com/en/latest/librarymanager/config.html#authors>`_
and allowed to setup multiple authors per library in `library.json <http://docs.platformio.ikravets.com/en/latest/librarymanager/config.html>`_
* Added option to specify "maintainer" status in `authors <http://docs.platformio.ikravets.com/en/latest/librarymanager/config.html#authors>`_ field
* New filters/options for `platformio lib search <http://docs.platformio.ikravets.com/en/latest/userguide/lib/cmd_search.html>`_
command: ``--framework`` and ``--platform``
0.7.1 (2014-10-06)
------------------
* Fixed bug with order for includes in conversation from INO/PDE to CPP
* Automatic detection of port on upload (`issue #15 <https://github.com/ivankravets/platformio/issues/15>`_)
* Fixed lib update crashing when no libs are installed (`issue #19 <https://github.com/ivankravets/platformio/issues/19>`_)
0.7.0 (2014-09-24)
------------------
* Implemented new `[platformio] <http://docs.platformio.ikravets.com/en/latest/projectconf.html#platformio>`_
section for Configuration File with `home_dir <http://docs.platformio.ikravets.com/en/latest/projectconf.html#home-dir>`_
option (`issue #14 <https://github.com/ivankravets/platformio/issues/14>`_)
* Implemented *Library Manager* (`issue #6 <https://github.com/ivankravets/platformio/issues/6>`_)
0.6.0 (2014-08-09)
------------------
* Implemented `platformio serialports monitor <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_serialports.html#platformio-serialports-monitor>`_ (`issue #10 <https://github.com/ivankravets/platformio/issues/10>`_)
* Fixed an issue ``ImportError: No module named platformio.util`` (`issue #9 <https://github.com/ivankravets/platformio/issues/9>`_)
* Fixed bug with auto-conversation from Arduino \*.ino to \*.cpp
0.5.0 (2014-08-04)
------------------
* Improved nested lookups for libraries
* Disabled default warning flag "-Wall"
* Added auto-conversation from \*.ino to valid \*.cpp for Arduino/Energia
frameworks (`issue #7 <https://github.com/ivankravets/platformio/issues/7>`_)
* Added `Arduino example <https://github.com/ivankravets/platformio/tree/develop/examples/arduino-adafruit-library>`_
with external library (*Adafruit CC3000*)
* Implemented `platformio upgrade <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_upgrade.html>`_
command and "auto-check" for the latest
version (`issue #8 <https://github.com/ivankravets/platformio/issues/8>`_)
* Fixed an issue with "auto-reset" for *Raspduino* board
* Fixed a bug with nested libs building
0.4.0 (2014-07-31)
------------------
* Implemented ``serialports`` command
* Implemented `platformio serialports <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_serialports.html>`_ command
* Allowed to put special build flags only for ``src`` files via
``srcbuild_flags`` environment option
`srcbuild_flags <http://docs.platformio.ikravets.com/en/latest/projectconf.html#srcbuild-flags>`_
environment option
* Allowed to override some of settings via system environment variables
such as: ``$PIOSRCBUILD_FLAGS`` and ``$PIOENVS_DIR``
* Added ``--upload-port`` option for ``platformio run`` command
* Added ``--upload-port`` option for `platformio run <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_run.html#cmdoption--upload-port>`_ command
* Implemented (especially for `SmartAnthill <http://smartanthill.ikravets.com/>`_)
``platformio run -t uploadlazy`` target (no dependencies to framework libs,
ELF and etc.)
* Allowed to skip default packages via ``platformio install --skip-default-package`` flag
* Added tools for Raspberry Pi platform
* Added support for Microduino and Raspduino boards in ``atmelavr`` platform
`platformio run -t uploadlazy <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_run.html>`_
target (no dependencies to framework libs, ELF and etc.)
* Allowed to skip default packages via `platformio install --skip-default-package <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_install.html#cmdoption--skip-default>`_
option
* Added tools for *Raspberry Pi* platform
* Added support for *Microduino* and *Raspduino* boards in
`atmelavr <http://docs.platformio.ikravets.com/en/latest/platforms/atmelavr.html>`_ platform
0.3.1 (2014-06-21)

View File

@ -17,598 +17,107 @@ PlatformIO
:target: https://pypi.python.org/pypi/platformio/
:alt: License
`Quickstart <#quickstart>`_ |
`Installation <#installation>`_ |
`Documentation <#documentation>`_ |
`Examples <https://github.com/ivankravets/platformio/tree/develop/examples>`_ |
`Embedded Platform Boards <#embedded-platform-boards>`_ |
`IDE Integration <#ide-integration>`_ |
`Blog <http://www.ikravets.com/category/computer-life/platformio>`_
`Website + Library Search <http://platformio.ikravets.com>`_ |
`Documentation <http://docs.platformio.ikravets.com>`_ |
`Project Examples <https://github.com/ivankravets/platformio/tree/develop/examples>`_ |
`Blog <http://www.ikravets.com/category/computer-life/platformio>`_ |
`Twitter <https://twitter.com/PlatformIOTool>`_
.. image:: https://raw.githubusercontent.com/ivankravets/platformio/develop/docs/_static/platformio-logo.png
:target: http://platformio.ikravets.com
**PlatformIO** is a console tool to build code with different development
platforms.
`PlatformIO <http://platformio.ikravets.com>`_ is a cross-platform code builder
and the missing library manager.
You have no need to install any *IDE* or compile any toolchains. *PlatformIO*
* `Get Started <http://platformio.ikravets.com/#!/get-started>`_
* `Web 2.0 Library Search <http://platformio.ikravets.com/#!/lib>`_
* `Development Platforms <http://platformio.ikravets.com/#!/platforms>`_
* `Embedded Boards <http://platformio.ikravets.com/#!/boards>`_
* `Library Manager <http://docs.platformio.ikravets.com/en/latest/librarymanager/index.html>`_
* `User Guide <http://docs.platformio.ikravets.com/en/latest/userguide/index.html>`_
* `IDE Integration <http://docs.platformio.ikravets.com/en/latest/ide.html>`_
* `Release History <http://docs.platformio.ikravets.com/en/latest/history.html>`_
You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO*
has pre-built different development platforms including: compiler, debugger,
flasher (for embedded) and many other useful tools.
uploader (for embedded boards) and many other useful tools.
**PlatformIO** allows developer to compile the same code with different
platforms using only one command ``platformio run``. This happens due to
``platformio.ini`` project's file (see
`default template <https://github.com/ivankravets/platformio/blob/develop/platformio/projectconftpl.ini>`_)
where you can setup different environments with specific settings: platform,
firmware uploading options, pre-built framework and many more.
Use whenever. *Run everywhere.*
-------------------------------
*PlatformIO* is written in pure *Python* and **doesn't depend** on any
additional libraries/tools from an operation system. It allows you to use
*PlatformIO* beginning from *PC (Mac, Linux, Win)* and ending with credit-card
sized computers (like *Raspberry Pi*).
Each platform consists of packages which are located in own repository.
Due to ``platformio update`` command you will have up-to-date development
instruments.
Embedded Development. *Easier Than Ever.*
-----------------------------------------
*PlatformIO* is well suited for embedded development and has pre-configured
settings for most popular `Embedded Boards <http://platformio.ikravets.com/#!/boards>`_.
.. image:: examples/platformio-examples.png
:target: https://github.com/ivankravets/platformio/raw/develop/examples/platformio-examples.png
:alt: Examples
:width: 730px
* Colourful `command-line output <https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/platformio-examples.png>`_
* Built-in `Serial Port Monitor <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_serialports.html#platformio-serialports-monitor>`_
* Configurable `build -flags/-options <http://docs.platformio.ikravets.com/en/latest/projectconf.html#build-flags>`_
* Automatic **firmware uploading**
* Integration with `development environments (IDE) <http://docs.platformio.ikravets.com/en/latest/ide.html>`_
* Ready for **cloud compilers**
* Pre-built tool chains, frameworks for the popular `Hardware Platforms <http://platformio.ikravets.com/#!/platforms>`_
**PlatformIO** is well suited for **embedded development**. It can:
.. image:: https://raw.githubusercontent.com/ivankravets/platformio-web/develop/app/images/platformio-embedded-development.png
:target: http://platformio.ikravets.com
:alt: PlatformIO Embedded Development Process
* Automatically analyse dependency
* Reliably detect build changes
* Build framework or library source code to static library
* Build *ELF* (executable and linkable firmware)
* Convert *ELF* to *HEX* or *BIN* file
* Extract *EEPROM* data
* Upload firmware to your device
The Missing Library Manager. *It's here!*
-----------------------------------------
*PlatformIO Library Manager* is the missing library manager for development
platforms which allows you to organize and have up-to-date external libraries.
* Friendly `Command-Line Interface <http://docs.platformio.ikravets.com/en/latest/librarymanager/index.html>`_
* Modern `Web 2.0 Library Search <http://platformio.ikravets.com/#!/lib>`_
* Open Source `Library Registry API <https://github.com/ivankravets/platformio-api>`_
* Library Crawler based on `library.json <http://docs.platformio.ikravets.com/en/latest/librarymanager/config.html>`_
specification
* Library **dependency management**
* Automatic library updating
.. image:: https://raw.githubusercontent.com/ivankravets/platformio-web/develop/app/images/platformio-library-manager.png
:target: http://platformio.ikravets.com
:alt: PlatformIO Library Manager Architecture
Smart Code Builder. *Fast and Reliable.*
----------------------------------------
*PlatformIO Code Builder* is built-on a next-generation software construction
tool named `SCons <http://www.scons.org/>`_. Think of *SCons* as an improved,
cross-platform substitute for the classic *Make* utility.
* Reliable, automatic *dependency analysis*
* Reliable detection of *build changes*
* Improved support for *parallel builds*
* Ability to share *built files in a cache*
* Lookup for external libraries which are installed via `Library Manager <http://docs.platformio.ikravets.com/en/latest/librarymanager/index.html>`_
.. image:: https://raw.githubusercontent.com/ivankravets/platformio-web/develop/app/images/platformio-scons-builder.png
:target: http://platformio.ikravets.com
:alt: PlatformIO Code Builder Architecture
Single source code. *Multiple platforms.*
-----------------------------------------
*PlatformIO* allows developer to compile the same code with different
development platforms using the *Only One Command*
`platformio run <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_run.html>`_.
This happens due to
`Project Configuration File (platformio.ini) <http://docs.platformio.ikravets.com/en/latest/projectconf.html>`_
where you can setup different environments with specific options (platform
type, firmware uploading settings, pre-built framework, build flags and many
more).
It has support for many popular embedded platforms like these:
* ``atmelavr`` `Atmel AVR <http://en.wikipedia.org/wiki/Atmel_AVR>`_
(including `Arduino <http://www.arduino.cc>`_ based boards)
* ``timsp430`` `TI MSP430 <http://www.ti.com/lsds/ti/microcontroller/16-bit_msp430/overview.page>`_
(including `MSP430 LaunchPads <http://www.ti.com/ww/en/launchpad/launchpads-msp430.html>`_)
* ``titiva`` `TI TIVA C <http://www.ti.com/lsds/ti/microcontroller/tiva_arm_cortex/c_series/overview.page>`_
(including `TIVA C Series LaunchPads <http://www.ti.com/ww/en/launchpad/launchpads-connected.html>`_)
See project `examples with screenshots <https://github.com/ivankravets/platformio/tree/develop/examples>`_.
IDE Integration
---------------
* [Eclipse] `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO <http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio>`_
Embedded Platform Boards
------------------------
**PlatformIO** has pre-configured settings for most popular platform boards. You
have no need to specify in ``platformio.ini`` type or frequency of MCU, upload
protocol or etc. Please use ``board`` option (for
`example <https://github.com/ivankravets/platformio/blob/develop/examples/wiring-blink/platformio.ini>`_).
Platform ``atmelavr``
~~~~~~~~~~~~~~~~~~~~~
* ``diecimilaatmega168`` Arduino Duemilanove or Diecimila (ATmega168)
* ``diecimilaatmega328`` Arduino Duemilanove or Diecimila (ATmega328)
* ``fio`` Arduino Fio
* ``leonardo`` Arduino Leonardo
* ``LilyPadUSB`` Arduino LilyPad USB
* ``lilypadatmega168`` Arduino LilyPad (ATmega168)
* ``lilypadatmega328`` Arduino LilyPad (ATmega328)
* ``megaatmega1280`` Arduino Mega (ATmega1280)
* ``megaatmega2560`` Arduino Mega (ATmega2560)
* ``megaADK`` Arduino Mega ADK
* ``micro`` Arduino Micro
* ``miniatmega168`` Arduino Mini (ATmega168)
* ``miniatmega328`` Arduino Mini (ATmega328)
* ``nanoatmega168`` Arduino Nano (ATmega168)
* ``nanoatmega328`` Arduino Nano (ATmega328)
* ``pro8MHzatmega168`` Arduino Pro or Pro Mini (ATmega168, 3.3V, 8MHz)
* ``pro16MHzatmega168`` Arduino Pro or Pro Mini (ATmega168, 5V, 16MHz)
* ``pro8MHzatmega328`` Arduino Pro or Pro Mini (ATmega328, 3.3V, 8MHz)
* ``pro16MHzatmega328`` Arduino Pro or Pro Mini (ATmega328, 5V, 16MHz)
* ``uno`` Arduino Uno
* ``raspduino`` Raspduino
* ``328p8m`` Microduino Core (ATmega328P, 3.3V, 8MHz)
* ``328p16m`` Microduino Core (Atmega328P, 5V, 16MHz)
* ``168pa8m`` Microduino Core (ATmega168PA, 3.3V, 8MHz)
* ``168pa16m`` Microduino Core (ATmega168PA, 5V, 16MHz)
* ``644pa8m`` Microduino Core+ (ATmega644PA, 3.3V, 8MHz)
* ``644pa16m`` Microduino Core+ (ATmega644PA, 5V, 16MHz)
* ``1284p8m`` Microduino-Core+ (ATmega1284P, 3.3V, 8MHz)
* ``1284p16m`` Microduino-Core+ (ATmega1284P, 5V, 16MHz)
* ``32u416m`` Microduino-Core USB (ATmega32U4, 5V, 16MHz)
Platform ``timsp430``
~~~~~~~~~~~~~~~~~~~~~
* ``lpmsp430g2231`` TI LaunchPad MSP430 (msp430g2231)
* ``lpmsp430g2452`` TI LaunchPad MSP430 (msp430g2452)
* ``lpmsp430g2553`` TI LaunchPad MSP430 (msp430g2553)
* ``lpmsp430f5529`` TI LaunchPad MSP430 (msp430f5529, 16MHz)
* ``lpmsp430f5529_25`` TI LaunchPad MSP430 (msp430f5529, 25MHz)
* ``lpmsp430fr5969`` TI LaunchPad MSP430 (msp430fr5969)
* ``lpmsp430fr5739`` TI FraunchPad MSP430 (msp430fr5739)
Platform ``titiva``
~~~~~~~~~~~~~~~~~~~
* ``lplm4f120h5qr`` TI Stellaris LM4F120 LaunchPad
* ``lptm4c1230c3pm`` TI Tiva C Series TM4C123G LaunchPad
* ``lptm4c1294ncpdt`` TI Tiva C Series TM4C1294 Connected LaunchPad
Python & OS Support
-------------------
**PlatformIO** is written in `Python <https://www.python.org>`_ and works with
versions 2.6 and 2.7 on Unix/Linux, OS X, and Windows.
Quickstart
----------
.. code-block:: bash
# Print all availalbe development platforms for installing
$ platformio search all
# Install new development platform
$ platformio install SomePlatform
# Initialize new platformio based project
$ cd /path/to/empty/directory
$ platformio init
# Process the project's environments
$ platformio run
For more detailed information please follow to `Installation <#installation>`_
and `Documentation <#documentation>`_ sections.
Installation
------------
All commands below should be executed in
`Command-line <http://en.wikipedia.org/wiki/Command-line_interface>`_
application in your *OS*:
* *Unix/Linux/OS X* this is *Terminal* application.
* *Windows* this is
`Command Prompt <http://en.wikipedia.org/wiki/Command_Prompt>`_ (``cmd.exe``)
application.
Also, the `Python Interpreter <https://www.python.org/downloads/>`_ (2.6 or 2.7)
is required.
Super-Quick
~~~~~~~~~~~
To install or upgrade *PlatformIO*, download
`get-platformio.py <https://raw.githubusercontent.com/ivankravets/platformio/develop/scripts/get-platformio.py>`_ script.
Then run the following (which may require administrator access):
.. code-block:: bash
$ python get-platformio.py
An alternative short version for *Mac/Linux* users:
.. code-block:: bash
$ curl -L http://bit.ly/1lpanta | python
On *Windows OS* it may look like:
.. code-block:: bash
C:\Python27\python.exe get-platformio.py
Full Guide
~~~~~~~~~~
1. Check a ``python`` version (only 2.6-2.7 is supported):
.. code-block:: bash
$ python --version
*Windows OS* Users only:
* `Download Python 2.7 <https://www.python.org/downloads/>`_ and install it.
* Add to PATH system variable ``;C:\Python27;C:\Python27\Scripts;`` and
reopen *Command Prompt* (``cmd.exe``) application. Please read this
article `How to set the path and environment variables in Windows
<http://www.computerhope.com/issues/ch000549.htm>`_.
2. Check a ``pip`` tool for installing and managing *Python* packages:
.. code-block:: bash
$ pip search platformio
You should see short information about ``platformio`` package.
If your computer does not recognize ``pip`` command, try to install it first
using `these instructions <http://www.pip-installer.org/en/latest/installing.html>`_.
3. Install a ``platformio`` and related packages:
.. code-block:: bash
$ pip install platformio && pip install --egg scons
For upgrading the ``platformio`` to new version please use this command:
.. code-block:: bash
$ pip install -U platformio
Documentation
-------------
To print all available commands and options:
.. code-block:: bash
$ platformio --help
$ platformio COMMAND --help
# Example
$ platformio --help
Usage: platformio [OPTIONS] COMMAND [ARGS]...
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
init Initialize new PlatformIO based project
install Install new platforms
list List installed platforms
run Process project environments
search Search for development platforms
serialports List Serial ports
show Show details about an installed platforms
uninstall Uninstall platforms
update Update installed platforms
``platformio init``
~~~~~~~~~~~~~~~~~~~
Initialize new PlatformIO based project.
.. code-block:: bash
# Change directory to future project
$ cd /path/to/empty/directory
$ platformio init
# Example
$ platformio init
Project has been initialized!
Please put your source code to `src` directory, external libraries to `lib`
and setup environments in `platformio.ini` file.
Then process project with `platformio run` command.
After this command ``platformio`` will create:
* ``.pioenvs`` - a temporary working directory.
* ``lib`` - a directory for project specific libraries. PlatformIO will
compile their to static libraries and link to executable file
* ``src`` - a source directory. Put code here.
* ``platformio.ini`` - a configuration file for project
``platformio install``
~~~~~~~~~~~~~~~~~~~~~~
*PlatformIO* has pre-built development platforms with related packages. You
can install one of them:
.. code-block:: bash
$ platformio install SomePlatform
$ platformio install SomePlatform --with-package=toolchain|uploader|PackageName
$ platformio install SomePlatform --without-package=toolchain|uploader|PackageName
$ platformio install SomePlatform --skip-default-package
# Example
$ platformio install timsp430
Installing toolchain-timsp430 package:
Downloading [####################################] 100%
Unpacking [####################################] 100%
Installing tool-mspdebug package:
Downloading [####################################] 100%
Unpacking [####################################] 100%
Installing framework-energiamsp430 package:
Downloading [####################################] 100%
Unpacking [####################################] 100%
The platform 'timsp430' has been successfully installed!
# Skip default packages and install uploader utility only
$ platformio install timsp430 --skip-default-package --with-package=uploader
Installing tool-mspdebug package:
Downloading [####################################] 100%
Unpacking [####################################] 100%
The platform 'timsp430' has been successfully installed!
``platformio list``
~~~~~~~~~~~~~~~~~~~
To list installed platforms:
.. code-block:: bash
$ platformio list
# Example
$ platformio list
timsp430 with packages: toolchain-timsp430, tool-mspdebug, framework-energiamsp430
``platformio run``
~~~~~~~~~~~~~~~~~~
Process the project's environments defined in ``platformio.ini`` file:
.. code-block:: bash
$ platformio run
# Example
$ platformio run
Processing arduino_pro5v environment:
scons: `.pioenvs/arduino_pro5v/firmware.elf' is up to date.
scons: `.pioenvs/arduino_pro5v/firmware.hex' is up to date.
Processing launchpad_msp430g2 environment:
scons: `.pioenvs/launchpad_msp430g2/firmware.elf' is up to date.
scons: `.pioenvs/launchpad_msp430g2/firmware.hex' is up to date.
Processing launchpad_lm4f120 environment:
scons: `.pioenvs/launchpad_lm4f120/firmware.elf' is up to date.
scons: `.pioenvs/launchpad_lm4f120/firmware.hex' is up to date
Process specific environments:
.. code-block:: bash
$ platformio run -e myenv1 -e myenv2
# Example
$ platformio run -e arduino_pro5v -e launchpad_lm4f120
Processing arduino_pro5v environment:
scons: `.pioenvs/arduino_pro5v/firmware.elf' is up to date.
scons: `.pioenvs/arduino_pro5v/firmware.hex' is up to date.
Processing launchpad_lm4f120 environment:
scons: `.pioenvs/launchpad_lm4f120/firmware.elf' is up to date.
scons: `.pioenvs/launchpad_lm4f120/firmware.hex' is up to date.
Process specific target:
.. code-block:: bash
$ platformio run -t clean
$ platformio run -t upload --upload-port=/dev/ttyUSBX
# Example
platformio run -t clean
Processing arduino_pro5v environment:
Removed .pioenvs/arduino_pro5v/src/main.o
...
Removed .pioenvs/arduino_pro5v/firmware.hex
Processing launchpad_msp430g2 environment:
Removed .pioenvs/launchpad_msp430g2/src/main.o
...
Removed .pioenvs/launchpad_msp430g2/firmware.hex
Processing launchpad_lm4f120 environment:
Removed .pioenvs/launchpad_lm4f120/src/main.o
...
Removed .pioenvs/launchpad_lm4f120/firmware.hex
Mix environments and targets:
.. code-block:: bash
$ platformio run -e myembeddeddevice -t upload
# Example
$ platformio run -e launchpad_msp430g2 -t upload
Processing launchpad_msp430g2 environment:
/Users/ikravets/.platformio/timsp430/tools/mspdebug/mspdebug rf2500 --force-reset "prog .pioenvs/launchpad_msp430g2/firmware.hex"
MSPDebug version 0.20 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2012 Daniel Beer <dlbeer@gmail.com>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Trying to open interface 1 on 009
Initializing FET...
FET protocol version is 30394216
Configured for Spy-Bi-Wire
Sending reset...
Set Vcc: 3000 mV
Device ID: 0x2553
Code start address: 0xc000
Code size : 16384 byte = 16 kb
RAM start address: 0x200
RAM end address: 0x3ff
RAM size : 512 byte = 0 kb
Device: MSP430G2553/G2403
Code memory starts at 0xc000
Number of breakpoints: 2
Chip ID data: 25 53
Erasing...
Programming...
Writing 646 bytes at c000...
Writing 32 bytes at ffe0...
Done, 678 bytes total
``platformio search``
~~~~~~~~~~~~~~~~~~~~~
Search for development platforms:
.. code-block:: bash
# Print all available development platforms
$ platformio search all
# Filter platforms by "Query"
$ platformio search "Query"
# Example
$ platformio search ti
timsp430 - An embedded platform for TI MSP430 microcontrollers (with Energia Framework)
titiva - An embedded platform for TI TIVA C ARM microcontrollers (with Energia Framework)
$ platformio search arduino
atmelavr - An embedded platform for Atmel AVR microcontrollers (with Arduino Framework)
``platformio serialports``
~~~~~~~~~~~~~~~~~~~~~~~~~~
To list available `Serial Ports <http://en.wikipedia.org/wiki/Serial_port>`_:
.. code-block:: bash
$ platformio serialports
# Example (Posix)
$ platformio serialports
/dev/cu.SLAB_USBtoUART
----------
Hardware ID: USB VID:PID=10c4:ea60 SNR=0001
Description: CP2102 USB to UART Bridge Controller
/dev/cu.uart-1CFF4676258F4543
----------
Hardware ID: USB VID:PID=451:f432 SNR=1CFF4676258F4543
Description: Texas Instruments MSP-FET430UIF
# Example (Windows)
$ platformio serialports
COM4
----------
Hardware ID: USB VID:PID=0451:F432
Description: MSP430 Application UART (COM4)
COM3
----------
Hardware ID: USB VID:PID=10C4:EA60 SNR=0001
Description: Silicon Labs CP210x USB to UART Bridge (COM3)
``platformio show``
~~~~~~~~~~~~~~~~~~~
To show details about an installed platform:
.. code-block:: bash
$ platformio show SomePlatform
# Example
$ platformio show atmelavr
atmelavr - An embedded platform for Atmel AVR microcontrollers (with Arduino Framework)
----------
Package: toolchain-atmelavr
Alias: toolchain
Location: /Users/ikravets/.platformio/atmelavr/tools/toolchain
Version: 1
----------
Package: tool-avrdude
Alias: uploader
Location: /Users/ikravets/.platformio/atmelavr/tools/avrdude
Version: 1
----------
Package: framework-arduinoavr
Location: /Users/ikravets/.platformio/atmelavr/frameworks/arduino
Version: 1
``platformio uninstall``
~~~~~~~~~~~~~~~~~~~~~~~~
To uninstall platform:
.. code-block:: bash
$ platformio uninstall SomePlatform
# Example
$ platformio uninstall timsp430
Uninstalling toolchain-timsp430 package: [OK]
Uninstalling tool-mspdebug package: [OK]
Uninstalling framework-energiamsp430 package: [OK]
The platform 'timsp430' has been successfully uninstalled!
``platformio update``
~~~~~~~~~~~~~~~~~~~~~~~~
To check or update installed platforms:
.. code-block:: bash
$ platformio update
# Example
$ platformio update
Platform atmelavr
--------
Updating toolchain-atmelavr package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating framework-arduinoavr package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating tool-avrdude package:
Versions: Current=1, Latest=1 [Up-to-date]
Platform timsp430
--------
Updating toolchain-timsp430 package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating tool-mspdebug package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating framework-energiamsp430 package:
Versions: Current=1, Latest=1 [Up-to-date]
Platform titiva
--------
Updating toolchain-gccarmnoneeabi package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating tool-lm4flash package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating framework-energiativa package:
Versions: Current=1, Latest=1 [Up-to-date]
Questions & Bugs
----------------
Please use the
`issue tracker <https://github.com/ivankravets/platformio/issues>`_
to ask questions or report bugs.
* ``atmelavr`` `Atmel AVR <http://platformio.ikravets.com/#!/platforms/atmelavr>`_
(including *Arduino*-based boards, *Microduino, Raspduino, Teensy*)
* ``timsp430`` `TI MSP430 <http://platformio.ikravets.com/#!/platforms/timsp430>`_
(including *MSP430* LaunchPads)
* ``titiva`` `TI TIVA C <http://platformio.ikravets.com/#!/platforms/titiva>`_
(including *TIVA C* Series LaunchPads)
Licence

177
docs/Makefile Normal file
View File

@ -0,0 +1,177 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PlatformIO.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PlatformIO.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/PlatformIO"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PlatformIO"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

BIN
docs/_static/ide-platformio-arduino.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
docs/_static/ide-platformio-eclipse.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 KiB

BIN
docs/_static/ide-platformio-energia.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

BIN
docs/_static/ide-platformio-vim.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
docs/_static/platformio-logo.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

278
docs/conf.py Normal file
View File

@ -0,0 +1,278 @@
# -*- coding: utf-8 -*-
#
# PlatformIO documentation build configuration file, created by
# sphinx-quickstart on Sun Aug 3 19:13:49 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import os
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath(os.pardir))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'PlatformIO'
copyright = u'2014, Ivan Kravets'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
import platformio
# The short X.Y version.
version = '.'.join(map(str, platformio.VERSION[0:2]))
# The full version, including alpha/beta/rc tags.
release = platformio.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'PlatformIOdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'PlatformIO.tex', u'PlatformIO Documentation',
u'Ivan Kravets', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'platformio', u'PlatformIO Documentation',
[u'Ivan Kravets'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'PlatformIO', u'PlatformIO Documentation',
u'Ivan Kravets', 'PlatformIO', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
# Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'http://docs.python.org/': None}
# Read the Docs Sphinx Theme patch
# on_rtd is whether we are on readthedocs.org,
# this line of code grabbed from docs.readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# A timeout value, in seconds, for the linkcheck builder
# http://sphinx-doc.org/config.html#confval-linkcheck_timeout
linkcheck_timeout = 10
linkcheck_anchors = False

1
docs/history.rst Normal file
View File

@ -0,0 +1 @@
.. include:: ../HISTORY.rst

59
docs/ide.rst Normal file
View File

@ -0,0 +1,59 @@
.. _ide:
IDE Integration
===============
Arduino IDE
-----------
.. image:: _static/ide-platformio-arduino.png
:target: http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides
* `Integration of PlatformIO library manager to Arduino IDE <http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides>`_
Eclipse
-------
.. image:: _static/ide-platformio-eclipse.png
:target: http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio
* `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO <http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio>`_
Energia IDE
-----------
.. image:: _static/ide-platformio-energia.png
:target: http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides
* `Integration of PlatformIO library manager to Energia IDE <http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides>`_
VIM
---
.. image:: _static/ide-platformio-vim.png
Recommended bundles:
* Syntax highlight - `Arduino-syntax-file <https://github.com/vim-scripts/Arduino-syntax-file>`_
* Code Completion - `YouCompleteMe <https://github.com/Valloric/YouCompleteMe>`_
* Syntax checking - `Syntastic <https://github.com/scrooloose/syntastic>`_
Put to the project directory ``Makefile`` wrapper with contents:
.. code-block:: make
# Uncomment lines below if you have problems with $PATH
#SHELL := /bin/bash
#PATH := /usr/local/bin:$(PATH)
all:
platformio run -t upload
clean:
platformio run -t clean
Now, in VIM ``cd /path/to/this/project`` and press ``Ctrl+B`` or ``Cmd+B``
(Mac). *PlatformIO* should compile your source code from the ``src`` directory,
make firmware and upload it.

50
docs/index.rst Normal file
View File

@ -0,0 +1,50 @@
PlatformIO: A cross-platform code builder and the missing library manager
=========================================================================
.. image:: _static/platformio-logo.png
:target: http://platformio.ikravets.com
`Website + Library Search <http://platformio.ikravets.com>`_ |
`Project Examples <https://github.com/ivankravets/platformio/tree/develop/examples>`_ |
`Source Code <https://github.com/ivankravets/platformio>`_ |
`Issues <https://github.com/ivankravets/platformio/issues>`_ |
`Blog <http://www.ikravets.com/category/computer-life/platformio>`_ |
`Twitter <https://twitter.com/PlatformIOTool>`_
You have no need to install any *IDE* or compile any tool chains. *PlatformIO*
has pre-built different development platforms including: compiler, debugger,
uploader (for embedded) and many other useful tools.
**PlatformIO** allows developer to compile the same code with different
platforms using only one command :ref:`cmd_run`. This happens due to
:ref:`projectconf` where you can setup different environments with specific
options: platform type, firmware uploading settings, pre-built framework
and many more.
Each platform consists of packages which are located in own repository.
Due to :ref:`cmd_update` command you will have up-to-date development
instruments.
**PlatformIO** is well suited for **embedded development**. It can:
* Automatically analyse dependency
* Reliably detect build changes
* Build framework or library source code to static library
* Lookup for external libraries which are installed via :ref:`librarymanager`
* Upload firmware to your device
Contents
--------
.. toctree::
:maxdepth: 2
quickstart
installation
projectconf
platforms/index
librarymanager/index
userguide/index
ide
history

108
docs/installation.rst Normal file
View File

@ -0,0 +1,108 @@
.. _installation:
Installation
============
*PlatformIO* is written in `Python <http://python.org/download/>`_ and works
on *Mac OS X*, *Linux*, *Windows OS* and Credit-card *ARM*-based
computers (*Raspberry Pi*).
System requirements
-------------------
* **Operating systems:**
* Mac OS X
* Linux
* Windows
* `Python 2.6 or Python 2.7 <http://python.org/download/>`_
All commands below should be executed in
`Command-line <http://en.wikipedia.org/wiki/Command-line_interface>`_
application:
* *Mac OS X / Linux* this is *Terminal* application.
* *Windows* this is
`Command Prompt <http://en.wikipedia.org/wiki/Command_Prompt>`_ (``cmd.exe``)
application.
Please *choose one of* the following:
Super-Quick (Mac / Linux)
-------------------------
To install or upgrade *PlatformIO* paste that at a *Terminal* prompt
(you might need to run ``sudo`` first):
.. code-block:: bash
python -c "$(curl -fsSL https://raw.githubusercontent.com/ivankravets/platformio/master/scripts/get-platformio.py)"
Installer Script (Mac / Linux / Windows)
----------------------------------------
To install or upgrade *PlatformIO*, download
`get-platformio.py <https://raw.githubusercontent.com/ivankravets/platformio/develop/scripts/get-platformio.py>`_
script. Then run the following (you might need to run ``sudo`` first):
.. code-block:: bash
python get-platformio.py
On *Windows OS* it may look like:
.. code-block:: bash
C:\Python27\python.exe get-platformio.py
.. warning::
**Mac OS Users**: If you have an error ``pkg_resources.DistributionNotFound`` please
upgrade *SetupTools* package: ``$ [sudo] pip uninstall setuptools``
and ``$ [sudo] pip install setuptools``.
Then re-install *PlatformIO*: ``$ [sudo] pip uninstall platformio``
and ``$ [sudo] pip install platformio``.
Full Guide
----------
1. Check a ``python`` version (only 2.6-2.7 is supported):
.. code-block:: bash
$ python --version
*Windows OS* Users only:
* `Download Python 2.7 <https://www.python.org/downloads/>`_ and install it.
* Add to PATH system variable ``;C:\Python27;C:\Python27\Scripts;`` and
reopen *Command Prompt* (``cmd.exe``) application. Please read this
article `How to set the path and environment variables in Windows
<http://www.computerhope.com/issues/ch000549.htm>`_.
2. Check a ``pip`` tool for installing and managing *Python* packages:
.. code-block:: bash
$ pip search platformio
You should see short information about ``platformio`` package.
If your computer does not recognize ``pip`` command, try to install it first
using `these instructions <https://pip.pypa.io/en/latest/installing.html>`_.
3. Install a ``platformio`` and related packages:
.. code-block:: bash
$ pip install platformio && pip install --egg scons
For upgrading the ``platformio`` to new version please use this command:
.. code-block:: bash
$ pip install -U platformio

View File

@ -0,0 +1,307 @@
.. |PIOAPICR| replace:: *PlatformIO Library Registry Crawler*
.. _library_config:
library.json
============
``library.json`` is a manifest file of development library.
Initially it was
developed for :ref:`librarymanager`, but later was accepted by worldwide embedded
community like a **standard library specification**.
A data in ``library.json`` should be represented
in `JSON-style <http://en.wikipedia.org/wiki/JSON>`_ via
`associative array <http://en.wikipedia.org/wiki/Associative_array>`_
(name/value pairs). An order doesn't matter. The allowable fields
(names from pairs) are described below.
.. contents::
.. _libjson_name:
``name``
--------
**Required** | Type: ``String`` | Max. Length: 50
A name of the library.
* Must be unique.
* Should be slug style for simplicity, consistency and compatibility.
Example: *Arduino-SPI*
* Title Case, Aa-z, can contain digits and dashes (but not start/end
with them).
* Consecutive dashes are not allowed.
.. _libjson_description:
``description``
---------------
**Required** | Type: ``String`` | Max. Length: 255
The field helps users to identify and search for your library with a brief
description. Describe the hardware devices (sensors, boards and etc.) which
are suitable with it.
.. _libjson_keywords:
``keywords``
------------
**Required** | Type: ``String`` | Max. Length: 255
Used for search by keyword. Helps to make your library easier to discover
without people needing to know its name.
The keyword should be lowercased, can contain a-z, digits and dash (but not
start/end with them). A list from the keywords can be specified with
separator ``,``
.. _libjson_authors:
``authors``
-----------
*Required* if :ref:`libjson_repository` field is not defined | Type: ``Object``
or ``Array``
An author contact information
* ``name`` Full name (**Required**)
* ``email``
* ``url`` An author's contact page
* ``maintainer`` Specify "maintainer" status
Examples:
.. code-block:: javascript
"authors":
{
"name": "John Smith",
"email": "me@john-smith.com",
"url": "http://www.john-smith/contact"
}
...
"authors":
[
{
"name": "John Smith",
"email": "me@john-smith.com",
"url": "http://www.john-smith/contact"
},
{
"name": "Andrew Smith",
"email": "me@andrew-smith.com",
"url": "http://www.andrew-smith/contact",
"maintainer": true
}
]
.. note::
You can omit :ref:`libjson_authors` field and define
:ref:`libjson_repository` field. Only *GitHub-based* repository is
supported now. In this case
|PIOAPICR| will use information from
`GitHub API Users <https://developer.github.com/v3/users/>`_.
.. _libjson_repository:
``repository``
--------------
*Required* if :ref:`libjson_downloadurl` field is not defined | Type: ``Object``
The repository in which the source code can be found.
Example:
.. code-block:: javascript
"repository":
{
"type": "git",
"url": "https://github.com/foo/bar.git"
}
.. _libjson_downloadurl:
``downloadUrl``
---------------
*Required* if :ref:`libjson_repository` field is not defined | Type: ``String``
It is the *HTTP URL* to the archived source code of library. It should end
with the type of archive (``.zip`` or ``.tar.gz``).
.. _libjson_version:
``version``
-----------
*Required* if :ref:`libjson_repository` field is not defined | Type: ``String``
| Max. Length: 20
A version of the current library source code.
* Can contain a-z, digits, dots or dash.
* `Semantic Versioning <http://semver.org>`_ is recommended.
* A `CVS <http://en.wikipedia.org/wiki/Concurrent_Versions_System>`_
revision from the latest commit. Example: ``13`` (*SVN*) or first 10
chars of *SHA* digest ``e4564b7da4`` (*Git*).
.. note::
You can omit :ref:`libjson_version` field and define
:ref:`libjson_repository` field. In this case
|PIOAPICR| will use the *CVS*-revision from the latest commit.
.. _libjson_include:
``include``
-----------
*Optional* | Type: ``String`` or ``Array`` |
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_
If :ref:`libjson_include` field is a type of ``String``, then
|PIOAPICR| will recognize it like a "relative path inside
repository/archive to library source code". See example below where the only
source code from the relative directory ``LibrarySourceCodeHere`` will be
included.
.. code-block:: javascript
"include": "some/child/dir/LibrarySourceCodeHere"
If :ref:`libjson_include` field is a type of ``Array``, then
|PIOAPICR| firstly will apply :ref:`libjson_exclude` filter and
then include only directories/files which match with :ref:`libjson_include`
patterns.
Example:
.. code-block:: javascript
"include":
[
"dir/*.[ch]pp",
"dir/examples/*",
"*/*/*.h"
]
Pattern Meaning
.. list-table::
:header-rows: 1
* - Pattern
- Meaning
* - ``*``
- matches everything
* - ``?``
- matches any single character
* - ``[seq]``
- matches any character in seq
* - ``[!seq]``
- matches any character not in seq
.. _libjson_exclude:
``exclude``
-----------
*Optional* | Type: ``String`` or ``Array`` |
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_
Exclude the directories and files which match with :ref:`libjson_exclude`
patterns.
.. _libjson_frameworks:
``frameworks``
--------------
*Optional* | Type: ``String`` or ``Array``
A list with compatible frameworks. The available framework types are defined in
the :ref:`platforms` section.
.. _libjson_platforms:
``platforms``
-------------
*Optional* | Type: ``String`` or ``Array``
A list with compatible platforms. The available platform types are
defined in :ref:`platforms` section.
.. _libjson_dependencies:
``dependencies``
----------------
*Optional* | Type: ``Array`` or ``Object``
A list of dependent libraries. They will be installed automatically with
:ref:`cmd_lib_install` command.
Allowed requirements for dependent library:
* ``name`` | Type: ``String``
* ``authors`` | Type: ``String`` or ``Array``
* ``frameworks`` | Type: ``String`` or ``Array``
* ``platforms`` | Type: ``String`` or ``Array``
Example:
.. code-block:: javascript
"dependencies":
[
{
"name": "Library-Foo",
"authors":
[
"Jhon Smith",
"Andrew Smith"
]
},
{
"name": "Library-Bar",
"frameworks": "FrameworkFoo, FrameworkBar"
}
]
.. _libjson_examples:
``examples``
----------------
*Optional* | Type: ``String`` or ``Array`` |
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_
A list of example patterns. This field is predefined with default value:
.. code-block:: javascript
"examples": [
"[Ee]xamples/*/*.ini",
"[Ee]xamples/*/*.pde"
]

View File

@ -0,0 +1,130 @@
.. _library_creating:
.. |PIOAPICR| replace:: *PlatformIO Library Registry Crawler*
Creating Library
================
*PlatformIO* :ref:`librarymanager` doesn't have any requirements to a library
source code structure. The only one requirement is library's manifest file -
:ref:`library_config`. It can be located inside your library or in the another
location where |PIOAPICR| will have *HTTP* access.
.. contents::
Source Code Location
--------------------
There are a several ways how to share your library with the whole world
(see `examples <https://github.com/ivankravets/platformio-libmirror/tree/master/configs>`_).
You can hold a lot of libraries (split into separated folders) inside one of
the repository/archive. In this case please use :ref:`libjson_include`
field to specify the relative path to your library's source code.
At GitHub
^^^^^^^^^
**Recommended**
If a library source code is located at `GitHub <https://github.com>`_, then
you **need to specify** only these fields in the :ref:`library_config`:
* :ref:`libjson_name`
* :ref:`libjson_keywords`
* :ref:`libjson_description`
* :ref:`libjson_repository`
|PIOAPICR| will populate the rest fields, like :ref:`libjson_version` or
:ref:`libjson_authors` with an actual information from *GitHub*.
Example:
.. code-block:: javascript
{
"name": "IRremote",
"keywords": "infrared, ir, remote",
"description": "Send and receive infrared signals with multiple protocols",
"repository":
{
"type": "git",
"url": "https://github.com/shirriff/Arduino-IRremote.git"
}
}
Under CVS (SVN/GIT)
^^^^^^^^^^^^^^^^^^^
|PIOAPICR| can operate with a library source code that is under *CVS* control.
The list of **required** fields in the :ref:`library_config` will look like:
* :ref:`libjson_name`
* :ref:`libjson_keywords`
* :ref:`libjson_description`
* :ref:`libjson_authors`
* :ref:`libjson_repository`
Example:
.. code-block:: javascript
{
"name": "XBee",
"keywords": "xbee, protocol, radio",
"description": "Arduino library for communicating with XBees in API mode",
"authors":
{
"name": "Andrew Rapp",
"email": "andrew.rapp@gmail.com",
"url": "https://code.google.com/u/andrew.rapp@gmail.com/"
},
"repository":
{
"type": "git",
"url": "https://code.google.com/p/xbee-arduino/"
}
}
Self-hosted
^^^^^^^^^^^
You can manually archive (*Zip, Tar.Gz*) your library source code and host it
in the *Internet*. Then you should specify the additional fields,
like :ref:`libjson_version` and :ref:`libjson_downloadurl`. The final list
of **required** fields in the :ref:`library_config` will look like:
* :ref:`libjson_name`
* :ref:`libjson_keywords`
* :ref:`libjson_description`
* :ref:`libjson_authors`
* :ref:`libjson_version`
* :ref:`libjson_downloadurl`
.. code-block:: javascript
{
"name": "OneWire",
"keywords": "onewire, 1-wire, bus, sensor, temperature, ibutton",
"description": "Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc)",
"authors":
{
"name": "Paul Stoffregen",
"url": "http://www.pjrc.com/teensy/td_libs_OneWire.html"
},
"version": "2.2",
"downloadUrl": "http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip",
"include": "OneWire"
}
Register
--------
The registration requirements:
* A library must adhere to the :ref:`library_config` specification.
* There must be public *HTTP* access to the library :ref:`library_config` file.
Now, you can :ref:`register <cmd_lib_register>` your library and allow others
to :ref:`install <cmd_lib_install>` it.

View File

@ -0,0 +1,25 @@
.. _librarymanager:
Library Manager
===============
..
*"The missing library manager for development platforms"* [#]_
*PlatformIO Library Manager* allows you to organize external embedded libraries.
You can search for new libraries via :ref:`Command Line interface <cmd_lib_search>`
or `Web 2.0 Library Search <http://platformio.ikravets.com/#!/lib>`_.
You don't need to bother for finding the latest version of library. Due to
:ref:`cmd_lib_update` command you will have up-to-date external libraries.
.. toctree::
:maxdepth: 2
config
creating
User Guide <../userguide/lib/index.rst>
.. [#] Inspired by `npm <https://www.npmjs.org>`_ and `bower
<http://bower.io>`_ package managers for web.

242
docs/make.bat Normal file
View File

@ -0,0 +1,242 @@
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\PlatformIO.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\PlatformIO.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %BUILDDIR%/..
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %BUILDDIR%/..
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
if "%1" == "xml" (
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The XML files are in %BUILDDIR%/xml.
goto end
)
if "%1" == "pseudoxml" (
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
goto end
)
:end

323
docs/platforms/atmelavr.rst Normal file
View File

@ -0,0 +1,323 @@
.. _platform_atmelavr:
Platform ``atmelavr``
=====================
`Atmel AVR® 8- and 32-bit MCUs <http://www.atmel.com/products/microcontrollers/avr/default.aspx>`_
deliver a unique combination of performance, power efficiency and design
flexibility. Optimized to speed time to market—and easily adapt to new
ones—they are based on the industry's most code-efficient architecture for
C and assembly programming.
.. contents::
Packages
--------
.. list-table::
:header-rows: 1
* - Name
- Alias
- Contents
* - ``toolchain-atmelavr``
- toolchain
- `avr-gcc <https://gcc.gnu.org/wiki/avr-gcc>`_,
`GDB <http://www.gnu.org/software/gdb/>`_,
`AVaRICE <http://avarice.sourceforge.net>`_,
`SimulAVR <http://www.nongnu.org/simulavr/>`_
* - ``tool-avrdude``
- uploader
- `AVRDUDE <http://www.nongnu.org/avrdude/>`_
* - ``framework-arduinoavr``
-
- See below in :ref:`atmelavr_frameworks`
.. note::
You can install ``atmelavr`` platform with these packages
via :ref:`cmd_install` command.
.. _atmelavr_frameworks:
Frameworks
----------
.. list-table::
:header-rows: 1
* - Type ``framework``
- Name
- Reference
* - ``arduino``
- Arduino Wiring-based Framework (AVR Core, 1.5.x branch)
- `Documentation <http://arduino.cc/en/Reference/HomePage>`_
Boards
------
.. note::
For more detailed ``board`` information please scroll tables below by
horizontal.
Arduino
~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller ``board_mcu``
- Frequency ``board_f_cpu``
- Flash
- RAM
* - ``diecimilaatmega168``
- `Arduino Diecimila or Duemilanove (ATmega168)
<http://arduino.cc/en/Main/ArduinoBoardDiecimila>`_
- ATmega168 ``atmega168``
- 16 MHz ``16000000L``
- 16 Kb
- 1 Kb
* - ``diecimilaatmega328``
- `Arduino Diecimila or Duemilanove (ATmega328)
<http://arduino.cc/en/Main/ArduinoBoardDiecimila>`_
- ATmega328 ``atmega328``
- 16 MHz ``16000000L``
- 32 Kb
- 2 Kb
* - ``fio``
- `Arduino Fio
<http://arduino.cc/en/Main/ArduinoBoardFio>`_
- ATmega328P ``atmega328p``
- 8 MHz ``8000000L``
- 32 Kb
- 2 Kb
* - ``leonardo``
- `Arduino Leonardo <http://arduino.cc/en/Main/arduinoBoardLeonardo>`_
- ATmega32u4 ``atmega32u4``
- 16 MHz ``16000000L``
- 32 Kb
- 2.5 Kb
* - ``LilyPadUSB``
- `Arduino LilyPad USB
<http://arduino.cc/en/Main/ArduinoBoardLilyPadUSB>`_
- ATmega32u4 ``atmega32u4``
- 8 MHz ``8000000L``
- 32 Kb
- 2.5 Kb
* - ``lilypadatmega168``
- `Arduino LilyPad (ATmega168)
<http://arduino.cc/en/Main/ArduinoBoardLilyPad>`_
- ATmega168 ``atmega168``
- 8 MHz ``8000000L``
- 16 Kb
- 1 Kb
* - ``lilypadatmega328``
- `Arduino LilyPad (ATmega328)
<http://arduino.cc/en/Main/ArduinoBoardLilyPad>`_
- ATmega328P ``atmega328p``
- 8 MHz ``8000000L``
- 32 Kb
- 2 Kb
* - ``megaatmega1280``
- `Arduino Mega (ATmega1280)
<http://arduino.cc/en/Main/arduinoBoardMega>`_
- ATmega1280 ``atmega1280``
- 16 MHz ``16000000L``
- 128 Kb
- 8 Kb
* - ``megaatmega2560``
- `Arduino Mega (ATmega2560)
<http://arduino.cc/en/Main/arduinoBoardMega2560>`_
- ATmega2560 ``atmega2560``
- 16 MHz ``16000000L``
- 256 Kb
- 8 Kb
* - ``megaADK``
- `Arduino Mega ADK
<http://arduino.cc/en/Main/ArduinoBoardMegaADK>`_
- ATmega2560 ``atmega2560``
- 16 MHz ``16000000L``
- 256 Kb
- 8 Kb
* - ``micro``
- `Arduino Micro
<http://arduino.cc/en/Main/ArduinoBoardMicro>`_
- ATmega32u4 ``atmega32u4``
- 16 MHz ``16000000L``
- 32 Kb
- 2.5 Kb
* - ``miniatmega168``
- `Arduino Mini (ATmega168)
<http://arduino.cc/en/Main/ArduinoBoardMini>`_
- ATmega168 ``atmega168``
- 16 MHz ``16000000L``
- 16 Kb
- 1 Kb
* - ``miniatmega328``
- `Arduino Mini (ATmega328P)
<http://arduino.cc/en/Main/ArduinoBoardMini>`_
- ATmega328P ``atmega328p``
- 16 MHz ``16000000L``
- 32 Kb
- 2 Kb
* - ``nanoatmega168``
- `Arduino Nano (ATmega168)
<http://arduino.cc/en/Main/ArduinoBoardNano>`_
- ATmega168 ``atmega168``
- 16 MHz ``16000000L``
- 16 Kb
- 1 Kb
* - ``nanoatmega328``
- `Arduino Nano (ATmega328P)
<http://arduino.cc/en/Main/ArduinoBoardNano>`_
- ATmega328P ``atmega328p``
- 16 MHz ``16000000L``
- 32 Kb
- 2 Kb
* - ``pro8MHzatmega168``
- `Arduino Pro or Pro Mini (ATmega168, 3.3V)
<http://arduino.cc/en/Main/ArduinoBoardProMini>`_
- ATmega168 ``atmega168``
- 8 MHz ``8000000L``
- 16 Kb
- 1 Kb
* - ``pro16MHzatmega168``
- `Arduino Pro or Pro Mini (ATmega168, 5V)
<http://arduino.cc/en/Main/ArduinoBoardProMini>`_
- ATmega168 ``atmega168``
- 16 MHz ``16000000L``
- 16 Kb
- 1 Kb
* - ``pro8MHzatmega328``
- `Arduino Pro or Pro Mini (ATmega328P, 3.3V)
<http://arduino.cc/en/Main/ArduinoBoardProMini>`_
- ATmega328P ``atmega328p``
- 8 MHz ``8000000L``
- 32 Kb
- 2 Kb
* - ``pro16MHzatmega328``
- `Arduino Pro or Pro Mini (ATmega328P, 5V)
<http://arduino.cc/en/Main/ArduinoBoardProMini>`_
- ATmega328P ``atmega328p``
- 16 MHz ``16000000L``
- 32 Kb
- 2 Kb
* - ``uno``
- `Arduino Uno
<http://arduino.cc/en/Main/ArduinoBoardUno>`_
- ATmega328P ``atmega328p``
- 16 MHz ``16000000L``
- 32 Kb
- 2 Kb
More detailed information you can find here
`Arduino boards <http://arduino.cc/en/Main/Products>`_.
Microduino
~~~~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller ``board_mcu``
- Frequency ``board_f_cpu``
- Flash
- RAM
* - ``168pa8m``
- `Microduino Core (ATmega168P, 3.3V)
<http://www.microduino.cc/wiki/index.php?title=Microduino-Core>`_
- ATmega168P ``atmega168p``
- 8 MHz ``8000000L``
- 16 Kb
- 1 Kb
* - ``168pa16m``
- `Microduino Core (ATmega168P, 5V)
<http://www.microduino.cc/wiki/index.php?title=Microduino-Core>`_
- ATmega168P ``atmega168p``
- 16 MHz ``16000000L``
- 16 Kb
- 1 Kb
* - ``328p8m``
- `Microduino Core (ATmega328P, 3.3V)
<http://www.microduino.cc/wiki/index.php?title=Microduino-Core>`_
- ATmega328P ``atmega328p``
- 8 MHz ``8000000L``
- 32 Kb
- 2 Kb
* - ``328p16m``
- `Microduino Core (ATmega328P, 5V)
<http://www.microduino.cc/wiki/index.php?title=Microduino-Core>`_
- ATmega328P ``atmega328p``
- 16 MHz ``16000000L``
- 32 Kb
- 2 Kb
* - ``644pa8m``
- `Microduino Core+ (ATmega644PA, 3.3V)
<http://www.microduino.cc/wiki/index.php?title=Microduino-Core%2B>`_
- ATmega644PA ``atmega644p``
- 8 MHz ``8000000L``
- 64 Kb
- 4 Kb
* - ``644pa16m``
- `Microduino Core+ (ATmega644PA, 5V)
<http://www.microduino.cc/wiki/index.php?title=Microduino-Core%2B>`_
- ATmega644PA ``atmega644p``
- 16 MHz ``16000000L``
- 64 Kb
- 4 Kb
* - ``1284p8m``
- `Microduino Core+ (Atmega1284P, 3.3V)
<http://www.microduino.cc/wiki/index.php?title=Microduino-Core%2B>`_
- Atmega1284P ``atmega1284p``
- 8 MHz ``8000000L``
- 128 Kb
- 16 Kb
* - ``1284p16m``
- `Microduino Core+ (Atmega1284P, 5V)
<http://www.microduino.cc/wiki/index.php?title=Microduino-Core%2B>`_
- Atmega1284P ``atmega1284p``
- 16 MHz ``16000000L``
- 128 Kb
- 16 Kb
* - ``32u416m``
- `Microduino-Core USB
<http://www.microduino.cc/wiki/index.php?title=Microduino-CoreUSB>`_
- ATmega32u4 ``atmega32u4``
- 16 MHz ``16000000L``
- 32 Kb
- 2.5 Kb
More detailed information you can find here
`Microduino boards <http://www.microduino.cc/wiki/index.php?title=Main_Page>`_.
Raspduino
~~~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller ``board_mcu``
- Frequency ``board_f_cpu``
- Flash
- RAM
* - ``raspduino``
- `Raspduino
<http://www.bitwizard.nl/wiki/index.php/Raspduino>`_
- ATmega328P ``atmega328p``
- 16 MHz ``16000000L``
- 32 Kb
- 2 Kb
More detailed information you can find in
`Wiki <http://www.bitwizard.nl/wiki/index.php/Raspduino>`_.

19
docs/platforms/index.rst Normal file
View File

@ -0,0 +1,19 @@
.. _platforms:
Platforms & Embedded Boards
===========================
*PlatformIO* has pre-built different development platforms for popular OS (Mac,
Linux 32/64/ARM and Windows). Each of them include compiler, debugger, uploader
(for embedded) and many other useful tools.
Also it has pre-configured settings for most popular **Embedded Platform
Boards**. You have no need to specify in :ref:`projectconf` type or frequency of
MCU, upload protocol or etc. Please use ``board`` option.
.. toctree::
:maxdepth: 2
atmelavr
timsp430
titiva

119
docs/platforms/timsp430.rst Normal file
View File

@ -0,0 +1,119 @@
.. _platform_timsp430:
Platform ``timsp430``
=====================
`MSP430 microcontrollers (MCUs) from Texas Instruments (TI) <http://www.ti.com/lsds/ti/microcontrollers_16-bit_32-bit/msp/overview.page>`_
are 16-bit, RISC-based, mixed-signal processors designed for ultra-low power.
These MCUs offer the lowest power consumption and the perfect mix of integrated
peripherals for thousands of applications.
.. contents::
Packages
--------
.. list-table::
:header-rows: 1
* - Name
- Alias
- Contents
* - ``toolchain-timsp430``
- toolchain
- `msp-gcc <http://sourceforge.net/projects/mspgcc/>`_,
`GDB <http://www.gnu.org/software/gdb/>`_
* - ``tool-mspdebug``
- uploader
- `MSPDebug <http://mspdebug.sourceforge.net>`_
* - ``framework-energiamsp430``
-
- See below in :ref:`timsp430_frameworks`
.. note::
You can install ``atmelavr`` platform with these packages
via :ref:`cmd_install` command.
.. _timsp430_frameworks:
Frameworks
----------
.. list-table::
:header-rows: 1
* - Type ``framework``
- Name
- Reference
* - ``energia``
- Energia Wiring-based Framework (MSP430 Core)
- `Documentation <http://energia.nu/reference/>`_
Boards
------
.. note::
For more detailed ``board`` information please scroll table below by
horizontal.
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller ``board_mcu``
- Frequency ``board_f_cpu``
- Flash
- RAM
* - ``lpmsp430g2231``
- `MSP430G2231 LaunchPad <http://www.ti.com/ww/en/launchpad/launchpads-msp430-msp-exp430g2.html>`_
- MSP430G2231 ``msp430g2231``
- 16 MHz ``16000000L``
- 2 Kb
- 128 B
* - ``lpmsp430g2452``
- `MSP430G2452 LaunchPad <http://www.ti.com/ww/en/launchpad/launchpads-msp430-msp-exp430g2.html>`_
- MSP430G2452 ``msp430g2452``
- 16 MHz ``16000000L``
- 8 Kb
- 256 B
* - ``lpmsp430g2553``
- `MSP430G2553 LaunchPad <http://www.ti.com/ww/en/launchpad/launchpads-msp430-msp-exp430g2.html>`_
- MSP430G2553 ``msp430g2553``
- 16 MHz ``16000000L``
- 16 Kb
- 512 B
* - ``lpmsp430f5529``
- `MSP430F5529 LaunchPad (16 Mhz) <http://www.ti.com/ww/en/launchpad/launchpads-msp430-msp-exp430f5529lp.html>`_
- MSP430F5529 ``msp430f5529``
- 16 MHz ``16000000L``
- 128 Kb
- 8 KB
* - ``lpmsp430f5529_25``
- `MSP430F5529 LaunchPad (25 Mhz) <http://www.ti.com/ww/en/launchpad/launchpads-msp430-msp-exp430f5529lp.html>`_
- MSP430F5529 ``msp430f5529``
- 25 MHz ``25000000L``
- 128 Kb
- 8 KB
* - ``lpmsp430fr5739``
- `MSP430FR5739 Experimenter Board <http://www.ti.com/tool/msp-exp430fr5739>`_
- MSP430FR5739 ``msp430fr5739``
- 16 MHz ``16000000L``
- 16 Kb
- 1 KB
* - ``lpmsp430fr5969``
- `MSP430FR5969 LaunchPad <http://www.ti.com/ww/en/launchpad/launchpads-msp430-msp-exp430fr5969.html>`_
- MSP430FR5969 ``msp430fr5969``
- 16 MHz ``16000000L``
- 64 Kb
- 2 KB
More detailed information you can find here
`MSP430 LaunchPads <http://www.ti.com/ww/en/launchpad/launchpads-msp430.html>`_.

93
docs/platforms/titiva.rst Normal file
View File

@ -0,0 +1,93 @@
.. _platform_titiva:
Platform ``titiva``
===================
`Texas Instruments TM4C12x MCUs <http://www.ti.com/lsds/ti/microcontrollers_16-bit_32-bit/c2000_performance/control_automation/tm4c12x/overview.page>`_
offer the industrys most popular ARM®
Cortex®-M4 core with scalable memory and package options, unparalleled
connectivity peripherals, advanced application functions, industry-leading
analog integration, and extensive software solutions.
.. contents::
Packages
--------
.. list-table::
:header-rows: 1
* - Name
- Alias
- Contents
* - ``toolchain-gccarmnoneeabi``
- toolchain
- `gcc-arm-embedded <https://launchpad.net/gcc-arm-embedded/>`_,
`GDB <http://www.gnu.org/software/gdb/>`_
* - ``tool-lm4flash``
- uploader
- `Flash Programmer <http://www.ti.com/tool/lmflashprogrammer>`_
* - ``framework-energiativa``
-
- See below in :ref:`titiva_frameworks`
.. note::
You can install ``titiva`` platform with these packages
via :ref:`cmd_install` command.
.. _titiva_frameworks:
Frameworks
----------
.. list-table::
:header-rows: 1
* - Type ``framework``
- Name
- Reference
* - ``energia``
- Energia Wiring-based Framework (LM4F Core)
- `Documentation <http://energia.nu/reference/>`_
Boards
------
.. note::
For more detailed ``board`` information please scroll table below by
horizontal.
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller ``board_mcu``
- Frequency ``board_f_cpu``
- Flash
- RAM
* - ``lplm4f120h5qr``
- `Stellaris LM4F120 LaunchPad <http://www.ti.com/tool/ek-lm4f120xl>`_
- LM4F120H5QR ``cortex-m4``
- 80 MHz ``80000000L``
- 256 Kb
- 32 Kb
* - ``lptm4c1230c3pm``
- `Tiva C Series TM4C123G LaunchPad
<http://www.ti.com/ww/en/launchpad/launchpads-connected-ek-tm4c123gxl.html>`_
- TM4C123GH6PM ``cortex-m4``
- 80 MHz ``80000000L``
- 256 Kb
- 32 Kb
* - ``lptm4c1294ncpdt``
- `Tiva C Series TM4C1294 Connected LaunchPad
<http://www.ti.com/ww/en/launchpad/launchpads-connected-ek-tm4c1294xl.html>`_
- TM4C1294NCPDT ``cortex-m4``
- 120 Mhz ``120000000L``
- 1 Mb
- 256 Kb
More detailed information you can find here
`TIVA C Series LaunchPads <http://www.ti.com/ww/en/launchpad/launchpads-connected.html>`_.

342
docs/projectconf.rst Normal file
View File

@ -0,0 +1,342 @@
.. _projectconf:
Project Configuration File
==========================
The Project configuration file is named ``platformio.ini``. This is a
`INI-style <http://en.wikipedia.org/wiki/INI_file>`_ file.
``platformio.ini`` has sections (each denoted by a ``[header]``) and
key / value pairs within the sections. A sign ``#`` at the beginning of the
line indicate a comment. Comment lines are ignored.
The sections and their allowable values are described below.
.. contents::
[platformio]
------------
A ``platformio`` section is used for overriding default configuration options
Options
~~~~~~~
``home_dir``
^^^^^^^^^^^^
A ``$PIO_HOME_DIR`` is used to store platform tool chains, frameworks,
external libraries, service data and etc.
A default value is user's home directory: *Unix* - ``~/.platformio``,
Windows - ``%HOMEPATH%\.platformio``.
``lib_dir``
^^^^^^^^^^^^
This directory is used to store external libraries downloaded by
:ref:`librarymanager`.
A default value is ``$PIO_HOME_DIR/lib``.
[env:NAME]
----------
A section with ``env:`` prefix is used to define virtual environment with
specific options that will be processed with :ref:`cmd_run` command. You can
define unlimited numbers of environments.
Each environment must have unique ``NAME``. The valid chars for ``NAME`` are
* letters ``a-z``
* numbers ``0-9``
* special char ``_`` (underscore)
For example, ``[env:hello_world]``.
Options
~~~~~~~
``platform``
^^^^^^^^^^^^
:ref:`Platform <platforms>` type
``framework``
^^^^^^^^^^^^^
See ``framework`` type in *Frameworks* section of :ref:`platforms`
``board``
^^^^^^^^^
*PlatformIO* has pre-configured settings for most popular boards. You don't
need to specify ``board_mcu``, ``board_f_cpu``, ``upload_protocol`` or
``upload_speed`` options. Just define a ``board`` type and *PlatformIO* will
pre-fill options described above with appropriate values.
You can find the ``board`` type in *Boards* section of each :ref:`platforms`.
``board_mcu``
^^^^^^^^^^^^^
``board_mcu`` is a microcontroller(MCU) type that is used by compiler to
recognize MCU architecture. The correct type of ``board_mcu`` depends on
platform library. For example, the list of ``board_mcu`` for "megaAVR Devices"
is described `here <http://www.nongnu.org/avr-libc/user-manual/>`_.
The full list of ``board_mcu`` for popular embedded platforms you can find in
*Boards* section of :ref:`platforms`. See "Microcontroller" column.
``board_f_cpu``
^^^^^^^^^^^^^^^
An option ``board_f_cpu`` is used to define MCU frequency (Hertz, Clock). A
format of this option is ``C-like long integer`` value with ``L`` suffix. The
1 Hertz is equal to ``1L``, then 16 Mhz (Mega Hertz) is equal to ``16000000L``.
The full list of ``board_f_cpu`` for popular embedded platforms you can find in
*Boards* section of :ref:`platforms`. See "Frequency" column.
``upload_port``
^^^^^^^^^^^^^^^
This option is used by "uploader" tool to send firmware to the board via
``upload_port``. For example,
* ``/dev/ttyUSB0`` - Unix-based OS
* ``COM3`` - Windows OS
To print all available serial ports use :ref:`cmd_serialports` command.
``upload_protocol``
^^^^^^^^^^^^^^^^^^^
A protocol that "uploader" tool uses to talk to the board.
``upload_speed``
^^^^^^^^^^^^^^^^
A connection speed (`baud rate <http://en.wikipedia.org/wiki/Baud>`_)
which "uploader" tool uses when sending firmware to the board.
``targets``
^^^^^^^^^^^
A list with targets which will be processed by :ref:`cmd_run` command by
default. You can enter more then one target separated with "space".
When no targets are defined, *PlatformIO* will build only sources by default.
.. note::
This option is useful to enable "auto-uploading" after building operation
(``targets = upload``).
``build_flags``
^^^^^^^^^^^^^^^
These flags/options control preprocessing, compilation, assembly and linking
processes:
.. list-table::
:header-rows: 1
* - Format
- Scope
- Description
* - ``Wp,option``
- CPPFLAGS
- Bypass the compiler driver and pass *option* directly through to the
preprocessor
* - ``-D name``
- CPPDEFINES
- Predefine *name* as a macro, with definition 1.
* - ``-D name=definition``
- CPPDEFINES
- The contents of *definition* are tokenized and processed as if they
appeared during translation phase three in a ``#define`` directive.
* - ``-U name``
- CPPDEFINES
- Cancel any previous definition of *name*, either built in or provided
with a ``-D`` option.
* - ``-Wall``
- CCFLAGS
- Turns on all optional warnings which are desirable for normal code.
* - ``-Werror``
- CCFLAGS
- Make all warnings into hard errors. Source code which triggers warnings will be rejected.
* - ``-w``
- CCFLAGS
- Suppress all warnings, including those which GNU CPP issues by default.
* - ``-include file``
- CCFLAGS
- Process *file* as if ``#include "file"`` appeared as the first line of
the primary source file.
* - ``-Wa,option``
- ASFLAGS, CCFLAGS
- Pass *option* as an option to the assembler. If *option* contains
commas, it is split into multiple options at the commas.
* - ``-llibrary``
- LIBS
- Search the *library* named library when linking
* - ``-Ldir``
- LIBPATH
- Add directory *dir* to the list of directories to be searched for
``-l``.
* - ``-Idir``
- CPPPATH
- Add the directory *dir* to the list of directories to be searched
for header files.
Example:
.. code-block:: ini
[env:specific_defines]
build_flags = -O2 -Dfoo -Dbar=1
[env:specific_inclibs]
build_flags = -I/opt/include -L/opt/lib -lfoo
For more detailed information about available flags/options go to:
* `Options to Request or Suppress Warnings
<https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html>`_
* `Options for Debugging Your Program
<https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html>`_
* `Options That Control Optimization
<https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html>`_
* `Options Controlling the Preprocessor
<https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html>`_
* `Passing Options to the Assembler
<https://gcc.gnu.org/onlinedocs/gcc/Assembler-Options.html>`_
* `Options for Linking <https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html>`_
* `Options for Directory Search
<https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html>`_
``srcbuild_flags``
^^^^^^^^^^^^^^^^^^
This is option ``srcbuild_flags`` has the same behaviour like ``build_flags``
but will be applied only for project source code from ``src`` directory.
Examples
--------
1. :ref:`platform_atmelavr`: Arduino UNO board with auto pre-configured
``board_*`` and ``upload_*`` options (use only ``board`` option) and Arduino
Wiring-based Framework
.. code-block:: ini
[env:atmelavr_arduino_uno_board]
platform = atmelavr
framework = arduino
board = uno
# enable auto-uploading
targets = upload
2. :ref:`platform_atmelavr`: Microduino Core (ATmega168P, 3.3V) board with
auto pre-configured ``board_*`` and ``upload_*`` options (use only
``board`` option) and Arduino Wiring-based Framework
.. code-block:: ini
[env:atmelavr_microduino_core_board]
platform = atmelavr
framework = arduino
board = 168pa8m
# enable auto-uploading
targets = upload
3. :ref:`platform_atmelavr`: Raspduino board with
auto pre-configured ``board_*`` and ``upload_*`` options (use only
``board`` option) and Arduino Wiring-based Framework
.. code-block:: ini
[env:atmelavr_raspduino_board]
platform = atmelavr
framework = arduino
board = raspduino
upload_port = /dev/ttyS0
# enable auto-uploading
targets = upload
4. :ref:`platform_atmelavr`: Embedded board that is based on ATmega168 MCU with
"arduino" bootloader
.. code-block:: ini
[env:atmelavr_atmega168_board]
platform = atmelavr
board_mcu = atmega168
board_f_cpu = 16000000L
upload_port = /dev/ttyUSB0
# for Windows OS
# upload_port = COM3
upload_protocol = arduino
upload_speed = 19200
# enable auto-uploading
targets = upload
5. :ref:`platform_timsp430`: TI MSP430G2553 LaunchPad with auto pre-configured
``board_*`` and ``upload_*`` options (use only ``board`` option) and Energia
Wiring-based Framework
.. code-block:: ini
[env:timsp430_g2553_launchpad]
platform = timsp430
framework = energia
board = lpmsp430g2553
6. :ref:`platform_timsp430`: Embedded board that is based on MSP430G2553 MCU
.. code-block:: ini
[env:timsp430_g2553_board]
platform = timsp430
board_mcu = msp430g2553
board_f_cpu = 16000000L
upload_protocol = rf2500
# enable auto-uploading
targets = upload
5. :ref:`platform_titiva`: TI Tiva C ARM Series TM4C123G LaunchPad with auto
pre-configured ``board_*`` and ``upload_*`` options (use only ``board``
option) and Energia Wiring-based Framework
.. code-block:: ini
[env:titiva_tm4c1230c3pm_launchpad]
platform = titiva
framework = energia
board = lptm4c1230c3pm

71
docs/quickstart.rst Normal file
View File

@ -0,0 +1,71 @@
.. _quickstart:
Quickstart
==========
.. note::
Please read `Get Started <http://platformio.ikravets.com/#!/get-started>`_
article from the official WebSite.
First, :ref:`Install PlatformIO <installation>`.
Print all available development platforms for installing
.. code-block:: bash
$ platformio search all
[ ... ]
Install new development platform
.. code-block:: bash
$ platformio install PLATFORM
Downloading [####################################] 100%
Unpacking [####################################] 100%
Installing .....
[ ... ]
The platform 'PLATFORM' has been successfully installed!
Initialize new PlatformIO based project
.. code-block:: bash
$ cd /path/to/empty/directory
$ platformio init
Project has been initialized!
Please put your source code to `src` directory, external libraries to `lib`
and setup environments in `platformio.ini` file.
Then process project with `platformio run` command.
Setup environments in ``platformio.ini``. For more examples go to
:ref:`projectconf`
.. code-block:: ini
# Simple and base environment
[env:mybaseenv]
platform = %INSTALLED_PLATFORM_NAME_HERE%
Process the project's environments
.. code-block:: bash
$ platformio run
# if embedded project then upload firmware
$ platformio run --target upload
# clean project
$ platformio run --target clean
Further examples can be found in the ``examples/`` directory in the source
distribution or `on the web <https://github.com/ivankravets/platformio/tree/develop/examples>`_.
Also, for more detailed information as for commands please go to
:ref:`userguide` sections.

View File

@ -0,0 +1,70 @@
.. _cmd_init:
platformio init
===============
.. contents::
Usage
-----
.. code-block:: bash
platformio init [OPTIONS]
Description
-----------
Initialize new PlatformIO based project.
This command will create:
* :ref:`projectconf`
* ``src`` - a source directory. Put your source code here
* ``lib`` - a directory for the project specific libraries. PlatformIO will
compile them to static libraries and link to executable file
Options
-------
.. option::
--project-dir, -d
Specified path to the directory where *PlatformIO* will initialize new project.
Examples
--------
1. Create new project in the current working directory
.. code-block:: bash
$ platformio init
The current working directory *** will be used for the new project.
You can specify another project directory via
`platformio init -d %PATH_TO_PROJECT_DIR%` command.
The next files/directories will be created in ***
platformio.ini - Project Configuration File
src - a source directory. Put your source code here
lib - a directory for the project specific libraries
Do you want to continue? [y/N]: y
Project has been successfully initialized!
Now you can process it with `platformio run` command.
2. Create new project in the specified directory
.. code-block:: bash
$ platformio init -d %PATH_TO_DIR%
The next files/directories will be created in ***
platformio.ini - Project Configuration File
src - a source directory. Put your source code here
lib - a directory for the project specific libraries
Do you want to continue? [y/N]: y
Project has been successfully initialized!
Now you can process it with `platformio run` command.

View File

@ -0,0 +1,76 @@
.. _cmd_install:
platformio install
==================
.. contents::
Usage
-----
.. code-block:: bash
platformio install [OPTIONS] [PLATFORMS]
Description
-----------
Install pre-built development :ref:`Platforms <platforms>` with related
packages.
There are several predefined aliases for packages, such as:
* ``toolchain``
* ``uploader``
Options
-------
.. option::
--with-package
Install specified package (or alias)
.. option::
--without-package
Do not install specified package (or alias)
.. option::
--skip-default
Skip default packages
Examples
--------
1. Install :ref:`platform_timsp430` with default packages
.. code-block:: bash
$ platformio install timsp430
Installing toolchain-timsp430 package:
Downloading [####################################] 100%
Unpacking [####################################] 100%
Installing tool-mspdebug package:
Downloading [####################################] 100%
Unpacking [####################################] 100%
Installing framework-energiamsp430 package:
Downloading [####################################] 100%
Unpacking [####################################] 100%
The platform 'timsp430' has been successfully installed!
2. Install :ref:`platform_timsp430` with ``uploader`` utility only and skip
default packages
.. code-block:: bash
$ platformio install timsp430 --skip-default-package --with-package=uploader
Installing tool-mspdebug package:
Downloading [####################################] 100%
Unpacking [####################################] 100%
The platform 'timsp430' has been successfully installed!

View File

@ -0,0 +1,30 @@
.. _cmd_list:
platformio list
===============
.. contents::
Usage
-----
.. code-block:: bash
platformio list
Description
-----------
List installed :ref:`Platforms <platforms>`
Examples
--------
.. code-block:: bash
$ platformio list
timsp430 with packages: toolchain-timsp430, tool-mspdebug, framework-energiamsp430
atmelavr with packages: toolchain-atmelavr, tool-avrdude, framework-arduinoavr
titiva with packages: toolchain-gccarmnoneeabi, tool-lm4flash, framework-energiativa

130
docs/userguide/cmd_run.rst Normal file
View File

@ -0,0 +1,130 @@
.. _cmd_run:
platformio run
==============
.. contents::
Usage
-----
.. code-block:: bash
platformio run [OPTIONS]
Description
-----------
Process environments which are defined in :ref:`projectconf` file
Options
-------
.. option::
-e, --environment
Process specified environments
.. option::
-t, --target
Process specified targets
.. option::
--upload-port
Upload port of embedded board. To print all available ports use
:ref:`cmd_serialports` command
Examples
--------
1. Process `Wiring Blink Example <https://github.com/ivankravets/platformio/tree/develop/examples/wiring-blink>`_
.. code-block:: bash
$ platformio run
Processing arduino_pro5v environment:
scons: `.pioenvs/arduino_pro5v/firmware.elf' is up to date.
scons: `.pioenvs/arduino_pro5v/firmware.hex' is up to date.
Processing launchpad_msp430g2 environment:
scons: `.pioenvs/launchpad_msp430g2/firmware.elf' is up to date.
scons: `.pioenvs/launchpad_msp430g2/firmware.hex' is up to date.
Processing launchpad_lm4f120 environment:
scons: `.pioenvs/launchpad_lm4f120/firmware.elf' is up to date.
scons: `.pioenvs/launchpad_lm4f120/firmware.hex' is up to date
2. Process specific environment
.. code-block:: bash
$ platformio run -e arduino_pro5v -e launchpad_lm4f120
Processing arduino_pro5v environment:
scons: `.pioenvs/arduino_pro5v/firmware.elf' is up to date.
scons: `.pioenvs/arduino_pro5v/firmware.hex' is up to date.
Processing launchpad_lm4f120 environment:
scons: `.pioenvs/launchpad_lm4f120/firmware.elf' is up to date.
scons: `.pioenvs/launchpad_lm4f120/firmware.hex' is up to date.
3. Process specific target
.. code-block:: bash
$ platformio run -t clean
Processing arduino_pro5v environment:
Removed .pioenvs/arduino_pro5v/src/main.o
...
Removed .pioenvs/arduino_pro5v/firmware.hex
Processing launchpad_msp430g2 environment:
Removed .pioenvs/launchpad_msp430g2/src/main.o
...
Removed .pioenvs/launchpad_msp430g2/firmware.hex
Processing launchpad_lm4f120 environment:
Removed .pioenvs/launchpad_lm4f120/src/main.o
...
Removed .pioenvs/launchpad_lm4f120/firmware.hex
4. Mix environments and targets
.. code-block:: bash
$ platformio run -e launchpad_msp430g2 -t upload
Processing launchpad_msp430g2 environment:
/Users/ikravets/.platformio/timsp430/tools/mspdebug/mspdebug rf2500 --force-reset "prog .pioenvs/launchpad_msp430g2/firmware.hex"
MSPDebug version 0.20 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2012 Daniel Beer <dlbeer@gmail.com>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Trying to open interface 1 on 009
Initializing FET...
FET protocol version is 30394216
Configured for Spy-Bi-Wire
Sending reset...
Set Vcc: 3000 mV
Device ID: 0x2553
Code start address: 0xc000
Code size : 16384 byte = 16 kb
RAM start address: 0x200
RAM end address: 0x3ff
RAM size : 512 byte = 0 kb
Device: MSP430G2553/G2403
Code memory starts at 0xc000
Number of breakpoints: 2
Chip ID data: 25 53
Erasing...
Programming...
Writing 646 bytes at c000...
Writing 32 bytes at ffe0...
Done, 678 bytes total

View File

@ -0,0 +1,42 @@
.. _cmd_search:
platformio search
=================
.. contents::
Usage
-----
.. code-block:: bash
# Print all available development platforms
platformio search
# Filter platforms by "Query"
platformio search QUERY
Description
-----------
Search for development :ref:`Platforms <platforms>`
Examples
--------
1. Search for TI development platforms
.. code-block:: bash
$ platformio search ti
timsp430 - An embedded platform for TI MSP430 microcontrollers (with Energia Framework)
titiva - An embedded platform for TI TIVA C ARM microcontrollers (with Energia Framework)
2. Search for development platforms which support "Arduino Framework"
.. code-block:: bash
$ platformio search arduino
atmelavr - An embedded platform for Atmel AVR microcontrollers (with Arduino Framework)

View File

@ -0,0 +1,243 @@
.. _cmd_serialports:
platformio serialports
======================
.. contents::
platformio serialports list
---------------------------
Usage
~~~~~
.. code-block:: bash
platformio serialports list
Description
~~~~~~~~~~~
List available `Serial Ports <http://en.wikipedia.org/wiki/Serial_port>`_
Examples
~~~~~~~~
1. Unix OS
.. code-block:: bash
$ platformio serialports list
/dev/cu.SLAB_USBtoUART
----------
Hardware ID: USB VID:PID=10c4:ea60 SNR=0001
Description: CP2102 USB to UART Bridge Controller
/dev/cu.uart-1CFF4676258F4543
----------
Hardware ID: USB VID:PID=451:f432 SNR=1CFF4676258F4543
Description: Texas Instruments MSP-FET430UIF
2. Windows OS
.. code-block:: bash
$ platformio serialports list
COM4
----------
Hardware ID: USB VID:PID=0451:F432
Description: MSP430 Application UART (COM4)
COM3
----------
Hardware ID: USB VID:PID=10C4:EA60 SNR=0001
Description: Silicon Labs CP210x USB to UART Bridge (COM3)
platformio serialports monitor
------------------------------
Usage
~~~~~
.. code-block:: bash
platformio serialports monitor [OPTIONS]
Description
~~~~~~~~~~~
This is a console application that provides a small terminal
application. It is based on `Miniterm <http://pyserial.sourceforge.net/examples.html#miniterm>`_
and itself does not implement any terminal features such
as *VT102* compatibility. However it inherits these features from the terminal
it is run. For example on GNU/Linux running from an *xterm* it will support the
escape sequences of the *xterm*. On *Windows* the typical console window is dumb
and does not support any escapes. When *ANSI.sys* is loaded it supports some
escapes.
To control *monitor* please use these "hot keys":
* ``Ctrl+]`` Quit
* ``Ctrl+T`` Menu
* ``Ctrl+T followed by Ctrl+H`` Help
Options
~~~~~~~
.. option::
-p, --port
Port, a number or a device name
.. option::
-b, --baud
Set baud rate, default ``9600``
.. option::
--parity
Set parity (*None, Even, Odd, Space, Mark*), one of
[``N``, ``E``, ``O``, ``S``, ``M``], default ``N``
.. option::
--rtscts
Enable ``RTS/CTS`` flow control, default ``Off``
.. option::
--xonxoff
Enable software flow control, default ``Off``
.. option::
--rts
Set initial ``RTS`` line state, default ``0``
.. option::
--dtr
Set initial ``DTR`` line state, default ``0``
.. option::
--echo
Enable local echo, default ``Off``
.. option::
--cr
Do not send ``CR+LF``, send ``R`` only, default ``Off``
.. option::
--lf
Do not send ``CR+LF``, send ``LF`` only, default ``Off``
.. option::
-d, --debug
Debug received data (escape non-printable chars). ``--debug`` can be given
multiple times:
0. just print what is received
1. escape non-printable characters, do newlines as unusual
2. escape non-printable characters, newlines too
3. hex dump everything
.. option::
--exit-char
ASCII code of special character that is used to exit the application,
default ``0x1d``
.. option::
--menu-char
ASCII code of special character that is used to control miniterm (menu),
default ``0x14``
.. option::
---quiet
Diagnostics: suppress non-error messages, default ``Off``
Examples
~~~~~~~~
1. Show available options for *monitor*
.. code-block:: bash
$ platformio serialports monitor --help
Usage: platformio serialports monitor [OPTIONS]
Options:
-p, --port TEXT Port, a number or a device name
-b, --baud INTEGER Set baud rate, default=9600
--parity [N|E|O|S|M] Set parity, default=N
--rtscts Enable RTS/CTS flow control, default=Off
--xonxoff Enable software flow control, default=Off
--rts [0|1] Set initial RTS line state, default=0
--dtr [0|1] Set initial DTR line state, default=0
--echo Enable local echo, default=Off
--cr Do not send CR+LF, send CR only, default=Off
--lf Do not send CR+LF, send LF only, default=Off
-d, --debug Debug received data (escape non-printable chars)
--debug can be given multiple times:
0: just print what is received
1: escape non-printable characters, do newlines as
unusual
2: escape non-printable characters, newlines too
3: hex dump everything
--exit-char INTEGER ASCII code of special character that is used to exit
the application, default=0x1d
--menu-char INTEGER ASCII code of special character that is used to
control miniterm (menu), default=0x14
--quiet Diagnostics: suppress non-error messages, default=Off
--help Show this message and exit.
2. Communicate with serial device and print help inside terminal
.. code-block:: bash
$ platformio serialports monitor
--- Available ports:
--- /dev/cu.Bluetooth-Incoming-Port n/a
--- /dev/cu.Bluetooth-Modem n/a
--- /dev/cu.SLAB_USBtoUART CP2102 USB to UART Bridge Controller
--- /dev/cu.obd2ecu-SPPDev n/a
Enter port name:/dev/cu.SLAB_USBtoUART
--- Miniterm on /dev/cu.SLAB_USBtoUART: 9600,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
Hello PlatformIO!
--- pySerial (2.7) - miniterm - help
---
--- Ctrl+] Exit program
--- Ctrl+T Menu escape key, followed by:
--- Menu keys:
--- Ctrl+T Send the menu character itself to remote
--- Ctrl+] Send the exit character itself to remote
--- Ctrl+I Show info
--- Ctrl+U Upload file (prompt will be shown)
--- Toggles:
--- Ctrl+R RTS Ctrl+E local echo
--- Ctrl+D DTR Ctrl+B BREAK
--- Ctrl+L line feed Ctrl+A Cycle repr mode
---
--- Port settings (Ctrl+T followed by the following):
--- p change port
--- 7 8 set data bits
--- n e o s m change parity (None, Even, Odd, Space, Mark)
--- 1 2 3 set stop bits (1, 2, 1.5)
--- b change baud rate
--- x X disable/enable software flow control
--- r R disable/enable hardware flow control
--- exit ---

View File

@ -0,0 +1,114 @@
.. _cmd_settings:
platformio settings
===================
Manage PlatformIO settings
.. contents::
platformio settings get
-----------------------
Usage
~~~~~
.. code-block:: bash
platformio settings get [NAME]
Description
~~~~~~~~~~~
Get/List existing settings
Examples
~~~~~~~~
1. List all settings and current their values
.. code-block:: bash
$ platformio settings get
Name Value [Default] Description
------------------------------------------------------------------------------------------
auto_update_libraries Yes Automatically update libraries (Yes/No)
auto_update_platforms Yes Automatically update platforms (Yes/No)
check_libraries_interval 7 Check for the library updates interval (days)
check_platformio_interval 3 Check for the new PlatformIO interval (days)
check_platforms_interval 7 Check for the platforms updates interval (days)
2. Show specified setting
.. code-block:: bash
$ platformio settings get auto_update_platforms
Name Value [Default] Description
------------------------------------------------------------------------------------------
auto_update_platforms Yes Automatically update platforms (Yes/No)
platformio settings set
-----------------------
Usage
~~~~~
.. code-block:: bash
platformio settings set NAME VALUE
Description
~~~~~~~~~~~
Set new value for the setting
Examples
~~~~~~~~
Change to check for the new PlatformIO each day
.. code-block:: bash
$ platformio settings set check_platformio_interval 1
The new value for the setting has been set!
Name Value [Default] Description
------------------------------------------------------------------------------------------
check_platformio_interval 1 [3] Check for the new PlatformIO interval (days)
platformio settings reset
-------------------------
Usage
~~~~~
.. code-block:: bash
platformio settings reset
Description
~~~~~~~~~~~
Reset settings to default
Examples
~~~~~~~~
.. code-block:: bash
$ platformio settings reset
The settings have been reseted!
Name Value [Default] Description
------------------------------------------------------------------------------------------
auto_update_libraries Yes Automatically update libraries (Yes/No)
auto_update_platforms Yes Automatically update platforms (Yes/No)
check_libraries_interval 7 Check for the library updates interval (days)
check_platformio_interval 3 Check for the new PlatformIO interval (days)
check_platforms_interval 7 Check for the platform updates interval (days)

View File

@ -0,0 +1,42 @@
.. _cmd_show:
platformio show
===============
.. contents::
Usage
-----
.. code-block:: bash
platformio show PLATFORM
Description
-----------
Show details about the installed :ref:`Platforms <platforms>`
Examples
--------
.. code-block:: bash
$ platformio show atmelavr
atmelavr - An embedded platform for Atmel AVR microcontrollers (with Arduino Framework)
----------
Package: toolchain-atmelavr
Alias: toolchain
Location: /Users/ikravets/.platformio/atmelavr/tools/toolchain
Version: 1
----------
Package: tool-avrdude
Alias: uploader
Location: /Users/ikravets/.platformio/atmelavr/tools/avrdude
Version: 1
----------
Package: framework-arduinoavr
Location: /Users/ikravets/.platformio/atmelavr/frameworks/arduino
Version: 1

View File

@ -0,0 +1,31 @@
.. _cmd_uninstall:
platformio uninstall
====================
.. contents::
Usage
-----
.. code-block:: bash
platformio uninstall PLATFORM
Description
-----------
Uninstall specified :ref:`Platforms <platforms>`
Examples
--------
.. code-block:: bash
$ platformio uninstall timsp430
Uninstalling toolchain-timsp430 package: [OK]
Uninstalling tool-mspdebug package: [OK]
Uninstalling framework-energiamsp430 package: [OK]
The platform 'timsp430' has been successfully uninstalled!

View File

@ -0,0 +1,54 @@
.. _cmd_update:
platformio update
=================
.. contents::
Usage
-----
.. code-block:: bash
platformio update
Description
-----------
Check or update installed :ref:`Platforms <platforms>`
Examples
--------
.. code-block:: bash
$ platformio update
Platform atmelavr
--------
Updating toolchain-atmelavr package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating framework-arduinoavr package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating tool-avrdude package:
Versions: Current=1, Latest=1 [Up-to-date]
Platform timsp430
--------
Updating toolchain-timsp430 package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating tool-mspdebug package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating framework-energiamsp430 package:
Versions: Current=1, Latest=1 [Up-to-date]
Platform titiva
--------
Updating toolchain-gccarmnoneeabi package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating tool-lm4flash package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating framework-energiativa package:
Versions: Current=1, Latest=1 [Up-to-date]

View File

@ -0,0 +1,32 @@
.. _cmd_upgrade:
platformio upgrade
==================
.. contents::
Usage
-----
.. code-block:: bash
platformio upgrade
Description
-----------
Check or upgrade PlatformIO to the latest version
Examples
--------
.. code-block:: bash
$ platformio upgrade
You're up-to-date!
PlatformIO x.x.x is currently the newest version available.
# If you have problem with permissions try:
$ sudo platformio upgrade

28
docs/userguide/index.rst Normal file
View File

@ -0,0 +1,28 @@
.. _userguide:
User Guide
==========
To print all available commands and options use:
.. code-block:: bash
$ platformio --help
$ platformio COMMAND --help
.. toctree::
:maxdepth: 2
cmd_init
cmd_install
platformio lib <lib/index>
cmd_list
cmd_run
cmd_search
cmd_serialports
cmd_settings
cmd_show
cmd_uninstall
cmd_update
cmd_upgrade

View File

@ -0,0 +1,72 @@
.. _cmd_lib_install:
platformio lib install
======================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib install [OPTIONS] [LIBRARY_ID]
Description
-----------
Install new library by specified
`PlatformIO Library Registry ID <http://platformio.ikravets.com/#!/lib>`_.
Options
-------
.. option::
-v, --version
Install specified version of library
Examples
--------
1. Install the latest version of library
.. code-block:: bash
# IRremote: http://platformio.ikravets.com/#!/lib/show/4/IRremote
$ platformio lib install 4
# Installing library [ 4 ]:
# Downloading [####################################] 100%
# Unpacking [####################################] 100%
# The library #4 'IRremote' has been successfully installed!
2. Install specified version of library
.. code-block:: bash
# XBee: http://platformio.ikravets.com/#!/lib/show/6/XBee
$ platformio lib install 6 --version=0.5
# Installing library [ 6 ]:
# Downloading [####################################] 100%
# Unpacking [####################################] 100%
# The library #6 'XBee' has been successfully installed!
3. Install library with dependencies
.. code-block:: bash
# Adafruit-ST7735: http://platformio.ikravets.com/#!/lib/show/12/Adafruit-ST7735
$ platformio lib install 12
# Installing library [ 12 ]:
# Downloading [####################################] 100%
# Unpacking [####################################] 100%
# The library #12 'Adafruit-ST7735' has been successfully installed!
# Installing dependencies:
# Installing library [ 13 ]:
# Downloading [####################################] 100%
# Unpacking [####################################] 100%
# The library #13 'Adafruit-GFX' has been successfully installed!

View File

@ -0,0 +1,39 @@
.. _cmd_lib_list:
platformio lib list
===================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib list
Description
-----------
List installed libraries
Examples
--------
.. code-block:: bash
$ platformio lib list
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 23 ] Adafruit-L3GD20-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the L3GD20 Gyroscope
# [ 12 ] Adafruit-ST7735 arduino, atmelavr "Adafruit Industries": A library for the Adafruit 1.8" SPI display
# [ 31 ] Adafruit-Unified-Sensor arduino, atmelavr "Adafruit Industries": Adafruit Unified Sensor Driver
# [ 26 ] Adafruit-LSM303DLHC-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for Adafruit's LSM303 Breakout (Accelerometer + Magnetometer)
# [ 6 ] XBee arduino, atmelavr "Andrew Rapp": Arduino library for communicating with XBees in API mode
# [ 13 ] Adafruit-GFX arduino, atmelavr "Adafruit Industries": A core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.)
# [ 4 ] IRremote arduino, atmelavr "Ken Shirriff": Send and receive infrared signals with multiple protocols
# [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303)
# ...

View File

@ -0,0 +1,26 @@
.. _cmd_lib_register:
platformio lib register
=======================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib regiter [HTTP_URL_TO_LIBRARY.JSON]
Description
-----------
Register new library and allow others to install it.
Examples
--------
.. code-block:: bash
$ platformio lib register http://my.example.com/library.json

View File

@ -0,0 +1,191 @@
.. _cmd_lib_search:
platformio lib search
=====================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib search [OPTIONS] [QUERY]
Description
-----------
Search for library in `PlatformIO Library Registry <http://platformio.ikravets.com/#!/lib>`_
by :ref:`library_config` fields in the boolean mode.
The boolean search capability supports the following operators:
.. list-table::
:header-rows: 1
* - Operator
- Description
* - ``+``
- A leading or trailing plus sign indicates that this word must be present
in library fields (see above) that is returned.
* - ``-``
- A leading or trailing minus sign indicates that this word must not be
present in any of the libraries that are returned.
* - ``(no operator)``
- By default (when neither ``+`` nor ``-`` is specified), the
word is optional, but the libraries that contain it are rated higher.
* - ``> <``
- These two operators are used to change a word's contribution to the
relevance value that is assigned to a library. The ``>`` operator
increases the contribution and the ``<`` operator decreases it.
* - ``( )``
- Parentheses group words into subexpressions. Parenthesized groups can
be nested.
* - ``~``
- A leading tilde acts as a negation operator, causing the word's
contribution to the library's relevance to be negative. This is useful for
marking "noise" words. A library containing such a word is rated lower than
others, but is not excluded altogether, as it would be with the ``-`` operator.
* - ``*``
- The asterisk serves as the truncation (or wildcard) operator. Unlike the
other operators, it is appended to the word to be affected. Words match if
they begin with the word preceding the ``*`` operator.
* - ``"``
- A phrase that is enclosed within double quote (``"``) characters matches
only libraries that contain the phrase literally, as it was typed.
For more detail information please go to
`MySQL Boolean Full-Text Searches <http://dev.mysql.com/doc/refman/5.6/en/fulltext-boolean.html>`_.
Options
-------
.. option::
-a, --author
Filter libraries by specified author
.. option::
-k, --keyword
Filter libraries by specified keyword
.. option::
-f, --framework
Filter libraries by specified framework
.. option::
-p, --platform
Filter libraries by specified keyword
Examples
--------
1. List all libraries
.. code-block:: bash
$ platformio lib search
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303)
# [ 13 ] Adafruit-GFX arduino, atmelavr "Adafruit Industries": A core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.)
# [ 23 ] Adafruit-L3GD20-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the L3GD20 Gyroscope
# [ 26 ] Adafruit-LSM303DLHC-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for Adafruit's LSM303 Breakout (Accelerometer + Magnetometer)
# [ 12 ] Adafruit-ST7735 arduino, atmelavr "Adafruit Industries": A library for the Adafruit 1.8" SPI display
# [ 31 ] Adafruit-Unified-Sensor arduino, atmelavr "Adafruit Industries": Adafruit Unified Sensor Driver
# [ 4 ] IRremote arduino, atmelavr "Ken Shirriff": Send and receive infrared signals with multiple protocols
# [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc)
# [ 6 ] XBee arduino, atmelavr "Andrew Rapp": Arduino library for communicating with XBees in API mode
# [ 15 ] Adafruit-ADXL345-Unified arduino, atmelavr "Adafruit Industries": Unified driver for the ADXL345 Accelerometer
# Show next libraries? [y/N]:
# ...
2. Search for `1-Wire libraries <http://platformio.ikravets.com/#!/lib/search?query=%25221-wire%2522>`_
.. code-block:: bash
$ platformio lib search "1-wire"
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc)
# ...
3. Search for `Arduino-based "I2C" libraries <http://platformio.ikravets.com/#!/lib/search?query=framework%253Aarduino%2520i2c&page=1>`_
.. code-block:: bash
$ platformio lib search "i2c" --framework="arduino"
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 11 ] I2Cdevlib-Core arduino, atmelavr "Jeff Rowberg": The I2C Device Library (I2Cdevlib) is a collection of uniform and well-documented classes to provide simple and intuitive interfaces to I2C devices.
# [ 24 ] Adafruit-L3GD20 arduino, atmelavr "Adafruit Industries": Driver for Adafruit's L3GD20 I2C Gyroscope Breakout
# [ 10 ] I2Cdevlib-AK8975 arduino, atmelavr "Jeff Rowberg": AK8975 is 3-axis electronic compass IC with high sensitive Hall sensor technology
# [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303)
# ...
4. Search for `libraries by "web" and "http" keywords <http://platformio.ikravets.com/#!/lib/search?query=keyword%253A%2522web%2522%2520keyword%253A%2522http%2522&page=1>`_.
.. code-block:: bash
$ platformio lib search --keyword="web" --keyword="http"
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 5 ] Webduino arduino, atmelavr "Ben Combee": An extensible web server library (for use with the Arduino WizNet Ethernet Shield)
# [ 17 ] Adafruit-CC3000 arduino, atmelavr "Adafruit Industries": Library code for Adafruit's CC3000 Wi-Fi/WiFi breakouts
# ...
5. Search for `libraries from "Adafruit Industries" author <http://platformio.ikravets.com/#!/lib/search?query=author%253A%2522Adafruit%20Industries%2522>`_
.. code-block:: bash
$ platformio lib search --author="Adafruit Industries"
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303)
# [ 13 ] Adafruit-GFX arduino, atmelavr "Adafruit Industries": A core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.)
# [ 23 ] Adafruit-L3GD20-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the L3GD20 Gyroscope
# [ 26 ] Adafruit-LSM303DLHC-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for Adafruit's LSM303 Breakout (Accelerometer + Magnetometer)
# ...
6. Search for `libraries that are compatible with Dallas temperature sensors <http://platformio.ikravets.com/#!/lib/search?query=DS*>`_
like DS18B20, DS18S20 and etc.
.. code-block:: bash
$ platformio lib search "DS*"
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc)
# ...
7. Search for `Arduino-based *X10* or *XBee* libraries <http://platformio.ikravets.com/#!/lib/search?query=framework%253Aarduino%2520%252B(x10%2520xbee)&page=1>`_.
The search query that is described below can be interpreted like
``arduino x10 OR arduino xbee``
.. code-block:: bash
$ platformio lib search "+(x10 xbee)" --framework="arduino"
# Found 2 libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 36 ] X10 arduino, atmelavr "Doug Clinton": Sending X10 signals over AC power lines (PL513, TW523 and etc)
# [ 6 ] XBee arduino, atmelavr "Andrew Rapp": Arduino library for communicating with XBees in API mode

View File

@ -0,0 +1,37 @@
.. _cmd_lib_show:
platformio lib show
===================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib show ID
Description
-----------
Show details about the installed library
Examples
--------
.. code-block:: bash
# OneWire: http://platformio.ikravets.com/#!/lib/show/1/OneWire
$ platformio lib show 1
# OneWire
# -------
# Authors: Paul Stoffregen <paul@pjrc.com> http://www.pjrc.com/teensy/td_libs_OneWire.html (maintainer), Jim Studt, Jason Dangel <dangel.jason@gmail.com>, Derek Yerger, Tom Pollard <pollard@alum.mit.edu>, Robin James
# Keywords: onewire, 1-wire, bus, sensor, temperature, ibutton
# Frameworks: arduino
# Platforms: atmelavr
# Version: 2.2
#
# Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc)

View File

@ -0,0 +1,29 @@
.. _cmd_lib_uninstall:
platformio lib uninstall
========================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib uninstall ID
Description
-----------
Uninstall specified library
Examples
--------
.. code-block:: bash
# XBee: http://platformio.ikravets.com/#!/lib/show/6/XBee
$ platformio lib uninstall 6
# The library #6 'XBee' has been successfully uninstalled!

View File

@ -0,0 +1,43 @@
.. _cmd_lib_update:
platformio lib update
=====================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib update
Description
-----------
Check or update installed libraries
Examples
--------
.. code-block:: bash
$ platformio lib update
# Updating [ 23 ] Adafruit-L3GD20-Unified library:
# Versions: Current=63de2eb9ea, Latest=63de2eb9ea [Up-to-date]
# Updating [ 12 ] Adafruit-ST7735 library:
# Versions: Current=e880eb1687, Latest=e880eb1687 [Up-to-date]
# Updating [ 31 ] Adafruit-Unified-Sensor library:
# Versions: Current=88ae805bce, Latest=88ae805bce [Up-to-date]
# Updating [ 26 ] Adafruit-LSM303DLHC-Unified library:
# Versions: Current=59767208a8, Latest=59767208a8 [Up-to-date]
# Updating [ 13 ] Adafruit-GFX library:
# Versions: Current=a9e5bc4707, Latest=a9e5bc4707 [Up-to-date]
# Updating [ 1 ] OneWire library:
# Versions: Current=2.2, Latest=2.2 [Up-to-date]
# Updating [ 4 ] IRremote library:
# Versions: Current=f2dafe5030, Latest=f2dafe5030 [Up-to-date]
# Updating [ 14 ] Adafruit-9DOF-Unified library:
# Versions: Current=b2f07242ac, Latest=b2f07242ac [Up-to-date]

View File

@ -0,0 +1,23 @@
.. _userguide_lib:
Library Manager
===============
To print all available commands and options use:
.. code-block:: bash
$ platformio lib --help
$ platformio lib COMMAND --help
.. toctree::
:maxdepth: 2
cmd_install
cmd_list
cmd_register
cmd_search
cmd_show
cmd_uninstall
cmd_update

View File

@ -0,0 +1,22 @@
Arduino Example: Build \*.ino file with external Adafruit library
=================================================================
1. Download ``platformio``
`sources <https://github.com/ivankravets/platformio/archive/develop.zip>`_
2. Extract ZIP archive
3. Then run these commands:
.. code-block:: bash
# Change directory to example
$ cd platformio-develop/examples/arduino-adafruit-library/
# Install Atmel AVR development platform with Arduino Framework
$ platformio install atmelavr
# Process example project
$ platformio run
# Upload firmware
$ platformio run -t upload

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,179 @@
/**************************************************************************/
/*!
@file Adafruit_CC3000.h
@author KTOWN (Kevin Townsend for Adafruit Industries)
@license BSD (see license.txt)
This is a library for the Adafruit CC3000 WiFi breakout board
This library works with the Adafruit CC3000 breakout
----> https://www.adafruit.com/products/1469
Check out the links above for our tutorials and wiring diagrams
These chips use SPI to communicate.
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
*/
/**************************************************************************/
#ifndef ADAFRUIT_CC3000_H
#define ADAFRUIT_CC3000_H
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "utility/cc3000_common.h"
#include "utility/wlan.h"
#include "utility/netapp.h"
#include "ccspi.h"
#if defined(__arm__) && defined(__SAM3X8E__) // Arduino Due
#define SPI_CLOCK_DIVIDER 6 // used to set the speed for the SPI bus; 6 == 14 Mhz on the Arduino Due
#else
#define SPI_CLOCK_DIVIDER SPI_CLOCK_DIV2 // Don't set this to a slower speed (i.e. larger div value)
// or communication will be flakey on 16mhz chips!
#endif
//#define ENABLE_CC3K_PRINTER
#ifdef ENABLE_CC3K_PRINTER
#define CHECK_PRINTER if(CC3KPrinter != 0)
#else
#define CHECK_PRINTER if(false)
#endif
#define WLAN_CONNECT_TIMEOUT 10000 // how long to wait, in milliseconds
#define RXBUFFERSIZE 64 // how much to buffer on the incoming side
#define TXBUFFERSIZE 32 // how much to buffer on the outgoing side
#define WIFI_ENABLE 1
#define WIFI_DISABLE 0
#define WIFI_STATUS_CONNECTED 1
typedef struct Result_Struct
{
uint32_t num_networks;
uint32_t scan_status;
uint8_t rssiByte;
uint8_t Sec_ssidLen;
uint16_t time;
uint8_t ssid_name[32];
uint8_t bssid[6];
} ResultStruct_t; /**!ResultStruct_t : data struct to store SSID scan results */
/* Enum for wlan_ioctl_statusget results */
typedef enum
{
STATUS_DISCONNECTED = 0,
STATUS_SCANNING = 1,
STATUS_CONNECTING = 2,
STATUS_CONNECTED = 3
} status_t;
class Adafruit_CC3000;
class Adafruit_CC3000_Client : public Print {
public:
Adafruit_CC3000_Client(uint16_t s);
Adafruit_CC3000_Client(void);
Adafruit_CC3000_Client(const Adafruit_CC3000_Client& copy);
void operator=(const Adafruit_CC3000_Client& other);
// NOTE: If public functions below are added/modified/removed please make sure to update the
// Adafruit_CC3000_ClientRef class to match!
bool connected(void);
size_t write(uint8_t c);
size_t fastrprint(const char *str);
size_t fastrprintln(const char *str);
size_t fastrprint(char *str);
size_t fastrprintln(char *str);
size_t fastrprint(const __FlashStringHelper *ifsh);
size_t fastrprintln(const __FlashStringHelper *ifsh);
int16_t write(const void *buf, uint16_t len, uint32_t flags = 0);
int16_t read(void *buf, uint16_t len, uint32_t flags = 0);
uint8_t read(void);
int32_t close(void);
uint8_t available(void);
uint8_t _rx_buf[RXBUFFERSIZE], _rx_buf_idx;
int16_t bufsiz;
private:
int16_t _socket;
};
// Ugly but necessary to include the server header after the client is fully defined.
// A forward reference in the server header won't cut it because the server needs to contain
// instances of the client. The client definition above can be pulled into a separate
// header in a later change to make this cleaner.
#include "Adafruit_CC3000_Server.h"
class Adafruit_CC3000 {
public:
Adafruit_CC3000(uint8_t csPin, uint8_t irqPin, uint8_t vbatPin, uint8_t spispeed = SPI_CLOCK_DIVIDER);
bool begin(uint8_t patchReq = 0, bool useSmartConfigData = false, const char *_deviceName = NULL);
void reboot(uint8_t patchReq = 0);
void stop(void);
bool disconnect(void);
bool deleteProfiles(void);
void printHex(const byte * data, const uint32_t numBytes);
void printHexChar(const byte * data, const uint32_t numBytes);
void printIPdots(uint32_t ip);
void printIPdotsRev(uint32_t ip);
uint32_t IP2U32(uint8_t a, uint8_t b, uint8_t c, uint8_t d);
bool getMacAddress(uint8_t address[6]);
bool setMacAddress(uint8_t address[6]);
bool setStaticIPAddress(uint32_t ip, uint32_t subnetMask, uint32_t defaultGateway, uint32_t dnsServer);
bool setDHCP();
bool connectToAP(const char *ssid, const char *key, uint8_t secmode, uint8_t attempts = 0);
bool connectSecure(const char *ssid, const char *key, int32_t secMode);
bool connectOpen(const char *ssid);
bool checkConnected(void);
bool checkDHCP(void);
bool getIPAddress(uint32_t *retip, uint32_t *netmask, uint32_t *gateway, uint32_t *dhcpserv, uint32_t *dnsserv);
bool checkSmartConfigFinished(void);
Adafruit_CC3000_Client connectTCP(uint32_t destIP, uint16_t destPort);
Adafruit_CC3000_Client connectUDP(uint32_t destIP, uint16_t destPort);
#ifndef CC3000_TINY_DRIVER
bool getFirmwareVersion(uint8_t *major, uint8_t *minor);
status_t getStatus(void);
uint16_t startSSIDscan(void);
void stopSSIDscan();
uint8_t getNextSSID(uint8_t *rssi, uint8_t *secMode, char *ssidname);
bool listSSIDResults(void);
bool startSmartConfig(const char *_deviceName = NULL, const char *smartConfigKey = NULL);
bool getIPConfig(tNetappIpconfigRetArgs *ipConfig);
uint16_t ping(uint32_t ip, uint8_t attempts=3, uint16_t timeout=500, uint8_t size=32);
uint16_t getHostByName(char *hostname, uint32_t *ip);
#endif
/* Functions that aren't available with the tiny driver */
#ifndef CC3000_TINY_DRIVER
bool scanSSIDs(uint32_t time);
#endif
void setPrinter(Print*);
private:
bool _initialised;
};
extern Print* CC3KPrinter;
#endif

View File

@ -0,0 +1,221 @@
/**************************************************************************/
/*!
@file Adafruit_CC3000_Server.cpp
@author Tony DiCola (tony@tonydicola.com)
@license BSD (see license.txt)
Adafruit CC3000 TCP server implementation based on the same interface as
the Arduino Ethernet library server class.
See http://arduino.cc/en/Reference/Ethernet for documentation on the
Arduino Ethernet library and its server interface.
*/
/**************************************************************************/
#include "Adafruit_CC3000_Server.h"
#include "utility/socket.h"
#define CC3K_PRINTLN_F(text) CHECK_PRINTER { if(CC3KPrinter != NULL) { CC3KPrinter->println(F(text)); } }
#define HANDLE_NULL(client, value) { if (client == NULL) return value; }
/**************************************************************************/
/*
Adafruit_CC3000_ClientRef implementation
*/
/**************************************************************************/
Adafruit_CC3000_ClientRef::Adafruit_CC3000_ClientRef(Adafruit_CC3000_Client* client)
: _client(client)
{ }
// Return true if the referenced client is connected. This is provided for
// compatibility with Ethernet library code.
Adafruit_CC3000_ClientRef::operator bool() {
return connected();
}
// Below are wrappers around the public client functions. These hide the fact that users
// are dealing with a reference to a client instance and allow code to be written using
// value semantics like in the Ethernet library.
bool Adafruit_CC3000_ClientRef::connected(void) {
HANDLE_NULL(_client, false);
return _client->connected();
}
size_t Adafruit_CC3000_ClientRef::write(uint8_t c) {
HANDLE_NULL(_client, 0);
return _client->write(c);
}
size_t Adafruit_CC3000_ClientRef::fastrprint(const char *str) {
HANDLE_NULL(_client, 0);
return _client->fastrprint(str);
}
size_t Adafruit_CC3000_ClientRef::fastrprintln(const char *str) {
HANDLE_NULL(_client, 0);
return _client->fastrprintln(str);
}
size_t Adafruit_CC3000_ClientRef::fastrprint(char *str) {
HANDLE_NULL(_client, 0);
return _client->fastrprint(str);
}
size_t Adafruit_CC3000_ClientRef::fastrprintln(char *str) {
HANDLE_NULL(_client, 0);
return _client->fastrprintln(str);
}
size_t Adafruit_CC3000_ClientRef::fastrprint(const __FlashStringHelper *ifsh) {
HANDLE_NULL(_client, 0);
return _client->fastrprint(ifsh);
}
size_t Adafruit_CC3000_ClientRef::fastrprintln(const __FlashStringHelper *ifsh) {
HANDLE_NULL(_client, 0);
return _client->fastrprintln(ifsh);
}
int16_t Adafruit_CC3000_ClientRef::write(const void *buf, uint16_t len, uint32_t flags) {
HANDLE_NULL(_client, 0);
return _client->write(buf, len, flags);
}
int16_t Adafruit_CC3000_ClientRef::read(void *buf, uint16_t len, uint32_t flags) {
HANDLE_NULL(_client, 0);
return _client->read(buf, len, flags);
}
uint8_t Adafruit_CC3000_ClientRef::read(void) {
HANDLE_NULL(_client, 0);
return _client->read();
}
int32_t Adafruit_CC3000_ClientRef::close(void) {
HANDLE_NULL(_client, 0);
return _client->close();
}
uint8_t Adafruit_CC3000_ClientRef::available(void) {
HANDLE_NULL(_client, 0);
return _client->available();
}
/**************************************************************************/
/*
Adafruit_CC3000_Server implementation
*/
/**************************************************************************/
// Construct a TCP server to listen on the specified port.
Adafruit_CC3000_Server::Adafruit_CC3000_Server(uint16_t port)
: _port(port)
, _listenSocket(-1)
{ }
// Return a reference to a client instance which has data available to read.
Adafruit_CC3000_ClientRef Adafruit_CC3000_Server::available() {
acceptNewConnections();
// Find the first client which is ready to read and return it.
for (int i = 0; i < MAX_SERVER_CLIENTS; ++i) {
if (_clients[i].connected() && _clients[i].available() > 0) {
return Adafruit_CC3000_ClientRef(&_clients[i]);
}
}
// Couldn't find a client ready to read, so return a client that is not
// connected to signal no clients are available for reading (convention
// used by the Ethernet library).
return Adafruit_CC3000_ClientRef(NULL);
}
// Initialize the server and start listening for connections.
void Adafruit_CC3000_Server::begin() {
// Set the CC3000 inactivity timeout to 0 (never timeout). This will ensure
// the CC3000 does not close the listening socket when it's idle for more than
// 60 seconds (the default timeout). See more information from:
// http://e2e.ti.com/support/low_power_rf/f/851/t/292664.aspx
unsigned long aucDHCP = 14400;
unsigned long aucARP = 3600;
unsigned long aucKeepalive = 30;
unsigned long aucInactivity = 0;
cc3k_int_poll();
if (netapp_timeout_values(&aucDHCP, &aucARP, &aucKeepalive, &aucInactivity) != 0) {
CC3K_PRINTLN_F("Error setting inactivity timeout!");
return;
}
// Create a TCP socket
cc3k_int_poll();
int16_t soc = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (soc < 0) {
CC3K_PRINTLN_F("Couldn't create listening socket!");
return;
}
// Set the socket's accept call as non-blocking.
cc3k_int_poll();
char arg = SOCK_ON; // nsd: looked in TI example code and they pass this as a 'short' in one example, and 'char' in two others. 'char' seems as likely work, and has no endianess issue
if (setsockopt(soc, SOL_SOCKET, SOCKOPT_ACCEPT_NONBLOCK, &arg, sizeof(arg)) < 0) {
CC3K_PRINTLN_F("Couldn't set socket as non-blocking!");
return;
}
// Bind the socket to a TCP address.
sockaddr_in address;
address.sin_family = AF_INET;
address.sin_addr.s_addr = htonl(0); // Listen on any network interface, equivalent to INADDR_ANY in sockets programming.
address.sin_port = htons(_port); // Listen on the specified port.
cc3k_int_poll();
if (bind(soc, (sockaddr*) &address, sizeof(address)) < 0) {
CC3K_PRINTLN_F("Error binding listen socket to address!");
return;
}
// Start listening for connections.
// The backlog parameter is 0 as it is not supported on TI's CC3000 firmware.
cc3k_int_poll();
if (listen(soc, 0) < 0) {
CC3K_PRINTLN_F("Error opening socket for listening!");
return;
}
_listenSocket = soc;
}
// Write data to all connected clients. Buffer is a pointer to an array
// of bytes, and size specifies how many bytes to write from the buffer.
// Return the sum of bytes written to all clients.
size_t Adafruit_CC3000_Server::write(const uint8_t *buffer, size_t size) {
size_t written = 0;
for (int i = 0; i < MAX_SERVER_CLIENTS; ++i) {
if (_clients[i].connected()) {
written += _clients[i].write(buffer, size);
}
}
return written;
}
// Write a byte value to all connected clients.
// Return the sum of bytes written to all clients.
size_t Adafruit_CC3000_Server::write(uint8_t value) {
return write(&value, 1);
}
// Accept new connections and update the connected clients.
void Adafruit_CC3000_Server::acceptNewConnections() {
// For any unconnected client, see if new connections are pending and accept
// them as a new client.
for (int i = 0; i < MAX_SERVER_CLIENTS; ++i) {
if (!_clients[i].connected()) {
// Note: Because the non-blocking option was set for the listening
// socket this call will not block and instead return SOC_IN_PROGRESS (-2)
// if there are no pending client connections. Also, the address of the
// connected client is not needed, so those parameters are set to NULL.
cc3k_int_poll();
int soc = accept(_listenSocket, NULL, NULL);
if (soc > -1) {
_clients[i] = Adafruit_CC3000_Client(soc);
}
// else either there were no sockets to accept or an error occured.
}
}
}

View File

@ -0,0 +1,100 @@
/**************************************************************************/
/*!
@file Adafruit_CC3000_Server.h
@author Tony DiCola (tony@tonydicola.com)
@license BSD (see license.txt)
Adafruit CC3000 TCP server implementation based on the same interface as
the Arduino Ethernet library server class.
See http://arduino.cc/en/Reference/Ethernet for documentation on the
Arduino Ethernet library and its server interface.
The only difference between this implementation and the Ethernet library
is that a special client reference facade is returned by the available()
function, instead of a copy of a client like in the Ethernet library. This
is necessary to ensure the buffers that client instances contain aren't
copied and get out of sync.
*/
/**************************************************************************/
#ifndef ADAFRUIT_CC3000_SERVER_H
#define ADAFRUIT_CC3000_SERVER_H
#include "Adafruit_CC3000.h"
#include "Print.h"
#include "Server.h"
// Assume 4 sockets available, 1 of which is used for listening, so at most 3
// clients can be connected at once.
#define MAX_SERVER_CLIENTS 3
// Facade that wraps a reference to a client instance into something that looks
// and acts like a client instance value. This is done to mimic the semantics
// of the Ethernet library, without running into problems allowing client buffers
// to be copied and get out of sync.
class Adafruit_CC3000_ClientRef : public Print {
public:
Adafruit_CC3000_ClientRef(Adafruit_CC3000_Client* client);
// Return true if the referenced client is connected. This is provided for
// compatibility with Ethernet library code.
operator bool();
// Below are all the public methods of the client class:
bool connected(void);
size_t write(uint8_t c);
size_t fastrprint(const char *str);
size_t fastrprintln(const char *str);
size_t fastrprint(char *str);
size_t fastrprintln(char *str);
size_t fastrprint(const __FlashStringHelper *ifsh);
size_t fastrprintln(const __FlashStringHelper *ifsh);
int16_t write(const void *buf, uint16_t len, uint32_t flags = 0);
int16_t read(void *buf, uint16_t len, uint32_t flags = 0);
uint8_t read(void);
int32_t close(void);
uint8_t available(void);
private:
// Hide the fact that users are really dealing with a pointer to a client
// instance. Note: this class does not own the contents of the client
// pointer and should NEVER attempt to free/delete this pointer.
Adafruit_CC3000_Client* _client;
};
class Adafruit_CC3000_Server : public Server {
public:
// Construct a TCP server to listen on the specified port.
Adafruit_CC3000_Server(uint16_t port);
// Return a reference to a client instance which has data available to read.
Adafruit_CC3000_ClientRef available();
// Initialize the server and start listening for connections.
virtual void begin();
// Write data to all connected clients. Buffer is a pointer to an array
// of bytes, and size specifies how many bytes to write from the buffer.
// Return the sum of bytes written to all clients.
virtual size_t write(const uint8_t *buffer, size_t size);
// Write a byte value to all connected clients.
// Return the sum of bytes written to all clients.
virtual size_t write(uint8_t value);
// Make the overloads of write from the Print base class available.
using Print::write;
private:
// Store the clients in a simple array.
Adafruit_CC3000_Client _clients[MAX_SERVER_CLIENTS];
// The port this server will listen for connections on.
uint16_t _port;
// The id of the listening socket.
uint16_t _listenSocket;
// Accept new connections and update the connected clients.
void acceptNewConnections();
};
#endif

View File

@ -0,0 +1,24 @@
This is a library for the Adafruit CC3000 WiFi Breakouts etc
Designed specifically to work with the Adafruit CC3000 Breakout
----> https://www.adafruit.com/products/1469
These modules use SPI to communicate, 6 pins are required to interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Check out the links above for our tutorials and wiring diagrams
Arduino library Written by Limor Fried & Kevin Townsend for Adafruit Industries.
CC3000 host core written by TI
To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_CC3000
Check that the Adafruit_CC3000 folder contains Adafruit_CC3000.cpp and Adafruit_CC3000.h
Place the Adafruit_CC3000 library folder your *arduinosketchfolder*/libraries/ folder.
You may need to create the libraries subfolder if its your first library. Restart the IDE.
NOTE: the 'SendTweet' example currently DOES NOT WORK due to Twitter API changes. The code is being kept for posterity in case a workaround can be developed.

View File

@ -0,0 +1,769 @@
/*****************************************************************************
*
* spi.c - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#include <Arduino.h>
#include "ccspi.h"
#include "utility/hci.h"
#include "utility/netapp.h"
#include "utility/evnt_handler.h"
#include "utility/cc3000_common.h"
#include "utility/debug.h"
extern uint8_t g_csPin, g_irqPin, g_vbatPin, g_IRQnum, g_SPIspeed;
#define READ (3)
#define WRITE (1)
#define HI(value) (((value) & 0xFF00) >> 8)
#define LO(value) ((value) & 0x00FF)
#define HEADERS_SIZE_EVNT (SPI_HEADER_SIZE + 5)
#define SPI_HEADER_SIZE (5)
#define eSPI_STATE_POWERUP (0)
#define eSPI_STATE_INITIALIZED (1)
#define eSPI_STATE_IDLE (2)
#define eSPI_STATE_WRITE_IRQ (3)
#define eSPI_STATE_WRITE_FIRST_PORTION (4)
#define eSPI_STATE_WRITE_EOT (5)
#define eSPI_STATE_READ_IRQ (6)
#define eSPI_STATE_READ_FIRST_PORTION (7)
#define eSPI_STATE_READ_EOT (8)
/*
these variables store the SPI configuration
so they can be modified and restored
this is so that we can have multiple SPI devices
on the same bus, so they can operate at different speeds
and in different modes
*/
#if defined(SPI2X) && defined(__AVR__) // most likely AVR8
uint8_t ccspi_mySPCR, ccspi_mySPSR, ccspi_oldSPSR, ccspi_oldSPCR;
#define SpiConfigStoreOld() { \
ccspi_oldSPCR = SPCR; \
ccspi_oldSPSR = SPSR & _BV(SPI2X); }
#define SpiConfigStoreMy() { \
ccspi_mySPCR = SPCR; \
ccspi_mySPSR = SPSR & _BV(SPI2X); }
#define SpiConfigPush() { \
ccspi_oldSPCR = SPCR; \
ccspi_oldSPSR = SPSR & _BV(SPI2X); \
SPCR = ccspi_mySPCR; \
if(ccspi_mySPSR) SPSR |= _BV(SPI2X); \
else SPSR &= ~_BV(SPI2X); }
#define SpiConfigPop() { \
SPCR = ccspi_oldSPCR; \
if(ccspi_oldSPSR) SPSR |= _BV(SPI2X); \
else SPSR &= ~_BV(SPI2X); }
#elif defined(__AVR_XMEGA__) // most likely XMEGA
uint8_t ccspi_mySPICTRL, ccspi_oldSPICTRL;
#define SpiConfigStoreOld() do { ccspi_oldSPICTRL = SPCR; } while (0)
#define SpiConfigStoreMy() do { ccspi_mySPICTRL = SPCR; } while (0)
#define SpiConfigPush() do { ccspi_oldSPICTRL = SPCR; SPCR = ccspi_mySPICTRL; } while (0)
#define SpiConfigPop() do { SPCR = ccspi_oldSPICTRL; } while (0)
#else
// TODO: ARM (Due, Teensy 3.0, etc)
// #error platform not yet supported by Adafruit_CC3000
#define SpiConfigStoreOld() do { } while (0)
#define SpiConfigStoreMy() do { } while (0)
#define SpiConfigPush() do { } while (0)
#define SpiConfigPop() do { } while (0)
#endif
#ifdef SPI_HAS_TRANSACTION
// CC3000 SPI config + begin SPI usage + chip select
#define CC3000_ASSERT_CS { \
SpiConfigPush(); \
SPI.beginTransaction(SPISettings(16000000, MSBFIRST, SPI_MODE1)); \
digitalWrite(g_csPin, LOW); }
// CC3000 chip deselect + end SPI usage + SPI restore
#define CC3000_DEASSERT_CS { \
digitalWrite(g_csPin, HIGH); \
SPI.endTransaction(); \
SpiConfigPop(); }
#else
// CC3000 chip select + SPI config
#define CC3000_ASSERT_CS { \
digitalWrite(g_csPin, LOW); \
SpiConfigPush(); }
// CC3000 chip deselect + SPI restore
#define CC3000_DEASSERT_CS { \
digitalWrite(g_csPin, HIGH); \
SpiConfigPop(); }
#endif
/* smartconfig flags (defined in Adafruit_CC3000.cpp) */
// extern unsigned long ulSmartConfigFinished, ulCC3000DHCP;
typedef struct
{
gcSpiHandleRx SPIRxHandler;
unsigned short usTxPacketLength;
unsigned short usRxPacketLength;
unsigned long ulSpiState;
unsigned char *pTxPacket;
unsigned char *pRxPacket;
} tSpiInformation;
tSpiInformation sSpiInformation;
/* Static buffer for 5 bytes of SPI HEADER */
unsigned char tSpiReadHeader[] = {READ, 0, 0, 0, 0};
void SpiWriteDataSynchronous(unsigned char *data, unsigned short size);
void SpiWriteAsync(const unsigned char *data, unsigned short size);
void SpiPauseSpi(void);
void SpiResumeSpi(void);
void SSIContReadOperation(void);
void cc3k_int_poll(void);
// The magic number that resides at the end of the TX/RX buffer (1 byte after the allocated size)
// for the purpose of detection of the overrun. The location of the memory where the magic number
// resides shall never be written. In case it is written - the overrun occured and either recevie function
// or send function will stuck forever.
#define CC3000_BUFFER_MAGIC_NUMBER (0xDE)
char spi_buffer[CC3000_RX_BUFFER_SIZE];
unsigned char wlan_tx_buffer[CC3000_TX_BUFFER_SIZE];
static volatile char ccspi_is_in_irq = 0;
static volatile char ccspi_int_enabled = 0;
/* Mandatory functions are:
- SpiOpen
- SpiWrite
- SpiRead
- SpiClose
- SpiResumeSpi
- ReadWlanInterruptPin
- WlanInterruptEnable
- WlanInterruptDisable
- WriteWlanPin
*/
/**************************************************************************/
/*!
*/
/**************************************************************************/
void SpiClose(void)
{
DEBUGPRINT_F("\tCC3000: SpiClose");
if (sSpiInformation.pRxPacket)
{
sSpiInformation.pRxPacket = 0;
}
/* Disable Interrupt in GPIOA module... */
tSLInformation.WlanInterruptDisable();
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
void SpiOpen(gcSpiHandleRx pfRxHandler)
{
DEBUGPRINT_F("\tCC3000: SpiOpen");
sSpiInformation.ulSpiState = eSPI_STATE_POWERUP;
memset(spi_buffer, 0, sizeof(spi_buffer));
memset(wlan_tx_buffer, 0, sizeof(spi_buffer));
sSpiInformation.SPIRxHandler = pfRxHandler;
sSpiInformation.usTxPacketLength = 0;
sSpiInformation.pTxPacket = NULL;
sSpiInformation.pRxPacket = (unsigned char *)spi_buffer;
sSpiInformation.usRxPacketLength = 0;
spi_buffer[CC3000_RX_BUFFER_SIZE - 1] = CC3000_BUFFER_MAGIC_NUMBER;
wlan_tx_buffer[CC3000_TX_BUFFER_SIZE - 1] = CC3000_BUFFER_MAGIC_NUMBER;
/* Enable interrupt on the GPIO pin of WLAN IRQ */
tSLInformation.WlanInterruptEnable();
DEBUGPRINT_F("\tCC3000: Finished SpiOpen\n\r");
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
int init_spi(void)
{
DEBUGPRINT_F("\tCC3000: init_spi\n\r");
/* Set POWER_EN pin to output and disable the CC3000 by default */
pinMode(g_vbatPin, OUTPUT);
digitalWrite(g_vbatPin, 0);
delay(500);
/* Set CS pin to output (don't de-assert yet) */
pinMode(g_csPin, OUTPUT);
/* Set interrupt/gpio pin to input */
#if defined(INPUT_PULLUP)
pinMode(g_irqPin, INPUT_PULLUP);
#else
pinMode(g_irqPin, INPUT);
digitalWrite(g_irqPin, HIGH); // w/weak pullup
#endif
SpiConfigStoreOld(); // prime ccspi_old* values for DEASSERT
/* Initialise SPI (Mode 1) */
SPI.begin();
SPI.setDataMode(SPI_MODE1);
SPI.setBitOrder(MSBFIRST);
SPI.setClockDivider(g_SPIspeed);
SpiConfigStoreMy(); // prime ccspi_my* values for ASSERT
// Newly-initialized SPI is in the same state that ASSERT_CS will set it
// to. Invoke DEASSERT (which also restores SPI registers) so the next
// ASSERT call won't clobber the ccspi_old* values -- we need those!
#ifdef SPI_HAS_TRANSACTION
SPI.usingInterrupt(g_IRQnum);
digitalWrite(g_csPin, HIGH); // same as CC3000_DEASSERT_CS, but not
SpiConfigPop(); // SPI.endTransaction, because none began
#else
CC3000_DEASSERT_CS;
#endif
/* ToDo: Configure IRQ interrupt! */
DEBUGPRINT_F("\tCC3000: Finished init_spi\n\r");
return(ESUCCESS);
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
long SpiFirstWrite(unsigned char *ucBuf, unsigned short usLength)
{
DEBUGPRINT_F("\tCC3000: SpiWriteFirst\n\r");
/* Workaround for the first transaction */
CC3000_ASSERT_CS;
/* delay (stay low) for ~50us */
delay(1);
/* SPI writes first 4 bytes of data */
SpiWriteDataSynchronous(ucBuf, 4);
delay(1);
SpiWriteDataSynchronous(ucBuf + 4, usLength - 4);
/* From this point on - operate in a regular manner */
sSpiInformation.ulSpiState = eSPI_STATE_IDLE;
CC3000_DEASSERT_CS;
return(0);
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
long SpiWrite(unsigned char *pUserBuffer, unsigned short usLength)
{
unsigned char ucPad = 0;
DEBUGPRINT_F("\tCC3000: SpiWrite\n\r");
/* Figure out the total length of the packet in order to figure out if there is padding or not */
if(!(usLength & 0x0001))
{
ucPad++;
}
pUserBuffer[0] = WRITE;
pUserBuffer[1] = HI(usLength + ucPad);
pUserBuffer[2] = LO(usLength + ucPad);
pUserBuffer[3] = 0;
pUserBuffer[4] = 0;
usLength += (SPI_HEADER_SIZE + ucPad);
/* The magic number that resides at the end of the TX/RX buffer (1 byte after the allocated size)
* for the purpose of overrun detection. If the magic number is overwritten - buffer overrun
* occurred - and we will be stuck here forever! */
if (wlan_tx_buffer[CC3000_TX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER)
{
DEBUGPRINT_F("\tCC3000: Error - No magic number found in SpiWrite\n\r");
while (1);
}
if (sSpiInformation.ulSpiState == eSPI_STATE_POWERUP)
{
while (sSpiInformation.ulSpiState != eSPI_STATE_INITIALIZED);
}
if (sSpiInformation.ulSpiState == eSPI_STATE_INITIALIZED)
{
/* This is time for first TX/RX transactions over SPI: the IRQ is down - so need to send read buffer size command */
SpiFirstWrite(pUserBuffer, usLength);
}
else
{
/* We need to prevent here race that can occur in case two back to back packets are sent to the
* device, so the state will move to IDLE and once again to not IDLE due to IRQ */
tSLInformation.WlanInterruptDisable();
while (sSpiInformation.ulSpiState != eSPI_STATE_IDLE);
sSpiInformation.ulSpiState = eSPI_STATE_WRITE_IRQ;
sSpiInformation.pTxPacket = pUserBuffer;
sSpiInformation.usTxPacketLength = usLength;
/* Assert the CS line and wait till SSI IRQ line is active and then initialize write operation */
CC3000_ASSERT_CS;
/* Re-enable IRQ - if it was not disabled - this is not a problem... */
tSLInformation.WlanInterruptEnable();
/* Check for a missing interrupt between the CS assertion and enabling back the interrupts */
if (tSLInformation.ReadWlanInterruptPin() == 0)
{
SpiWriteDataSynchronous(sSpiInformation.pTxPacket, sSpiInformation.usTxPacketLength);
sSpiInformation.ulSpiState = eSPI_STATE_IDLE;
CC3000_DEASSERT_CS;
#ifdef SPI_HAS_TRANSACTION
WlanInterruptEnable();
#endif
}
}
/* Due to the fact that we are currently implementing a blocking situation
* here we will wait till end of transaction */
while (eSPI_STATE_IDLE != sSpiInformation.ulSpiState);
return(0);
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
void SpiWriteDataSynchronous(unsigned char *data, unsigned short size)
{
DEBUGPRINT_F("\tCC3000: SpiWriteDataSynchronous Start\n\r");
unsigned short loc;
for (loc = 0; loc < size; loc ++)
{
SPI.transfer(data[loc]);
#if (DEBUG_MODE == 1)
if (!(loc==size-1))
{
DEBUGPRINT_F(" ");
DEBUGPRINT_HEX(data[loc]);
}
else
{
DEBUGPRINT_F(" ");
DEBUGPRINT_HEX(data[loc]);
}
#endif
}
DEBUGPRINT_F("\n\r\tCC3000: SpiWriteDataSynchronous End\n\r");
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
void SpiReadDataSynchronous(unsigned char *data, unsigned short size)
{
unsigned short i = 0;
DEBUGPRINT_F("\tCC3000: SpiReadDataSynchronous\n\r");
SPI.setDataMode(SPI_MODE1);
for (i = 0; i < size; i ++)
{
data[i] = SPI.transfer(0x03);
DEBUGPRINT_F(" ");
DEBUGPRINT_HEX(data[i]);
}
DEBUGPRINT_F("\n\r");
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
void SpiReadHeader(void)
{
DEBUGPRINT_F("\tCC3000: SpiReadHeader\n\r");
SpiReadDataSynchronous(sSpiInformation.pRxPacket, HEADERS_SIZE_EVNT);
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
long SpiReadDataCont(void)
{
long data_to_recv;
unsigned char *evnt_buff, type;
DEBUGPRINT_F("\tCC3000: SpiReadDataCont\n\r");
/* Determine what type of packet we have */
evnt_buff = sSpiInformation.pRxPacket;
data_to_recv = 0;
STREAM_TO_UINT8((uint8_t *)(evnt_buff + SPI_HEADER_SIZE), HCI_PACKET_TYPE_OFFSET, type);
switch(type)
{
case HCI_TYPE_DATA:
{
/* We need to read the rest of data.. */
STREAM_TO_UINT16((char *)(evnt_buff + SPI_HEADER_SIZE), HCI_DATA_LENGTH_OFFSET, data_to_recv);
if (!((HEADERS_SIZE_EVNT + data_to_recv) & 1))
{
data_to_recv++;
}
if (data_to_recv)
{
SpiReadDataSynchronous(evnt_buff + HEADERS_SIZE_EVNT, data_to_recv);
}
break;
}
case HCI_TYPE_EVNT:
{
/* Calculate the rest length of the data */
STREAM_TO_UINT8((char *)(evnt_buff + SPI_HEADER_SIZE), HCI_EVENT_LENGTH_OFFSET, data_to_recv);
data_to_recv -= 1;
/* Add padding byte if needed */
if ((HEADERS_SIZE_EVNT + data_to_recv) & 1)
{
data_to_recv++;
}
if (data_to_recv)
{
SpiReadDataSynchronous(evnt_buff + HEADERS_SIZE_EVNT, data_to_recv);
}
sSpiInformation.ulSpiState = eSPI_STATE_READ_EOT;
break;
}
}
return (0);
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
void SpiPauseSpi(void)
{
DEBUGPRINT_F("\tCC3000: SpiPauseSpi\n\r");
ccspi_int_enabled = 0;
detachInterrupt(g_IRQnum);
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
void SpiResumeSpi(void)
{
DEBUGPRINT_F("\tCC3000: SpiResumeSpi\n\r");
ccspi_int_enabled = 1;
attachInterrupt(g_IRQnum, SPI_IRQ, FALLING);
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
void SpiTriggerRxProcessing(void)
{
DEBUGPRINT_F("\tCC3000: SpiTriggerRxProcessing\n\r");
/* Trigger Rx processing */
SpiPauseSpi();
CC3000_DEASSERT_CS;
//DEBUGPRINT_F("Magic?\n\r");
/* The magic number that resides at the end of the TX/RX buffer (1 byte after the allocated size)
* for the purpose of detection of the overrun. If the magic number is overriten - buffer overrun
* occurred - and we will stuck here forever! */
if (sSpiInformation.pRxPacket[CC3000_RX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER)
{
/* You've got problems if you're here! */
DEBUGPRINT_F("\tCC3000: ERROR - magic number missing!\n\r");
while (1);
}
//DEBUGPRINT_F("OK!\n\r");
sSpiInformation.ulSpiState = eSPI_STATE_IDLE;
sSpiInformation.SPIRxHandler(sSpiInformation.pRxPacket + SPI_HEADER_SIZE);
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
void SSIContReadOperation(void)
{
DEBUGPRINT_F("\tCC3000: SpiContReadOperation\n\r");
/* The header was read - continue with the payload read */
if (!SpiReadDataCont())
{
/* All the data was read - finalize handling by switching to teh task
* and calling from task Event Handler */
//DEBUGPRINT_F("SPItrig\n\r");
SpiTriggerRxProcessing();
}
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
void WriteWlanPin( unsigned char val )
{
if (DEBUG_MODE)
{
DEBUGPRINT_F("\tCC3000: WriteWlanPin - ");
DEBUGPRINT_DEC(val);
DEBUGPRINT_F("\n\r");
delay(1);
}
if (val)
{
digitalWrite(g_vbatPin, HIGH);
}
else
{
digitalWrite(g_vbatPin, LOW);
}
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
long ReadWlanInterruptPin(void)
{
DEBUGPRINT_F("\tCC3000: ReadWlanInterruptPin - ");
DEBUGPRINT_DEC(digitalRead(g_irqPin));
DEBUGPRINT_F("\n\r");
return(digitalRead(g_irqPin));
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
void WlanInterruptEnable()
{
DEBUGPRINT_F("\tCC3000: WlanInterruptEnable.\n\r");
// delay(100);
ccspi_int_enabled = 1;
attachInterrupt(g_IRQnum, SPI_IRQ, FALLING);
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
void WlanInterruptDisable()
{
DEBUGPRINT_F("\tCC3000: WlanInterruptDisable\n\r");
ccspi_int_enabled = 0;
detachInterrupt(g_IRQnum);
}
//*****************************************************************************
//
//! sendDriverPatch
//!
//! @param pointer to the length
//!
//! @return none
//!
//! @brief The function returns a pointer to the driver patch:
//! since there is no patch in the host - it returns 0
//
//*****************************************************************************
char *sendDriverPatch(unsigned long *Length) {
*Length = 0;
return NULL;
}
//*****************************************************************************
//
//! sendBootLoaderPatch
//!
//! @param pointer to the length
//!
//! @return none
//!
//! @brief The function returns a pointer to the boot loader patch:
//! since there is no patch in the host - it returns 0
//
//*****************************************************************************
char *sendBootLoaderPatch(unsigned long *Length) {
*Length = 0;
return NULL;
}
//*****************************************************************************
//
//! sendWLFWPatch
//!
//! @param pointer to the length
//!
//! @return none
//!
//! @brief The function returns a pointer to the FW patch:
//! since there is no patch in the host - it returns 0
//
//*****************************************************************************
char *sendWLFWPatch(unsigned long *Length) {
*Length = 0;
return NULL;
}
/**************************************************************************/
/*!
*/
/**************************************************************************/
void SPI_IRQ(void)
{
ccspi_is_in_irq = 1;
DEBUGPRINT_F("\tCC3000: Entering SPI_IRQ\n\r");
if (sSpiInformation.ulSpiState == eSPI_STATE_POWERUP)
{
/* IRQ line was low ... perform a callback on the HCI Layer */
sSpiInformation.ulSpiState = eSPI_STATE_INITIALIZED;
}
else if (sSpiInformation.ulSpiState == eSPI_STATE_IDLE)
{
//DEBUGPRINT_F("IDLE\n\r");
sSpiInformation.ulSpiState = eSPI_STATE_READ_IRQ;
/* IRQ line goes down - start reception */
CC3000_ASSERT_CS;
// Wait for TX/RX Compete which will come as DMA interrupt
SpiReadHeader();
sSpiInformation.ulSpiState = eSPI_STATE_READ_EOT;
//DEBUGPRINT_F("SSICont\n\r");
SSIContReadOperation();
}
else if (sSpiInformation.ulSpiState == eSPI_STATE_WRITE_IRQ)
{
SpiWriteDataSynchronous(sSpiInformation.pTxPacket, sSpiInformation.usTxPacketLength);
sSpiInformation.ulSpiState = eSPI_STATE_IDLE;
CC3000_DEASSERT_CS;
}
DEBUGPRINT_F("\tCC3000: Leaving SPI_IRQ\n\r");
ccspi_is_in_irq = 0;
return;
}
//*****************************************************************************
//
//! cc3k_int_poll
//!
//! \brief checks if the interrupt pin is low
//! just in case the hardware missed a falling edge
//! function is in ccspi.cpp
//
//*****************************************************************************
void cc3k_int_poll()
{
if (digitalRead(g_irqPin) == LOW && ccspi_is_in_irq == 0 && ccspi_int_enabled != 0) {
SPI_IRQ();
}
}

View File

@ -0,0 +1,90 @@
/*****************************************************************************
*
* spi.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __SPI_H__
#define __SPI_H__
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <SPI.h>
#include "utility/wlan.h"
typedef void (*gcSpiHandleRx)(void *p);
typedef void (*gcSpiHandleTx)(void);
extern unsigned char wlan_tx_buffer[];
//*****************************************************************************
//
// Prototypes for the APIs.
//
//*****************************************************************************
extern void SpiOpen(gcSpiHandleRx pfRxHandler);
extern void SpiClose(void);
extern long SpiWrite(unsigned char *pUserBuffer, unsigned short usLength);
extern void SpiResumeSpi(void);
extern void SpiCleanGPIOISR(void);
extern int init_spi(void);
extern long TXBufferIsEmpty(void);
extern long RXBufferIsEmpty(void);
extern void CC3000_UsynchCallback(long lEventType, char * data, unsigned char length);
extern void WriteWlanPin( unsigned char val );
extern long ReadWlanInterruptPin(void);
extern void WlanInterruptEnable();
extern void WlanInterruptDisable();
extern char *sendDriverPatch(unsigned long *Length);
extern char *sendBootLoaderPatch(unsigned long *Length);
extern char *sendWLFWPatch(unsigned long *Length);
extern void SPI_IRQ(void);
#endif

View File

@ -0,0 +1,179 @@
/***************************************************
Adafruit CC3000 Breakout/Shield TCP Chat Server
This is a simple chat server which allows clients to connect
with telnet and exchange messages. Anything sent by one
client will be written out to all connected clients.
See the CC3000 tutorial on Adafruit's learning system
for more information on setting up and using the
CC3000:
http://learn.adafruit.com/adafruit-cc3000-wifi
Requirements:
This sketch requires the Adafruit CC3000 library. You can
download the library from:
https://github.com/adafruit/Adafruit_CC3000_Library
For information on installing libraries in the Arduino IDE
see this page:
http://arduino.cc/en/Guide/Libraries
Usage:
Update the SSID and, if necessary, the CC3000 hardware pin
information below, then run the sketch and check the
output of the serial port. After connecting to the
wireless network successfully the sketch will output
the IP address of the server and start listening for
connections. Once listening for connections, connect
to the server from your computer using a telnet client
on port 23.
For example on Linux or Mac OSX, if your CC3000 has an
IP address 192.168.1.100 you would execute in a command
window:
telnet 192.168.1.100 23
Connect multiple clients and notice that whatever one client
sends will be echoed to all other clients. Press ctrl-] and
type quit at the prompt to close the telnet session.
On Windows you'll need to download a telnet client. PuTTY
is a good, free GUI client:
http://www.chiark.greenend.org.uk/~sgtatham/putty/
License:
This example is copyright (c) 2013 Tony DiCola (tony@tonydicola.com)
and is released under an open source MIT license. See details at:
http://opensource.org/licenses/MIT
This code was adapted from Adafruit CC3000 library example
code which has the following license:
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried & Kevin Townsend for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#include <Adafruit_CC3000.h>
#include <SPI.h>
#include "utility/debug.h"
#include "utility/socket.h"
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIVIDER); // you can change this clock speed
#define WLAN_SSID "myNetwork" // cannot be longer than 32 characters!
#define WLAN_PASS "myPassword"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY WLAN_SEC_WPA2
#define LISTEN_PORT 23 // What TCP port to listen on for connections.
Adafruit_CC3000_Server chatServer(LISTEN_PORT);
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC);
/* Initialise the module */
Serial.println(F("\nInitializing..."));
if (!cc3000.begin())
{
Serial.println(F("Couldn't begin()! Check your wiring?"));
while(1);
}
Serial.print(F("\nAttempting to connect to ")); Serial.println(WLAN_SSID);
if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println(F("Failed!"));
while(1);
}
Serial.println(F("Connected!"));
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP())
{
delay(100); // ToDo: Insert a DHCP timeout!
}
/* Display the IP address DNS, Gateway, etc. */
while (! displayConnectionDetails()) {
delay(1000);
}
/*********************************************************/
/* You can safely remove this to save some flash memory! */
/*********************************************************/
Serial.println(F("\r\nNOTE: This sketch may cause problems with other sketches"));
Serial.println(F("since the .disconnect() function is never called, so the"));
Serial.println(F("AP may refuse connection requests from the CC3000 until a"));
Serial.println(F("timeout period passes. This is normal behaviour since"));
Serial.println(F("there isn't an obvious moment to disconnect with a server.\r\n"));
// Start listening for connections
chatServer.begin();
Serial.println(F("Listening for connections..."));
}
void loop(void)
{
// Try to get a client which is connected.
Adafruit_CC3000_ClientRef client = chatServer.available();
if (client) {
// Check if there is data available to read.
if (client.available() > 0) {
// Read a byte and write it to all clients.
uint8_t ch = client.read();
chatServer.write(ch);
}
}
}
/**************************************************************************/
/*!
@brief Tries to read the IP address and other connection details
*/
/**************************************************************************/
bool displayConnectionDetails(void)
{
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
{
Serial.println(F("Unable to retrieve the IP Address!\r\n"));
return false;
}
else
{
Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
Serial.println();
return true;
}
}

View File

@ -0,0 +1,185 @@
/***************************************************
Adafruit CC3000 Breakout/Shield TCP Echo Server
This is a simple implementation of the echo
protocol, RFC 862 http://tools.ietf.org/html/rfc862 ,
for the Arduino platform and Adafruit CC3000 breakout
or shield. This sketch will create a TCP server that
listens by default on port 7 and echos back any data
received. Up to 3 clients can be connected concurrently
to the server. This sketch is meant as an example of how
to write a simple server with the Arduino and CC3000.
See the CC3000 tutorial on Adafruit's learning system
for more information on setting up and using the
CC3000:
http://learn.adafruit.com/adafruit-cc3000-wifi
Requirements:
This sketch requires the Adafruit CC3000 library. You can
download the library from:
https://github.com/adafruit/Adafruit_CC3000_Library
For information on installing libraries in the Arduino IDE
see this page:
http://arduino.cc/en/Guide/Libraries
Usage:
Update the SSID and, if necessary, the CC3000 hardware pin
information below, then run the sketch and check the
output of the serial port. After connecting to the
wireless network successfully the sketch will output
the IP address of the server and start listening for
connections. Once listening for connections, connect
to the server from your computer using a telnet client
on port 7.
For example on Linux or Mac OSX, if your CC3000 has an
IP address 192.168.1.100 you would execute in a command
window:
telnet 192.168.1.100 7
After connecting, notice that as you type input and
press enter to send it the CC3000 will echo back exactly
what you typed. Press ctrl-] and type quit at the prompt
to close the telnet session.
On Windows you'll need to download a telnet client. PuTTY
is a good, free GUI client:
http://www.chiark.greenend.org.uk/~sgtatham/putty/
License:
This example is copyright (c) 2013 Tony DiCola (tony@tonydicola.com)
and is released under an open source MIT license. See details at:
http://opensource.org/licenses/MIT
This code was adapted from Adafruit CC3000 library example
code which has the following license:
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried & Kevin Townsend for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#include <Adafruit_CC3000.h>
#include <SPI.h>
#include "utility/debug.h"
#include "utility/socket.h"
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIVIDER); // you can change this clock speed
#define WLAN_SSID "myNetwork" // cannot be longer than 32 characters!
#define WLAN_PASS "myPassword"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY WLAN_SEC_WPA2
#define LISTEN_PORT 7 // What TCP port to listen on for connections. The echo protocol uses port 7.
Adafruit_CC3000_Server echoServer(LISTEN_PORT);
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC);
/* Initialise the module */
Serial.println(F("\nInitializing..."));
if (!cc3000.begin())
{
Serial.println(F("Couldn't begin()! Check your wiring?"));
while(1);
}
Serial.print(F("\nAttempting to connect to ")); Serial.println(WLAN_SSID);
if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println(F("Failed!"));
while(1);
}
Serial.println(F("Connected!"));
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP())
{
delay(100); // ToDo: Insert a DHCP timeout!
}
/* Display the IP address DNS, Gateway, etc. */
while (! displayConnectionDetails()) {
delay(1000);
}
/*********************************************************/
/* You can safely remove this to save some flash memory! */
/*********************************************************/
Serial.println(F("\r\nNOTE: This sketch may cause problems with other sketches"));
Serial.println(F("since the .disconnect() function is never called, so the"));
Serial.println(F("AP may refuse connection requests from the CC3000 until a"));
Serial.println(F("timeout period passes. This is normal behaviour since"));
Serial.println(F("there isn't an obvious moment to disconnect with a server.\r\n"));
// Start listening for connections
echoServer.begin();
Serial.println(F("Listening for connections..."));
}
void loop(void)
{
// Try to get a client which is connected.
Adafruit_CC3000_ClientRef client = echoServer.available();
if (client) {
// Check if there is data available to read.
if (client.available() > 0) {
// Read a byte and write it to all clients.
uint8_t ch = client.read();
client.write(ch);
}
}
}
/**************************************************************************/
/*!
@brief Tries to read the IP address and other connection details
*/
/**************************************************************************/
bool displayConnectionDetails(void)
{
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
{
Serial.println(F("Unable to retrieve the IP Address!\r\n"));
return false;
}
else
{
Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
Serial.println();
return true;
}
}

View File

@ -0,0 +1,296 @@
/***************************************************
This is an example for the Adafruit CC3000 Wifi Breakout & Shield
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried, Kevin Townsend and Phil Burgess for
Adafruit Industries. BSD license, all text above must be included
in any redistribution
****************************************************/
/*
This example queries the freegeoip.net service to get the local
approximate geographic location based on IP address. Combined with
code in the InternetTime sketch, this can give absolute position and
time, extremely useful for seasonal calculations like sun position,
insolation, day length, etc. Sure, could always add a GPS module or
just plug in values from one's GPS or phone, but this has the dual
luxuries of coming 'free' with the existing WiFi hardware, and being
automatic (albeit a bit less accurate...but totally sufficient for
the applications mentioned).
Positional accuracy depends on the freegeoip.net database, in turn
based on data collected by maxmind.com. No guarantees this will work
for every location.
Position should be polled only once, at startup, or very infrequently
if making a mobile network-hopping thing, so as not to overwhelm the
kindly-provided free geolocation service.
*/
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <string.h>
#include "utility/debug.h"
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS,
ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIVIDER); // you can change this clock speed
#define WLAN_SSID "myNetwork" // cannot be longer than 32 characters!
#define WLAN_PASS "myPassword"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY WLAN_SEC_WPA2
Adafruit_CC3000_Client client;
const unsigned long
dhcpTimeout = 60L * 1000L, // Max time to wait for address from DHCP
connectTimeout = 15L * 1000L, // Max time to wait for server connection
responseTimeout = 15L * 1000L; // Max time to wait for data from server
// This program prints a few tidbits of information about the current location
// (Country, region (state), city, longitude and latitude). Additional info is
// available but just isn't recorded by this code -- can look at jsonParse()
// function to see how it's done and add what you need (or remove what you don't).
// The total list of available attributes includes: ip, country_code,
// country_name, region_code, region_name, city, zipcode, latitude, longitude,
// metro_code and areacode.
char
country[20],
region[20],
city[20],
name[13], // Temp space for name:value parsing
value[64]; // Temp space for name:value parsing
float
longitude, latitude;
void setup(void) {
uint32_t ip = 0L, t;
Serial.begin(115200);
Serial.println(F("Hello, CC3000!"));
Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC);
Serial.print(F("Initializing..."));
if(!cc3000.begin()) {
Serial.println(F("failed. Check your wiring?"));
return;
}
Serial.print(F("OK.\r\nConnecting to network..."));
if(!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println(F("Failed!"));
return;
}
Serial.println(F("connected!"));
Serial.print(F("Requesting address from DHCP server..."));
for(t=millis(); !cc3000.checkDHCP() && ((millis() - t) < dhcpTimeout); delay(1000));
if(cc3000.checkDHCP()) {
Serial.println(F("OK"));
} else {
Serial.println(F("failed"));
return;
}
while(!displayConnectionDetails()) delay(1000);
// Look up server's IP address
Serial.print(F("\r\nGetting server IP address..."));
t = millis();
while((0L == ip) && ((millis() - t) < connectTimeout)) {
if(cc3000.getHostByName("freegeoip.net", &ip)) break;
delay(1000);
}
if(0L == ip) {
Serial.println(F("failed"));
return;
}
cc3000.printIPdotsRev(ip);
Serial.println();
// Request JSON-formatted data from server (port 80)
Serial.print(F("Connecting to geo server..."));
client = cc3000.connectTCP(ip, 80);
if(client.connected()) {
Serial.print(F("connected.\r\nRequesting data..."));
client.print(F("GET /json/ HTTP/1.0\r\nConnection: close\r\n\r\n"));
} else {
Serial.println(F("failed"));
return;
}
Serial.print("\r\nReading response...");
country[0] = region[0] = city[0] = 0; // Clear data
jsonParse(0, 0);
client.close();
Serial.println(F("OK"));
/* You need to make sure to clean up after yourself or the CC3000 can freak out */
/* the next time your try to connect ... */
Serial.println(F("\nDisconnecting"));
cc3000.disconnect();
Serial.print(F("\r\nRESULTS:\r\n Country: "));
Serial.println(country);
Serial.print(F(" Region: "));
Serial.println(region);
Serial.print(F(" City: "));
Serial.println(city);
Serial.print(F(" Longitude: "));
Serial.println(longitude);
Serial.print(F(" Latitude: "));
Serial.println(latitude);
}
void loop(void) { } // Not used by this code
bool displayConnectionDetails(void) {
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv)) {
Serial.println(F("Unable to retrieve the IP Address!\r\n"));
return false;
} else {
Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
Serial.println();
return true;
}
}
// Helper functions swiped from Adafruit 'Gutenbird' code (with changes)
boolean jsonParse(int depth, byte endChar) {
int c, i;
boolean readName = true;
for(;;) {
while(isspace(c = timedRead())); // Scan past whitespace
if(c < 0) return false; // Timeout
if(c == endChar) return true; // EOD
if(c == '{') { // Object follows
if(!jsonParse(depth + 1, '}')) return false;
if(!depth) return true; // End of file
} else if(c == '[') { // Array follows
if(!jsonParse(depth + 1,']')) return false;
} else if((c == '"') || (c == '\'')) { // String follows
if(readName) { // Name-reading mode
if(!readString(name, sizeof(name)-1, c)) return false;
} else { // Value-reading mode
if(!readString(value, sizeof(value)-1, c)) return false;
// Process name and value strings:
if (!strcasecmp(name, "country_name")) {
strncpy(country, value, sizeof(country)-1);
} else if(!strcasecmp(name, "region_name")) {
strncpy(region, value, sizeof(region)-1);
} else if(!strcasecmp(name, "city")) {
strncpy(city, value, sizeof(city)-1);
}
}
} else if(c == ':') { // Separator between name:value
readName = false; // Now in value-reading mode
value[0] = 0; // Clear existing value data
} else if(c == ',') { // Separator between name/value pairs
readName = true; // Now in name-reading mode
name[0] = 0; // Clear existing name data
} else {
// Else true/false/null or a number follows.
value[0] = c;
if(!strcasecmp(name, "longitude")) {
if(!readString(value+1, sizeof(value)-1, ',')) return false;
longitude = atof(value);
} else if(!strcasecmp(name, "latitude")) {
if(!readString(value+1, sizeof(value)-1, ',')) return false;
latitude = atof(value);
}
readName = true; // Now in name-reading mode
name[0] = 0; // Clear existing name data
}
}
}
// Read string from client stream into destination buffer, up to a maximum
// requested length. Buffer should be at least 1 byte larger than this to
// accommodate NUL terminator. Opening quote is assumed already read,
// closing quote will be discarded, and stream will be positioned
// immediately following the closing quote (regardless whether max length
// is reached -- excess chars are discarded). Returns true on success
// (including zero-length string), false on timeout/read error.
boolean readString(char *dest, int maxLen, char quote) {
int c, len = 0;
while((c = timedRead()) != quote) { // Read until closing quote
if(c == '\\') { // Escaped char follows
c = timedRead(); // Read it
// Certain escaped values are for cursor control --
// there might be more suitable printer codes for each.
if (c == 'b') c = '\b'; // Backspace
else if(c == 'f') c = '\f'; // Form feed
else if(c == 'n') c = '\n'; // Newline
else if(c == 'r') c = '\r'; // Carriage return
else if(c == 't') c = '\t'; // Tab
else if(c == 'u') c = unidecode(4);
else if(c == 'U') c = unidecode(8);
// else c is unaltered -- an escaped char such as \ or "
} // else c is a normal unescaped char
if(c < 0) return false; // Timeout
// In order to properly position the client stream at the end of
// the string, characters are read to the end quote, even if the max
// string length is reached...the extra chars are simply discarded.
if(len < maxLen) dest[len++] = c;
}
dest[len] = 0;
return true; // Success (even if empty string)
}
// Read a given number of hexadecimal characters from client stream,
// representing a Unicode symbol. Return -1 on error, else return nearest
// equivalent glyph in printer's charset. (See notes below -- for now,
// always returns '-' or -1.)
int unidecode(byte len) {
int c, v, result = 0;
while(len--) {
if((c = timedRead()) < 0) return -1; // Stream timeout
if ((c >= '0') && (c <= '9')) v = c - '0';
else if((c >= 'A') && (c <= 'F')) v = 10 + c - 'A';
else if((c >= 'a') && (c <= 'f')) v = 10 + c - 'a';
else return '-'; // garbage
result = (result << 4) | v;
}
return '?';
}
// Read from client stream with a 5 second timeout. Although an
// essentially identical method already exists in the Stream() class,
// it's declared private there...so this is a local copy.
int timedRead(void) {
unsigned long start = millis();
while((!client.available()) && ((millis() - start) < 5000L));
return client.read(); // -1 on timeout
}

View File

@ -0,0 +1,278 @@
/***************************************************
This is an example for the Adafruit CC3000 Wifi Breakout & Shield
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried, Kevin Townsend and Phil Burgess for
Adafruit Industries. BSD license, all text above must be included
in any redistribution
****************************************************/
/*
This example queries an NTP time server to get the current "UNIX time"
(seconds since 1/1/1970, UTC (GMT)), then uses the Arduino's internal
timer to keep relative time. The clock is re-synchronized roughly
once per day. This minimizes NTP server misuse/abuse.
The RTClib library (a separate download, and not used here) contains
functions to convert UNIX time to other formats if needed.
*/
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIVIDER); // you can change this clock speed but DI
#define WLAN_SSID "myNetwork" // cannot be longer than 32 characters!
#define WLAN_PASS "myPassword"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY WLAN_SEC_WPA2
Adafruit_CC3000_Client client;
const unsigned long
connectTimeout = 15L * 1000L, // Max time to wait for server connection
responseTimeout = 15L * 1000L; // Max time to wait for data from server
int
countdown = 0; // loop() iterations until next time server query
unsigned long
lastPolledTime = 0L, // Last value retrieved from time server
sketchTime = 0L; // CPU milliseconds since last server query
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
displayDriverMode();
Serial.println(F("\nInitialising the CC3000 ..."));
if (!cc3000.begin()) {
Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
for(;;);
}
uint16_t firmware = checkFirmwareVersion();
if (firmware < 0x113) {
Serial.println(F("Wrong firmware version!"));
for(;;);
}
displayMACAddress();
Serial.println(F("\nDeleting old connection profiles"));
if (!cc3000.deleteProfiles()) {
Serial.println(F("Failed!"));
while(1);
}
/* Attempt to connect to an access point */
char *ssid = WLAN_SSID; /* Max 32 chars */
Serial.print(F("\nAttempting to connect to ")); Serial.println(ssid);
/* NOTE: Secure connections are not available in 'Tiny' mode! */
if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println(F("Failed!"));
while(1);
}
Serial.println(F("Connected!"));
/* Wait for DHCP to complete */
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP()) {
delay(100); // ToDo: Insert a DHCP timeout!
}
/* Display the IP address DNS, Gateway, etc. */
while (!displayConnectionDetails()) {
delay(1000);
}
}
// To reduce load on NTP servers, time is polled once per roughly 24 hour period.
// Otherwise use millis() to estimate time since last query. Plenty accurate.
void loop(void) {
if(countdown == 0) { // Time's up?
unsigned long t = getTime(); // Query time server
if(t) { // Success?
lastPolledTime = t; // Save time
sketchTime = millis(); // Save sketch time of last valid time query
countdown = 24*60*4-1; // Reset counter: 24 hours * 15-second intervals
}
} else {
countdown--; // Don't poll; use math to figure current time
}
unsigned long currentTime = lastPolledTime + (millis() - sketchTime) / 1000;
Serial.print(F("Current UNIX time: "));
Serial.print(currentTime);
Serial.println(F(" (seconds since 1/1/1970 UTC)"));
delay(15000L); // Pause 15 seconds
}
/**************************************************************************/
/*!
@brief Displays the driver mode (tiny of normal), and the buffer
size if tiny mode is not being used
@note The buffer size and driver mode are defined in cc3000_common.h
*/
/**************************************************************************/
void displayDriverMode(void)
{
#ifdef CC3000_TINY_DRIVER
Serial.println(F("CC3000 is configure in 'Tiny' mode"));
#else
Serial.print(F("RX Buffer : "));
Serial.print(CC3000_RX_BUFFER_SIZE);
Serial.println(F(" bytes"));
Serial.print(F("TX Buffer : "));
Serial.print(CC3000_TX_BUFFER_SIZE);
Serial.println(F(" bytes"));
#endif
}
/**************************************************************************/
/*!
@brief Tries to read the CC3000's internal firmware patch ID
*/
/**************************************************************************/
uint16_t checkFirmwareVersion(void)
{
uint8_t major, minor;
uint16_t version;
#ifndef CC3000_TINY_DRIVER
if(!cc3000.getFirmwareVersion(&major, &minor))
{
Serial.println(F("Unable to retrieve the firmware version!\r\n"));
version = 0;
}
else
{
Serial.print(F("Firmware V. : "));
Serial.print(major); Serial.print(F(".")); Serial.println(minor);
version = major; version <<= 8; version |= minor;
}
#endif
return version;
}
/**************************************************************************/
/*!
@brief Tries to read the 6-byte MAC address of the CC3000 module
*/
/**************************************************************************/
void displayMACAddress(void)
{
uint8_t macAddress[6];
if(!cc3000.getMacAddress(macAddress))
{
Serial.println(F("Unable to retrieve MAC Address!\r\n"));
}
else
{
Serial.print(F("MAC Address : "));
cc3000.printHex((byte*)&macAddress, 6);
}
}
/**************************************************************************/
/*!
@brief Tries to read the IP address and other connection details
*/
/**************************************************************************/
bool displayConnectionDetails(void)
{
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
{
Serial.println(F("Unable to retrieve the IP Address!\r\n"));
return false;
}
else
{
Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
Serial.println();
return true;
}
}
// Minimalist time server query; adapted from Adafruit Gutenbird sketch,
// which in turn has roots in Arduino UdpNTPClient tutorial.
unsigned long getTime(void) {
uint8_t buf[48];
unsigned long ip, startTime, t = 0L;
Serial.print(F("Locating time server..."));
// Hostname to IP lookup; use NTP pool (rotates through servers)
if(cc3000.getHostByName("pool.ntp.org", &ip)) {
static const char PROGMEM
timeReqA[] = { 227, 0, 6, 236 },
timeReqB[] = { 49, 78, 49, 52 };
Serial.println(F("\r\nAttempting connection..."));
startTime = millis();
do {
client = cc3000.connectUDP(ip, 123);
} while((!client.connected()) &&
((millis() - startTime) < connectTimeout));
if(client.connected()) {
Serial.print(F("connected!\r\nIssuing request..."));
// Assemble and issue request packet
memset(buf, 0, sizeof(buf));
memcpy_P( buf , timeReqA, sizeof(timeReqA));
memcpy_P(&buf[12], timeReqB, sizeof(timeReqB));
client.write(buf, sizeof(buf));
Serial.print(F("\r\nAwaiting response..."));
memset(buf, 0, sizeof(buf));
startTime = millis();
while((!client.available()) &&
((millis() - startTime) < responseTimeout));
if(client.available()) {
client.read(buf, sizeof(buf));
t = (((unsigned long)buf[40] << 24) |
((unsigned long)buf[41] << 16) |
((unsigned long)buf[42] << 8) |
(unsigned long)buf[43]) - 2208988800UL;
Serial.print(F("OK\r\n"));
}
client.close();
}
}
if(!t) Serial.println(F("error"));
return t;
}

View File

@ -0,0 +1,447 @@
/*
IMPORTANT: THIS SOFTWARE CURRENTLY DOES NOT WORK, and future
status is uncertain. Twitter has changed their API to require
SSL (Secure Sockets Layer) on -all- connections, a complex
operation beyond the Arduino's ability to handle. The code is
being kept around on the chance that a suitable proxy service
becomes available...but at present we have no such service, no
code for such, nor a schedule or even a firm commitment to
pursue it. For projects requiring Twitter we now recommend
using an SSL-capable system such as Raspberry Pi.
*/
/*
Send tweets wirelessly from Arduino using the new Twitter 1.1 API.
Self-contained, operates directly -- no proxy server required!
Designed for IoTA -- Internet of Things by Adafruit -- a series of Arduino-
compatible WiFi products based on the TI CC3000 module, to be available in
shield, breakout and standalone development board form-factors.
Written by Adafruit Industries, distributed under BSD License.
MUST BE CONFIGURED FOR TWITTER 1.1 API BEFORE USE. See notes below.
REQUIRES ARDUINO IDE 1.0 OR LATER -- Back-porting is not likely to occur,
as the code is deeply dependent on the Stream class, etc.
Requires Adafruit fork of Peter Knight's Cryptosuite library for Arduino:
https://github.com/adafruit/Cryptosuite
Required hardware includes an 802.11 wireless access point, any of the
Adafruit IoTa WiFi devices, a compatible Arduino board (for shield and
breakout form-factors) and, optionally, sensors to be read and reported
via Twitter.
Resources:
http://www.adafruit.com/products/1469 IoTa breakout board
http://www.adafruit.com/products/201 Arduino Uno
[ additional links will go here ]
Uses Twitter 1.1 API. This REQUIRES a Twitter account and some account
configuration. Start at dev.twitter.com, sign in with your Twitter
credentials, select "My Applications" from the avatar drop-down menu at the
top right, then "Create a new application." Provide a name, description,
placeholder URL and complete the captcha, after which you'll be provided a
"consumer key" and "consumer secret" for your app. Select "Create access
token" to also generate an "access token" and "access token secret."
ALL FOUR STRINGS must be copied to the correct positions in the globals below,
and configure the search string to your liking. DO NOT SHARE your keys or
secrets! If you put code on Github or other public repository, replace them
with dummy strings. Next, from the Twitter "Settings" tab, change the
Application Type to "Read and Write" -- MANDATORY or the sketch won't work!
Copyright (c) 2013 Adafruit Industries.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <sha1.h>
// --------------------------------------------------------------------------
// This is a relatively complex sketch, not recommended as a first
// introduction to IoTa. Try running some of the other, simpler sketches
// first before attempting to adapt this code. Additionally, some of the
// CC3000 helper and status functions have been pared back in this code.
// See other example sketches for more complete and verbose debugging info
// during your initial IoTa experiments.
// Configurable globals and defines. Edit to your needs. -------------------
// CC3000 interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
#define ADAFRUIT_CC3000_VBAT 5 // These can be
#define ADAFRUIT_CC3000_CS 10 // any two pins
// Hardware SPI required for remaining pins.
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(
ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIVIDER);
// WiFi access point credentials
#define WLAN_SSID "myNetwork" // 32 characters max
#define WLAN_PASS "myPassword"
#define WLAN_SECURITY WLAN_SEC_WPA2 // WLAN_SEC_UNSEC/WLAN_SEC_WEP/WLAN_SEC_WPA/WLAN_SEC_WPA2
const char PROGMEM
// Twitter application credentials -- see notes above -- DO NOT SHARE.
consumer_key[] = "PUT_YOUR_CONSUMER_KEY_HERE",
access_token[] = "PUT_YOUR_ACCESS_TOKEN_HERE",
signingKey[] = "PUT_YOUR_CONSUMER_SECRET_HERE" // Consumer secret
"&" "PUT_YOUR_ACCESS_TOKEN_SECRET_HERE", // Access token secret
// The ampersand is intentional -- do not delete!
// Other globals. You probably won't need to change these. ---------------
endpoint[] = "/1.1/statuses/update.json",
agent[] = "Arduino-Tweet-Test v1.0";
const char
host[] = "api.twitter.com";
const unsigned long
dhcpTimeout = 60L * 1000L, // Max time to wait for address from DHCP
connectTimeout = 15L * 1000L, // Max time to wait for server connection
responseTimeout = 15L * 1000L; // Max time to wait for data from server
unsigned long
currentTime = 0L;
Adafruit_CC3000_Client
client; // For WiFi connections
// Similar to F(), but for PROGMEM string pointers rather than literals
#define F2(progmem_ptr) (const __FlashStringHelper *)progmem_ptr
// --------------------------------------------------------------------------
void setup(void) {
uint32_t ip = 0L, t;
Serial.begin(115200);
Serial.print(F("Hello! Initializing CC3000..."));
if(!cc3000.begin()) hang(F("failed. Check your wiring?"));
uint16_t firmware = checkFirmwareVersion();
if ((firmware != 0x113) && (firmware != 0x118)) {
hang(F("Wrong firmware version!"));
}
Serial.print(F("OK\r\nDeleting old connection profiles..."));
if(!cc3000.deleteProfiles()) hang(F("failed."));
Serial.print(F("OK\r\nConnecting to network..."));
/* NOTE: Secure connections are not available in 'Tiny' mode! */
if(!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) hang(F("Failed!"));
Serial.print(F("OK\r\nRequesting address from DHCP server..."));
for(t=millis(); !cc3000.checkDHCP() && ((millis() - t) < dhcpTimeout); delay(100));
if(!cc3000.checkDHCP()) hang(F("failed"));
Serial.println(F("OK"));
while(!displayConnectionDetails());
// Get initial time from time server (make a few tries if needed)
for(uint8_t i=0; (i<5) && !(currentTime = getTime()); delay(5000L), i++);
// Initialize crypto library
Sha1.initHmac_P((uint8_t *)signingKey, sizeof(signingKey) - 1);
}
// On error, print PROGMEM string to serial monitor and stop
void hang(const __FlashStringHelper *str) {
Serial.println(str);
for(;;);
}
uint8_t countdown = 23; // Countdown to next time server query (once per ~24hr)
void loop() {
unsigned long t = millis();
// For now this just issues a fixed tweet. In reality, you might want to
// read from some sensors or that sort of thing, then nicely format the
// results into a buffer to be passed to the sendTweet() function.
sendTweet("Adafruit IoTa test. Tweet directly from Arduino...no proxy, no wires! http://www.adafruit.com/products/1469");
// Delay remainder of 1 hour (takes tweeting time into account)
Serial.println("Waiting ~1 hour...");
delay((60L * 60L * 1000L) - (millis() - t));
currentTime += 60L * 60L * 1000L;
if(!countdown) { // 24 hours elapsed?
if((t = getTime())) { // Synchronize time if server contacted
currentTime = t;
countdown = 23; // and reset counter
}
} else countdown--;
}
// Returns true on success, false on error
boolean sendTweet(char *msg) { // 140 chars max! No checks made here.
uint8_t *in, out, i;
char nonce[9], // 8 random digits + NUL
searchTime[11], // 32-bit int + NUL
b64[29];
unsigned long startTime, t, ip;
static const char PROGMEM b64chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
startTime = millis();
sprintf(nonce, "%04x%04x", random() ^ currentTime, startTime ^ currentTime);
sprintf(searchTime, "%ld", currentTime);
// A dirty hack makes the Oauth song and dance MUCH simpler within the
// Arduino's limited RAM and CPU. A proper general-purpose implementation
// would be expected to URL-encode keys and values (from the complete list
// of POST parameters and authentication values), sort by encoded key,
// concatenate and URL-encode the combined result. Sorting is avoided
// because every POST this program performs has exactly the same set of
// parameters, so we've pre-sorted the list as it appears here. Keys
// (and many values) are pre-encoded because they never change; many are
// passed through verbatim because the format is known to not require
// encoding. Most reside in PROGMEM, not RAM. This is bending a LOT of
// rules of Good and Proper Authentication and would land you an 'F' in
// Comp Sci class, but it handles the required task and is VERY compact.
Sha1.print(F("POST&http%3A%2F%2F"));
Sha1.print(host);
urlEncode(Sha1, endpoint, true, false);
Sha1.print(F("&oauth_consumer_key%3D"));
Sha1.print(F2(consumer_key));
Sha1.print(F("%26oauth_nonce%3D"));
Sha1.print(nonce);
Sha1.print(F("%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D"));
Sha1.print(searchTime);
Sha1.print(F("%26oauth_token%3D"));
Sha1.print(F2(access_token));
Sha1.print(F("%26oauth_version%3D1.0%26status%3D"));
urlEncode(Sha1, msg, false, true);
// base64-encode SHA-1 hash output. This is NOT a general-purpose base64
// encoder! It's stripped down for the fixed-length hash -- always 20
// bytes input, always 27 chars output + '='.
for(in = Sha1.resultHmac(), out=0; ; in += 3) { // octets to sextets
b64[out++] = in[0] >> 2;
b64[out++] = ((in[0] & 0x03) << 4) | (in[1] >> 4);
if(out >= 26) break;
b64[out++] = ((in[1] & 0x0f) << 2) | (in[2] >> 6);
b64[out++] = in[2] & 0x3f;
}
b64[out] = (in[1] & 0x0f) << 2;
// Remap sextets to base64 ASCII chars
for(i=0; i<=out; i++) b64[i] = pgm_read_byte(&b64chars[b64[i]]);
b64[i++] = '=';
b64[i++] = 0;
// Hostname lookup
Serial.print(F("Locating Twitter server..."));
cc3000.getHostByName((char *)host, &ip);
// Connect to numeric IP
Serial.print(F("OK\r\nConnecting to server..."));
t = millis();
do {
client = cc3000.connectTCP(ip, 80);
} while((!client.connected()) &&
((millis() - t) < connectTimeout));
if(client.connected()) { // Success!
Serial.print(F("OK\r\nIssuing HTTP request..."));
// Unlike the hash prep, parameters in the HTTP request don't require sorting.
client.fastrprint(F("POST "));
client.fastrprint(F2(endpoint));
client.fastrprint(F(" HTTP/1.1\r\nHost: "));
client.fastrprint(host);
client.fastrprint(F("\r\nUser-Agent: "));
client.fastrprint(F2(agent));
client.fastrprint(F("\r\nConnection: close\r\n"
"Content-Type: application/x-www-form-urlencoded;charset=UTF-8\r\n"
"Content-Length: "));
client.print(7 + encodedLength(msg));
client.fastrprint(F("\r\nAuthorization: Oauth oauth_consumer_key=\""));
client.fastrprint(F2(consumer_key));
client.fastrprint(F("\", oauth_nonce=\""));
client.fastrprint(nonce);
client.fastrprint(F("\", oauth_signature=\""));
urlEncode(client, b64, false, false);
client.fastrprint(F("\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\""));
client.fastrprint(searchTime);
client.fastrprint(F("\", oauth_token=\""));
client.fastrprint(F2(access_token));
client.fastrprint(F("\", oauth_version=\"1.0\"\r\n\r\nstatus="));
urlEncode(client, msg, false, false);
Serial.print(F("OK\r\nAwaiting response..."));
int c = 0;
// Dirty trick: instead of parsing results, just look for opening
// curly brace indicating the start of a successful JSON response.
while(((c = timedRead()) > 0) && (c != '{'));
if(c == '{') Serial.println(F("success!"));
else if(c < 0) Serial.println(F("timeout"));
else Serial.println(F("error (invalid Twitter credentials?)"));
client.close();
return (c == '{');
} else { // Couldn't contact server
Serial.println(F("failed"));
return false;
}
}
// Helper functions. --------------------------------------------------------
uint16_t checkFirmwareVersion(void) {
uint8_t major, minor;
uint16_t version = 0;
#ifndef CC3000_TINY_DRIVER
if(!cc3000.getFirmwareVersion(&major, &minor)) {
Serial.println(F("Unable to retrieve the firmware version!\r\n"));
} else {
Serial.print(F("Firmware V. : "));
Serial.print(major); Serial.print(F(".")); Serial.println(minor);
version = ((uint16_t)major << 8) | minor;
}
#endif
return version;
}
bool displayConnectionDetails(void) {
uint32_t addr, netmask, gateway, dhcpserv, dnsserv;
if(!cc3000.getIPAddress(&addr, &netmask, &gateway, &dhcpserv, &dnsserv))
return false;
Serial.print(F("IP Addr: ")); cc3000.printIPdotsRev(addr);
Serial.print(F("\r\nNetmask: ")); cc3000.printIPdotsRev(netmask);
Serial.print(F("\r\nGateway: ")); cc3000.printIPdotsRev(gateway);
Serial.print(F("\r\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
Serial.print(F("\r\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
Serial.println();
return true;
}
// Read from client stream with a 5 second timeout. Although an
// essentially identical method already exists in the Stream() class,
// it's declared private there...so this is a local copy.
int timedRead(void) {
unsigned long start = millis();
while((!client.available()) && ((millis() - start) < responseTimeout));
return client.read(); // -1 on timeout
}
// For URL-encoding functions below
static const char PROGMEM hexChar[] = "0123456789ABCDEF";
// URL-encoding output function for Print class.
// Input from RAM or PROGMEM (flash). Double-encoding is a weird special
// case for Oauth (encoded strings get encoded a second time).
void urlEncode(
Print &p, // EthernetClient, Sha1, etc.
const char *src, // String to be encoded
boolean progmem, // If true, string is in PROGMEM (else RAM)
boolean x2) // If true, "double encode" parenthesis
{
uint8_t c;
while((c = (progmem ? pgm_read_byte(src) : *src))) {
if(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) ||
((c >= '0') && (c <= '9')) || strchr_P(PSTR("-_.~"), c)) {
p.write(c);
} else {
if(x2) p.print("%25");
else p.write('%');
p.write(pgm_read_byte(&hexChar[c >> 4]));
p.write(pgm_read_byte(&hexChar[c & 15]));
}
src++;
}
}
// Returns would-be length of encoded string, without actually encoding
int encodedLength(char *src) {
uint8_t c;
int len = 0;
while((c = *src++)) {
len += (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) ||
((c >= '0') && (c <= '9')) || strchr_P(PSTR("-_.~"), c)) ? 1 : 3;
}
return len;
}
// Minimalist time server query; adapted from Adafruit Gutenbird sketch,
// which in turn has roots in Arduino UdpNTPClient tutorial.
unsigned long getTime(void) {
uint8_t buf[48];
unsigned long ip, startTime, t = 0L;
Serial.print(F("Locating time server..."));
// Hostname to IP lookup; use NTP pool (rotates through servers)
if(cc3000.getHostByName("pool.ntp.org", &ip)) {
static const char PROGMEM
timeReqA[] = { 227, 0, 6, 236 },
timeReqB[] = { 49, 78, 49, 52 };
Serial.println(F("found\r\nConnecting to time server..."));
startTime = millis();
do {
client = cc3000.connectUDP(ip, 123);
} while((!client.connected()) &&
((millis() - startTime) < connectTimeout));
if(client.connected()) {
Serial.print(F("connected!\r\nIssuing request..."));
// Assemble and issue request packet
memset(buf, 0, sizeof(buf));
memcpy_P( buf , timeReqA, sizeof(timeReqA));
memcpy_P(&buf[12], timeReqB, sizeof(timeReqB));
client.write(buf, sizeof(buf));
Serial.print(F("OK\r\nAwaiting response..."));
memset(buf, 0, sizeof(buf));
startTime = millis();
while((!client.available()) &&
((millis() - startTime) < responseTimeout));
if(client.available()) {
client.read(buf, sizeof(buf));
t = (((unsigned long)buf[40] << 24) |
((unsigned long)buf[41] << 16) |
((unsigned long)buf[42] << 8) |
(unsigned long)buf[43]) - 2208988800UL;
Serial.println(F("success!"));
}
client.close();
}
}
if(!t) Serial.println(F("error"));
return t;
}

View File

@ -0,0 +1,225 @@
/***************************************************
This is an example for the Adafruit CC3000 Wifi Breakout & Shield
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried & Kevin Townsend for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
/* This sketch will attempt to establish an AP connection
using the SmartConfig tool, and save the connection
details for later use (with SmartConfigReconnect, etc.).
If a connection is successfully established, the data
will be stored as a connection profile in non-volatile
memory on the CC3000, and the device will be configured
to automatically connect to this profile on startup.
To see how to safely use the CC3000 without erasing
this SmartConfig data please consult the
SmartConfigReconnect sketch, which uses an optional flag
in Adafruit_CC3000.begin() to avoid erasing the
connection profiles from memory, as well as a new
.reconnect function.
Using other non SmartConfig example sketches will
erase the connection profile data on startup, but
this sketch combined with SmartConfigReconnect hopefully
illustrate how to use SmartConfig when hard-coded
connection details aren't appropriate.
SmartConfig is still beta and kind of works but is not fully
vetted! It might not work on all networks!
*/
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <string.h>
#include "utility/debug.h"
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
#define DEVICE_NAME "CC3000"
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS,
ADAFRUIT_CC3000_IRQ,
ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIVIDER);
// The SSID & Password are retrieved via the Smartconfig app
/**************************************************************************/
/*!
@brief Sets up the HW and the CC3000 module (called automatically
on startup)
*/
/**************************************************************************/
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
displayDriverMode();
Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC);
/* Initialise the module, deleting any existing profile data (which */
/* is the default behaviour) */
Serial.println(F("\nInitialising the CC3000 ..."));
if (!cc3000.begin(false))
{
Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
while(1);
}
uint16_t firmware = checkFirmwareVersion();
if ((firmware != 0x113) && (firmware != 0x118)) {
Serial.println(F("Wrong firmware version!"));
for(;;);
}
displayMACAddress();
/* Try to use the smart config app (no AES encryption), saving */
/* the connection details if we succeed */
Serial.println(F("Waiting for a SmartConfig connection (~60s) ..."));
if (!cc3000.startSmartConfig(DEVICE_NAME))
{
Serial.println(F("SmartConfig failed"));
while(1);
}
Serial.println(F("Saved connection details and connected to AP!"));
/* Wait for DHCP to complete */
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP())
{
delay(100); // ToDo: Insert a DHCP timeout!
}
/* Display the IP address DNS, Gateway, etc. */
while (! displayConnectionDetails()) {
delay(1000);
}
Serial.println(F("\nTo use these connection details be sure to use"));
Serial.println(F("'.begin(false, true, DEVICE_NAME)' with your Adafruit_CC3000"));
Serial.println(F("code instead of the default '.begin()' values!"));
/* You need to make sure to clean up after yourself or the CC3000 can freak out */
/* the next time your try to connect ... */
Serial.println(F("\nClosing the connection"));
cc3000.disconnect();
}
void loop(void)
{
delay(1000);
}
/**************************************************************************/
/*!
@brief Displays the driver mode (tiny of normal), and the buffer
size if tiny mode is not being used
@note The buffer size and driver mode are defined in cc3000_common.h
*/
/**************************************************************************/
void displayDriverMode(void)
{
#ifdef CC3000_TINY_DRIVER
Serial.println(F("CC3000 is configure in 'Tiny' mode"));
#else
Serial.print(F("RX Buffer : "));
Serial.print(CC3000_RX_BUFFER_SIZE);
Serial.println(F(" bytes"));
Serial.print(F("TX Buffer : "));
Serial.print(CC3000_TX_BUFFER_SIZE);
Serial.println(F(" bytes"));
#endif
}
/**************************************************************************/
/*!
@brief Tries to read the CC3000's internal firmware patch ID
*/
/**************************************************************************/
uint16_t checkFirmwareVersion(void)
{
uint8_t major, minor;
uint16_t version;
#ifndef CC3000_TINY_DRIVER
if(!cc3000.getFirmwareVersion(&major, &minor))
{
Serial.println(F("Unable to retrieve the firmware version!\r\n"));
version = 0;
}
else
{
Serial.print(F("Firmware V. : "));
Serial.print(major); Serial.print(F(".")); Serial.println(minor);
version = major; version <<= 8; version |= minor;
}
#endif
return version;
}
/**************************************************************************/
/*!
@brief Tries to read the 6-byte MAC address of the CC3000 module
*/
/**************************************************************************/
void displayMACAddress(void)
{
uint8_t macAddress[6];
if(!cc3000.getMacAddress(macAddress))
{
Serial.println(F("Unable to retrieve MAC Address!\r\n"));
}
else
{
Serial.print(F("MAC Address : "));
cc3000.printHex((byte*)&macAddress, 6);
}
}
/**************************************************************************/
/*!
@brief Tries to read the IP address and other connection details
*/
/**************************************************************************/
bool displayConnectionDetails(void)
{
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
{
Serial.println(F("Unable to retrieve the IP Address!\r\n"));
return false;
}
else
{
Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
Serial.println();
return true;
}
}

View File

@ -0,0 +1,146 @@
/***************************************************
This is an example for the Adafruit CC3000 Wifi Breakout & Shield
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried & Kevin Townsend for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
/* This sketch attempts to re-connect to an AP using
data from a previous SmartConfig session (i.e. from
the SmartConfigCreate sketch!).
It will attempt to do the following:
* Initialization the CC3000
* Re-connect using previous SmartConfig data (see SmartConfigCreate)
* DHCP printout
* Disconnect
If the connection fails, there are two likely
explanations:
1.) You haven't run the SmartConfigCreate sketch and
successfully connected to a network, since this
is the process that 'saves' the AP details to the
device
2.) You've used one of the other non SmartConfig
sketches, which erase all stored profiles from
the CC3000 memory in order to manually establish
a connection using hard coded values. (This sketch
uses an optional flag in the Adafruit_CC3000.begin
function to avoid this erasure process!).
SmartConfig is still beta and kind of works but is not fully
vetted! It might not work on all networks!
*/
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <string.h>
#include "utility/debug.h"
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
#define DEVICE_NAME "CC3000"
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS,
ADAFRUIT_CC3000_IRQ,
ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIVIDER);
// We get the SSID & Password from memory thanks to SmartConfigCreate!
/**************************************************************************/
/*!
@brief Sets up the HW and the CC3000 module (called automatically
on startup)
*/
/**************************************************************************/
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
/* Try to reconnect using the details from SmartConfig */
/* This basically just resets the CC3000, and the auto connect */
/* tries to do it's magic if connections details are found */
Serial.println(F("Trying to reconnect using SmartConfig values ..."));
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
/* !!! Note the additional arguments in .begin that tell the !!! */
/* !!! app NOT to deleted previously stored connection details !!! */
/* !!! and reconnected using the connection details in memory! !!! */
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
if (!cc3000.begin(false, true, DEVICE_NAME))
{
Serial.println(F("Unable to re-connect!? Did you run the SmartConfigCreate"));
Serial.println(F("sketch to store your connection details?"));
while(1);
}
/* Round of applause! */
Serial.println(F("Reconnected!"));
/* Wait for DHCP to complete */
Serial.println(F("\nRequesting DHCP"));
while (!cc3000.checkDHCP()) {
delay(100); // ToDo: Insert a DHCP timeout!
}
/* Display the IP address DNS, Gateway, etc. */
while (! displayConnectionDetails()) {
delay(1000);
}
/* This is where you'd do your own thing! */
/* You need to make sure to clean up after yourself or the CC3000 can freak out */
/* the next time your try to connect ... */
Serial.println(F("\nClosing the connection"));
cc3000.disconnect();
}
void loop(void)
{
delay(1000);
}
/**************************************************************************/
/*!
@brief Tries to read the IP address and other connection details
*/
/**************************************************************************/
bool displayConnectionDetails(void)
{
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
{
Serial.println(F("Unable to retrieve the IP Address!\r\n"));
return false;
}
else
{
Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
Serial.println();
return true;
}
}

View File

@ -0,0 +1,224 @@
/***************************************************
This is an example for the Adafruit CC3000 Wifi Breakout & Shield
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried & Kevin Townsend for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
/*
This example does a test of the TCP client capability:
* Initialization
* Optional: SSID scan
* AP connection
* DHCP printout
* DNS lookup
* Optional: Ping
* Connect to website and print out webpage contents
* Disconnect
SmartConfig is still beta and kind of works but is not fully vetted!
It might not work on all networks!
*/
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <string.h>
#include "utility/debug.h"
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIVIDER); // you can change this clock speed
#define WLAN_SSID "myNetwork" // cannot be longer than 32 characters!
#define WLAN_PASS "myPassword"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY WLAN_SEC_WPA2
#define IDLE_TIMEOUT_MS 3000 // Amount of time to wait (in milliseconds) with no data
// received before closing the connection. If you know the server
// you're accessing is quick to respond, you can reduce this value.
// What page to grab!
#define WEBSITE "www.adafruit.com"
#define WEBPAGE "/testwifi/index.html"
/**************************************************************************/
/*!
@brief Sets up the HW and the CC3000 module (called automatically
on startup)
*/
/**************************************************************************/
uint32_t ip;
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC);
/* Initialise the module */
Serial.println(F("\nInitializing..."));
if (!cc3000.begin())
{
Serial.println(F("Couldn't begin()! Check your wiring?"));
while(1);
}
// Optional SSID scan
// listSSIDResults();
Serial.print(F("\nAttempting to connect to ")); Serial.println(WLAN_SSID);
if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println(F("Failed!"));
while(1);
}
Serial.println(F("Connected!"));
/* Wait for DHCP to complete */
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP())
{
delay(100); // ToDo: Insert a DHCP timeout!
}
/* Display the IP address DNS, Gateway, etc. */
while (! displayConnectionDetails()) {
delay(1000);
}
ip = 0;
// Try looking up the website's IP address
Serial.print(WEBSITE); Serial.print(F(" -> "));
while (ip == 0) {
if (! cc3000.getHostByName(WEBSITE, &ip)) {
Serial.println(F("Couldn't resolve!"));
}
delay(500);
}
cc3000.printIPdotsRev(ip);
// Optional: Do a ping test on the website
/*
Serial.print(F("\n\rPinging ")); cc3000.printIPdotsRev(ip); Serial.print("...");
replies = cc3000.ping(ip, 5);
Serial.print(replies); Serial.println(F(" replies"));
*/
/* Try connecting to the website.
Note: HTTP/1.1 protocol is used to keep the server from closing the connection before all data is read.
*/
Adafruit_CC3000_Client www = cc3000.connectTCP(ip, 80);
if (www.connected()) {
www.fastrprint(F("GET "));
www.fastrprint(WEBPAGE);
www.fastrprint(F(" HTTP/1.1\r\n"));
www.fastrprint(F("Host: ")); www.fastrprint(WEBSITE); www.fastrprint(F("\r\n"));
www.fastrprint(F("\r\n"));
www.println();
} else {
Serial.println(F("Connection failed"));
return;
}
Serial.println(F("-------------------------------------"));
/* Read data until either the connection is closed, or the idle timeout is reached. */
unsigned long lastRead = millis();
while (www.connected() && (millis() - lastRead < IDLE_TIMEOUT_MS)) {
while (www.available()) {
char c = www.read();
Serial.print(c);
lastRead = millis();
}
}
www.close();
Serial.println(F("-------------------------------------"));
/* You need to make sure to clean up after yourself or the CC3000 can freak out */
/* the next time your try to connect ... */
Serial.println(F("\n\nDisconnecting"));
cc3000.disconnect();
}
void loop(void)
{
delay(1000);
}
/**************************************************************************/
/*!
@brief Begins an SSID scan and prints out all the visible networks
*/
/**************************************************************************/
void listSSIDResults(void)
{
uint8_t valid, rssi, sec, index;
char ssidname[33];
index = cc3000.startSSIDscan();
Serial.print(F("Networks found: ")); Serial.println(index);
Serial.println(F("================================================"));
while (index) {
index--;
valid = cc3000.getNextSSID(&rssi, &sec, ssidname);
Serial.print(F("SSID Name : ")); Serial.print(ssidname);
Serial.println();
Serial.print(F("RSSI : "));
Serial.println(rssi);
Serial.print(F("Security Mode: "));
Serial.println(sec);
Serial.println();
}
Serial.println(F("================================================"));
cc3000.stopSSIDscan();
}
/**************************************************************************/
/*!
@brief Tries to read the IP address and other connection details
*/
/**************************************************************************/
bool displayConnectionDetails(void)
{
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
{
Serial.println(F("Unable to retrieve the IP Address!\r\n"));
return false;
}
else
{
Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
Serial.println();
return true;
}
}

View File

@ -0,0 +1,320 @@
/***************************************************
This is an example for the Adafruit CC3000 Wifi Breakout & Shield
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Kevin Townsend & Limor Fried for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
/*
This example does a full test of core connectivity:
* Initialization
* SSID Scan
* AP connection
* DHCP printout
* DNS lookup
* Ping
* Disconnect
It's a good idea to run this sketch when first setting up the
module.
*/
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <string.h>
#include "utility/debug.h"
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIVIDER); // you can change this clock speed but DI
#define WLAN_SSID "myNetwork" // cannot be longer than 32 characters!
#define WLAN_PASS "myPassword"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY WLAN_SEC_WPA2
/**************************************************************************/
/*!
@brief Sets up the HW and the CC3000 module (called automatically
on startup)
*/
/**************************************************************************/
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
displayDriverMode();
Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC);
/* Initialise the module */
Serial.println(F("\nInitialising the CC3000 ..."));
if (!cc3000.begin())
{
Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
while(1);
}
/* Optional: Update the Mac Address to a known value */
/*
uint8_t macAddress[6] = { 0x08, 0x00, 0x28, 0x01, 0x79, 0xB7 };
if (!cc3000.setMacAddress(macAddress))
{
Serial.println(F("Failed trying to update the MAC address"));
while(1);
}
*/
uint16_t firmware = checkFirmwareVersion();
if (firmware < 0x113) {
Serial.println(F("Wrong firmware version!"));
for(;;);
}
displayMACAddress();
/* Optional: Get the SSID list (not available in 'tiny' mode) */
#ifndef CC3000_TINY_DRIVER
listSSIDResults();
#endif
/* Delete any old connection data on the module */
Serial.println(F("\nDeleting old connection profiles"));
if (!cc3000.deleteProfiles()) {
Serial.println(F("Failed!"));
while(1);
}
/* Optional: Set a static IP address instead of using DHCP.
Note that the setStaticIPAddress function will save its state
in the CC3000's internal non-volatile memory and the details
will be used the next time the CC3000 connects to a network.
This means you only need to call the function once and the
CC3000 will remember the connection details. To switch back
to using DHCP, call the setDHCP() function (again only needs
to be called once).
*/
/*
uint32_t ipAddress = cc3000.IP2U32(192, 168, 1, 19);
uint32_t netMask = cc3000.IP2U32(255, 255, 255, 0);
uint32_t defaultGateway = cc3000.IP2U32(192, 168, 1, 1);
uint32_t dns = cc3000.IP2U32(8, 8, 4, 4);
if (!cc3000.setStaticIPAddress(ipAddress, netMask, defaultGateway, dns)) {
Serial.println(F("Failed to set static IP!"));
while(1);
}
*/
/* Optional: Revert back from static IP addres to use DHCP.
See note for setStaticIPAddress above, this only needs to be
called once and will be remembered afterwards by the CC3000.
*/
/*
if (!cc3000.setDHCP()) {
Serial.println(F("Failed to set DHCP!"));
while(1);
}
*/
/* Attempt to connect to an access point */
char *ssid = WLAN_SSID; /* Max 32 chars */
Serial.print(F("\nAttempting to connect to ")); Serial.println(ssid);
/* NOTE: Secure connections are not available in 'Tiny' mode!
By default connectToAP will retry indefinitely, however you can pass an
optional maximum number of retries (greater than zero) as the fourth parameter.
*/
if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println(F("Failed!"));
while(1);
}
Serial.println(F("Connected!"));
/* Wait for DHCP to complete */
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP())
{
delay(100); // ToDo: Insert a DHCP timeout!
}
/* Display the IP address DNS, Gateway, etc. */
while (! displayConnectionDetails()) {
delay(1000);
}
#ifndef CC3000_TINY_DRIVER
/* Try looking up www.adafruit.com */
uint32_t ip = 0;
Serial.print(F("www.adafruit.com -> "));
while (ip == 0) {
if (! cc3000.getHostByName("www.adafruit.com", &ip)) {
Serial.println(F("Couldn't resolve!"));
}
delay(500);
}
cc3000.printIPdotsRev(ip);
/* Do a quick ping test on adafruit.com */
Serial.print(F("\n\rPinging ")); cc3000.printIPdotsRev(ip); Serial.print("...");
uint8_t replies = cc3000.ping(ip, 5);
Serial.print(replies); Serial.println(F(" replies"));
if (replies)
Serial.println(F("Ping successful!"));
#endif
/* You need to make sure to clean up after yourself or the CC3000 can freak out */
/* the next time you try to connect ... */
Serial.println(F("\n\nClosing the connection"));
cc3000.disconnect();
}
void loop(void)
{
delay(1000);
}
/**************************************************************************/
/*!
@brief Displays the driver mode (tiny of normal), and the buffer
size if tiny mode is not being used
@note The buffer size and driver mode are defined in cc3000_common.h
*/
/**************************************************************************/
void displayDriverMode(void)
{
#ifdef CC3000_TINY_DRIVER
Serial.println(F("CC3000 is configure in 'Tiny' mode"));
#else
Serial.print(F("RX Buffer : "));
Serial.print(CC3000_RX_BUFFER_SIZE);
Serial.println(F(" bytes"));
Serial.print(F("TX Buffer : "));
Serial.print(CC3000_TX_BUFFER_SIZE);
Serial.println(F(" bytes"));
#endif
}
/**************************************************************************/
/*!
@brief Tries to read the CC3000's internal firmware patch ID
*/
/**************************************************************************/
uint16_t checkFirmwareVersion(void)
{
uint8_t major, minor;
uint16_t version;
#ifndef CC3000_TINY_DRIVER
if(!cc3000.getFirmwareVersion(&major, &minor))
{
Serial.println(F("Unable to retrieve the firmware version!\r\n"));
version = 0;
}
else
{
Serial.print(F("Firmware V. : "));
Serial.print(major); Serial.print(F(".")); Serial.println(minor);
version = major; version <<= 8; version |= minor;
}
#endif
return version;
}
/**************************************************************************/
/*!
@brief Tries to read the 6-byte MAC address of the CC3000 module
*/
/**************************************************************************/
void displayMACAddress(void)
{
uint8_t macAddress[6];
if(!cc3000.getMacAddress(macAddress))
{
Serial.println(F("Unable to retrieve MAC Address!\r\n"));
}
else
{
Serial.print(F("MAC Address : "));
cc3000.printHex((byte*)&macAddress, 6);
}
}
/**************************************************************************/
/*!
@brief Tries to read the IP address and other connection details
*/
/**************************************************************************/
bool displayConnectionDetails(void)
{
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
{
Serial.println(F("Unable to retrieve the IP Address!\r\n"));
return false;
}
else
{
Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
Serial.println();
return true;
}
}
/**************************************************************************/
/*!
@brief Begins an SSID scan and prints out all the visible networks
*/
/**************************************************************************/
void listSSIDResults(void)
{
uint8_t valid, rssi, sec, index;
char ssidname[33];
index = cc3000.startSSIDscan();
Serial.print(F("Networks found: ")); Serial.println(index);
Serial.println(F("================================================"));
while (index) {
index--;
valid = cc3000.getNextSSID(&rssi, &sec, ssidname);
Serial.print(F("SSID Name : ")); Serial.print(ssidname);
Serial.println();
Serial.print(F("RSSI : "));
Serial.println(rssi);
Serial.print(F("Security Mode: "));
Serial.println(sec);
Serial.println();
}
Serial.println(F("================================================"));
cc3000.stopSSIDscan();
}

View File

@ -0,0 +1,347 @@
// This driver patcher will take 1.11.1 firmware modules up to 1.12
// It seems to work, but it is 100% not guaranteed! Based on the TI driver patch
// code for MSP430 - ladyada
// If you fail halfway thru update, you may have to restart and you may have lost
// the MAC address in EEPROM so before you begin, write down your mac address!
// You can re-burn the mac address in the buildtest example
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <string.h>
#include <EEPROM.h>
#include "utility/debug.h"
#include "utility/nvmem.h"
#include "driverpatchinc.h"
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
#define ADAFRUIT_CC3000_CS 10
#define ADAFRUIT_CC3000_VBAT 5
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT);
/**************************************************************************/
/*!
@brief Displays the driver mode (tiny of normal), and the buffer
size if tiny mode is not being used
@note The buffer size and driver mode are defined in cc3000_common.h
*/
/**************************************************************************/
void displayDriverMode(void)
{
#ifdef CC3000_TINY_DRIVER
Serial.println(F("CC3000 is configure in 'Tiny' mode"));
#else
Serial.print(F("RX Buffer : "));
Serial.print(CC3000_RX_BUFFER_SIZE);
Serial.println(F(" bytes"));
Serial.print(F("TX Buffer : "));
Serial.print(CC3000_TX_BUFFER_SIZE);
Serial.println(F(" bytes"));
#endif
}
/**************************************************************************/
/*!
@brief Tries to read the CC3000's internal firmware patch ID
*/
/**************************************************************************/
void displayFirmwareVersion(void)
{
#ifndef CC3000_TINY_DRIVER
uint8_t major, minor;
if(!cc3000.getFirmwareVersion(&major, &minor))
{
Serial.println(F("Unable to retrieve the firmware version!\r\n"));
}
else
{
Serial.print(F("Firmware V. : "));
Serial.print(major); Serial.print(F(".")); Serial.println(minor);
}
#endif
}
/**************************************************************************/
/*!
@brief Tries to read the 6-byte MAC address of the CC3000 module
*/
/**************************************************************************/
boolean MACvalid = false;
// array to store MAC address from EEPROM
uint8_t cMacFromEeprom[MAC_ADDR_LEN];
void displayMACAddress(void)
{
if(!cc3000.getMacAddress(cMacFromEeprom))
{
Serial.println(F("Unable to retrieve MAC Address!\r\n"));
MACvalid = false;
}
else
{
Serial.print(F("MAC Address : "));
cc3000.printHex((byte*)&cMacFromEeprom, 6);
MACvalid = true;
}
}
/**************************************************************************/
/*!
@brief Sets up the HW and the CC3000 module (called automatically
on startup)
*/
/**************************************************************************/
uint8_t ucStatus_Dr, return_status = 0xFF;
uint8_t counter = 0;
// array to store RM parameters from EEPROM
unsigned char cRMParamsFromEeprom[128];
// 2 dim array to store address and length of new FAT
uint16_t aFATEntries[2][NVMEM_RM_FILEID + 1] =
/* address */ {{0x50, 0x1f0, 0x1390, 0x0390, 0x2390, 0x4390, 0x6390, 0x63a0, 0x63b0, 0x63f0, 0x6430, 0x6830},
/* length */ {0x1a0, 0x1a0, 0x1000, 0x1000, 0x2000, 0x2000, 0x10, 0x10, 0x40, 0x40, 0x400, 0x200 }};
/* 0. NVS */
/* 1. NVS Shadow */
/* 2. Wireless Conf */
/* 3. Wireless Conf Shadow */
/* 4. BT (WLAN driver) Patches */
/* 5. WiLink (Firmware) Patches */
/* 6. MAC addr */
/* 7. Frontend Vars */
/* 8. IP config */
/* 9. IP config Shadow */
/* 10. Bootloader Patches */
/* 11. Radio Module params */
/* 12. AES128 for smart config */
/* 13. user file */
/* 14. user file */
/* 15. user file */
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
Serial.println(F("Hit any key & return to start"));
while (!Serial.available());
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(6, LOW);
displayDriverMode();
displayFreeRam();
/* Initialise the module */
Serial.println(F("\nInitialising the CC3000 ..."));
if (!cc3000.begin(2)) // init with NO patches!
{
Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
while(1);
}
//displayFirmwareVersion();
displayMACAddress();
return_status = 1;
uint8_t index;
uint8_t *pRMParams;
while ((return_status) && (counter < 3)) {
// read RM parameters
// read in 16 parts to work with tiny driver
return_status = 0;
pRMParams = cRMParamsFromEeprom;
for (index = 0; index < 16; index++) {
return_status |= nvmem_read(NVMEM_RM_FILEID, 8, 8*index, pRMParams);
Serial.print(F("\n\rRead NVRAM $")); Serial.print(8*index); Serial.print("\t");
for(uint8_t x=0; x<8; x++) {
Serial.print("0x"); Serial.print(pRMParams[x], HEX); Serial.print(", ");
}
pRMParams += 8;
}
counter++;
}
// if RM file is not valid, load the default one
if (counter == 3) {
Serial.println(F("\n\rLoad default params"));
pRMParams = (uint8_t *)cRMdefaultParams;
} else {
Serial.println(F("\n\rLoad EEPROM params"));
pRMParams = cRMParamsFromEeprom;
if (EEPROM.read(0) == 0xFF) {
for (uint8_t e=0; e<128; e++) {
EEPROM.write(e, cRMParamsFromEeprom[e]);
}
Serial.println(F("Backed up to eeprom!"));
}
}
return_status = 1;
while (return_status) {
// write new FAT
return_status = fat_write_content(aFATEntries[0], aFATEntries[1]);
Serial.print(F("Wrote FAT entries: ")); Serial.println(return_status, DEC);
}
//Serial.println(F("Stopping..."));
//cc3000.stop();
//Serial.println(F("\nInitialising the CC3000 ..."));
//if (!cc3000.begin(2)) // no patches!
//{
// Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
// while(1);
//}
return_status = 1;
Serial.println(F("Write params"));
while (return_status) {
// write RM parameters
// write in 4 parts to work with tiny driver
return_status = 0;
for (index = 0; index < 4; index++) {
return_status |= nvmem_write(NVMEM_RM_FILEID, 32, 32*index, (pRMParams + 32*index));
Serial.println(F("Wrote 32 bytes to NVRAM"));
}
}
Serial.println(F("Wrote params"));
return_status = 1;
// write back the MAC address, only if exist
if (MACvalid) {
// zero out MCAST bit if set
cMacFromEeprom[0] &= 0xfe;
while (return_status) {
return_status = nvmem_set_mac_address(cMacFromEeprom);
}
}
ucStatus_Dr = 1;
Serial.println(F("Writing driver patch"));
while (ucStatus_Dr) {
//writing driver patch to EEPRROM - PROTABLE CODE
// Note that the array itself is changing between the different Service Packs
ucStatus_Dr = nvmem_write_patch(NVMEM_WLAN_DRIVER_SP_FILEID, drv_length, wlan_drv_patch);
}
Serial.println(F("Wrote driver patch"));
Serial.println(F("Starting w/o patches"));
//if (!cc3000.begin(2))
//{
// Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
// while(1);
//}
Serial.println(F("Writing firmware"));
unsigned char ucStatus_FW = 1;
while (ucStatus_FW) {
//writing FW patch to EAPRROM - PROTABLE CODE
//Note that the array itself is changing between the different Service Packs
ucStatus_FW = nvmem_write_patch(NVMEM_WLAN_FW_SP_FILEID, fw_length, fw_patch);
}
Serial.println(F("Starting w/patches"));
cc3000.reboot();
/*
if (!)
{
Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
while(1);
}
*/
Serial.println(F("Patched!"));
displayFirmwareVersion();
displayMACAddress();
}
//*****************************************************************************
//
//! fat_write_content
//!
//! \param[in] file_address array of file address in FAT table:\n
//! this is the absolute address of the file in the EEPROM.
//! \param[in] file_length array of file length in FAT table:\n
//! this is the upper limit of the file size in the EEPROM.
//!
//! \return on succes 0, error otherwise
//!
//! \brief parse the FAT table from eeprom
//
//*****************************************************************************
uint8_t fat_write_content(uint16_t *file_address, uint16_t *file_length)
{
uint16_t index = 0;
uint8_t ucStatus;
uint8_t fatTable[48];
uint8_t* fatTablePtr = fatTable;
uint8_t LS[3] = "LS";
// first, write the magic number
ucStatus = nvmem_write(16, 2, 0, LS);
for (; index <= NVMEM_RM_FILEID; index++)
{
// write address low char and mark as allocated
*fatTablePtr++ = (uint8_t)(file_address[index] & 0xff) | _BV(0);
// write address high char
*fatTablePtr++ = (uint8_t)((file_address[index]>>8) & 0xff);
// write length low char
*fatTablePtr++ = (uint8_t)(file_length[index] & 0xff);
// write length high char
*fatTablePtr++ = (uint8_t)((file_length[index]>>8) & 0xff);
}
// second, write the FAT
// write in two parts to work with tiny driver
ucStatus = nvmem_write(16, 24, 4, fatTable);
ucStatus = nvmem_write(16, 24, 24+4, &fatTable[24]);
// third, we want to erase any user files
memset(fatTable, 0, sizeof(fatTable));
ucStatus = nvmem_write(16, 16, 52, fatTable);
return ucStatus;
}
void loop(void)
{
delay(1000);
}

View File

@ -0,0 +1,104 @@
//Service Pack version P1.12.7.15.26 - Driver patches
uint8_t cRMdefaultParams[128] = { 0x03, 0x00, 0x01, 0x01, 0x14, 0x14, 0x00, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x23, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x23, 0x23, 0x23, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x01, 0x77, 0x80, 0x1D, 0x1F, 0x22, 0x26, 0x28, 0x29, 0x1A, 0x1F, 0x22, 0x24, 0x26, 0x28, 0x16, 0x1D, 0x1E, 0x20, 0x24, 0x25, 0x1E, 0x2D, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x15, 0x15, 0x15, 0x11, 0x15, 0x15, 0x0E, 0x00};
unsigned char PROGMEM wlan_drv_patch[8076] = { 0x00, 0x01, 0x00, 0x00, 0x84, 0x1F, 0x00, 0x00, 0xF0, 0x03, 0x18, 0x00, 0xE4, 0x62, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x7A, 0x63, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x10, 0x64, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x20, 0x0C, 0x49, 0x08, 0x60, 0x0C, 0x48, 0x19, 0x30, 0xF7, 0x46, 0x30, 0xB5, 0x05, 0x1C, 0xAC, 0x69, 0x68, 0x68, 0x5F, 0x30, 0x09, 0xD1, 0x60, 0x6B, 0x0C, 0x38, 0x01, 0x21, 0x8E, 0x46, 0x06, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x00, 0x20, 0x60, 0x63, 0xAC, 0x69, 0x6C, 0x60, 0x04, 0x48, 0x5B, 0x30, 0x30, 0xBD, 0x40, 0x3B, 0x08, 0x00, 0x49, 0xD0, 0x01, 0x00, 0x09, 0xEA, 0x02, 0x00, 0x91, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xA6, 0x64, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3C, 0x65, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xB5, 0x85, 0xB0, 0x05, 0x1C, 0xA8, 0x88, 0x00, 0x90, 0x28, 0x89, 0x01, 0x90, 0xE9, 0x68, 0x02, 0x91, 0x28, 0x7C, 0x03, 0x90, 0x2A, 0x6A, 0x00, 0x20, 0x17, 0x56, 0x68, 0x60, 0x00, 0x29, 0x4C, 0xD0, 0x00, 0x2F, 0x4A, 0xDC ,
0xCA, 0x49, 0x0C, 0x1C, 0x08, 0x26, 0x04, 0x90, 0x21, 0x88, 0x00, 0x98, 0x81, 0x42, 0x0C, 0xD1, 0x62, 0x88, 0x01, 0x98, 0x82, 0x42, 0x08, 0xD1, 0x46, 0x20, 0x02, 0x5D, 0x03, 0x98, 0x82, 0x42, 0x03, 0xD1, 0x0E, 0x20, 0x00, 0x57, 0xB8, 0x42, 0x0A, 0xD0, 0x46, 0x20, 0x00, 0x5D, 0x11, 0x28, 0x22, 0xD1, 0x00, 0x98, 0x81, 0x42, 0x1F, 0xD1, 0x0E, 0x20, 0x00, 0x57, 0xFF, 0xFF, 0xD2, 0x65, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xB8, 0x42, 0x1B, 0xD1, 0x04, 0x20, 0x02, 0x1C, 0x02, 0x98, 0xB9, 0x49, 0x01, 0x23, 0x9E, 0x46, 0xEA, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x17, 0xD0, 0x20, 0x1D, 0x02, 0x99, 0x04, 0x22, 0x01, 0x23, 0x9E, 0x46, 0xE5, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x0D, 0xD0, 0x46, 0x20, 0x00, 0x5D, 0x11, 0x28, 0x09, 0xD0, 0xA0, 0x6D, 0x00, 0x28, 0x06, 0xD0, 0xAC, 0x34, 0x04, 0x98, 0x01, 0x30, 0x04, 0x90, 0x01, 0x3E, 0xC1, 0xD1, 0x07, 0xE0, 0x04, 0x98, 0x00, 0x06, 0x00, 0x0E ,
0xAC, 0x21, 0x41, 0x43, 0xA6, 0x48, 0x40, 0x18, 0x68, 0x60, 0xA6, 0x48, 0xAD, 0x30, 0x05, 0xB0, 0xF0, 0xBD, 0x00, 0xB5, 0xC2, 0x68, 0x90, 0x69, 0x02, 0x21, 0x01, 0x23, 0x9E, 0x46, 0xA2, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xA2, 0x48, 0x61, 0x30, 0x00, 0xBD, 0x01, 0x79, 0x0B, 0x29, 0x03, 0xD0, 0x89, 0x00, 0x9F, 0x4A, 0x51, 0x5A, 0x01, 0xE0, 0x01, 0x21, 0x49, 0x02, 0x41, 0x60, 0x9D, 0x48, 0x0D, 0x30, 0xF7, 0x46, 0x01, 0x1C, 0xFF, 0xFF, 0x68, 0x66, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x9C, 0x48, 0x02, 0x68, 0x9C, 0x48, 0x01, 0x2A, 0x01, 0xD1, 0x25, 0x30, 0xF7, 0x46, 0x9B, 0x4A, 0x12, 0x68, 0x4A, 0x60, 0x19, 0x30, 0xF7, 0x46, 0x00, 0x21, 0x41, 0x60, 0x99, 0x48, 0x98, 0x49, 0x08, 0x18, 0xF7, 0x46, 0x00, 0x21, 0x41, 0x60, 0x97, 0x48, 0xE5, 0x49, 0x08, 0x18, 0xF7, 0x46, 0xFF, 0xB5, 0x46, 0x69, 0x40, 0x68, 0x01, 0x90, 0x94, 0x49, 0x0A, 0x7C, 0x9A, 0x4F, 0x01, 0x2A, 0x63, 0xD0, 0x09, 0x7C, 0x03, 0x29 ,
0x60, 0xD0, 0x91, 0x4A, 0x92, 0x4B, 0x00, 0x21, 0x02, 0x91, 0x59, 0x56, 0x24, 0x23, 0x59, 0x43, 0x53, 0x18, 0x03, 0x93, 0x01, 0x28, 0x17, 0xD1, 0x8A, 0x18, 0x04, 0x23, 0x6C, 0x46, 0x8C, 0x49, 0x15, 0x79, 0x08, 0x78, 0xC0, 0x43, 0x28, 0x43, 0x20, 0x70, 0x01, 0x32, 0x01, 0x31, 0x01, 0x34, 0x01, 0x3B, 0xF5, 0xD1, 0x31, 0x1D, 0x68, 0x46, 0x04, 0x22, 0x01, 0x23, 0x9E, 0x46, 0xA7, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x40, 0xD0, 0x35, 0x1D, 0x82, 0x48, 0x00, 0x78, 0xFF, 0x28, 0xFF, 0xFF, 0xFE, 0x66, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x11, 0xD0, 0x00, 0x28, 0x0F, 0xD0, 0x03, 0x98, 0x01, 0x1D, 0x28, 0x1C, 0x01, 0x24, 0xA6, 0x46, 0x7E, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x00, 0x28, 0x05, 0xD1, 0x7A, 0x48, 0xA6, 0x46, 0x7B, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x05, 0xE0, 0x28, 0x1C, 0x01, 0x21, 0x8E, 0x46, 0x78, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x01, 0x99, 0x01, 0x29, 0x01, 0xD1, 0x00, 0x28, 0x1E, 0xD1 ,
0x01, 0x99, 0x5F, 0x31, 0x01, 0xD0, 0x00, 0x28, 0x0F, 0xD1, 0xA8, 0x20, 0x81, 0x5D, 0x00, 0x29, 0x08, 0xD0, 0x49, 0x1E, 0x81, 0x55, 0x80, 0x5D, 0x00, 0x28, 0x09, 0xD1, 0x38, 0x1C, 0xFF, 0x30, 0x08, 0x30, 0x11, 0xE0, 0x03, 0x21, 0x02, 0x91, 0x00, 0xE0, 0xA8, 0x20, 0x02, 0x99, 0x81, 0x55, 0x38, 0x1C, 0xFF, 0x30, 0x16, 0x30, 0x07, 0xE0, 0x01, 0x98, 0x01, 0x28, 0x02, 0xD1, 0x38, 0x1C, 0xA3, 0x30, 0x01, 0xE0, 0x38, 0x1C, 0x9F, 0x30, 0x00, 0x90, 0xFF, 0xBD, 0x00, 0xB5, 0x02, 0x1C, 0x10, 0x6A, 0xD1, 0x69, 0x52, 0x69, 0xC3, 0x69, 0x5A, 0x60, 0xFF, 0xFF, 0x94, 0x67, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x01, 0x22, 0x96, 0x46, 0x5E, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x5E, 0x48, 0xFF, 0x30, 0x6E, 0x30, 0x00, 0xBD, 0x10, 0xB5, 0x0A, 0x1C, 0x41, 0x69, 0x00, 0x6A, 0x93, 0x69, 0xDB, 0x69, 0x58, 0x60, 0x90, 0x69, 0x01, 0x24, 0xA6, 0x46, 0x56, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0xA6, 0x46, 0x56, 0x48, 0xFE, 0x44 ,
0x00, 0x47, 0x55, 0x48, 0xFF, 0x30, 0xB6, 0x30, 0x10, 0xBD, 0x70, 0xB5, 0x05, 0x1C, 0x6E, 0x69, 0x53, 0x48, 0x02, 0x68, 0x5C, 0x21, 0x88, 0x5D, 0x04, 0x28, 0x15, 0xD1, 0x07, 0x20, 0x88, 0x55, 0x10, 0x0B, 0x11, 0xD2, 0x01, 0x24, 0xA6, 0x46, 0x4E, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x00, 0x28, 0x0A, 0xD0, 0x47, 0x21, 0x89, 0x57, 0xC1, 0x60, 0x11, 0x21, 0xC9, 0x02, 0x00, 0x22, 0x04, 0x23, 0xA6, 0x46, 0x48, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x01, 0x20, 0x68, 0x60, 0x43, 0x48, 0x46, 0x49, 0x08, 0x18, 0x70, 0xBD, 0x70, 0xB5, 0x05, 0x1C, 0xAE, 0x69, 0x9C, 0x20, 0x80, 0x19, 0x4B, 0x21, 0x89, 0x00, 0x01, 0x24, 0xFF, 0xFF, 0x2A, 0x68, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xA6, 0x46, 0x41, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x5C, 0x21, 0x88, 0x5D, 0x07, 0x28, 0x01, 0xD1, 0x09, 0x20, 0x00, 0xE0, 0x05, 0x20, 0xAA, 0x69, 0x88, 0x54, 0x30, 0x1C, 0xA6, 0x46, 0xEA, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x68, 0x60, 0xE9, 0x48 ,
0x4D, 0x30, 0x70, 0xBD, 0xF0, 0xB5, 0x41, 0x68, 0x82, 0x68, 0x88, 0x23, 0x5E, 0x18, 0x37, 0x88, 0x0B, 0x6F, 0x00, 0x2B, 0x01, 0xD1, 0x00, 0x2F, 0x10, 0xD1, 0x06, 0x2F, 0x02, 0xDD, 0x00, 0x21, 0xC9, 0x43, 0x07, 0xE0, 0x33, 0x88, 0x9B, 0x00, 0xC9, 0x18, 0x0A, 0x67, 0x31, 0x88, 0x01, 0x31, 0x31, 0x80, 0x01, 0x21, 0x81, 0x60, 0xEA, 0x48, 0x1D, 0x30, 0xF0, 0xBD, 0x0B, 0x1C, 0x01, 0x24, 0x5D, 0x6F, 0x1D, 0x67, 0x04, 0x33, 0x01, 0x34, 0x06, 0x2C, 0xE1, 0xDA, 0xF8, 0xE7, 0x00, 0xB5, 0x00, 0x21, 0xC1, 0x60, 0xEB, 0x48, 0x01, 0x68, 0x10, 0x31, 0xE8, 0x48, 0x20, 0x22, 0x01, 0x23, 0x9E, 0x46, 0xE9, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xE7, 0x48, 0xFB, 0x30, 0x00, 0xBD, 0xFF, 0xFF, 0xC0, 0x68, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x14, 0x0D, 0x1B, 0x00, 0x54, 0x19, 0x1B, 0x00, 0x91, 0x1A, 0x01, 0x00, 0x4B, 0xAD, 0x03, 0x00, 0x61, 0x4E, 0x01, 0x00, 0x06, 0x32, 0x08, 0x00, 0x1F, 0x0B, 0x02, 0x00, 0x54, 0x3F ,
0x08, 0x00, 0x45, 0xC1, 0x00, 0x00, 0x84, 0x3C, 0x08, 0x00, 0x1B, 0x02, 0x00, 0x00, 0xED, 0x17, 0x00, 0x00, 0xF3, 0xC1, 0x01, 0x00, 0x34, 0x19, 0x1B, 0x00, 0x08, 0x19, 0x1B, 0x00, 0xA6, 0x44, 0x08, 0x00, 0x1C, 0x17, 0x1B, 0x00, 0x18, 0x17, 0x1B, 0x00, 0xCB, 0x67, 0x03, 0x00, 0x0D, 0x47, 0x02, 0x00, 0x39, 0x42, 0x03, 0x00, 0xBD, 0xE7, 0x02, 0x00, 0xB1, 0x40, 0x03, 0x00, 0xB9, 0xEA, 0x01, 0x00, 0x45, 0xDA, 0x00, 0x00, 0x24, 0x41, 0x08, 0x00, 0x71, 0xC0, 0x02, 0x00, 0x7B, 0xC0, 0x02, 0x00, 0x9F, 0x03, 0x00, 0x00, 0x7D, 0xB8, 0x03, 0x00, 0xF0, 0xB5, 0x88, 0xB0, 0x06, 0x91, 0x07, 0x90, 0x86, 0x69, 0xF0, 0x1C, 0xE5, 0xA1, 0x04, 0x22, 0x01, 0x24, 0xA6, 0x46, 0x0F, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x40, 0xD1, 0xFF, 0xFF, 0x56, 0x69, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xF3, 0x79, 0xE3, 0x48, 0x1A, 0x1C, 0x03, 0x70, 0x30, 0x7A, 0x00, 0x90, 0x70, 0x7A, 0x01, 0x90, 0x03, 0x20, 0x2F, 0x49 ,
0xF0, 0x31, 0xA6, 0x46, 0xDF, 0x4D, 0xFE, 0x44, 0x28, 0x47, 0xF2, 0x79, 0x35, 0x7A, 0x77, 0x7A, 0x78, 0x1B, 0x43, 0x1C, 0x93, 0x42, 0x1E, 0xD0, 0x16, 0x2A, 0x0F, 0xDB, 0x00, 0x2D, 0x0D, 0xD1, 0x01, 0xE0, 0x8F, 0xC6, 0x03, 0x00, 0xDB, 0x48, 0x04, 0x70, 0x0A, 0x20, 0x81, 0x19, 0xD5, 0x48, 0x1A, 0x1C, 0xA6, 0x46, 0xAF, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x82, 0xE0, 0xD7, 0x48, 0x04, 0x70, 0xD1, 0x48, 0x40, 0x19, 0x0A, 0x21, 0x89, 0x19, 0x7A, 0x1B, 0x52, 0x1C, 0xA6, 0x46, 0xA8, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x75, 0xE0, 0xCF, 0x48, 0x04, 0x70, 0xCF, 0x48, 0x04, 0x70, 0x0A, 0x20, 0x81, 0x19, 0xC8, 0x48, 0xA6, 0x46, 0xA2, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x69, 0xE0, 0xF0, 0x1C, 0x03, 0x27, 0xC1, 0xA1, 0x3A, 0x1C, 0xA6, 0x46, 0xCC, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x5F, 0xD1, 0xFF, 0xFF, 0xEC, 0x69, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xFF, 0xE7, 0xF1, 0x79, 0xC0, 0x48, 0x01, 0x70, 0xC0, 0x4D ,
0xB2, 0x79, 0x2A, 0x70, 0x38, 0x1C, 0x0A, 0x49, 0xF4, 0x31, 0xA6, 0x46, 0xBE, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x28, 0x78, 0x00, 0x28, 0x0E, 0xD1, 0xBE, 0x48, 0x04, 0x70, 0xBE, 0x48, 0x04, 0x70, 0x38, 0x1C, 0x03, 0x49, 0xF5, 0x31, 0xA6, 0x46, 0xBC, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x02, 0xE0, 0xC0, 0x46, 0xC7, 0x04, 0x00, 0x00, 0x30, 0x7A, 0x00, 0x90, 0x70, 0x7A, 0x01, 0x90, 0xAF, 0x48, 0x02, 0x78, 0xF3, 0x79, 0x38, 0x1C, 0xB6, 0x49, 0xF6, 0x31, 0xA6, 0x46, 0xAA, 0x4D, 0xFE, 0x44, 0x28, 0x47, 0x23, 0x1C, 0xF2, 0x79, 0x37, 0x7A, 0x70, 0x7A, 0xC1, 0x1B, 0x4D, 0x1C, 0x95, 0x42, 0x1E, 0xD0, 0xA6, 0x49, 0x09, 0x78, 0x16, 0x29, 0x0C, 0xDB, 0x00, 0x2F, 0x0A, 0xD1, 0xA8, 0x48, 0x03, 0x70, 0x0A, 0x20, 0x81, 0x19, 0xE7, 0x48, 0x2A, 0x1C, 0xA6, 0x46, 0x7A, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x18, 0xE0, 0xA4, 0x49, 0x0B, 0x70, 0xE3, 0x49, 0xCB, 0x19, 0xFF, 0xFF, 0x82, 0x6A, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00 ,
0x0A, 0x21, 0x89, 0x19, 0xC0, 0x1B, 0x42, 0x1C, 0x18, 0x1C, 0xA6, 0x46, 0x73, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x0A, 0xE0, 0x9C, 0x48, 0x03, 0x70, 0x9C, 0x48, 0x03, 0x70, 0x0A, 0x20, 0x81, 0x19, 0xDA, 0x48, 0xA6, 0x46, 0x6D, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x94, 0x48, 0x00, 0x78, 0x00, 0x28, 0x0A, 0xD0, 0x93, 0x48, 0x00, 0x78, 0x00, 0x28, 0x06, 0xD0, 0x92, 0x48, 0x00, 0x78, 0x00, 0x28, 0x02, 0xD0, 0x91, 0x48, 0x00, 0x78, 0x00, 0x28, 0x00, 0xD1, 0x8C, 0xE0, 0x03, 0x20, 0x17, 0x21, 0x89, 0x01, 0xA6, 0x46, 0x8E, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x85, 0x48, 0x01, 0x78, 0x85, 0x48, 0x07, 0x78, 0x82, 0x4E, 0x80, 0x4D, 0xDF, 0x48, 0x00, 0x68, 0x00, 0x28, 0x2E, 0xD1, 0x07, 0x98, 0x41, 0x61, 0x06, 0x62, 0xC5, 0x48, 0x06, 0x9A, 0x10, 0x64, 0x02, 0x2F, 0x01, 0xD0, 0x03, 0x2F, 0x01, 0xD1, 0x03, 0x22, 0x00, 0xE0, 0x3A, 0x1C, 0x06, 0x9B, 0xDA, 0x63, 0x2A, 0x78, 0x9A, 0x63, 0x01, 0x2F, 0x03, 0xD1, 0x05, 0x29 ,
0xFF, 0xFF, 0x18, 0x6B, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x04, 0xD0, 0x0D, 0x29, 0x02, 0xD0, 0xEB, 0x48, 0xDB, 0x30, 0x64, 0xE0, 0x00, 0x25, 0x00, 0x95, 0x01, 0x91, 0x02, 0x96, 0x03, 0x95, 0x04, 0x90, 0x2B, 0x1C, 0x20, 0x1C, 0x01, 0x1C, 0x8E, 0x46, 0xE5, 0x4E, 0xFE, 0x44, 0x30, 0x47, 0xE5, 0x48, 0x04, 0x60, 0x28, 0x1C, 0xA6, 0x46, 0xE4, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x4C, 0xE0, 0x0D, 0x27, 0x00, 0x20, 0x39, 0x1C, 0x05, 0xAA, 0xA6, 0x46, 0xE1, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x68, 0x46, 0x80, 0x8A, 0x40, 0x08, 0x05, 0xD2, 0x38, 0x1C, 0x50, 0x21, 0xA6, 0x46, 0xDB, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x38, 0x1C, 0x23, 0x1C, 0x29, 0x1C, 0x00, 0x22, 0x9E, 0x46, 0xEE, 0x4F, 0xFE, 0x44, 0x38, 0x47, 0x2B, 0x78, 0x0D, 0x20, 0x31, 0x1C, 0x22, 0x1C, 0x96, 0x46, 0xEA, 0x4E, 0xFE, 0x44, 0x30, 0x47, 0x28, 0x78, 0x01, 0x30, 0x02, 0x1C, 0x0D, 0x20, 0x56, 0x49, 0x23, 0x1C, 0x9E, 0x46, 0xE5, 0x4E, 0xFE, 0x44 ,
0x30, 0x47, 0x54, 0x4E, 0x28, 0x78, 0x02, 0x30, 0x02, 0x1C, 0xFF, 0xFF, 0xAE, 0x6B, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x0D, 0x20, 0x31, 0x1C, 0x23, 0x1C, 0x9E, 0x46, 0xE0, 0x4F, 0xFE, 0x44, 0x38, 0x47, 0x30, 0x78, 0x00, 0x28, 0x0A, 0xD0, 0x28, 0x78, 0x03, 0x30, 0x02, 0x1C, 0x4A, 0x48, 0x03, 0x78, 0x0D, 0x20, 0x8F, 0x49, 0xA6, 0x46, 0xD9, 0x4D, 0xFE, 0x44, 0x28, 0x47, 0xBE, 0x48, 0x21, 0x1C, 0x01, 0x60, 0x00, 0x20, 0x8E, 0x46, 0xBD, 0x49, 0xFE, 0x44, 0x08, 0x47, 0xB8, 0x48, 0xEB, 0x49, 0x08, 0x18, 0x08, 0xB0, 0xF0, 0xBD, 0xC0, 0x46, 0xC9, 0x21, 0x01, 0x00, 0x91, 0xE1, 0x00, 0x00, 0x01, 0x1C, 0xE7, 0x48, 0x02, 0x68, 0xE7, 0x48, 0x00, 0x2A, 0x04, 0xD0, 0x00, 0x22, 0x0A, 0x62, 0x8A, 0x61, 0x1D, 0x30, 0xF7, 0x46, 0xD7, 0x30, 0xF7, 0x46, 0x01, 0x1C, 0xE2, 0x48, 0x02, 0x68, 0xE2, 0x48, 0x00, 0x2A, 0x02, 0xD0, 0xFF, 0x30, 0xB4, 0x30, 0xF7, 0x46, 0x00, 0x22, 0xCA, 0x61, 0x8A, 0x61, 0x4F, 0x30 ,
0xF7, 0x46, 0xC0, 0x46, 0x89, 0x17, 0x02, 0x00, 0xDC, 0x48, 0x01, 0x68, 0x8A, 0x69, 0x01, 0x20, 0xC0, 0x03, 0x10, 0x43, 0xFF, 0xFF, 0x44, 0x6C, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x88, 0x61, 0x00, 0x20, 0x08, 0x61, 0xD9, 0x48, 0x23, 0x30, 0xF7, 0x46, 0x46, 0x17, 0x1B, 0x00, 0x30, 0x3F, 0x08, 0x00, 0x41, 0xEB, 0x00, 0x00, 0x09, 0xB4, 0x03, 0x00, 0x70, 0xB5, 0x05, 0x1C, 0xD3, 0x4E, 0x29, 0x6A, 0xEA, 0x69, 0x30, 0x1C, 0x01, 0x24, 0xA6, 0x46, 0xD4, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x68, 0x69, 0xA6, 0x46, 0xCF, 0x49, 0xFE, 0x44, 0x08, 0x47, 0xA8, 0x69, 0x06, 0x30, 0xA8, 0x60, 0xCD, 0x48, 0x00, 0x68, 0x68, 0x60, 0xEE, 0x60, 0xCC, 0x48, 0x6D, 0x30, 0x70, 0xBD, 0x30, 0xB5, 0xF1, 0x48, 0x01, 0x6D, 0x80, 0x6C, 0x08, 0x43, 0x18, 0xD0, 0xEF, 0x49, 0x08, 0x1C, 0x07, 0x22, 0xFF, 0x23, 0x09, 0x33, 0x1B, 0x58, 0x00, 0x2B, 0x04, 0xD0, 0xFF, 0x30, 0x1D, 0x30, 0x01, 0x3A, 0xF6, 0xD1, 0x0B, 0xE0, 0x02, 0x20 ,
0xF0, 0x4A, 0xF1, 0x4B, 0x01, 0x24, 0xA6, 0x46, 0xF0, 0x4D, 0xFE, 0x44, 0x28, 0x47, 0xA6, 0x46, 0xEF, 0x48, 0xFE, 0x44, 0x00, 0x47, 0xEF, 0x48, 0xFF, 0x30, 0x5C, 0x30, 0x30, 0xBD, 0xFF, 0xFF, 0xDA, 0x6C, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xC0, 0x46, 0x53, 0x53, 0x49, 0x44, 0x00, 0xC0, 0x46, 0xC0, 0x4B, 0x45, 0x59, 0x00, 0xEE, 0x62, 0x08, 0x00, 0x13, 0x7F, 0x03, 0x00, 0xF0, 0x62, 0x08, 0x00, 0xEC, 0x62, 0x08, 0x00, 0xED, 0x62, 0x08, 0x00, 0xE7, 0x7E, 0x03, 0x00, 0xE8, 0x62, 0x08, 0x00, 0xE9, 0x62, 0x08, 0x00, 0xEA, 0x62, 0x08, 0x00, 0xEB, 0x62, 0x08, 0x00, 0xDD, 0x7E, 0x03, 0x00, 0x8F, 0xC6, 0x03, 0x00, 0xC7, 0x04, 0x00, 0x00, 0xF0, 0xB5, 0x87, 0xB0, 0x00, 0x91, 0x01, 0x90, 0x6B, 0x48, 0x01, 0x68, 0xCD, 0x4A, 0x14, 0x1C, 0x02, 0x94, 0x07, 0x26, 0x00, 0x25, 0x03, 0x95, 0x04, 0x94, 0x05, 0x95, 0xDD, 0x48, 0x00, 0x68, 0x08, 0x43, 0x27, 0xD0, 0xE0, 0x68, 0x03, 0x99, 0x88, 0x42, 0x0A, 0xDD ,
0x03, 0x90, 0x40, 0x1C, 0x00, 0x99, 0x88, 0x60, 0xC3, 0x49, 0xFF, 0x20, 0x1D, 0x30, 0x68, 0x43, 0x0C, 0x18, 0xE0, 0x68, 0x04, 0x91, 0x02, 0x99, 0xC9, 0x68, 0x88, 0x42, 0x10, 0xDB, 0x88, 0x42, 0x10, 0xD1, 0x02, 0x98, 0x01, 0x27, 0xBE, 0x46, 0xFF, 0xFF, 0x70, 0x6D, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xCC, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x06, 0x90, 0x20, 0x1C, 0xBE, 0x46, 0xC9, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x06, 0x99, 0x88, 0x42, 0x01, 0xDA, 0x05, 0x95, 0x02, 0x94, 0x51, 0x48, 0x01, 0x68, 0xFF, 0x27, 0x09, 0x37, 0x38, 0x59, 0x00, 0x28, 0x06, 0xD0, 0xC5, 0x48, 0x00, 0x68, 0x07, 0x2E, 0x00, 0xD1, 0x2E, 0x1C, 0x08, 0x43, 0x04, 0xD0, 0xFF, 0x34, 0x1D, 0x34, 0x01, 0x35, 0x07, 0x2D, 0xC2, 0xDB, 0x07, 0x2E, 0x0A, 0xD1, 0xBE, 0x48, 0x00, 0x68, 0x08, 0x43, 0x06, 0xD0, 0x05, 0x9E, 0x30, 0x1C, 0x01, 0x21, 0x8E, 0x46, 0xB8, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x01, 0x98, 0x47, 0x61, 0x00, 0x21, 0x81, 0x61 ,
0xFF, 0x22, 0x1D, 0x32, 0x72, 0x43, 0x04, 0x99, 0x89, 0x18, 0xC1, 0x61, 0x06, 0x62, 0xB2, 0x48, 0x39, 0x30, 0x07, 0xB0, 0xF0, 0xBD, 0x10, 0xB5, 0x04, 0x1C, 0x00, 0x20, 0x01, 0x21, 0x8E, 0x46, 0xAF, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x40, 0x1E, 0x00, 0xD5, 0x00, 0x20, 0x60, 0x60, 0xE0, 0x61, 0xAC, 0x48, 0xFF, 0xFF, 0x06, 0x6E, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x21, 0x30, 0x10, 0xBD, 0xC0, 0x46, 0x10, 0x63, 0x08, 0x00, 0x70, 0xB5, 0x04, 0x1C, 0xE5, 0x69, 0x66, 0x69, 0x00, 0x20, 0x01, 0x21, 0x8E, 0x46, 0xA5, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x60, 0x60, 0xAB, 0x19, 0xA4, 0x4A, 0xA3, 0x49, 0x93, 0x42, 0x02, 0xD3, 0x9A, 0x1A, 0x82, 0x42, 0x02, 0xD9, 0x08, 0x1C, 0x99, 0x30, 0x70, 0xBD, 0x08, 0x1C, 0xAB, 0x30, 0x70, 0xBD, 0x08, 0x6B, 0x41, 0x7D, 0x02, 0x88, 0x92, 0x00, 0x51, 0x1A, 0x3C, 0x39, 0xFF, 0x22, 0x5F, 0x32, 0x91, 0x42, 0x03, 0xD9, 0x65, 0x21, 0x01, 0x80, 0x02, 0x21, 0x81, 0x73, 0x99, 0x48 ,
0x97, 0x49, 0x08, 0x18, 0xF7, 0x46, 0xC0, 0x46, 0x30, 0x63, 0x08, 0x00, 0xF8, 0xB5, 0x40, 0x68, 0x24, 0x21, 0x41, 0x43, 0x95, 0x48, 0x45, 0x18, 0x28, 0x1D, 0x0C, 0x21, 0x49, 0x19, 0x04, 0x22, 0x01, 0x23, 0x9E, 0x46, 0x92, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x8F, 0x4C, 0x00, 0x28, 0x1B, 0xD0, 0x2B, 0x1C, 0x04, 0x22, 0x6E, 0x46, 0x8F, 0x49, 0x1F, 0x7B, 0x08, 0x78, 0xFF, 0xFF, 0x9C, 0x6E, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xC0, 0x43, 0x38, 0x43, 0x30, 0x70, 0x01, 0x33, 0x01, 0x31, 0x01, 0x36, 0x01, 0x3A, 0xF5, 0xD1, 0x0C, 0x20, 0x41, 0x19, 0x68, 0x46, 0x04, 0x22, 0x01, 0x23, 0x9E, 0x46, 0x85, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x02, 0xD0, 0x20, 0x1C, 0x4A, 0x30, 0xF8, 0xBD, 0x20, 0x1C, 0xF8, 0xBD, 0xB1, 0xBD, 0x00, 0x00, 0x15, 0x95, 0x00, 0x00, 0x58, 0x3F, 0x08, 0x00, 0xF3, 0xF8, 0x00, 0x00, 0xE9, 0x09, 0x02, 0x00, 0xDD, 0x0A, 0x02, 0x00, 0xF8, 0xB5, 0x05, 0x1C, 0xAA, 0x69, 0x7C, 0x49 ,
0x00, 0x20, 0x08, 0x56, 0x24, 0x21, 0x41, 0x43, 0x75, 0x48, 0x43, 0x18, 0x04, 0x24, 0x6E, 0x46, 0x75, 0x49, 0x1F, 0x79, 0x08, 0x78, 0xC0, 0x43, 0x38, 0x43, 0x30, 0x70, 0x01, 0x33, 0x01, 0x31, 0x01, 0x36, 0x01, 0x3C, 0xF5, 0xD1, 0x11, 0x1D, 0x68, 0x46, 0x04, 0x22, 0x01, 0x24, 0xA6, 0x46, 0x6C, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x01, 0x1C, 0x6C, 0x48, 0x04, 0xD0, 0x6D, 0x49, 0x09, 0x78, 0x69, 0x60, 0x45, 0x30, 0xF8, 0xBD, 0xFF, 0xFF, 0x32, 0x6F, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xEC, 0x61, 0xAF, 0x30, 0xF8, 0xBD, 0x2B, 0x09, 0x02, 0x00, 0x70, 0xB5, 0xC5, 0x68, 0x81, 0x68, 0x0A, 0x89, 0x6B, 0x4E, 0x00, 0x2A, 0x22, 0xD0, 0x01, 0x24, 0xC2, 0x6D, 0xA2, 0x18, 0xC2, 0x65, 0x08, 0x89, 0x0D, 0x28, 0x1B, 0xD1, 0x68, 0x6B, 0x21, 0x1C, 0xA6, 0x46, 0x61, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x22, 0x1C, 0x28, 0x1C, 0x00, 0x21, 0xA6, 0x46, 0x5E, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x2C, 0x60, 0xE9, 0x6B, 0x28, 0x1C ,
0xA6, 0x46, 0x5C, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x28, 0x1C, 0xA6, 0x46, 0x5A, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x30, 0x1C, 0x3D, 0x30, 0x70, 0xBD, 0x30, 0x1C, 0x23, 0x30, 0x70, 0xBD, 0xC0, 0x46, 0xB1, 0x02, 0x00, 0x00, 0x74, 0x3F, 0x08, 0x00, 0x19, 0xC6, 0x00, 0x00, 0x5C, 0x3F, 0x08, 0x00, 0x1D, 0xC2, 0x00, 0x00, 0x68, 0x44, 0x08, 0x00, 0x43, 0x12, 0x03, 0x00, 0x34, 0x63, 0x08, 0x00, 0x2F, 0x7A, 0x02, 0x00, 0xB4, 0x36, 0x08, 0x00, 0x8F, 0xF4, 0x01, 0x00, 0x09, 0xB4, 0x03, 0x00, 0xFF, 0xFF, 0xC8, 0x6F, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xF0, 0xB5, 0x05, 0x1C, 0xAB, 0x69, 0xEC, 0x69, 0x60, 0x68, 0x00, 0x68, 0x2A, 0x30, 0x01, 0x78, 0x0A, 0x06, 0x41, 0x78, 0x09, 0x04, 0x8A, 0x18, 0x81, 0x78, 0x09, 0x02, 0x8A, 0x18, 0xC1, 0x78, 0x8A, 0x18, 0x8E, 0x26, 0xF1, 0x5A, 0x09, 0x0A, 0x01, 0x70, 0xF0, 0x5C, 0x61, 0x68, 0x09, 0x68, 0x2B, 0x26, 0x70, 0x54, 0x8C, 0x20, 0xC0, 0x18, 0x61, 0x68, 0x0E, 0x68 ,
0x01, 0x88, 0x09, 0x0A, 0x2C, 0x27, 0xB9, 0x55, 0x61, 0x68, 0x09, 0x68, 0x2D, 0x26, 0x00, 0x78, 0x70, 0x54, 0x60, 0x68, 0x01, 0x68, 0x32, 0x31, 0x08, 0x78, 0x00, 0x02, 0x49, 0x78, 0x08, 0x18, 0x00, 0x04, 0x00, 0x0C, 0x8C, 0x21, 0xCB, 0x58, 0x32, 0x49, 0x41, 0x40, 0x08, 0x04, 0x00, 0x0C, 0xC0, 0x18, 0x80, 0x1A, 0x01, 0x21, 0x8E, 0x46, 0x2F, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x61, 0x68, 0x0A, 0x68, 0x32, 0x23, 0x01, 0x0A, 0x99, 0x54, 0x61, 0x68, 0x09, 0x68, 0x33, 0x22, 0x50, 0x54, 0x60, 0x68, 0x68, 0x60, 0x29, 0x48, 0xF0, 0xBD, 0x00, 0x00, 0xFF, 0xFF, 0x5E, 0x70, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x34, 0x04, 0x1B, 0x00, 0x02, 0x6A, 0x8B, 0x69, 0xDB, 0x69, 0x1B, 0x68, 0x83, 0x60, 0x88, 0x69, 0xC0, 0x69, 0x41, 0x68, 0x8A, 0x42, 0x00, 0xDA, 0x42, 0x60, 0x22, 0x48, 0x79, 0x30, 0xF7, 0x46, 0x32, 0x04, 0x00, 0x00, 0xC4, 0x07, 0x00, 0x00, 0x15, 0x09, 0x02, 0x00, 0xC5, 0x93, 0x00, 0x00 ,
0x0D, 0x91, 0x00, 0x00, 0x40, 0x1E, 0x80, 0x00, 0x1C, 0x4B, 0x19, 0x50, 0x1A, 0x49, 0x0A, 0x50, 0xF7, 0x46, 0xC0, 0x46, 0xBD, 0xB5, 0x00, 0x00, 0x95, 0x92, 0x00, 0x00, 0xFD, 0x93, 0x00, 0x00, 0x54, 0x3F, 0x08, 0x00, 0x29, 0x4F, 0x03, 0x00, 0xDF, 0xE8, 0x02, 0x00, 0x36, 0x89, 0x41, 0x00, 0x81, 0x06, 0x00, 0x00, 0xB1, 0x78, 0x00, 0x00, 0x94, 0xEC, 0x01, 0x00, 0x08, 0x19, 0x1B, 0x00, 0x8F, 0xC6, 0x03, 0x00, 0x1C, 0x17, 0x1B, 0x00, 0x67, 0x66, 0x03, 0x00, 0xA6, 0x44, 0x08, 0x00, 0x18, 0x17, 0x1B, 0x00, 0xA7, 0x2F, 0x02, 0x00, 0x91, 0x44, 0x03, 0x00, 0x91, 0x63, 0x03, 0x00, 0x5B, 0x44, 0x03, 0x00, 0xFF, 0xFF, 0xF4, 0x70, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xE7, 0x44, 0x03, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x61, 0xA2, 0x03, 0x00, 0x6A, 0x1E, 0x01, 0x00, 0x45, 0xDA, 0x00, 0x00, 0x04, 0xF3, 0x1A, 0x00, 0x80, 0x7B, 0x08, 0x00, 0xFC, 0xB5, 0x04, 0x1C, 0xA5, 0x69, 0x60, 0x6A, 0x01, 0x90, 0x20, 0x69 ,
0x00, 0x28, 0x35, 0xD4, 0x08, 0x28, 0x33, 0xDA, 0xE1, 0x69, 0x09, 0x68, 0x10, 0x29, 0x2F, 0xD1, 0xAC, 0x21, 0x41, 0x43, 0x9E, 0x4A, 0x51, 0x5C, 0x49, 0x08, 0x27, 0xD3, 0x00, 0x06, 0x00, 0x16, 0xA2, 0x68, 0x69, 0x46, 0x01, 0x23, 0x9E, 0x46, 0x9A, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x06, 0x1C, 0x39, 0x30, 0x1F, 0xD0, 0x00, 0x2E, 0x1D, 0xD0, 0x00, 0x98, 0x07, 0x68, 0x00, 0x99, 0x0C, 0x39, 0x01, 0x98, 0x01, 0x60, 0x28, 0x1D, 0x10, 0x21, 0x79, 0x1A, 0x04, 0x22, 0x01, 0x23, 0x9E, 0x46, 0x91, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x02, 0x22, 0x2A, 0x80, 0xA8, 0x1C, 0x08, 0x21, 0x79, 0x1A, 0x01, 0x23, 0x9E, 0x46, 0x8C, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x03, 0xE0, 0x38, 0x20, 0xFF, 0xFF, 0x8A, 0x71, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x20, 0xC6, 0x43, 0x26, 0x60, 0x89, 0x48, 0x7C, 0x30, 0x20, 0x62, 0xFC, 0xBD, 0x30, 0xB5, 0x05, 0x1C, 0x28, 0x69, 0xA9, 0x69, 0x90, 0x29, 0x1D, 0xD1, 0x69, 0x69 ,
0x09, 0x78, 0x04, 0x29, 0x19, 0xD0, 0x05, 0x29, 0x17, 0xD0, 0x0A, 0x29, 0x15, 0xD0, 0x06, 0x29, 0x13, 0xD0, 0x0C, 0x29, 0x01, 0xDB, 0x10, 0x29, 0x0F, 0xD1, 0x01, 0x24, 0xA6, 0x46, 0x7D, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x7C, 0x48, 0x7D, 0x49, 0x00, 0x22, 0xA6, 0x46, 0x7C, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x7C, 0x48, 0xFF, 0x30, 0x5F, 0x30, 0x28, 0x62, 0x30, 0xBD, 0xF0, 0xB5, 0x89, 0xB0, 0x05, 0x90, 0x41, 0x69, 0x02, 0x69, 0x75, 0x48, 0x79, 0x4E, 0x82, 0x42, 0x3A, 0xD0, 0x04, 0x30, 0x82, 0x42, 0x25, 0xD0, 0x74, 0x4D, 0xAA, 0x42, 0x00, 0xD0, 0xCC, 0xE0, 0x08, 0x68, 0x06, 0x1C, 0x0C, 0x22, 0x8F, 0x1A, 0x4A, 0x68, 0x89, 0x18, 0x09, 0x1D, 0x10, 0x22, 0x01, 0x24, 0xA6, 0x46, 0x6E, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x01, 0x1C, 0xFF, 0xFF, 0x20, 0x72, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x09, 0xD1, 0xAC, 0x22, 0x72, 0x43, 0xCB, 0x48, 0x80, 0x18, 0x46, 0x22, 0x12, 0x5C, 0x11, 0x2A, 0x01, 0xD1, 0x44, 0x22 ,
0x14, 0x54, 0x28, 0x1C, 0x3A, 0x1C, 0xA6, 0x46, 0x62, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x69, 0x48, 0xEC, 0x30, 0xAB, 0xE0, 0x08, 0x68, 0xC0, 0x00, 0x30, 0x18, 0x8A, 0x68, 0x02, 0x2A, 0x02, 0xD0, 0xE7, 0x20, 0x80, 0x00, 0xA2, 0xE0, 0xCA, 0x68, 0x89, 0x18, 0x09, 0x7B, 0x41, 0x60, 0x80, 0x21, 0x01, 0x60, 0x3B, 0x20, 0x00, 0x01, 0x99, 0xE0, 0x08, 0x68, 0x06, 0x90, 0xC0, 0x00, 0x34, 0x58, 0x10, 0x20, 0x04, 0x90, 0x01, 0x25, 0xAE, 0x46, 0x57, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x07, 0x90, 0x00, 0x28, 0x00, 0xD1, 0x89, 0xE0, 0x0C, 0x21, 0x07, 0x98, 0x0F, 0x18, 0xB0, 0x49, 0xAC, 0x20, 0x06, 0x9A, 0x50, 0x43, 0x08, 0x18, 0x48, 0x22, 0x13, 0x5C, 0x5B, 0x06, 0x5B, 0x0E, 0x13, 0x54, 0x06, 0x9A, 0xD2, 0x00, 0xB6, 0x18, 0x71, 0x68, 0x00, 0x29, 0x47, 0xD1, 0x00, 0x2C, 0x01, 0xDD, 0x08, 0x2C, 0xFF, 0xFF, 0xB6, 0x72, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x21, 0xDB, 0x00, 0x22, 0x69, 0x46, 0x0A, 0x70, 0x01, 0x92 ,
0x0A, 0x81, 0x8A, 0x72, 0xCD, 0x72, 0x0D, 0x73, 0x4D, 0x73, 0x01, 0x88, 0x44, 0x48, 0x06, 0x23, 0xAE, 0x46, 0x44, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x04, 0x1C, 0x02, 0xDC, 0x00, 0x20, 0xC0, 0x43, 0x36, 0xE0, 0x34, 0x60, 0xAC, 0x20, 0x60, 0x43, 0x9A, 0x49, 0x09, 0x18, 0x5C, 0x22, 0x28, 0x1C, 0x50, 0x54, 0x48, 0x20, 0x42, 0x5C, 0x52, 0x06, 0x52, 0x0E, 0x42, 0x54, 0xAC, 0x20, 0x60, 0x43, 0x94, 0x49, 0x08, 0x18, 0x5C, 0x21, 0x09, 0x5C, 0x49, 0x1E, 0x02, 0x29, 0x16, 0xD9, 0x03, 0x39, 0x08, 0xD0, 0x00, 0x20, 0x30, 0x56, 0xAE, 0x46, 0xEA, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x80, 0x20, 0x30, 0x60, 0xDB, 0xE7, 0x08, 0x94, 0x80, 0x21, 0x31, 0x60, 0x48, 0x22, 0x13, 0x5C, 0x19, 0x43, 0x11, 0x54, 0xAE, 0x46, 0xE4, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x0A, 0xE0, 0x01, 0x20, 0xCE, 0xE7, 0x06, 0x98, 0x39, 0x1C, 0x04, 0xAA, 0xAE, 0x46, 0xE0, 0x4B, 0xFE, 0x44, 0xFF, 0xFF, 0x4C, 0x73, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00 ,
0x18, 0x47, 0x04, 0x1C, 0x08, 0x90, 0x06, 0x98, 0x38, 0x60, 0x08, 0x98, 0x78, 0x60, 0x00, 0x28, 0x15, 0xD0, 0xAC, 0x20, 0x60, 0x43, 0x7C, 0x49, 0x09, 0x18, 0x48, 0x88, 0x02, 0x04, 0x02, 0x20, 0x10, 0x43, 0xB8, 0x60, 0x48, 0x68, 0x02, 0x0E, 0x01, 0x02, 0x09, 0x0E, 0x09, 0x02, 0x11, 0x43, 0x02, 0x04, 0x12, 0x0E, 0x12, 0x04, 0x0A, 0x43, 0x00, 0x06, 0x10, 0x43, 0xF8, 0x60, 0x07, 0x98, 0x0D, 0x49, 0x00, 0x22, 0x10, 0x23, 0xAE, 0x46, 0xCE, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x13, 0x48, 0x00, 0xE0, 0x16, 0x20, 0xCC, 0x49, 0x09, 0x18, 0x05, 0x98, 0x01, 0x62, 0x09, 0xB0, 0xF0, 0xBD, 0x5D, 0x0D, 0x1B, 0x00, 0x81, 0xE7, 0x02, 0x00, 0x09, 0xB4, 0x03, 0x00, 0x27, 0x1A, 0x02, 0x00, 0x2F, 0x7A, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x05, 0x10, 0x00, 0x00, 0xCF, 0xF6, 0x00, 0x00, 0xD5, 0xF4, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x91, 0x19, 0x02, 0x00, 0x50, 0x65, 0x08, 0x00, 0x71, 0xC0, 0x02, 0x00, 0x50, 0x19 ,
0xFF, 0xFF, 0xE2, 0x73, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x29, 0x16, 0x01, 0x00, 0x2A, 0x03, 0x00, 0x00, 0xF0, 0xB5, 0x8B, 0xB0, 0x07, 0x90, 0x05, 0x69, 0x47, 0x69, 0x0C, 0x20, 0x38, 0x1A, 0x08, 0x90, 0xB6, 0x49, 0x8D, 0x42, 0x16, 0xD1, 0x78, 0x68, 0x0F, 0x30, 0x00, 0x11, 0x00, 0x01, 0x78, 0x60, 0x38, 0x68, 0x0B, 0x28, 0x0E, 0xD8, 0x00, 0x23, 0x68, 0x46, 0x03, 0x70, 0x08, 0x98, 0x05, 0x22, 0x01, 0x24, 0xA6, 0x46, 0xAE, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0xAE, 0x48, 0xFF, 0x30, 0x95, 0x30, 0x07, 0x99, 0x08, 0x62, 0xAC, 0x48, 0x85, 0x42, 0x23, 0xD1, 0xAC, 0x48, 0x02, 0x78, 0x6C, 0x46, 0x22, 0x72, 0x43, 0x78, 0x63, 0x72, 0x81, 0x78, 0xA1, 0x72, 0xC0, 0x78, 0xE0, 0x72, 0x00, 0x91, 0x01, 0x90, 0x03, 0x20, 0xA6, 0x49, 0x01, 0x39, 0x01, 0x26, 0xB6, 0x46, 0xF3, 0x4E, 0xFE, 0x44, 0x30, 0x47, 0x04, 0x20, 0x20, 0x70, 0x08, 0x98, 0x9F, 0x49, 0x00, 0x22, 0x02, 0xAB, 0x01, 0x24, 0xA6, 0x46 ,
0x9B, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x9A, 0x48, 0xFF, 0x30, 0xFF, 0xFF, 0x78, 0x74, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x95, 0x30, 0x07, 0x99, 0x08, 0x62, 0xEB, 0x49, 0x8D, 0x42, 0x14, 0xD1, 0x02, 0x22, 0x68, 0x46, 0x02, 0x70, 0x3A, 0x68, 0xAC, 0x20, 0x42, 0x43, 0x30, 0x48, 0x68, 0x30, 0x83, 0x18, 0x08, 0x98, 0x00, 0x22, 0x01, 0x24, 0xA6, 0x46, 0x8F, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x8E, 0x48, 0xFF, 0x30, 0x95, 0x30, 0x07, 0x99, 0x08, 0x62, 0xEF, 0x48, 0x85, 0x42, 0x00, 0xD0, 0x04, 0xE1, 0x03, 0x20, 0x8C, 0x49, 0x01, 0x22, 0x96, 0x46, 0xEC, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x86, 0x48, 0xFF, 0x30, 0x95, 0x30, 0x09, 0x90, 0x38, 0x68, 0xEA, 0x4D, 0x00, 0x28, 0x00, 0xD1, 0xE2, 0xE0, 0x01, 0x24, 0xA6, 0x46, 0xE6, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x00, 0x28, 0x00, 0xD1, 0xD6, 0xE0, 0xE4, 0x48, 0x02, 0x68, 0x03, 0x20, 0x7F, 0x49, 0x01, 0x31, 0xA6, 0x46, 0xE2, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xDF, 0x48 ,
0x00, 0x68, 0x00, 0x28, 0x5A, 0xD1, 0xDF, 0x4D, 0x2E, 0x20, 0x41, 0x19, 0xB8, 0x68, 0x03, 0x30, 0x08, 0x70, 0x38, 0x7A, 0xFF, 0xFF, 0x0E, 0x75, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x48, 0x70, 0x2E, 0x1C, 0x30, 0x36, 0xB8, 0x68, 0x28, 0x18, 0x30, 0x30, 0xDA, 0x49, 0x0A, 0x68, 0x30, 0x3A, 0x31, 0x1C, 0xA6, 0x46, 0xD8, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x78, 0x68, 0x38, 0x18, 0x01, 0x1D, 0xBA, 0x68, 0x30, 0x1C, 0xA6, 0x46, 0xD9, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xB8, 0x68, 0x41, 0x19, 0x97, 0x22, 0x09, 0x30, 0x50, 0x54, 0xB8, 0x68, 0x46, 0x19, 0x9E, 0x36, 0x30, 0x70, 0x01, 0x36, 0xB8, 0x68, 0x01, 0xE0, 0x14, 0x0D, 0x1B, 0x00, 0x30, 0x18, 0xCA, 0x49, 0x0A, 0x68, 0x9E, 0x3A, 0x31, 0x1C, 0xA6, 0x46, 0xC8, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x78, 0x68, 0x38, 0x18, 0x01, 0x1D, 0xBA, 0x68, 0x30, 0x1C, 0xA6, 0x46, 0xC9, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xB8, 0x68, 0x40, 0x00, 0xC0, 0x49, 0x09, 0x68, 0x08, 0x18 ,
0x28, 0x18, 0xC0, 0x49, 0x0A, 0x79, 0x02, 0x70, 0x4A, 0x79, 0x42, 0x70, 0x8A, 0x79, 0x82, 0x70, 0xC9, 0x79, 0xC1, 0x70, 0x04, 0x30, 0x0F, 0x21, 0x41, 0x1A, 0x0A, 0x78, 0xBB, 0x68, 0xFF, 0xFF, 0xA4, 0x75, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x9A, 0x18, 0x0A, 0x70, 0x40, 0x1B, 0x00, 0x04, 0x00, 0x0C, 0xB5, 0x49, 0x08, 0x60, 0xB1, 0x48, 0x04, 0x60, 0x02, 0x20, 0x01, 0x1C, 0x11, 0x22, 0xA6, 0x46, 0xB4, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x06, 0x1C, 0x63, 0xD4, 0x03, 0x20, 0xA6, 0x46, 0xB1, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x0A, 0x90, 0x00, 0x25, 0x01, 0x1C, 0x8D, 0x42, 0x50, 0xD0, 0x29, 0x1C, 0x2B, 0x22, 0xA6, 0x46, 0xAD, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x0C, 0x20, 0x0A, 0x99, 0x40, 0x18, 0xAC, 0x22, 0x72, 0x43, 0xAB, 0x49, 0x8F, 0x18, 0x78, 0x63, 0x29, 0x1C, 0x18, 0x22, 0xA6, 0x46, 0xA6, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x9F, 0x48, 0x02, 0x68, 0x79, 0x6B, 0x4A, 0x60, 0x0A, 0x98, 0xAC, 0x30, 0x08, 0x60 ,
0x08, 0x68, 0x9A, 0x49, 0xA6, 0x46, 0xA0, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x29, 0x1C, 0x03, 0xA8, 0x10, 0x22, 0xA6, 0x46, 0x9C, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xE0, 0x21, 0x68, 0x46, 0x01, 0x74, 0x45, 0x74, 0x85, 0x74, 0xFB, 0x21, 0xC1, 0x74, 0xFF, 0xFF, 0x3A, 0x76, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xEE, 0x49, 0xC1, 0x81, 0x02, 0x21, 0x81, 0x81, 0x79, 0x6B, 0xCA, 0x68, 0x01, 0x20, 0xC0, 0x03, 0x10, 0x43, 0xC8, 0x60, 0x48, 0x68, 0x00, 0x90, 0x2A, 0x1C, 0x30, 0x1C, 0x0A, 0x9D, 0x29, 0x1C, 0x03, 0xAB, 0xA6, 0x46, 0xE6, 0x4F, 0xFE, 0x44, 0x38, 0x47, 0x07, 0x1C, 0x30, 0x06, 0x00, 0x16, 0xA6, 0x46, 0xEF, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x28, 0x1C, 0xA6, 0x46, 0xEE, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x11, 0xE0, 0x30, 0x06, 0x00, 0x16, 0xA6, 0x46, 0xE9, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x01, 0x20, 0xC7, 0x43, 0x08, 0xE0, 0x07, 0x1C, 0x06, 0xE0, 0x00, 0x20, 0x00, 0x21, 0xCF, 0x43, 0x01, 0xE0, 0x00, 0x20 ,
0x07, 0x1C, 0x28, 0x60, 0x00, 0x23, 0x68, 0x46, 0x03, 0x70, 0x3A, 0x06, 0x12, 0x0E, 0x08, 0x98, 0x6F, 0x49, 0x01, 0x24, 0xA6, 0x46, 0x09, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x07, 0x98, 0x09, 0x99, 0x01, 0x62, 0x0B, 0xB0, 0xF0, 0xBD, 0xC1, 0x18, 0x01, 0x00, 0xF1, 0x1B, 0x01, 0x00, 0xF3, 0x1C, 0x02, 0x00, 0xFF, 0xFF, 0xD0, 0x76, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x7B, 0xC0, 0x02, 0x00, 0x91, 0xF0, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0xA3, 0xC0, 0x02, 0x00, 0xA9, 0xE9, 0x00, 0x00, 0x07, 0x02, 0x00, 0x00, 0xE4, 0x62, 0x08, 0x00, 0xAC, 0x05, 0x00, 0x00, 0xFE, 0xB5, 0x07, 0x1C, 0x7D, 0x69, 0xBE, 0x69, 0x0C, 0x20, 0x30, 0x1A, 0x01, 0x90, 0xDF, 0x4C, 0x0A, 0x2D, 0x13, 0xD1, 0x30, 0x68, 0xDB, 0x49, 0x08, 0x60, 0x01, 0x20, 0x86, 0x46, 0xDA, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x0A, 0x20, 0x00, 0x21, 0x01, 0x9A, 0x01, 0x23, 0x9E, 0x46, 0xE6, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xF5, 0x20, 0x80, 0x00, 0x00, 0x19 ,
0x38, 0x62, 0x03, 0x2D, 0x79, 0xD1, 0xF5, 0x20, 0x80, 0x00, 0x00, 0x19, 0x02, 0x90, 0x70, 0x68, 0x00, 0x28, 0x0C, 0xD1, 0x00, 0x21, 0xCF, 0x48, 0x01, 0x60, 0xCF, 0x48, 0x00, 0x68, 0x00, 0x28, 0x61, 0xD0, 0x01, 0x21, 0x8E, 0x46, 0xCD, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x5B, 0xE0, 0xCC, 0x48, 0xB1, 0x68, 0x01, 0x60, 0xF1, 0x68, 0x41, 0x60, 0x31, 0x69, 0x81, 0x60, 0xFF, 0xFF, 0x66, 0x77, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x71, 0x69, 0xC1, 0x60, 0xB1, 0x69, 0xC1, 0x63, 0xF1, 0x69, 0x01, 0x64, 0x31, 0x6A, 0xC1, 0x64, 0x01, 0x24, 0xA6, 0x46, 0xC5, 0x48, 0xFE, 0x44, 0x00, 0x47, 0xA6, 0x46, 0xC4, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x70, 0x68, 0x7D, 0x25, 0xED, 0x00, 0xA8, 0x42, 0x21, 0xD8, 0x01, 0x28, 0x18, 0xD0, 0x02, 0x28, 0x05, 0xD0, 0x28, 0x1C, 0xA6, 0x46, 0xBE, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x1C, 0xE0, 0xB9, 0x48, 0x00, 0x23, 0x19, 0x1C, 0x59, 0x43, 0x3E, 0x22, 0x4A, 0x43, 0x82, 0x83, 0x02, 0x30 ,
0x01, 0x33, 0x10, 0x2B, 0xF6, 0xDB, 0xA6, 0x46, 0xB4, 0x48, 0xFE, 0x44, 0x00, 0x47, 0xB5, 0x48, 0x0D, 0xE0, 0xB5, 0x4D, 0x28, 0x1C, 0xA6, 0x46, 0xB2, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x04, 0xE0, 0xA6, 0x46, 0xAF, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x75, 0x68, 0xAE, 0x48, 0x05, 0x60, 0x05, 0x1C, 0xA7, 0x4E, 0x30, 0x68, 0x00, 0x28, 0x06, 0xD1, 0xAD, 0x48, 0x00, 0x68, 0xA6, 0x46, 0xAC, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x30, 0x60, 0xFF, 0xFF, 0xFC, 0x77, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x94, 0x2B, 0x68, 0xAA, 0x49, 0xAB, 0x4A, 0xA6, 0x46, 0xAB, 0x4D, 0xFE, 0x44, 0x28, 0x47, 0x9C, 0x48, 0x04, 0x60, 0x03, 0x20, 0x00, 0x21, 0x01, 0x9A, 0x01, 0x23, 0x9E, 0x46, 0xA7, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x02, 0x98, 0x38, 0x62, 0xFE, 0xBD, 0xC0, 0x46, 0x13, 0x7F, 0x03, 0x00, 0x12, 0x10, 0x00, 0x00, 0x30, 0xB5, 0x05, 0x1C, 0x00, 0x20, 0x01, 0x24, 0xA6, 0x46, 0xA0, 0x49, 0xFE, 0x44, 0x08, 0x47, 0xA6, 0x46 ,
0x9F, 0x49, 0xFE, 0x44, 0x08, 0x47, 0xA6, 0x46, 0x9E, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x7D, 0x21, 0xC9, 0x00, 0xA6, 0x46, 0x9E, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x9B, 0x49, 0x08, 0x18, 0x99, 0x49, 0x08, 0x80, 0x9B, 0x48, 0x0A, 0x30, 0x28, 0x62, 0x30, 0xBD, 0x11, 0x10, 0x00, 0x00, 0xDD, 0x7E, 0x03, 0x00, 0xB9, 0x90, 0x00, 0x00, 0x6C, 0x64, 0x08, 0x00, 0xE7, 0x7E, 0x03, 0x00, 0x74, 0x64, 0x08, 0x00, 0x70, 0x64, 0x08, 0x00, 0x6D, 0xC6, 0x03, 0x00, 0x08, 0x19, 0x1B, 0x00, 0x11, 0x18, 0xFF, 0xFF, 0x92, 0x78, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x02, 0x00, 0xD1, 0x78, 0x02, 0x00, 0xC9, 0xBA, 0x03, 0x00, 0x09, 0xB4, 0x03, 0x00, 0x14, 0x0D, 0x1B, 0x00, 0xFE, 0xB5, 0x02, 0x90, 0x45, 0x69, 0x68, 0x46, 0x01, 0x21, 0x8E, 0x46, 0x89, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x89, 0x48, 0x04, 0x1C, 0x68, 0x68, 0x01, 0x69, 0x4A, 0x78, 0x00, 0x27, 0x3E, 0x1C, 0x20, 0x88, 0x40, 0x08, 0x22, 0xD3, 0x20, 0x1D, 0x89, 0x1C ,
0x01, 0x23, 0x9E, 0x46, 0x83, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x07, 0xD1, 0x68, 0x68, 0x00, 0x69, 0x40, 0x78, 0x21, 0x88, 0x09, 0x04, 0x89, 0x16, 0x81, 0x42, 0x3D, 0xD0, 0x02, 0x20, 0x00, 0x5F, 0x00, 0x99, 0x08, 0x1A, 0x00, 0x04, 0x00, 0x14, 0x3C, 0x28, 0x03, 0xDD, 0x20, 0x88, 0x40, 0x10, 0x40, 0x00, 0x20, 0x80, 0x78, 0x1C, 0x07, 0x06, 0x3F, 0x0E, 0x68, 0x68, 0x01, 0x69, 0x4A, 0x78, 0x2A, 0x34, 0x01, 0x36, 0x14, 0x2E, 0xD5, 0xDB, 0x00, 0x2A, 0x02, 0xD1, 0xAB, 0x20, 0x40, 0x00, 0x50, 0xE0, 0x00, 0x9B, 0x6D, 0x48, 0x14, 0x21, 0xFF, 0xFF, 0x28, 0x79, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x22, 0x04, 0x88, 0x64, 0x08, 0x03, 0xD3, 0x2A, 0x30, 0x01, 0x32, 0x01, 0x39, 0xF8, 0xD1, 0x12, 0x06, 0x12, 0x0E, 0x14, 0x2F, 0x16, 0xD1, 0x66, 0x48, 0x00, 0x88, 0x00, 0x06, 0x44, 0x16, 0x64, 0x49, 0x00, 0x22, 0x01, 0x20, 0x4E, 0x8D, 0x36, 0x06, 0x76, 0x16, 0xA6, 0x42, 0x02, 0xDD, 0x34, 0x1C ,
0x02, 0x06, 0x12, 0x0E, 0x2A, 0x31, 0x01, 0x30, 0x14, 0x28, 0xF3, 0xDB, 0x02, 0xE0, 0x32, 0x06, 0x12, 0x0E, 0x00, 0x9B, 0x2A, 0x20, 0x42, 0x43, 0x5A, 0x48, 0x11, 0x18, 0x0C, 0x88, 0x01, 0x20, 0x20, 0x43, 0x00, 0x04, 0x00, 0x0C, 0x08, 0x80, 0xFE, 0x24, 0xA0, 0x43, 0x14, 0x24, 0x64, 0x57, 0x64, 0x06, 0x24, 0x0E, 0x04, 0x43, 0x52, 0x48, 0x14, 0x52, 0x14, 0x18, 0x63, 0x80, 0x08, 0x88, 0x80, 0x05, 0x82, 0x0D, 0x68, 0x68, 0x00, 0x69, 0x40, 0x78, 0x80, 0x02, 0x10, 0x43, 0x08, 0x80, 0x68, 0x68, 0x02, 0x69, 0x20, 0x1D, 0x91, 0x1C, 0x52, 0x78, 0x01, 0x23, 0x9E, 0x46, 0x4B, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xFF, 0xFF, 0xBE, 0x79, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x02, 0x98, 0x04, 0x61, 0xFE, 0x20, 0x47, 0x49, 0x09, 0x18, 0x02, 0x98, 0x01, 0x62, 0xFE, 0xBD, 0x82, 0x69, 0x41, 0x69, 0x03, 0x69, 0x02, 0x2B, 0x0A, 0xD1, 0x01, 0x2A, 0x01, 0xD1, 0x00, 0x29, 0x05, 0xD0, 0x02, 0x2A, 0x04, 0xD1, 0x00, 0x29 ,
0x02, 0xD1, 0x11, 0x21, 0x00, 0xE0, 0x06, 0x21, 0x41, 0x61, 0xF7, 0x46, 0xC0, 0x46, 0x14, 0xE9, 0x00, 0x00, 0xC9, 0x18, 0x02, 0x00, 0x30, 0xB5, 0x05, 0x1C, 0x3A, 0x48, 0x00, 0x78, 0x00, 0x28, 0x04, 0xD0, 0x01, 0x20, 0x86, 0x46, 0x38, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x01, 0x24, 0xA6, 0x46, 0x37, 0x48, 0xFE, 0x44, 0x00, 0x47, 0xA6, 0x46, 0x36, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x35, 0x48, 0x0E, 0x30, 0x28, 0x62, 0x30, 0xBD, 0x49, 0x19, 0x01, 0x00, 0x2F, 0x7A, 0x02, 0x00, 0x18, 0xB5, 0x43, 0x69, 0x81, 0x69, 0x31, 0x48, 0x81, 0x29, 0x00, 0xD1, 0x0B, 0x38, 0x00, 0x21, 0x00, 0x91, 0x1A, 0x68, 0x9B, 0x68, 0x01, 0x24, 0xA6, 0x46, 0x2D, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0xFF, 0xFF, 0x54, 0x7A, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x18, 0xBD, 0x18, 0xB5, 0x40, 0x69, 0x00, 0x21, 0x00, 0x91, 0x02, 0x68, 0x83, 0x68, 0x27, 0x48, 0x01, 0x30, 0x01, 0x24, 0xA6, 0x46, 0x26, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x18, 0xBD ,
0xC0, 0x46, 0x30, 0x63, 0x08, 0x00, 0x19, 0x9E, 0x00, 0x00, 0xB9, 0xEC, 0x00, 0x00, 0x74, 0x3F, 0x08, 0x00, 0x80, 0x3F, 0x08, 0x00, 0xB7, 0x5D, 0x03, 0x00, 0x00, 0x00, 0x1B, 0x00, 0xD3, 0x8E, 0x00, 0x00, 0xF7, 0xC6, 0x00, 0x00, 0xE5, 0x90, 0x00, 0x00, 0x68, 0x64, 0x08, 0x00, 0xC0, 0x27, 0x09, 0x00, 0xA0, 0x3B, 0x08, 0x00, 0x3D, 0x5D, 0x03, 0x00, 0x19, 0xC6, 0x00, 0x00, 0xE8, 0x3A, 0x08, 0x00, 0x81, 0x5D, 0x03, 0x00, 0xCF, 0xF6, 0x00, 0x00, 0x4B, 0x4F, 0x03, 0x00, 0x6B, 0xC0, 0x03, 0x00, 0x95, 0x1E, 0x01, 0x00, 0xDA, 0x40, 0x08, 0x00, 0xDC, 0x05, 0x00, 0x00, 0x55, 0xAA, 0x03, 0x00, 0x0D, 0x91, 0x00, 0x00, 0xD7, 0x56, 0x03, 0x00, 0x08, 0x51, 0x08, 0x00, 0x8F, 0xC6, 0x03, 0x00, 0x65, 0xB8, 0x00, 0x00, 0x09, 0xB4, 0xFF, 0xFF, 0xEA, 0x7A, 0x08, 0x00, 0x8C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x84, 0x17, 0x1B, 0x00, 0xB5, 0x86, 0x01, 0x00, 0x3D, 0x47, 0x02, 0x00, 0x73, 0x49, 0x02, 0x00, 0x5F, 0x90 ,
0x00, 0x00, 0x0E, 0x10, 0x00, 0x00, 0xF7, 0xF6, 0x00, 0x00, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x76, 0xFF, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x5A, 0xFF, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x99, 0xFF, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x83, 0xFF, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0xB6, 0xFE, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x55, 0xFC, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x27, 0xFB, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0xDD, 0xFA, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x68, 0xFE, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x3D, 0xFB, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0xBE, 0xFD, 0xFF, 0xBD, 0x78, 0x7B, 0x08, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xF8, 0xF0, 0x43, 0xFA, 0x00, 0xBD, 0x35, 0x66, 0x08, 0x00, 0x67, 0x66, 0x08, 0x00, 0x71, 0x65, 0x08, 0x00, 0x4D, 0x66 ,
0x08, 0x00, 0x25, 0x64, 0x08, 0x00, 0x81, 0x66, 0x08, 0x00, 0x8D, 0x66, 0x08, 0x00, 0x99, 0x66, 0x08, 0x00, 0x87, 0x67, 0x08, 0x00, 0xA7, 0x67, 0x08, 0x00, 0xD1, 0x67, 0x08, 0x00, 0x1B, 0x68, 0x08, 0x00, 0x57, 0x68, 0x08, 0x00, 0x39, 0x69, 0x08, 0x00, 0xFD, 0x6B, 0x08, 0x00, 0x17, 0x6C, 0x08, 0x00, 0x39, 0x6C, 0x08, 0x00, 0x61, 0x6C, 0x08, 0x00, 0xA1, 0x68, 0x08, 0x00, 0x95, 0x6C, 0x08, 0x00, 0xEB, 0x6D, 0x08, 0x00, 0x43, 0x6E, 0x08, 0x00, 0x6D, 0x6E, 0x08, 0x00, 0x3D, 0x6F, 0x08, 0x00, 0x1D, 0x6D, 0x08, 0x00, 0xE5, 0x6E, 0x08, 0x00, 0x11, 0x6E, 0x08, 0x00, 0xC9, 0x6F, 0x08, 0x00, 0x65, 0x70, 0x08, 0x00, 0x31, 0x64, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xF3, 0x1A, 0x00, 0x80, 0x00, 0x00, 0x00, 0xB2, 0x4E, 0x01, 0x00, 0x5A, 0xC1, 0x00, 0x00, 0x96, 0x1A, 0x01, 0x00, 0x22, 0x0B, 0x02, 0x00, 0x60, 0xD0, 0x01, 0x00, 0x06, 0x1A, 0x00, 0x00, 0xB8, 0xC6, 0x01, 0x00 ,
0xD8, 0x42, 0x03, 0x00, 0x16, 0x42, 0x03, 0x00, 0xEE, 0xDB, 0x00, 0x00, 0x62, 0xDC, 0x00, 0x00, 0xC8, 0xE1, 0x00, 0x00, 0x8A, 0x17, 0x02, 0x00, 0x38, 0xBE, 0x00, 0x00, 0x26, 0xC6, 0x00, 0x00, 0x56, 0xC2, 0x00, 0x00, 0x62, 0x12, 0x03, 0x00, 0xE4, 0xF4, 0x01, 0x00, 0x3A, 0xEC, 0x00, 0x00, 0x5E, 0x92, 0x00, 0x00, 0xFE, 0xE8, 0x02, 0x00, 0x18, 0x7F, 0x00, 0x00, 0x64, 0xEC, 0x01, 0x00, 0xFE, 0x44, 0x03, 0x00, 0x1C, 0x94, 0x00, 0x00, 0xA8, 0x66, 0x03, 0x00, 0x74, 0xE9, 0x02, 0x00, 0x68, 0x1E, 0x01, 0x00, 0xBC, 0xDA, 0x00, 0x00, 0xEA, 0xE1, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x18, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0x1A, 0xF0, 0xB5, 0x88, 0xB0, 0xCA, 0x4C, 0x03, 0x20, 0x22, 0x78, 0x63, 0x78, 0xCA, 0x4E, 0x31, 0x1C, 0x01, 0x39, 0x01, 0x25, 0xAE, 0x46, 0xC7, 0x4F, 0xFE, 0x44, 0x38, 0x47, 0xA2, 0x78, 0xE3, 0x78, 0x03, 0x20, 0x31, 0x1C, 0xAE, 0x46 ,
0xC3, 0x4F, 0xFE, 0x44, 0x38, 0x47, 0x03, 0x20, 0x31, 0x1C, 0x01, 0x31, 0xAE, 0x46, 0xC1, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0xC1, 0x48, 0x21, 0x78, 0x01, 0x70, 0x61, 0x78, 0x41, 0x70, 0xE1, 0x78, 0xC1, 0x70, 0xA1, 0x78, 0x81, 0x70, 0xBF, 0x48, 0x04, 0x1C, 0x33, 0x3C, 0x20, 0x1C, 0x00, 0x21, 0xDC, 0x22, 0xAE, 0x46, 0xBA, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x84, 0x20, 0xA0, 0x70, 0x05, 0x27, 0xE7, 0x71, 0x0C, 0x26, 0x26, 0x73, 0x0D, 0x20, 0x00, 0x19, 0x98, 0xA1, 0x32, 0x1C, 0xAE, 0x46, 0xB4, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x04, 0x20, 0x60, 0x76, 0x1A, 0x20, 0x00, 0x19, 0x97, 0xA1, 0x06, 0x91, 0x04, 0x22, 0xAE, 0x46, 0xAE, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xFF, 0xFF, 0x96, 0x00, 0x18, 0x00, 0x96, 0x00, 0x00, 0x00, 0xA7, 0x77, 0x1F, 0x34, 0x95, 0xA1, 0x07, 0x91, 0x20, 0x1C, 0x3A, 0x1C, 0xAE, 0x46, 0xA9, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xE6, 0x71, 0x28, 0x1C, 0x60, 0x72, 0x11, 0x20, 0x20, 0x73, 0x94, 0x20 ,
0x60, 0x73, 0xC0, 0x25, 0x65, 0x74, 0xA6, 0x74, 0x09, 0x22, 0xE2, 0x74, 0xA3, 0x4C, 0x20, 0x1C, 0x8C, 0xA1, 0x01, 0x23, 0x9E, 0x46, 0x9F, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x07, 0x22, 0x62, 0x72, 0x9E, 0x4C, 0x0A, 0x34, 0x20, 0x1C, 0x89, 0xA1, 0x01, 0x23, 0x9E, 0x46, 0x9A, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x04, 0x20, 0xE0, 0x71, 0x98, 0x4C, 0x12, 0x34, 0x20, 0x1C, 0x06, 0x99, 0x04, 0x22, 0x01, 0x23, 0x9E, 0x46, 0x94, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x27, 0x71, 0x93, 0x4C, 0x17, 0x34, 0x20, 0x1C, 0x07, 0x99, 0x3A, 0x1C, 0x01, 0x23, 0x9E, 0x46, 0x8E, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xE6, 0x71, 0x01, 0x20, 0x60, 0x72, 0x11, 0x20, 0x20, 0x73, 0x94, 0x20, 0x60, 0x73, 0x02, 0x20, 0xE0, 0x73, 0x25, 0x74, 0x66, 0x74, 0xFF, 0xFF, 0x2C, 0x01, 0x18, 0x00, 0x96, 0x00, 0x00, 0x00, 0xA5, 0x74, 0x2F, 0x27, 0xE7, 0x74, 0x10, 0x20, 0x60, 0x75, 0x80, 0x26, 0xA6, 0x75, 0x01, 0x20, 0xE0, 0x75, 0x11, 0x20, 0xA0, 0x76 ,
0x94, 0x20, 0xE0, 0x76, 0x24, 0x20, 0x60, 0x77, 0x0A, 0x22, 0xA2, 0x77, 0x80, 0x4C, 0x36, 0x34, 0x20, 0x1C, 0x6D, 0xA1, 0x01, 0x23, 0x9E, 0x46, 0x7C, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x18, 0x22, 0xA2, 0x72, 0x7A, 0x4C, 0x41, 0x34, 0x20, 0x1C, 0x6B, 0xA1, 0x01, 0x23, 0x9E, 0x46, 0x76, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x25, 0x76, 0x67, 0x76, 0x21, 0x20, 0xE0, 0x76, 0x26, 0x77, 0x01, 0x20, 0x60, 0x77, 0x72, 0x48, 0x61, 0x30, 0x11, 0x21, 0x01, 0x70, 0x94, 0x21, 0x41, 0x70, 0x04, 0x21, 0x01, 0x72, 0xD2, 0x21, 0x41, 0x72, 0xC5, 0x72, 0x1E, 0x21, 0x01, 0x73, 0x45, 0x73, 0x9E, 0x21, 0x81, 0x73, 0x01, 0x21, 0x01, 0x74, 0x46, 0x74, 0x81, 0x74, 0x11, 0x21, 0x41, 0x75, 0x94, 0x21, 0x81, 0x75, 0x04, 0x21, 0x01, 0x76, 0xAD, 0x20, 0x66, 0x49, 0x08, 0x60, 0x00, 0x24, 0x0F, 0x25, 0xFF, 0xFF, 0xC2, 0x01, 0x18, 0x00, 0x96, 0x00, 0x00, 0x00, 0x29, 0x06, 0x09, 0x0E, 0x00, 0x20, 0x6A, 0x46, 0x01, 0x23, 0x9E, 0x46 ,
0x62, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x6B, 0x46, 0x18, 0x88, 0x40, 0x08, 0x0E, 0xD3, 0xA0, 0x00, 0x0F, 0x21, 0xCA, 0x43, 0x69, 0x46, 0x0E, 0x88, 0x16, 0x40, 0x01, 0xAF, 0x3E, 0x52, 0x49, 0x88, 0x11, 0x40, 0x68, 0x44, 0xC1, 0x80, 0x60, 0x1C, 0x04, 0x04, 0x24, 0x0C, 0x01, 0x3D, 0x0B, 0x2D, 0xE0, 0xDA, 0x60, 0x1E, 0x00, 0x04, 0x00, 0x0C, 0x1D, 0xD0, 0x86, 0x46, 0x01, 0x1C, 0x01, 0xAD, 0x01, 0x22, 0xAE, 0x88, 0x90, 0x00, 0xC7, 0x5A, 0xB7, 0x42, 0x0A, 0xDA, 0xBC, 0x46, 0x07, 0x1C, 0x6F, 0x44, 0x7F, 0x88, 0x68, 0x44, 0x06, 0x80, 0xEE, 0x88, 0x46, 0x80, 0x60, 0x46, 0xA8, 0x80, 0xEF, 0x80, 0x04, 0x35, 0x50, 0x1C, 0x02, 0x04, 0x12, 0x0C, 0x01, 0x39, 0xE9, 0xD1, 0x70, 0x46, 0x01, 0x38, 0x86, 0x46, 0xE2, 0xD1, 0x99, 0x88, 0x68, 0x46, 0xC0, 0x88, 0x40, 0x18, 0x00, 0x04, 0x00, 0x0C, 0x42, 0x4B, 0x18, 0x80, 0x42, 0x49, 0x08, 0x1A, 0xFF, 0xFF, 0x58, 0x02, 0x18, 0x00, 0x96, 0x00, 0x00, 0x00, 0x58, 0x80 ,
0x02, 0x2C, 0x1E, 0xDB, 0x65, 0x1E, 0x01, 0xAA, 0x01, 0x20, 0x01, 0x1C, 0x8C, 0x00, 0x6B, 0x46, 0xE6, 0x5A, 0x93, 0x88, 0xD4, 0x88, 0xE7, 0x18, 0xB7, 0x42, 0x0C, 0xDA, 0x06, 0x24, 0x44, 0x43, 0x38, 0x4B, 0x1B, 0x19, 0x1F, 0x80, 0x1C, 0x88, 0x34, 0x1B, 0x5C, 0x80, 0x01, 0x24, 0x1C, 0x71, 0x40, 0x1C, 0x00, 0x04, 0x00, 0x0C, 0x04, 0x32, 0x49, 0x1C, 0x09, 0x06, 0x09, 0x0E, 0x01, 0x3D, 0xE4, 0xD1, 0x00, 0x24, 0x31, 0x48, 0x04, 0x70, 0x31, 0x48, 0x04, 0x70, 0x31, 0x48, 0x04, 0x70, 0x31, 0x48, 0x04, 0x70, 0x01, 0x20, 0x86, 0x46, 0x30, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x2F, 0x49, 0x22, 0x1C, 0x08, 0x68, 0x00, 0x28, 0x02, 0xD0, 0x01, 0x20, 0x90, 0x40, 0x04, 0x43, 0x04, 0x31, 0x01, 0x32, 0x20, 0x2A, 0xF5, 0xD3, 0x2A, 0x48, 0x04, 0x60, 0x08, 0xB0, 0xF0, 0xBD, 0x5F, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2D, 0x69, 0x6E, 0x66, 0x6F, 0x00, 0xC0, 0x46, 0xC0, 0x5F, 0x75, 0x64, 0x70, 0x00, 0xC0, 0xFF, 0xFF ,
0xEE, 0x02, 0x18, 0x00, 0x96, 0x00, 0x00, 0x00, 0x46, 0xC0, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x00, 0xC0, 0x46, 0x5F, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0xC0, 0x46, 0x5F, 0x64, 0x6E, 0x73, 0x2D, 0x73, 0x64, 0x00, 0x64, 0x65, 0x76, 0x3D, 0x43, 0x43, 0x33, 0x30, 0x30, 0x30, 0x00, 0xC0, 0x76, 0x65, 0x6E, 0x64, 0x6F, 0x72, 0x3D, 0x54, 0x65, 0x78, 0x61, 0x73, 0x2D, 0x49, 0x6E, 0x73, 0x74, 0x72, 0x75, 0x6D, 0x65, 0x6E, 0x74, 0x73, 0x00, 0xC0, 0x46, 0xC0, 0x00, 0x00, 0x18, 0x00, 0xF3, 0x7E, 0x03, 0x00, 0xC6, 0x05, 0x00, 0x00, 0xDD, 0x7E, 0x03, 0x00, 0xE4, 0x62, 0x08, 0x00, 0xC9, 0xBA, 0x03, 0x00, 0x09, 0xB4, 0x03, 0x00, 0xA7, 0x64, 0x08, 0x00, 0x70, 0x64, 0x08, 0x00, 0xDD, 0x0A, 0x02, 0x00, 0x48, 0x32, 0x08, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xE8, 0x62, 0x08, 0x00, 0xE9, 0x62, 0x08, 0x00, 0xEA, 0x62, 0x08, 0x00, 0xEB, 0x62, 0x08, 0x00, 0x81, 0x03, 0x18, 0x00, 0x80, 0x7B, 0x08, 0x00 ,
0x84, 0xF3, 0x1A, 0x00, 0x0D, 0x49, 0x0E, 0x48, 0xFF, 0xFF, 0x84, 0x03, 0x18, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x88, 0x67, 0x0E, 0x48, 0x88, 0x64, 0x0E, 0x48, 0x48, 0x64, 0x0E, 0x48, 0xC8, 0x64, 0x0E, 0x48, 0x08, 0x65, 0x11, 0x48, 0x02, 0x1C, 0x04, 0x32, 0x0C, 0x4B, 0x13, 0x60, 0x0C, 0x4B, 0x93, 0x62, 0x0C, 0x4A, 0x8A, 0x66, 0x0D, 0x49, 0x01, 0x60, 0x0D, 0x48, 0x0E, 0x49, 0x01, 0x60, 0x0E, 0x49, 0x41, 0x60, 0xF7, 0x46, 0x1C, 0x21, 0x08, 0x00, 0x4F, 0x7B, 0x08, 0x00, 0x45, 0x7B, 0x08, 0x00, 0x3B, 0x7B, 0x08, 0x00, 0x6D, 0x7B, 0x08, 0x00, 0x63, 0x7B, 0x08, 0x00, 0x59, 0x7B, 0x08, 0x00, 0x31, 0x7B, 0x08, 0x00, 0x13, 0x7B, 0x08, 0x00, 0x50, 0x23, 0x08, 0x00, 0x09, 0x7B, 0x08, 0x00, 0x58, 0x26, 0x08, 0x00, 0x27, 0x7B, 0x08, 0x00, 0x1D, 0x7B, 0x08, 0x00 };
uint16_t drv_length = 8076;
//Service Pack version P1.12.7.15.15 - FW patches
unsigned char PROGMEM fw_patch[5700] = { 0x00, 0x01, 0x00, 0x00, 0x3C, 0x16, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x14, 0x03, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x46, 0x25, 0xF0, 0x95, 0xFB, 0xE0, 0x6B, 0xD0, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x25, 0xF0, 0x38, 0xFB, 0x2C, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x25, 0xF0, 0x0A, 0xFB, 0x04, 0x15, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xB8, 0xF1, 0x90, 0x0F, 0xA4, 0x16, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x66, 0xE0, 0x04, 0xA8, 0x35, 0x1D, 0x21, 0xF0, 0x99, 0xFC, 0x68, 0x46, 0x23, 0xF0, 0x28, 0xFB, 0x9A, 0xF8, 0x00, 0x00, 0x01, 0x28, 0x07, 0xD1, 0x28, 0x46, 0x05, 0xF0, 0xC3, 0xFE, 0x01, 0x46, 0x01, 0xAA, 0x00, 0x20, 0x21, 0xF0, 0x50, 0xF9, 0x28, 0x46, 0x05, 0xF0, 0xBB, 0xFE, 0x01, 0xA9, 0x21, 0xF0, 0x2A, 0xFA, 0xE9, 0x79, 0x4F, 0xEA, 0xE0, 0x00, 0x40, 0xB2, 0x11, 0xB1, 0x00, 0xF1, 0x06, 0x00, 0x40, 0xB2, 0xA8, 0x71, 0x1F, 0x38, 0x40, 0x00, 0xE8, 0x71, 0x30, 0x46 ,
0x01, 0xF0, 0x0D, 0xFF, 0x10, 0xF1, 0x00, 0x09, 0x4F, 0xF0, 0x00, 0x01, 0x09, 0xD0, 0x28, 0x68, 0x40, 0x0C, 0x09, 0xD3, 0xE8, 0x68, 0xC0, 0x0B, 0x03, 0xD2, 0x48, 0x46, 0xFF, 0xF7, 0xDD, 0xFE, 0x01, 0x21, 0x28, 0x68, 0x40, 0x0C, 0x0A, 0xD2, 0x38, 0x68, 0x40, 0x1C, 0x38, 0x60, 0x20, 0x68, 0x6F, 0xF3, 0x0F, 0x00, 0x20, 0x60, 0x22, 0x68, 0x38, 0x68, 0x10, 0x43, 0x20, 0x60, 0xE8, 0x68, 0xC0, 0x0B, 0x0F, 0xD3, 0xD8, 0xF8, 0x00, 0x00, 0x00, 0xF1, 0x01, 0x00, 0xC8, 0xF8, 0x00, 0x00, 0x20, 0x68, 0x6F, 0xF3, 0x1F, 0x40, 0x20, 0x60, 0xD8, 0xF8, 0x00, 0x20, 0x20, 0x68, 0x40, 0xEA, 0x02, 0x40, 0x20, 0x60, 0x49, 0xB9, 0xB9, 0xF1, 0x00, 0x0F, 0x03, 0xD1, 0x30, 0x46, 0x07, 0xF0, 0xBE, 0xF9, 0x02, 0xE0, 0x48, 0x46, 0x07, 0xF0, 0x06, 0xFA, 0x6C, 0x17, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x68, 0x46, 0x0E, 0xF0, 0x85, 0xFB, 0x00, 0x9E, 0x00, 0x2E, 0x96, 0xD1, 0x05, 0xB0, 0xBD, 0xE8, 0xF0, 0x87, 0xC0, 0x46 ,
0x9C, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0xF0, 0x2A, 0xFE, 0x74, 0x47, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0B, 0x21, 0x21, 0xF0, 0x41, 0xFA, 0x20, 0x68, 0x18, 0x4B, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x21, 0xF0, 0x1C, 0xF9, 0x0A, 0xE0, 0x20, 0x68, 0x00, 0x68, 0x0C, 0x21, 0x40, 0xF0, 0x20, 0x00, 0x21, 0xF0, 0x14, 0xF9, 0x10, 0x57, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0xA8, 0x20, 0xF0, 0x97, 0xF9, 0x01, 0x98, 0x5C, 0x57, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0xA8, 0x20, 0xF0, 0x71, 0xF9, 0x03, 0x98, 0x00, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0xF0, 0x20, 0xF9, 0x1C, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0xF0, 0x12, 0xF9, 0x54, 0x58, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0xA8, 0x20, 0xF0, 0xF5, 0xF8, 0x04, 0xAB, 0x04, 0x62, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x79, 0x1F, 0xF0, 0x1B, 0xFD, 0x69, 0xE0, 0x60, 0x93, 0x00, 0x00, 0x40, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0xA6, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x78, 0x1B, 0xF0, 0x39, 0xFB, 0x28, 0x46, 0x90, 0xA8, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x78, 0x1B, 0xF0, 0x69, 0xF9, 0x1E, 0x48, 0x34, 0xAD, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x09, 0x68, 0xFF, 0x29, 0x98, 0xAD, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10, 0xD4, 0x21, 0xD4, 0xB2, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0xD0, 0x1A, 0xF0, 0x47, 0xFC, 0x20, 0x98, 0xAC, 0xC5, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x78, 0x19, 0xF0 ,
0xDB, 0xFA, 0x09, 0x49, 0x28, 0xC6, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x19, 0xF0, 0x9E, 0xFA, 0xDC, 0xD3, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xB5, 0x18, 0xF0, 0xAB, 0xFC, 0x00, 0xF0, 0x03, 0xF8, 0x00, 0xBD, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xDF, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0xF0, 0xA8, 0xFD, 0xCC, 0xEB, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x38, 0x78, 0x17, 0xF0, 0x77, 0xF8, 0x38, 0x78, 0x16, 0xF0, 0xF0, 0xFF, 0xA8, 0xF7, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0E, 0x49, 0x09, 0x68, 0x23, 0x22, 0x41, 0x61, 0xC8, 0xF7, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x31, 0x2E, 0x31, 0x39, 0x2E, 0x33, 0x31, 0x34, 0x5F, 0x4E, 0x65, 0x77, 0x5F, 0x43, 0x43, 0x41, 0x5F, 0x61, 0x6C, 0x67, 0x6F, 0x72, 0x69, 0x74, 0x68, 0x6D, 0x00, 0xC0, 0x74, 0x56, 0x30, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0xF9, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0xA8, 0x16, 0xF0, 0x79, 0xF8 ,
0x12, 0xE0, 0x38, 0xFA, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0xA8, 0x16, 0xF0, 0x03, 0xF8, 0x32, 0x20, 0x94, 0xFB, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x0C, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x05, 0xA8, 0x14, 0xF0, 0x05, 0xFF, 0x01, 0xF0, 0x10, 0x1B, 0x01, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x1E, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0xF0, 0x46, 0xBF, 0x18, 0x30, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x30, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x12, 0xF0, 0xD8, 0xFC, 0x9C, 0x31, 0x01, 0x00, 0x08, 0x00 ,
0x00, 0x00, 0x68, 0x46, 0x12, 0xF0, 0x51, 0xFC, 0xFE, 0xF7, 0xF0, 0x35, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x46, 0x12, 0xF0, 0x27, 0xFA, 0xFE, 0xF7, 0xF0, 0x3D, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x05, 0xA9, 0x11, 0xF0, 0x27, 0xFE, 0x20, 0x6F, 0xD0, 0x62, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0F, 0xF0, 0xB8, 0xFB, 0x80, 0x7E, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0xDF, 0xF8, 0x58, 0x82, 0xE0, 0x7E, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0D, 0xF0, 0x6A, 0xFE, 0x0B, 0xF0, 0x9A, 0xF9, 0x03, 0x20, 0xA8, 0xF5, 0x88, 0x71, 0x08, 0x60, 0xF2, 0xF7, 0x16, 0xF9, 0x7A, 0x48, 0x6B, 0x49, 0x9C, 0x7F, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x70, 0x51, 0x4D, 0xC4, 0x7F, 0x01, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x40, 0x49, 0x00, 0xF1, 0x52, 0x00, 0x3A, 0x4A, 0xA8, 0x81, 0x28, 0x83, 0xE8, 0x83, 0xE8, 0x84, 0xA8, 0x85, 0x2A, 0x60, 0x39, 0x48, 0x41, 0xF2, 0x11, 0x12, 0x2A, 0x85, 0x18, 0x90, 0x19, 0x91 ,
0x39, 0x49, 0x1A, 0x91, 0x39, 0x49, 0x1B, 0x91, 0x39, 0x49, 0x20, 0x46, 0xDF, 0xF8, 0xC4, 0x90, 0x1C, 0x91, 0x38, 0x49, 0xDF, 0xF8, 0xC0, 0xB0, 0x31, 0x4E, 0x1D, 0x91, 0x48, 0x80, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0D, 0xF0, 0x7C, 0xFA, 0xB4, 0x80, 0x01, 0x00, 0x34, 0x00, 0x00, 0x00, 0x34, 0x12, 0x66, 0x09, 0x84, 0x6B, 0x00, 0x20, 0x94, 0x70, 0x00, 0x20, 0xB4, 0x70, 0x00, 0x20, 0xC4, 0x78, 0x00, 0x20, 0x50, 0x7A, 0x00, 0x20, 0xFE, 0xFF, 0x03, 0x00, 0xA4, 0x70, 0x00, 0x20, 0xB0, 0x70, 0x00, 0x20, 0xB8, 0x70, 0x00, 0x20, 0x60, 0x55, 0x30, 0x80, 0x3C, 0x5C, 0x00, 0x20, 0x04, 0x74, 0x00, 0x20, 0xB8, 0xE4, 0x01, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x20, 0x78, 0x07, 0xF0, 0x01, 0xFC, 0x20, 0x78, 0x07, 0xF0, 0x7A, 0xFB, 0x04, 0x4D, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x2D, 0xE9, 0xF0, 0x4F, 0xAD, 0xF1, 0x8C, 0x0D, 0x04, 0x68, 0x0F, 0x30, 0x03, 0x94, 0xFE, 0xF7, 0xDB, 0xFA, 0x04, 0xF1, 0x14, 0x00 ,
0x04, 0x90, 0x21, 0x7D, 0x00, 0x20, 0x21, 0xF0, 0x73, 0x01, 0x88, 0x29, 0x08, 0xBF, 0x01, 0x20, 0x05, 0x90, 0x03, 0x98, 0x00, 0x1D, 0x06, 0x90, 0x5D, 0x48, 0x00, 0x68, 0x01, 0x28, 0x40, 0xF0, 0xFA, 0x83, 0x5B, 0x4D, 0x5C, 0x48, 0xDF, 0xF8, 0x70, 0x91, 0x29, 0x68, 0xDF, 0xF8, 0x70, 0x81, 0xDF, 0xF8, 0x74, 0xA1, 0x88, 0x42, 0x21, 0xD1, 0x10, 0x22, 0x00, 0x21, 0x48, 0x46, 0x4F, 0x46, 0xFB, 0xF7, 0xB7, 0xFE, 0x10, 0x22, 0x00, 0x21, 0x40, 0x46, 0xFB, 0xF7, 0xB2, 0xFE, 0x54, 0x49, 0x08, 0x68, 0x40, 0xF4, 0x80, 0x10, 0x08, 0x60, 0x01, 0x20, 0x51, 0x46, 0x08, 0x60, 0x00, 0x21, 0x29, 0x60, 0x39, 0x78, 0x46, 0x46, 0x00, 0x91, 0x31, 0x78, 0x41, 0xF2, 0x11, 0x13, 0x04, 0x22, 0x01, 0x91, 0x07, 0x21, 0x02, 0x90, 0x03, 0x20, 0xF3, 0xF7, 0x41, 0xFC, 0x51, 0x46, 0x07, 0x91, 0x08, 0x68, 0x56, 0x49, 0xDF, 0xF8, 0x5C, 0xB1, 0x01, 0x28, 0x08, 0x91, 0x56, 0x49, 0xDF, 0xF8, 0x48, 0xA1, 0x09, 0x91, 0x55, 0x49 ,
0x0A, 0x91, 0x44, 0x49, 0x0B, 0x91, 0x44, 0x49, 0x0C, 0x91, 0x44, 0x49, 0x0D, 0x91, 0x44, 0x49, 0x0E, 0x91, 0x44, 0x49, 0x0F, 0x91, 0x44, 0x49, 0x10, 0x91, 0x44, 0x49, 0xCC, 0x4D, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x11, 0x91, 0x44, 0x49, 0x12, 0x91, 0x44, 0x49, 0x13, 0x91, 0x44, 0x49, 0x14, 0x91, 0x44, 0x49, 0x15, 0x91, 0x44, 0x49, 0x16, 0x91, 0x9F, 0x49, 0x17, 0x91, 0x9F, 0x49, 0x18, 0x91, 0x9F, 0x49, 0x19, 0x91, 0x9F, 0x49, 0x1A, 0x91, 0x9F, 0x49, 0x1B, 0x91, 0x9F, 0x49, 0x1C, 0x91, 0x9F, 0x49, 0x1D, 0x91, 0x9F, 0x49, 0x1E, 0x91, 0x9F, 0x49, 0x1F, 0x91, 0x40, 0xF0, 0x00, 0x81, 0x04, 0x98, 0x40, 0x78, 0x00, 0xF0, 0x03, 0x01, 0x01, 0x29, 0x40, 0xF0, 0xF9, 0x80, 0x04, 0x99, 0x09, 0x78, 0x01, 0xF0, 0x0C, 0x01, 0x08, 0x29, 0x40, 0xF0, 0xF2, 0x80, 0x06, 0x99, 0x09, 0x88, 0xA1, 0xF1, 0x3C, 0x01, 0x0E, 0xB2, 0x05, 0x99, 0x11, 0xB1, 0xA6, 0xF1, 0x02, 0x06, 0x36, 0xB2, 0xC0, 0x09, 0x4F, 0xF0 ,
0x00, 0x07, 0x15, 0xD3, 0x08, 0x3E, 0x36, 0xB2, 0x03, 0x2E, 0x10, 0xD0, 0x17, 0x2E, 0x0E, 0xD0, 0x08, 0x3E, 0x36, 0xB2, 0x03, 0x2E, 0x08, 0xD0, 0x17, 0x2E, 0x06, 0xD0, 0x36, 0x1F, 0x36, 0xB2, 0x03, 0x2E, 0x14, 0xBF, 0x17, 0x2E, 0x02, 0x27, 0x02, 0xE0, 0x03, 0x27, 0x00, 0xE0, 0x01, 0x27, 0x03, 0x2E, 0x18, 0xBF, 0x17, 0x2E, 0x04, 0x9A, 0x40, 0xF0, 0xC8, 0x80, 0x0A, 0x32, 0x12, 0xF8, 0x01, 0x1B, 0x05, 0x24, 0x12, 0xF8, 0x01, 0x3B, 0x4B, 0x40, 0x64, 0x1E, 0xD9, 0xB2, 0xF9, 0xD1, 0x81, 0xEA, 0x21, 0x11, 0x03, 0x2E, 0x94, 0x4E, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x01, 0xF0, 0x0F, 0x01, 0x48, 0x46, 0x35, 0xD0, 0x43, 0x46, 0xCA, 0x5C, 0x52, 0x1C, 0xCA, 0x54, 0x0C, 0x18, 0x33, 0xE0, 0x50, 0x57, 0x02, 0x00, 0x04, 0x74, 0x00, 0x20, 0x34, 0x12, 0x66, 0x09, 0x60, 0x57, 0x02, 0x00, 0x70, 0x57, 0x02, 0x00, 0xC8, 0x48, 0x30, 0x80, 0x4C, 0x57, 0x02, 0x00, 0x88, 0x57, 0x02, 0x00, 0x80, 0x57, 0x02, 0x00 ,
0x18, 0x58, 0x02, 0x00, 0x20, 0x58, 0x02, 0x00, 0x28, 0x58, 0x02, 0x00, 0x30, 0x58, 0x02, 0x00, 0x38, 0x58, 0x02, 0x00, 0x40, 0x58, 0x02, 0x00, 0xE4, 0x58, 0x02, 0x00, 0xE2, 0x58, 0x02, 0x00, 0x14, 0x58, 0x02, 0x00, 0xEF, 0x58, 0x02, 0x00, 0xE0, 0x58, 0x02, 0x00, 0xEE, 0x58, 0x02, 0x00, 0x5C, 0x57, 0x02, 0x00, 0xE6, 0x58, 0x02, 0x00, 0xE8, 0x58, 0x02, 0x00, 0x0C, 0x18, 0x20, 0x78, 0x40, 0x1C, 0x20, 0x70, 0x20, 0x78, 0x43, 0x46, 0x03, 0xEB, 0x01, 0x08, 0x0A, 0x28, 0x76, 0xDB, 0x98, 0xF8, 0x00, 0x00, 0x0A, 0x28, 0x72, 0xDB, 0x94, 0x48, 0x00, 0x25, 0x01, 0x60, 0x04, 0x98, 0x00, 0xF1, 0x0A, 0x09, 0x40, 0x78, 0x41, 0x08, 0x24, 0xBF, 0x04, 0x99, 0x09, 0x1D, 0x04, 0xD2, 0x80, 0x08, 0x2E, 0xBF, 0x49, 0x46, 0x04, 0x99, 0x10, 0x31, 0x0B, 0x98, 0x06, 0x22, 0xFA, 0xF7, 0xB9, 0xFC, 0x0C, 0x98, 0x06, 0x22, 0x49, 0x46, 0xFA, 0xF7, 0xB4, 0xFC, 0x9B, 0x48, 0x9A, 0x49, 0x5C, 0x4F, 0x02, 0x00, 0xC8, 0x00 ,
0x00, 0x00, 0x00, 0x78, 0x08, 0x22, 0x08, 0x60, 0x58, 0x46, 0x07, 0x60, 0x0D, 0x98, 0x29, 0x46, 0xFB, 0xF7, 0xAF, 0xFD, 0x08, 0x22, 0x0E, 0x98, 0x29, 0x46, 0xFB, 0xF7, 0xAA, 0xFD, 0x08, 0x22, 0x0F, 0x98, 0x29, 0x46, 0xFB, 0xF7, 0xA5, 0xFD, 0x08, 0x22, 0x10, 0x98, 0x29, 0x46, 0xFB, 0xF7, 0xA0, 0xFD, 0x08, 0x22, 0x11, 0x98, 0x29, 0x46, 0xFB, 0xF7, 0x9B, 0xFD, 0x08, 0x22, 0x12, 0x98, 0x29, 0x46, 0xFB, 0xF7, 0x96, 0xFD, 0x07, 0x99, 0x02, 0x20, 0x08, 0x60, 0x13, 0x99, 0x28, 0x46, 0x08, 0x80, 0x08, 0x99, 0x08, 0x70, 0x14, 0x99, 0x08, 0x70, 0x15, 0x99, 0x08, 0x60, 0x16, 0x99, 0x08, 0x70, 0x17, 0x99, 0x08, 0x60, 0x18, 0x99, 0x08, 0x60, 0x19, 0x99, 0x08, 0x60, 0x09, 0x99, 0x08, 0x80, 0x0A, 0x99, 0x08, 0x80, 0x1A, 0x99, 0x08, 0x80, 0x7D, 0x49, 0x0D, 0x60, 0x1B, 0x99, 0x08, 0x70, 0x1C, 0x99, 0x08, 0x70, 0x1D, 0x99, 0x08, 0x70, 0x1E, 0x99, 0x08, 0x80, 0x1F, 0x99, 0x08, 0x80, 0x51, 0x46, 0x08, 0x80 ,
0x20, 0x78, 0x00, 0x96, 0x04, 0x22, 0x01, 0x90, 0x98, 0xF8, 0x00, 0x00, 0x41, 0xF2, 0x14, 0x13, 0x07, 0x21, 0x02, 0x90, 0x03, 0x20, 0xF3, 0xF7, 0x07, 0xFB, 0x07, 0x98, 0xA2, 0x49, 0x00, 0x68, 0x20, 0x91, 0xA2, 0x49, 0x05, 0x28, 0x21, 0x91, 0x9E, 0x49, 0x22, 0x91, 0x40, 0xF0, 0x37, 0x82, 0x04, 0x98, 0x40, 0x78, 0x24, 0x50, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x41, 0x08, 0x24, 0xBF, 0x04, 0x99, 0x09, 0x1D, 0x05, 0xD2, 0x80, 0x08, 0x27, 0xBF, 0x04, 0x99, 0x0A, 0x31, 0x04, 0x99, 0x10, 0x31, 0x0B, 0x98, 0xF8, 0xF7, 0x2D, 0xFC, 0x01, 0x28, 0x04, 0x98, 0x40, 0xF0, 0x23, 0x82, 0x40, 0x78, 0x00, 0xF0, 0x03, 0x00, 0x03, 0x28, 0x18, 0xD0, 0x02, 0x28, 0x07, 0xBF, 0x04, 0x99, 0x10, 0x31, 0x04, 0x99, 0x0A, 0x31, 0x13, 0xE0, 0x48, 0x58, 0x02, 0x00, 0x4C, 0x58, 0x02, 0x00, 0x50, 0x58, 0x02, 0x00, 0xF0, 0x58, 0x02, 0x00, 0xF2, 0x58, 0x02, 0x00, 0xF3, 0x58, 0x02, 0x00, 0xF4, 0x58, 0x02, 0x00, 0xEA, 0x58 ,
0x02, 0x00, 0xEC, 0x58, 0x02, 0x00, 0x04, 0x99, 0x18, 0x31, 0x0C, 0x98, 0xF8, 0xF7, 0x06, 0xFC, 0x04, 0x99, 0x01, 0x28, 0x40, 0xF0, 0xFC, 0x81, 0x49, 0x78, 0x01, 0xF0, 0x03, 0x01, 0x01, 0x29, 0x40, 0xF0, 0xF6, 0x81, 0x59, 0x46, 0x09, 0x68, 0x04, 0x9A, 0x8E, 0x46, 0x51, 0x46, 0xD2, 0x8A, 0x0B, 0x88, 0x12, 0x11, 0x93, 0x42, 0x00, 0xF0, 0x37, 0x82, 0x0A, 0x80, 0x06, 0x99, 0x09, 0x88, 0x3C, 0x39, 0x0B, 0xB2, 0x71, 0x46, 0x49, 0x1E, 0x09, 0xD0, 0x49, 0x1E, 0x04, 0xD0, 0x49, 0x1E, 0x08, 0xD1, 0xA3, 0xF1, 0x10, 0x03, 0x04, 0xE0, 0xA3, 0xF1, 0x14, 0x03, 0x01, 0xE0, 0xA3, 0xF1, 0x08, 0x03, 0x1B, 0xB2, 0x05, 0x98, 0x10, 0xB1, 0xA3, 0xF1, 0x02, 0x03, 0x1B, 0xB2, 0xEC, 0x50, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x00, 0xF1, 0xCE, 0x81, 0x16, 0x98, 0x40, 0xF2, 0x77, 0x51, 0x99, 0x42, 0x0B, 0x90, 0x14, 0x98, 0x05, 0x90, 0x00, 0xF0, 0xA3, 0x81, 0x08, 0x46, 0x00, 0xF1, 0x3C, 0x00, 0x98, 0x42 ,
0x05, 0x9A, 0x00, 0xF0, 0x9A, 0x81, 0xDF, 0xF8, 0x48, 0x82, 0x14, 0x78, 0x0B, 0x9A, 0xBB, 0x2C, 0x12, 0x78, 0x0C, 0x92, 0x63, 0xD1, 0xDD, 0xF8, 0x68, 0xC0, 0xBC, 0xF9, 0x00, 0x20, 0x91, 0x42, 0x18, 0xBF, 0x90, 0x42, 0x5B, 0xD1, 0x1C, 0x2B, 0x4F, 0xF0, 0x00, 0x00, 0xC0, 0xF2, 0x82, 0x81, 0x3D, 0x2B, 0x13, 0x9D, 0x80, 0xF2, 0x7E, 0x81, 0xA3, 0xF1, 0x1C, 0x01, 0x09, 0xB2, 0x29, 0x80, 0x1E, 0x9A, 0xDD, 0xF8, 0x30, 0x90, 0xB2, 0xF9, 0x00, 0x60, 0xB9, 0xF1, 0x01, 0x0F, 0x15, 0xD1, 0xDD, 0xF8, 0x24, 0x90, 0x03, 0x2E, 0x0D, 0xDA, 0xB9, 0xF9, 0x00, 0x70, 0xB9, 0x42, 0x07, 0xD0, 0x01, 0x26, 0x16, 0x80, 0x4A, 0x46, 0x0E, 0x46, 0x03, 0xE0, 0xC0, 0x46, 0x90, 0x57, 0x02, 0x00, 0x76, 0x1C, 0x16, 0x80, 0x1B, 0x9A, 0x16, 0x78, 0x1D, 0x9A, 0x16, 0x70, 0x0C, 0x9A, 0x1F, 0x9E, 0x02, 0x2A, 0x28, 0xD1, 0xB6, 0xF9, 0x00, 0x20, 0xBE, 0xF1, 0x00, 0x0F, 0x1A, 0xD0, 0x03, 0x2A, 0x35, 0x46, 0x0B, 0xDA, 0x0A, 0x9E ,
0xB6, 0xF9, 0x00, 0x70, 0xB9, 0x42, 0x04, 0xD0, 0x01, 0x22, 0x2A, 0x80, 0x0A, 0x46, 0x35, 0x46, 0x00, 0xE0, 0xB4, 0x51, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x52, 0x1C, 0x2A, 0x80, 0x1C, 0x99, 0x0A, 0x78, 0x1D, 0x99, 0x0A, 0x70, 0x0F, 0xE0, 0xC0, 0x46, 0x58, 0x57, 0x02, 0x00, 0xA6, 0x64, 0x00, 0x20, 0x54, 0x57, 0x02, 0x00, 0x28, 0x80, 0x05, 0x99, 0x08, 0x70, 0x08, 0x9A, 0x11, 0x78, 0x41, 0xF0, 0x04, 0x01, 0x11, 0x70, 0x04, 0x46, 0x45, 0x46, 0xAC, 0xF8, 0x00, 0x00, 0x28, 0x70, 0xCC, 0x2C, 0x09, 0x9A, 0x40, 0xF0, 0x00, 0x81, 0xDD, 0xF8, 0x7C, 0xC0, 0x0A, 0x99, 0x1E, 0x9F, 0x45, 0x46, 0xB1, 0xF9, 0x00, 0x60, 0xB2, 0xF9, 0x00, 0x90, 0x28, 0x78, 0xCD, 0xF8, 0x50, 0xC0, 0x16, 0x91, 0x0A, 0x97, 0x13, 0x92, 0x09, 0x95, 0x0C, 0x99, 0x01, 0x29, 0x05, 0xD1, 0x05, 0x9A, 0xB0, 0xEB, 0x49, 0x0F, 0x01, 0xD1, 0x00, 0x21, 0x11, 0x70, 0x0C, 0x99, 0x02, 0x29, 0x05, 0xD1, 0x05, 0x9A, 0xB0, 0xEB, 0x46, 0x0F ,
0x01, 0xD1, 0x00, 0x21, 0x11, 0x70, 0xB3, 0xF5, 0x14, 0x7F, 0x40, 0xF3, 0xBA, 0x80, 0x40, 0xF2, 0x51, 0x31, 0x99, 0x42, 0x08, 0x99, 0x40, 0xF3, 0xB4, 0x80, 0x09, 0x78, 0x06, 0x29, 0x00, 0xF0, 0xB0, 0x80, 0xA3, 0xF2, 0x51, 0x21, 0x0B, 0xB2, 0x4F, 0xEA, 0xE3, 0x01, 0x03, 0xEB, 0x11, 0x71, 0x4F, 0xEA, 0x21, 0x11, 0xCA, 0xB2, 0x4F, 0xEA, 0xE3, 0x01, 0x03, 0xEB, 0x11, 0x71, 0x15, 0x9D, 0x21, 0xF0, 0x0F, 0x01, 0xA3, 0xEB, 0x01, 0x03, 0x1D, 0x99, 0x2E, 0x68, 0x7C, 0x52, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x91, 0xF8, 0x00, 0xE0, 0x5F, 0xFA, 0x83, 0xF8, 0x60, 0xB1, 0x31, 0x18, 0x11, 0xF8, 0x01, 0x1C, 0x51, 0x40, 0xCB, 0xB2, 0x07, 0xE0, 0xC0, 0x46, 0x58, 0x58, 0x02, 0x00, 0x54, 0x58, 0x02, 0x00, 0xDC, 0x58, 0x02, 0x00, 0x13, 0x46, 0x19, 0x99, 0xDD, 0xF8, 0x6C, 0xA0, 0xDD, 0xF8, 0x70, 0xB0, 0xD1, 0xF8, 0x00, 0xC0, 0x00, 0xF0, 0x0F, 0x01, 0x99, 0x42, 0x22, 0xD0, 0x0A, 0x9B, 0x86, 0x45, 0x9A, 0xF8 ,
0x00, 0x10, 0xB3, 0xF9, 0x00, 0x30, 0x9B, 0xF8, 0x00, 0x50, 0x15, 0xDD, 0x37, 0x5C, 0x44, 0x1C, 0x82, 0xEA, 0x07, 0x0C, 0x04, 0xF0, 0x0F, 0x07, 0x67, 0x45, 0x0B, 0xD0, 0xA6, 0x45, 0x06, 0x44, 0x0A, 0xDD, 0x76, 0x78, 0x72, 0x40, 0x86, 0x1C, 0x06, 0xF0, 0x0F, 0x06, 0x96, 0x42, 0x03, 0xD1, 0xC0, 0x1C, 0x4D, 0xE0, 0x80, 0x1C, 0x4B, 0xE0, 0x05, 0x9E, 0x00, 0x22, 0x32, 0x70, 0x4A, 0xE0, 0x00, 0xF0, 0x1F, 0x01, 0x01, 0x22, 0x8A, 0x40, 0x17, 0x99, 0xC4, 0x10, 0x0B, 0x68, 0x24, 0xF0, 0x03, 0x01, 0x5C, 0xF8, 0x01, 0x70, 0x3A, 0x42, 0x32, 0xD1, 0x5F, 0x58, 0x3A, 0x42, 0x06, 0x44, 0x1F, 0xD0, 0x18, 0x9B, 0x37, 0x78, 0x1B, 0x68, 0xB8, 0x45, 0x04, 0xD1, 0x58, 0x58, 0x02, 0x42, 0x19, 0xD0, 0x63, 0x46, 0x15, 0xE0, 0xA1, 0x10, 0x8C, 0x00, 0x19, 0x59, 0x91, 0x43, 0x19, 0x51, 0x00, 0x90, 0x30, 0x78, 0x01, 0x90, 0x44, 0x53, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x03, 0x20, 0x06, 0x21, 0x02, 0x46, 0x4D, 0xF6 ,
0x80, 0x53, 0xF3, 0xF7, 0x63, 0xF9, 0x09, 0x99, 0x28, 0x68, 0x0E, 0x78, 0x36, 0x18, 0x06, 0xE0, 0xE3, 0x58, 0x02, 0x00, 0xA0, 0x10, 0x81, 0x00, 0x58, 0x58, 0x02, 0x43, 0x5A, 0x50, 0x86, 0xF8, 0x00, 0x80, 0x0B, 0x98, 0x00, 0x78, 0x0C, 0x90, 0x13, 0x98, 0xB0, 0xF9, 0x00, 0x90, 0x09, 0x98, 0x00, 0x78, 0x0A, 0x9A, 0x40, 0x1C, 0x9B, 0xF8, 0x00, 0x50, 0x9A, 0xF8, 0x00, 0x10, 0xB2, 0xF9, 0x00, 0x30, 0x09, 0x9A, 0xC0, 0xB2, 0x10, 0x70, 0x0C, 0x9A, 0x01, 0x2A, 0x03, 0xD1, 0x88, 0x42, 0xC8, 0xBF, 0x8A, 0xF8, 0x00, 0x00, 0x0C, 0x99, 0x02, 0x29, 0x07, 0xD1, 0xA8, 0x42, 0xC8, 0xBF, 0x8B, 0xF8, 0x00, 0x00, 0x02, 0xE0, 0x0A, 0x98, 0xB0, 0xF9, 0x00, 0x30, 0xB9, 0xF1, 0x00, 0x0F, 0x06, 0xDD, 0x03, 0x2B, 0x04, 0xD1, 0x11, 0x98, 0x01, 0x22, 0x49, 0x46, 0x00, 0xF0, 0x72, 0xFB, 0x16, 0x98, 0xB0, 0xF9, 0x00, 0x10, 0x14, 0x98, 0x00, 0x29, 0xB0, 0xF9, 0x00, 0x00, 0x05, 0xDD, 0x03, 0x28, 0x03, 0xD1, 0x12, 0x98 ,
0x02, 0x22, 0x00, 0xF0, 0x64, 0xFB, 0x05, 0x98, 0x04, 0x78, 0x0B, 0x98, 0x00, 0x78, 0x0C, 0x90, 0x08, 0x98, 0xBB, 0x2C, 0x01, 0x78, 0x02, 0xD0, 0xAA, 0x2C, 0x2F, 0xD0, 0x31, 0xE0, 0x0C, 0x98, 0x01, 0x28, 0x0B, 0xD1, 0x0D, 0x98, 0x17, 0x9A, 0x10, 0x60, 0x0C, 0x54, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x0F, 0x98, 0x18, 0x9A, 0x10, 0x60, 0x19, 0x9A, 0x11, 0x98, 0x10, 0x60, 0x47, 0x4A, 0x15, 0x98, 0x02, 0x60, 0x0C, 0x98, 0x02, 0x28, 0x0B, 0xD1, 0x0E, 0x98, 0x17, 0x9A, 0x10, 0x60, 0x10, 0x98, 0x18, 0x9A, 0x10, 0x60, 0x19, 0x9A, 0x12, 0x98, 0x10, 0x60, 0x41, 0x4A, 0x15, 0x98, 0x02, 0x60, 0xCC, 0x20, 0x0F, 0xE0, 0x08, 0x99, 0x09, 0x78, 0x0C, 0xE0, 0x02, 0x20, 0x00, 0xE0, 0x01, 0x20, 0x0B, 0x99, 0x08, 0x70, 0x1A, 0x99, 0x0B, 0x80, 0x13, 0x99, 0x00, 0x20, 0x08, 0x80, 0x08, 0x98, 0x01, 0x78, 0xBB, 0x20, 0x05, 0x9A, 0x10, 0x70, 0x06, 0x29, 0x07, 0x99, 0x11, 0xD1, 0x06, 0x20, 0x08, 0x60, 0x20, 0x98 ,
0x00, 0x25, 0x05, 0x70, 0x21, 0x98, 0x29, 0x46, 0x04, 0x22, 0xFB, 0xF7, 0x27, 0xFB, 0x01, 0x20, 0x00, 0xF0, 0x3A, 0xFA, 0x02, 0x20, 0x00, 0xF0, 0x37, 0xFA, 0x22, 0x98, 0x05, 0x60, 0x07, 0x98, 0x04, 0x99, 0x00, 0x68, 0x07, 0x28, 0x44, 0xD1, 0x09, 0x78, 0x03, 0x9C, 0x80, 0x29, 0x40, 0xD1, 0x38, 0x34, 0x21, 0x78, 0x64, 0x1C, 0x22, 0x46, 0x00, 0x29, 0x3A, 0xD1, 0x20, 0x98, 0x90, 0xF8, 0x00, 0xA0, 0x22, 0x98, 0x05, 0x90, 0xD0, 0xF8, 0x00, 0x90, 0x51, 0x46, 0x48, 0x46, 0xFD, 0xF7, 0x79, 0xF9, 0x5F, 0xFA, 0x80, 0xF8, 0x21, 0x9F, 0x15, 0x78, 0x51, 0x46, 0x48, 0x46, 0x17, 0xF8, 0x08, 0x30, 0xFD, 0xF7, 0xD4, 0x54, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x6F, 0xF9, 0x1E, 0x46, 0x1B, 0x1D, 0xC0, 0xB2, 0x38, 0x5C, 0x00, 0x1D, 0xA8, 0x42, 0x28, 0x46, 0x07, 0xDD, 0x80, 0x18, 0x82, 0x1C, 0x10, 0x78, 0x2D, 0x18, 0xAD, 0x1C, 0xAD, 0xB2, 0xAB, 0x42, 0xF7, 0xDC, 0x04, 0xF8, 0x01, 0x6B, 0x11, 0x49, 0x32, 0x46 ,
0x20, 0x46, 0x01, 0xEB, 0x48, 0x11, 0xFA, 0xF7, 0xDC, 0xF9, 0xAD, 0x1B, 0xFF, 0x20, 0x34, 0x19, 0xAD, 0x1E, 0x04, 0xF8, 0x01, 0x0B, 0x25, 0x70, 0x05, 0x98, 0x01, 0x68, 0x49, 0x1C, 0x01, 0x60, 0x07, 0x98, 0x00, 0x68, 0x07, 0x28, 0x04, 0xD0, 0x06, 0x99, 0x08, 0x68, 0x20, 0xF4, 0x80, 0x30, 0x08, 0x60, 0x23, 0xB0, 0xBD, 0xE8, 0xF0, 0x8F, 0xC0, 0x46, 0x94, 0x57, 0x02, 0x00, 0xD4, 0x57, 0x02, 0x00, 0x5C, 0x58, 0x02, 0x00, 0x6E, 0x48, 0x2D, 0xE9, 0xF0, 0x47, 0x6E, 0x4D, 0x82, 0x89, 0x4A, 0xF6, 0x55, 0x21, 0xAD, 0xF5, 0xFE, 0x7D, 0x91, 0x42, 0x4F, 0xF0, 0x00, 0x01, 0xAD, 0xF1, 0x38, 0x0D, 0x12, 0xD1, 0x29, 0x60, 0x68, 0x4A, 0x11, 0x70, 0x41, 0xF2, 0x10, 0x41, 0x81, 0x81, 0x4F, 0xF6, 0xFF, 0x70, 0x66, 0x49, 0x08, 0x60, 0x28, 0x68, 0x00, 0x90, 0x02, 0x22, 0x05, 0x21, 0x03, 0x20, 0x41, 0xF2, 0x34, 0x23, 0xF3, 0xF7, 0x48, 0xF8, 0x29, 0x68, 0x61, 0x4C, 0x01, 0x29, 0x20, 0x68, 0x40, 0xF0, 0xAF, 0x80 ,
0x5F, 0x4D, 0x02, 0x28, 0x29, 0x68, 0x23, 0xD1, 0x9C, 0x55, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x5E, 0x48, 0x00, 0x68, 0x5F, 0x4A, 0x12, 0x5C, 0x00, 0x92, 0x01, 0x91, 0x5E, 0x49, 0x09, 0x68, 0x02, 0x91, 0x5B, 0x49, 0x0B, 0x5C, 0x03, 0x20, 0x07, 0x21, 0x04, 0x22, 0xF3, 0xF7, 0x2E, 0xF8, 0x5B, 0x49, 0x4A, 0x79, 0x59, 0x48, 0x00, 0x92, 0x02, 0x79, 0x01, 0x92, 0x40, 0x79, 0x04, 0x22, 0x02, 0x90, 0x03, 0x20, 0x0B, 0x79, 0x07, 0x21, 0xF3, 0xF7, 0x20, 0xF8, 0x03, 0x20, 0x20, 0x60, 0xEC, 0xF7, 0x1A, 0xFF, 0x20, 0x68, 0x29, 0x68, 0x04, 0x28, 0x15, 0xD1, 0x0D, 0x20, 0x8D, 0xF8, 0x10, 0x00, 0x00, 0x25, 0x8D, 0xF8, 0x14, 0x50, 0x8D, 0xF8, 0x15, 0x10, 0x28, 0x46, 0x63, 0x21, 0x00, 0xF0, 0xAA, 0xFB, 0x63, 0x21, 0x28, 0x46, 0x00, 0xF0, 0xFA, 0xFA, 0x03, 0xA9, 0x04, 0xA8, 0xE0, 0xF7, 0xCA, 0xFC, 0x05, 0x20, 0x20, 0x60, 0x46, 0x4D, 0x05, 0x28, 0x29, 0x68, 0x01, 0xF1, 0x01, 0x01, 0x29, 0x60, 0x1D, 0xD1 ,
0x44, 0x4A, 0x8A, 0x42, 0x1A, 0xD1, 0x43, 0x48, 0x01, 0x68, 0x00, 0x91, 0x40, 0x68, 0x01, 0x90, 0x03, 0x20, 0x02, 0x46, 0x06, 0x21, 0x41, 0x4E, 0x33, 0x46, 0x22, 0x3B, 0xF2, 0xF7, 0xEB, 0xFF, 0x3E, 0x48, 0x01, 0x68, 0x00, 0x91, 0x40, 0x68, 0x33, 0x46, 0x06, 0x21, 0x01, 0x90, 0x03, 0x20, 0x02, 0x46, 0xF2, 0xF7, 0xE0, 0xFF, 0x00, 0x20, 0x28, 0x60, 0x20, 0x68, 0x06, 0x28, 0x47, 0xD1, 0x4F, 0xF0, 0x64, 0x56, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x07, 0x0A, 0xC4, 0xF8, 0x00, 0xA0, 0x03, 0x20, 0x48, 0xF2, 0x70, 0x53, 0x01, 0x22, 0x04, 0x21, 0xF2, 0xF7, 0xD0, 0xFF, 0xDF, 0xF8, 0xCC, 0x80, 0x31, 0x4F, 0x48, 0xF2, 0x70, 0x59, 0x01, 0x25, 0x49, 0xEA, 0x05, 0x03, 0x01, 0x22, 0x04, 0x21, 0x03, 0x20, 0xF2, 0xF7, 0xC3, 0xFF, 0x00, 0x24, 0x17, 0xF8, 0x02, 0x0F, 0x20, 0xE0, 0x69, 0x01, 0x04, 0xEB, 0x08, 0x02, 0x88, 0x18, 0xC6, 0x1C, 0x43, 0x78, 0x00, 0x93, 0x80, 0x78, 0x01, 0x90, 0x30, 0x78, 0x02, 0x90 ,
0x53, 0x5C, 0x51, 0x46, 0x04, 0x22, 0x03, 0x20, 0xF2, 0xF7, 0xAE, 0xFF, 0x38, 0x78, 0x01, 0x1B, 0xB1, 0xF1, 0xFF, 0x3F, 0x08, 0xD1, 0xF0, 0x78, 0x00, 0x90, 0xB3, 0x78, 0x03, 0x20, 0x02, 0x22, 0x05, 0x21, 0xF2, 0xF7, 0xA1, 0xFF, 0x38, 0x78, 0x24, 0x1D, 0xE4, 0xB2, 0xA0, 0x42, 0xDC, 0xDC, 0xAD, 0x1C, 0xED, 0xB2, 0x04, 0x2D, 0xCD, 0xDB, 0x63, 0x21, 0x4F, 0xF4, 0x05, 0x70, 0xF1, 0xF7, 0xA3, 0xFC, 0xE1, 0xF7, 0x85, 0xFD, 0x7F, 0xB0, 0x0E, 0xB0, 0xBD, 0xE8, 0xF0, 0x87, 0xC0, 0x46, 0x04, 0x74, 0x00, 0x20, 0x50, 0x57, 0x02, 0x00, 0x6C, 0x5D, 0x02, 0x00, 0x40, 0x00, 0x3D, 0x80, 0x4C, 0x57, 0x02, 0x00, 0x58, 0x57, 0x02, 0x00, 0x90, 0x57, 0x02, 0x00, 0x60, 0x57, 0x02, 0x00, 0x70, 0x57, 0x02, 0x00, 0x5C, 0x57, 0x02, 0x00, 0x80, 0x57, 0x02, 0x00, 0x2C, 0x57, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x88, 0x57, 0x02, 0x00, 0x54, 0x57, 0x02, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x38, 0x58, 0x02, 0x00, 0x40, 0x58 ,
0x02, 0x00, 0x66, 0x55, 0xDD, 0xEE, 0xDB, 0x58, 0x02, 0x00, 0x5C, 0x58, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0x57, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBC, 0x58, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2D, 0xE9, 0xFE, 0x4F, 0x4A, 0x4A, 0x49, 0x4D, 0x00, 0x90, 0xB2, 0xF9, 0x00, 0x20, 0x43, 0xA3, 0x29, 0x78, 0x01, 0x93, 0x43, 0xA3, 0x01, 0x28, 0x02, 0x93, 0x47, 0x4E, 0xDF, 0xF8, 0x1C, 0x81, 0xDF, 0xF8, 0x1C, 0x91, 0x1E, 0xD0, 0x43, 0x48, 0x04, 0x78, 0x48, 0x01, 0x87, 0x19, 0x30, 0x18, 0x01, 0x99, 0x06, 0x22, 0xF9, 0xF7, 0xC8, 0xFF, 0x40, 0x46, 0x01, 0x78, 0x00, 0x68, 0x07, 0xF1, 0x06, 0x07, 0x07, 0xF8, 0x01, 0x1B, 0x07, 0xF8, 0x01, 0x4B, 0x4F, 0xF0, 0x00, 0x01, 0x07, 0xF8, 0x01, 0x1B, 0x20, 0xB9, 0x39, 0x70, 0x28, 0x78, 0x4E, 0x46, 0x0A, 0x21, 0x58, 0xE0, 0xDF, 0xF8, 0xE4, 0xB0, 0x0F, 0xE0, 0xD4, 0xB2, 0x48, 0x01, 0x87, 0x19, 0x30, 0x18, 0x02, 0x99, 0x07, 0x22, 0xF9, 0xF7, 0xAA, 0xFF, 0xFF, 0x1D, 0x00, 0x20, 0xDF, 0xF8, 0xCC, 0xB0, 0x07, 0xF8, 0x01, 0x4B, 0x07, 0xF8, 0x01, 0x0B, 0x16, 0x2C, 0xB2, 0x46, 0xAE, 0xBF, 0x14, 0x20, 0x84, 0x59 ,
0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x60, 0x1E, 0xC0, 0xB2, 0x38, 0x70, 0x4E, 0x46, 0x7F, 0x1C, 0x40, 0x1C, 0xC2, 0xB2, 0x28, 0x78, 0x5B, 0x46, 0x00, 0x21, 0x32, 0x54, 0x38, 0x46, 0x00, 0xF0, 0xBC, 0xF9, 0x28, 0x78, 0x16, 0x2C, 0x31, 0x5C, 0x01, 0xF1, 0x0A, 0x01, 0x31, 0x54, 0x00, 0xF1, 0x01, 0x00, 0xC0, 0xB2, 0x28, 0x70, 0x2B, 0xDB, 0x00, 0x99, 0x0A, 0xEB, 0x40, 0x10, 0x07, 0x46, 0x01, 0x29, 0xA4, 0xF1, 0x01, 0x09, 0x09, 0xD0, 0x01, 0x99, 0x06, 0x22, 0xF9, 0xF7, 0x79, 0xFF, 0x40, 0x46, 0x00, 0x78, 0xBF, 0x1D, 0x07, 0xF8, 0x01, 0x0B, 0x04, 0xE0, 0x02, 0x99, 0x07, 0x22, 0xF9, 0xF7, 0x6F, 0xFF, 0xFF, 0x1D, 0x07, 0xF8, 0x01, 0x4B, 0x15, 0x3C, 0x15, 0x21, 0x28, 0x78, 0xE2, 0xB2, 0x5B, 0x46, 0x07, 0xF8, 0x01, 0x1B, 0x32, 0x54, 0x07, 0xF8, 0x01, 0x9B, 0x38, 0x46, 0x00, 0xF0, 0x8B, 0xF9, 0x28, 0x78, 0x31, 0x5C, 0x0A, 0x31, 0x31, 0x54, 0x40, 0x1C, 0x28, 0x70, 0xBD, 0xE8, 0xFE, 0x8F, 0xC0, 0x46 ,
0x54, 0x54, 0x54, 0x4B, 0x45, 0x59, 0x00, 0xC0, 0x54, 0x54, 0x54, 0x53, 0x53, 0x49, 0x44, 0x00, 0x54, 0x58, 0x02, 0x00, 0xE6, 0x58, 0x02, 0x00, 0xE8, 0x58, 0x02, 0x00, 0x5C, 0x58, 0x02, 0x00, 0x5C, 0x57, 0x02, 0x00, 0xDC, 0x58, 0x02, 0x00, 0xD4, 0x57, 0x02, 0x00, 0x94, 0x57, 0x02, 0x00, 0xFF, 0xB5, 0x0C, 0x46, 0x06, 0x46, 0xF7, 0xF7, 0x4C, 0x5A, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0xE3, 0xFE, 0x15, 0x49, 0x15, 0x4A, 0x0D, 0x68, 0x01, 0xA9, 0x92, 0xE8, 0x8C, 0x00, 0x81, 0xE8, 0x8C, 0x00, 0xF7, 0xF7, 0xFD, 0xFE, 0x01, 0x98, 0x11, 0x49, 0x28, 0x1A, 0x03, 0x9D, 0x25, 0x60, 0x02, 0x9A, 0x80, 0x18, 0x82, 0x42, 0x30, 0x60, 0x0E, 0xD8, 0x08, 0x46, 0x00, 0x68, 0x22, 0x68, 0x82, 0x42, 0x0E, 0xD2, 0x68, 0x46, 0xE8, 0xF7, 0xB9, 0xFF, 0x9D, 0xF8, 0x00, 0x00, 0x05, 0xF1, 0x01, 0x05, 0x30, 0xB9, 0x03, 0x95, 0x03, 0xE0, 0x25, 0x68, 0x6D, 0x1C, 0x25, 0x60, 0x0C, 0x46, 0x25, 0x60, 0x00, 0x20, 0x00, 0x90 ,
0xFF, 0xBD, 0x60, 0x55, 0x30, 0x80, 0x24, 0x5D, 0x00, 0x20, 0x6C, 0x5D, 0x02, 0x00, 0x70, 0xB5, 0x4D, 0x00, 0x20, 0x2D, 0x4F, 0xF0, 0x00, 0x01, 0x0C, 0x46, 0x4F, 0xEA, 0x55, 0x13, 0x09, 0xD3, 0x50, 0xF8, 0x21, 0x60, 0xB6, 0xF1, 0xFF, 0x3F, 0x04, 0xD1, 0x49, 0x1C, 0xC9, 0xB2, 0x20, 0x3D, 0x5B, 0x1E, 0xF5, 0xD1, 0x4D, 0xB1, 0x20, 0x2D, 0x09, 0xD2, 0x01, 0x23, 0xAB, 0x40, 0x5B, 0x1E, 0x50, 0xF8, 0x21, 0x00, 0x18, 0x40, 0x83, 0x42, 0x01, 0xD1, 0x4F, 0xF0, 0x01, 0x04, 0x07, 0x48, 0x03, 0x78, 0x2C, 0xB9, 0x01, 0x21, 0x91, 0x40, 0xC9, 0x43, 0xC9, 0xB2, 0x0B, 0x40, 0x03, 0xE0, 0x01, 0x21, 0x91, 0x40, 0xC9, 0xB2, 0x0B, 0x43, 0x03, 0x70, 0x70, 0xBD, 0xC0, 0x46, 0xEE, 0x58, 0x02, 0x00, 0x14, 0x5B, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x7E, 0xB5, 0x05, 0x46, 0x95, 0xF8, 0x36, 0x20, 0x0E, 0x46, 0x0F, 0x49, 0x07, 0x2A, 0x12, 0xBF, 0x08, 0x68, 0x01, 0x20, 0x08, 0x60, 0x0D, 0x4C, 0x00, 0x92, 0x21, 0x68 ,
0x41, 0xF2, 0x12, 0x13, 0x04, 0x22, 0x01, 0x91, 0x07, 0x21, 0x02, 0x90, 0x03, 0x20, 0xF2, 0xF7, 0x6B, 0xFD, 0x31, 0x46, 0x28, 0x46, 0xE7, 0xF7, 0x21, 0xFC, 0x21, 0x68, 0x00, 0x22, 0x05, 0x29, 0x02, 0xD1, 0x04, 0x49, 0x08, 0x31, 0x0A, 0x60, 0x7E, 0xBD, 0xC0, 0x46, 0x50, 0x57, 0x02, 0x00, 0x4C, 0x57, 0x02, 0x00, 0x00, 0x7C, 0x00, 0x20, 0x0E, 0x49, 0x09, 0x68, 0x49, 0x08, 0x15, 0xD2, 0x0D, 0x49, 0x09, 0x78, 0x91, 0xB1, 0x44, 0xF2, 0xE9, 0x21, 0x68, 0xB9, 0x0B, 0x48, 0x01, 0x78, 0x07, 0x48, 0x01, 0x29, 0x03, 0xD1, 0x0A, 0x49, 0x09, 0x78, 0x0E, 0x29, 0x02, 0xD0, 0x44, 0xF2, 0xDE, 0x21, 0x41, 0x60, 0x01, 0x21, 0x00, 0xE0, 0x06, 0x48, 0x01, 0x60, 0x70, 0x47, 0xC0, 0x46, 0x00, 0x97, 0x3C, 0x80, 0x10, 0x0C, 0x30, 0x80, 0xDD, 0x6A, 0x00, 0x20, 0xE0, 0x7C, 0x00, 0x20, 0xA6, 0x64, 0x00, 0x20, 0x04, 0x97, 0x3C, 0x80, 0x00, 0xB5, 0xAD, 0xF1, 0x18, 0x0D, 0x4F, 0xF0, 0x09, 0x00, 0x00, 0x90, 0x4F, 0xF4 ,
0x0C, 0x60, 0x03, 0x90, 0x4F, 0xF0, 0x00, 0x00, 0x01, 0x90, 0x02, 0x90, 0x08, 0x48, 0x08, 0x49, 0x05, 0x90, 0x08, 0x68, 0x20, 0xB9, 0xDC, 0x5B, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x68, 0x46, 0x03, 0x22, 0xED, 0xF7, 0x3A, 0xFA, 0x03, 0xE0, 0x68, 0x46, 0x03, 0x22, 0xED, 0xF7, 0xC1, 0xFC, 0x06, 0xB0, 0x00, 0xBD, 0xC0, 0x46, 0x81, 0x5C, 0x02, 0x00, 0xDC, 0x7C, 0x00, 0x20, 0x1C, 0xB5, 0x0F, 0x4C, 0x22, 0x68, 0x01, 0x2A, 0x15, 0xD1, 0x0C, 0x48, 0x00, 0x68, 0x07, 0x28, 0x14, 0xBF, 0x40, 0x20, 0x4F, 0xF4, 0x05, 0x70, 0x63, 0x21, 0xF1, 0xF7, 0x0F, 0xFA, 0x20, 0x68, 0x00, 0x90, 0x43, 0xF2, 0x33, 0x33, 0x06, 0x21, 0x40, 0x20, 0x01, 0x90, 0x03, 0x20, 0x02, 0x46, 0xF2, 0xF7, 0xF4, 0xFC, 0x1C, 0xBD, 0xF1, 0xF7, 0x01, 0xFA, 0x1C, 0xBD, 0x4C, 0x57, 0x02, 0x00, 0x50, 0x57, 0x02, 0x00, 0x1E, 0xB5, 0x04, 0x46, 0x0A, 0x49, 0x00, 0x20, 0x0A, 0x4A, 0x08, 0x60, 0x0A, 0x49, 0x00, 0x90, 0x01, 0x90, 0x11, 0x60 ,
0x09, 0x4A, 0x45, 0xF2, 0x55, 0x53, 0x02, 0x91, 0x10, 0x60, 0x07, 0x21, 0x04, 0x22, 0x03, 0x20, 0xF2, 0xF7, 0xD8, 0xFC, 0x20, 0x46, 0xE7, 0xF7, 0x59, 0xFD, 0x1E, 0xBD, 0x50, 0x57, 0x02, 0x00, 0x04, 0x74, 0x00, 0x20, 0x34, 0x12, 0x66, 0x09, 0x4C, 0x57, 0x02, 0x00, 0x00, 0xB5, 0x0B, 0x49, 0x00, 0x20, 0x08, 0x60, 0xE0, 0x20, 0xF7, 0xF7, 0xAA, 0xFD, 0x09, 0x49, 0x09, 0x78, 0x49, 0xB1, 0x08, 0x49, 0x0A, 0x78, 0x08, 0x49, 0x00, 0x2A, 0x06, 0xBF, 0x01, 0x22, 0x09, 0x1F, 0x44, 0xF2, 0xA4, 0x5C, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0xE9, 0x22, 0x0A, 0x60, 0xF7, 0xF7, 0xA1, 0xFD, 0x00, 0xBD, 0xC0, 0x46, 0xDC, 0x7C, 0x00, 0x20, 0xDD, 0x6A, 0x00, 0x20, 0xA7, 0x64, 0x00, 0x20, 0x04, 0x97, 0x3C, 0x80, 0x50, 0xB9, 0x09, 0x48, 0x00, 0x78, 0x01, 0x28, 0x06, 0xD1, 0x08, 0x48, 0x00, 0x78, 0x0E, 0x28, 0x08, 0xBF, 0x44, 0xF2, 0xCB, 0x20, 0x01, 0xD0, 0x44, 0xF2, 0xDE, 0x20, 0x04, 0x49, 0x08, 0x60, 0x01, 0x20 ,
0x41, 0xF8, 0x04, 0x0C, 0x70, 0x47, 0xE0, 0x7C, 0x00, 0x20, 0xA6, 0x64, 0x00, 0x20, 0x04, 0x97, 0x3C, 0x80, 0x30, 0xB5, 0x0D, 0x46, 0x84, 0x69, 0xDC, 0xF7, 0x97, 0xFB, 0x24, 0x1D, 0x01, 0x28, 0x04, 0xEB, 0x45, 0x01, 0x06, 0xD1, 0x89, 0x8E, 0x04, 0xEB, 0x85, 0x04, 0x11, 0xB9, 0x21, 0x69, 0x01, 0xB9, 0x00, 0x20, 0x30, 0xBD, 0x30, 0xB5, 0x05, 0x46, 0x5A, 0xB1, 0x03, 0xEB, 0x41, 0x03, 0x1C, 0x78, 0x59, 0x78, 0x41, 0xEA, 0x04, 0x11, 0x52, 0x1E, 0x03, 0xF1, 0x02, 0x03, 0x05, 0xF8, 0x01, 0x1B, 0xF5, 0xD1, 0x30, 0xBD, 0x00, 0xB5, 0x00, 0x20, 0xE7, 0xF7, 0xD6, 0xFE, 0x03, 0x48, 0x01, 0x68, 0x03, 0x29, 0x04, 0xBF, 0x04, 0x21, 0x01, 0x60, 0x00, 0xBD, 0xC0, 0x46, 0x4C, 0x57, 0x02, 0x00, 0x03, 0x4A, 0x12, 0x68, 0x01, 0x2A, 0x04, 0xBF, 0x02, 0x48, 0x63, 0x21, 0xF1, 0xF7, 0x76, 0xB9, 0x50, 0x57, 0x02, 0x00, 0x02, 0x20, 0x01, 0x00, 0x6C, 0x5D, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint16_t fw_length = 5700;

View File

@ -0,0 +1,372 @@
// Adafruit CC3000 Firmware V1.13 Upgrade Sketch
// Based on firmware patcher for MSP430 chips published by Texas Instruments.
//
// This sketch will upgrade CC3000 modules up to firmware version 1.13.
//
// You can find more details about the changes in the 1.13 firmware from TI at:
// http://processors.wiki.ti.com/index.php/CC3000_Release_Notes
//
// In general the 1.13 release is a bug fix release with fixes for stability
// issues that caused the CC3000 to hang when under load.
//
// WARNING: Upgrade firmware at your own risk! In general if the CC3000 is
// currently working fine for your needs then hold off on the upgrade.
//
// Usage (read all the steps before strarting):
// - Wire up your Arduino to the CC3000 just like you're running buildtest or
// other examples.
// - Adjust the ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_VBAT
// defines below to match your wiring (just like running buildtest).
// - Load the sketch on your Arduino and open the serial monitor at 115200 baud.
// - You should see a prompt waiting for a key press to continue. Enter text
// and press enter to start the upgrade.
// - You will see text printed as the firmware is upgraded. The upgrade process
// should be quick and take less than a minute.
// - You might see a message at the end that the firmware version or MAC address
// couldn't be read--this can be ignored.
// - Once the firmware upgrade is complete, run the buildtest sketch to check
// the CC3000 functionality.
// - During the firmware upgrade the CC3000 MAC address might be lost. You can
// write a new MAC address by uncommenting the appropriate line in the buildtest
// example. Make sure to save your MAC address before upgrading the firmware
// if you'd like to keep it the same after
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <string.h>
#include <EEPROM.h>
#include "utility/debug.h"
#include "utility/nvmem.h"
#include "driverpatchinc_1_13.h"
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
#define ADAFRUIT_CC3000_CS 10
#define ADAFRUIT_CC3000_VBAT 5
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT);
/**************************************************************************/
/*!
@brief Displays the driver mode (tiny of normal), and the buffer
size if tiny mode is not being used
@note The buffer size and driver mode are defined in cc3000_common.h
*/
/**************************************************************************/
void displayDriverMode(void)
{
#ifdef CC3000_TINY_DRIVER
Serial.println(F("CC3000 is configure in 'Tiny' mode"));
#else
Serial.print(F("RX Buffer : "));
Serial.print(CC3000_RX_BUFFER_SIZE);
Serial.println(F(" bytes"));
Serial.print(F("TX Buffer : "));
Serial.print(CC3000_TX_BUFFER_SIZE);
Serial.println(F(" bytes"));
#endif
}
/**************************************************************************/
/*!
@brief Tries to read the CC3000's internal firmware patch ID
*/
/**************************************************************************/
void displayFirmwareVersion(void)
{
#ifndef CC3000_TINY_DRIVER
uint8_t major, minor;
if(!cc3000.getFirmwareVersion(&major, &minor))
{
Serial.println(F("Unable to retrieve the firmware version!\r\n"));
}
else
{
Serial.print(F("Firmware V. : "));
Serial.print(major); Serial.print(F(".")); Serial.println(minor);
}
#endif
}
/**************************************************************************/
/*!
@brief Tries to read the 6-byte MAC address of the CC3000 module
*/
/**************************************************************************/
boolean MACvalid = false;
// array to store MAC address from EEPROM
uint8_t cMacFromEeprom[MAC_ADDR_LEN];
void displayMACAddress(void)
{
if(!cc3000.getMacAddress(cMacFromEeprom))
{
Serial.println(F("Unable to retrieve MAC Address!\r\n"));
MACvalid = false;
}
else
{
Serial.print(F("MAC Address : "));
cc3000.printHex((byte*)&cMacFromEeprom, 6);
MACvalid = true;
}
}
/**************************************************************************/
/*!
@brief Sets up the HW and the CC3000 module (called automatically
on startup)
*/
/**************************************************************************/
uint8_t ucStatus_Dr, return_status = 0xFF;
uint8_t counter = 0;
// array to store RM parameters from EEPROM
unsigned char cRMParamsFromEeprom[128];
// 2 dim array to store address and length of new FAT
uint16_t aFATEntries[2][NVMEM_RM_FILEID + 1] =
/* address */ {{0x50, 0x1f0, 0x1390, 0x0390, 0x2390, 0x4390, 0x6390, 0x63a0, 0x63b0, 0x63f0, 0x6430, 0x6830},
/* length */ {0x1a0, 0x1a0, 0x1000, 0x1000, 0x2000, 0x2000, 0x10, 0x10, 0x40, 0x40, 0x400, 0x200 }};
/* 0. NVS */
/* 1. NVS Shadow */
/* 2. Wireless Conf */
/* 3. Wireless Conf Shadow */
/* 4. BT (WLAN driver) Patches */
/* 5. WiLink (Firmware) Patches */
/* 6. MAC addr */
/* 7. Frontend Vars */
/* 8. IP config */
/* 9. IP config Shadow */
/* 10. Bootloader Patches */
/* 11. Radio Module params */
/* 12. AES128 for smart config */
/* 13. user file */
/* 14. user file */
/* 15. user file */
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
Serial.println(F("Hit any key & return to start"));
while (!Serial.available());
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(6, LOW);
displayDriverMode();
displayFreeRam();
/* Initialise the module */
Serial.println(F("\nInitialising the CC3000 ..."));
if (!cc3000.begin(2)) // init with NO patches!
{
Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
while(1);
}
displayFirmwareVersion();
displayMACAddress();
return_status = 1;
uint8_t index;
uint8_t *pRMParams;
while ((return_status) && (counter < 3)) {
// read RM parameters
// read in 16 parts to work with tiny driver
return_status = 0;
pRMParams = cRMParamsFromEeprom;
for (index = 0; index < 16; index++) {
return_status |= nvmem_read(NVMEM_RM_FILEID, 8, 8*index, pRMParams);
Serial.print(F("\n\rRead NVRAM $")); Serial.print(8*index); Serial.print("\t");
for(uint8_t x=0; x<8; x++) {
Serial.print("0x"); Serial.print(pRMParams[x], HEX); Serial.print(", ");
}
pRMParams += 8;
}
counter++;
}
// if RM file is not valid, load the default one
if (counter == 3) {
Serial.println(F("\n\rLoad default params"));
pRMParams = (uint8_t *)cRMdefaultParams;
} else {
Serial.println(F("\n\rLoad EEPROM params"));
pRMParams = cRMParamsFromEeprom;
if (EEPROM.read(0) == 0xFF) {
for (uint8_t e=0; e<128; e++) {
EEPROM.write(e, cRMParamsFromEeprom[e]);
}
Serial.println(F("Backed up to eeprom!"));
}
}
return_status = 1;
while (return_status) {
// write new FAT
return_status = fat_write_content(aFATEntries[0], aFATEntries[1]);
Serial.print(F("Wrote FAT entries: ")); Serial.println(return_status, DEC);
}
//Serial.println(F("Stopping..."));
//cc3000.stop();
//Serial.println(F("\nInitialising the CC3000 ..."));
//if (!cc3000.begin(2)) // no patches!
//{
// Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
// while(1);
//}
return_status = 1;
Serial.println(F("Write params"));
while (return_status) {
// write RM parameters
// write in 4 parts to work with tiny driver
return_status = 0;
for (index = 0; index < 4; index++) {
return_status |= nvmem_write(NVMEM_RM_FILEID, 32, 32*index, (pRMParams + 32*index));
Serial.println(F("Wrote 32 bytes to NVRAM"));
}
}
Serial.println(F("Wrote params"));
return_status = 1;
// write back the MAC address, only if exist
if (MACvalid) {
// zero out MCAST bit if set
cMacFromEeprom[0] &= 0xfe;
while (return_status) {
return_status = nvmem_set_mac_address(cMacFromEeprom);
}
}
ucStatus_Dr = 1;
Serial.println(F("Writing driver patch"));
while (ucStatus_Dr) {
//writing driver patch to EEPRROM - PROTABLE CODE
// Note that the array itself is changing between the different Service Packs
ucStatus_Dr = nvmem_write_patch(NVMEM_WLAN_DRIVER_SP_FILEID, drv_length, wlan_drv_patch);
}
Serial.println(F("Wrote driver patch"));
Serial.println(F("Starting w/o patches"));
//if (!cc3000.begin(2))
//{
// Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
// while(1);
//}
Serial.println(F("Writing firmware"));
unsigned char ucStatus_FW = 1;
while (ucStatus_FW) {
//writing FW patch to EAPRROM - PROTABLE CODE
//Note that the array itself is changing between the different Service Packs
ucStatus_FW = nvmem_write_patch(NVMEM_WLAN_FW_SP_FILEID, fw_length, fw_patch);
}
Serial.println(F("Starting w/patches"));
cc3000.reboot();
/*
if (!)
{
Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
while(1);
}
*/
Serial.println(F("Patched!"));
displayFirmwareVersion();
displayMACAddress();
}
//*****************************************************************************
//
//! fat_write_content
//!
//! \param[in] file_address array of file address in FAT table:\n
//! this is the absolute address of the file in the EEPROM.
//! \param[in] file_length array of file length in FAT table:\n
//! this is the upper limit of the file size in the EEPROM.
//!
//! \return on succes 0, error otherwise
//!
//! \brief parse the FAT table from eeprom
//
//*****************************************************************************
uint8_t fat_write_content(uint16_t *file_address, uint16_t *file_length)
{
uint16_t index = 0;
uint8_t ucStatus;
uint8_t fatTable[48];
uint8_t* fatTablePtr = fatTable;
uint8_t LS[3] = "LS";
// first, write the magic number
ucStatus = nvmem_write(16, 2, 0, LS);
for (; index <= NVMEM_RM_FILEID; index++)
{
// write address low char and mark as allocated
*fatTablePtr++ = (uint8_t)(file_address[index] & 0xff) | _BV(0);
// write address high char
*fatTablePtr++ = (uint8_t)((file_address[index]>>8) & 0xff);
// write length low char
*fatTablePtr++ = (uint8_t)(file_length[index] & 0xff);
// write length high char
*fatTablePtr++ = (uint8_t)((file_length[index]>>8) & 0xff);
}
// second, write the FAT
// write in two parts to work with tiny driver
ucStatus = nvmem_write(16, 24, 4, fatTable);
ucStatus = nvmem_write(16, 24, 24+4, &fatTable[24]);
// third, we want to erase any user files
memset(fatTable, 0, sizeof(fatTable));
ucStatus = nvmem_write(16, 16, 52, fatTable);
return ucStatus;
}
void loop(void)
{
delay(1000);
}

View File

@ -0,0 +1,102 @@
//Service Pack version P1.12.7.15.26 - Driver patches
uint8_t cRMdefaultParams[128] = { 0x03, 0x00, 0x01, 0x01, 0x14, 0x14, 0x00, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x23, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x23, 0x23, 0x23, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x01, 0x77, 0x80, 0x1D, 0x1F, 0x22, 0x26, 0x28, 0x29, 0x1A, 0x1F, 0x22, 0x24, 0x26, 0x28, 0x16, 0x1D, 0x1E, 0x20, 0x24, 0x25, 0x1E, 0x2D, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x15, 0x15, 0x15, 0x11, 0x15, 0x15, 0x0E, 0x00};
unsigned char PROGMEM wlan_drv_patch[8024] = { 0x00, 0x01, 0x00, 0x00, 0x50, 0x1F, 0x00, 0x00, 0xF0, 0x03, 0x18, 0x00, 0xE4, 0x62, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x7A, 0x63, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x10, 0x64, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x20, 0x0C, 0x49, 0x08, 0x60, 0x0C, 0x48, 0x19, 0x30, 0xF7, 0x46, 0x30, 0xB5, 0x05, 0x1C, 0xAC, 0x69, 0x68, 0x68, 0x5F, 0x30, 0x09, 0xD1, 0x60, 0x6B, 0x0C, 0x38, 0x01, 0x21, 0x8E, 0x46, 0x06, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x00, 0x20, 0x60, 0x63, 0xAC, 0x69, 0x6C, 0x60, 0x04, 0x48, 0x5B, 0x30, 0x30, 0xBD, 0x40, 0x3B, 0x08, 0x00, 0x49, 0xD0, 0x01, 0x00, 0x09, 0xEA, 0x02, 0x00, 0x91, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xA6, 0x64, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3C, 0x65, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xB5, 0x85, 0xB0, 0x05, 0x1C, 0xA8, 0x88, 0x00, 0x90, 0x28, 0x89, 0x01, 0x90, 0xE9, 0x68, 0x02, 0x91, 0x28, 0x7C, 0x03, 0x90, 0x2A, 0x6A, 0x00, 0x20, 0x17, 0x56, 0x68, 0x60, 0x00, 0x29, 0x4C, 0xD0, 0x00, 0x2F, 0x4A, 0xDC ,
0xCA, 0x49, 0x0C, 0x1C, 0x08, 0x26, 0x04, 0x90, 0x21, 0x88, 0x00, 0x98, 0x81, 0x42, 0x0C, 0xD1, 0x62, 0x88, 0x01, 0x98, 0x82, 0x42, 0x08, 0xD1, 0x46, 0x20, 0x02, 0x5D, 0x03, 0x98, 0x82, 0x42, 0x03, 0xD1, 0x0E, 0x20, 0x00, 0x57, 0xB8, 0x42, 0x0A, 0xD0, 0x46, 0x20, 0x00, 0x5D, 0x11, 0x28, 0x22, 0xD1, 0x00, 0x98, 0x81, 0x42, 0x1F, 0xD1, 0x0E, 0x20, 0x00, 0x57, 0xFF, 0xFF, 0xD2, 0x65, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xB8, 0x42, 0x1B, 0xD1, 0x04, 0x20, 0x02, 0x1C, 0x02, 0x98, 0xB9, 0x49, 0x01, 0x23, 0x9E, 0x46, 0xEC, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x17, 0xD0, 0x20, 0x1D, 0x02, 0x99, 0x04, 0x22, 0x01, 0x23, 0x9E, 0x46, 0xE7, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x0D, 0xD0, 0x46, 0x20, 0x00, 0x5D, 0x11, 0x28, 0x09, 0xD0, 0xA0, 0x6D, 0x00, 0x28, 0x06, 0xD0, 0xAC, 0x34, 0x04, 0x98, 0x01, 0x30, 0x04, 0x90, 0x01, 0x3E, 0xC1, 0xD1, 0x07, 0xE0, 0x04, 0x98, 0x00, 0x06, 0x00, 0x0E ,
0xAC, 0x21, 0x41, 0x43, 0xA6, 0x48, 0x40, 0x18, 0x68, 0x60, 0xA6, 0x48, 0xAD, 0x30, 0x05, 0xB0, 0xF0, 0xBD, 0x00, 0xB5, 0xC2, 0x68, 0x90, 0x69, 0x02, 0x21, 0x01, 0x23, 0x9E, 0x46, 0xA2, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xA2, 0x48, 0x61, 0x30, 0x00, 0xBD, 0x01, 0x79, 0x0B, 0x29, 0x03, 0xD0, 0x89, 0x00, 0x9F, 0x4A, 0x51, 0x5A, 0x01, 0xE0, 0x01, 0x21, 0x49, 0x02, 0x41, 0x60, 0x9D, 0x48, 0x0D, 0x30, 0xF7, 0x46, 0x01, 0x1C, 0xFF, 0xFF, 0x68, 0x66, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x9C, 0x48, 0x02, 0x68, 0x9C, 0x48, 0x01, 0x2A, 0x01, 0xD1, 0x25, 0x30, 0xF7, 0x46, 0x9B, 0x4A, 0x12, 0x68, 0x4A, 0x60, 0x19, 0x30, 0xF7, 0x46, 0x00, 0x21, 0x41, 0x60, 0x99, 0x48, 0x98, 0x49, 0x08, 0x18, 0xF7, 0x46, 0x00, 0x21, 0x41, 0x60, 0x97, 0x48, 0xE7, 0x49, 0x08, 0x18, 0xF7, 0x46, 0xFF, 0xB5, 0x46, 0x69, 0x40, 0x68, 0x01, 0x90, 0x94, 0x49, 0x0A, 0x7C, 0x9A, 0x4F, 0x01, 0x2A, 0x63, 0xD0, 0x09, 0x7C, 0x03, 0x29 ,
0x60, 0xD0, 0x91, 0x4A, 0x92, 0x4B, 0x00, 0x21, 0x02, 0x91, 0x59, 0x56, 0x24, 0x23, 0x59, 0x43, 0x53, 0x18, 0x03, 0x93, 0x01, 0x28, 0x17, 0xD1, 0x8A, 0x18, 0x04, 0x23, 0x6C, 0x46, 0x8C, 0x49, 0x15, 0x79, 0x08, 0x78, 0xC0, 0x43, 0x28, 0x43, 0x20, 0x70, 0x01, 0x32, 0x01, 0x31, 0x01, 0x34, 0x01, 0x3B, 0xF5, 0xD1, 0x31, 0x1D, 0x68, 0x46, 0x04, 0x22, 0x01, 0x23, 0x9E, 0x46, 0xA9, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x40, 0xD0, 0x35, 0x1D, 0x82, 0x48, 0x00, 0x78, 0xFF, 0x28, 0xFF, 0xFF, 0xFE, 0x66, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x11, 0xD0, 0x00, 0x28, 0x0F, 0xD0, 0x03, 0x98, 0x01, 0x1D, 0x28, 0x1C, 0x01, 0x24, 0xA6, 0x46, 0x7E, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x00, 0x28, 0x05, 0xD1, 0x7A, 0x48, 0xA6, 0x46, 0x7B, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x05, 0xE0, 0x28, 0x1C, 0x01, 0x21, 0x8E, 0x46, 0x78, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x01, 0x99, 0x01, 0x29, 0x01, 0xD1, 0x00, 0x28, 0x1E, 0xD1 ,
0x01, 0x99, 0x5F, 0x31, 0x01, 0xD0, 0x00, 0x28, 0x0F, 0xD1, 0xA8, 0x20, 0x81, 0x5D, 0x00, 0x29, 0x08, 0xD0, 0x49, 0x1E, 0x81, 0x55, 0x80, 0x5D, 0x00, 0x28, 0x09, 0xD1, 0x38, 0x1C, 0xFF, 0x30, 0x08, 0x30, 0x11, 0xE0, 0x03, 0x21, 0x02, 0x91, 0x00, 0xE0, 0xA8, 0x20, 0x02, 0x99, 0x81, 0x55, 0x38, 0x1C, 0xFF, 0x30, 0x16, 0x30, 0x07, 0xE0, 0x01, 0x98, 0x01, 0x28, 0x02, 0xD1, 0x38, 0x1C, 0xA3, 0x30, 0x01, 0xE0, 0x38, 0x1C, 0x9F, 0x30, 0x00, 0x90, 0xFF, 0xBD, 0x00, 0xB5, 0x02, 0x1C, 0x10, 0x6A, 0xD1, 0x69, 0x52, 0x69, 0xC3, 0x69, 0x5A, 0x60, 0xFF, 0xFF, 0x94, 0x67, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x01, 0x22, 0x96, 0x46, 0x5E, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x5E, 0x48, 0xFF, 0x30, 0x6E, 0x30, 0x00, 0xBD, 0x10, 0xB5, 0x0A, 0x1C, 0x41, 0x69, 0x00, 0x6A, 0x93, 0x69, 0xDB, 0x69, 0x58, 0x60, 0x90, 0x69, 0x01, 0x24, 0xA6, 0x46, 0x56, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0xA6, 0x46, 0x56, 0x48, 0xFE, 0x44 ,
0x00, 0x47, 0x55, 0x48, 0xFF, 0x30, 0xB6, 0x30, 0x10, 0xBD, 0x70, 0xB5, 0x05, 0x1C, 0x6E, 0x69, 0x53, 0x48, 0x02, 0x68, 0x5C, 0x21, 0x88, 0x5D, 0x04, 0x28, 0x15, 0xD1, 0x07, 0x20, 0x88, 0x55, 0x10, 0x0B, 0x11, 0xD2, 0x01, 0x24, 0xA6, 0x46, 0x4E, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x00, 0x28, 0x0A, 0xD0, 0x47, 0x21, 0x89, 0x57, 0xC1, 0x60, 0x11, 0x21, 0xC9, 0x02, 0x00, 0x22, 0x04, 0x23, 0xA6, 0x46, 0xE8, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x01, 0x20, 0x68, 0x60, 0x43, 0x48, 0xED, 0x49, 0x08, 0x18, 0x70, 0xBD, 0x70, 0xB5, 0x05, 0x1C, 0xAE, 0x69, 0x9C, 0x20, 0x80, 0x19, 0x4B, 0x21, 0x89, 0x00, 0x01, 0x24, 0xFF, 0xFF, 0x2A, 0x68, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xA6, 0x46, 0xE8, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x5C, 0x21, 0x88, 0x5D, 0x07, 0x28, 0x01, 0xD1, 0x09, 0x20, 0x00, 0xE0, 0x05, 0x20, 0xAA, 0x69, 0x88, 0x54, 0x30, 0x1C, 0xA6, 0x46, 0xE9, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x68, 0x60, 0xE8, 0x48 ,
0x4D, 0x30, 0x70, 0xBD, 0xF0, 0xB5, 0x41, 0x68, 0x82, 0x68, 0x88, 0x23, 0x5E, 0x18, 0x37, 0x88, 0x0B, 0x6F, 0x00, 0x2B, 0x01, 0xD1, 0x00, 0x2F, 0x10, 0xD1, 0x06, 0x2F, 0x02, 0xDD, 0x00, 0x21, 0xC9, 0x43, 0x07, 0xE0, 0x33, 0x88, 0x9B, 0x00, 0xC9, 0x18, 0x0A, 0x67, 0x31, 0x88, 0x01, 0x31, 0x31, 0x80, 0x01, 0x21, 0x81, 0x60, 0xE1, 0x48, 0x1D, 0x30, 0xF0, 0xBD, 0x0B, 0x1C, 0x01, 0x24, 0x5D, 0x6F, 0x1D, 0x67, 0x04, 0x33, 0x01, 0x34, 0x06, 0x2C, 0xE1, 0xDA, 0xF8, 0xE7, 0x00, 0xB5, 0x00, 0x21, 0xC1, 0x60, 0xE9, 0x48, 0x01, 0x68, 0x10, 0x31, 0xE6, 0x48, 0x20, 0x22, 0x01, 0x23, 0x9E, 0x46, 0xE7, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xE5, 0x48, 0xFB, 0x30, 0x00, 0xBD, 0xFF, 0xFF, 0xC0, 0x68, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x14, 0x0D, 0x1B, 0x00, 0x54, 0x19, 0x1B, 0x00, 0x91, 0x1A, 0x01, 0x00, 0x4B, 0xAD, 0x03, 0x00, 0x61, 0x4E, 0x01, 0x00, 0x06, 0x32, 0x08, 0x00, 0x1F, 0x0B, 0x02, 0x00, 0x54, 0x3F ,
0x08, 0x00, 0x45, 0xC1, 0x00, 0x00, 0x84, 0x3C, 0x08, 0x00, 0x1B, 0x02, 0x00, 0x00, 0xED, 0x17, 0x00, 0x00, 0xF3, 0xC1, 0x01, 0x00, 0x34, 0x19, 0x1B, 0x00, 0x08, 0x19, 0x1B, 0x00, 0xA6, 0x44, 0x08, 0x00, 0x1C, 0x17, 0x1B, 0x00, 0x18, 0x17, 0x1B, 0x00, 0xCB, 0x67, 0x03, 0x00, 0x0D, 0x47, 0x02, 0x00, 0x39, 0x42, 0x03, 0x00, 0xBD, 0xE7, 0x02, 0x00, 0xB1, 0x40, 0x03, 0x00, 0xB9, 0xEA, 0x01, 0x00, 0x45, 0xDA, 0x00, 0x00, 0x24, 0x41, 0x08, 0x00, 0x71, 0xC0, 0x02, 0x00, 0xF0, 0xB5, 0x88, 0xB0, 0x06, 0x91, 0x07, 0x90, 0x86, 0x69, 0xF0, 0x1C, 0xD9, 0xA1, 0x04, 0x22, 0x01, 0x24, 0xA6, 0x46, 0x14, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x32, 0xD1, 0xF2, 0x79, 0xD7, 0x48, 0x02, 0x70, 0x35, 0x7A, 0x77, 0x7A, 0x78, 0x1B, 0xFF, 0xFF, 0x56, 0x69, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x43, 0x1C, 0x93, 0x42, 0x1D, 0xD0, 0x16, 0x2A, 0x0C, 0xDB, 0x00, 0x2D, 0x0A, 0xD1, 0xD6, 0x48, 0x04, 0x70, 0x0A, 0x20 ,
0x81, 0x19, 0xD0, 0x48, 0x1A, 0x1C, 0xA6, 0x46, 0xB8, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x74, 0xE0, 0xD2, 0x48, 0x04, 0x70, 0xCC, 0x48, 0x40, 0x19, 0x0A, 0x21, 0x89, 0x19, 0x7A, 0x1B, 0x52, 0x1C, 0xA6, 0x46, 0xB1, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x67, 0xE0, 0x8F, 0xC6, 0x03, 0x00, 0xC9, 0x48, 0x04, 0x70, 0xC9, 0x48, 0x04, 0x70, 0x0A, 0x20, 0x81, 0x19, 0xC2, 0x48, 0xA6, 0x46, 0xAA, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x59, 0xE0, 0xF0, 0x1C, 0x03, 0x21, 0x0A, 0x1C, 0xBC, 0xA1, 0xA6, 0x46, 0xC6, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x4F, 0xD1, 0xF1, 0x79, 0xBB, 0x48, 0x01, 0x70, 0xBB, 0x4D, 0xB2, 0x79, 0x2A, 0x70, 0x03, 0x20, 0x17, 0x49, 0xF4, 0x31, 0xA6, 0x46, 0xB8, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x28, 0x78, 0x00, 0x28, 0x0B, 0xD1, 0xFF, 0xE7, 0xB8, 0x49, 0x0C, 0x70, 0xB8, 0x49, 0xFF, 0xFF, 0xEC, 0x69, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x0C, 0x70, 0x03, 0x20, 0x0F, 0x49, 0xF5, 0x31, 0xA6, 0x46 ,
0xB6, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x20, 0x1C, 0xF2, 0x79, 0x35, 0x7A, 0x77, 0x7A, 0x79, 0x1B, 0x4B, 0x1C, 0x93, 0x42, 0x20, 0xD0, 0xA9, 0x49, 0x09, 0x78, 0x16, 0x29, 0x0F, 0xDB, 0x00, 0x2D, 0x0D, 0xD1, 0xAB, 0x49, 0x08, 0x70, 0x0A, 0x20, 0x81, 0x19, 0xE9, 0x48, 0x1A, 0x1C, 0xA6, 0x46, 0x8B, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x1A, 0xE0, 0xC0, 0x46, 0xC7, 0x04, 0x00, 0x00, 0xA5, 0x49, 0x08, 0x70, 0xE3, 0x48, 0x40, 0x19, 0x0A, 0x21, 0x89, 0x19, 0x7A, 0x1B, 0x52, 0x1C, 0xA6, 0x46, 0x83, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x0A, 0xE0, 0x9E, 0x49, 0x08, 0x70, 0x9E, 0x49, 0x08, 0x70, 0x0A, 0x20, 0x81, 0x19, 0xDB, 0x48, 0xA6, 0x46, 0x7D, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x96, 0x48, 0x00, 0x78, 0x00, 0x28, 0x0A, 0xD0, 0x95, 0x48, 0x00, 0x78, 0x00, 0x28, 0x06, 0xD0, 0x94, 0x48, 0x00, 0x78, 0x00, 0x28, 0x02, 0xD0, 0x93, 0x48, 0x00, 0x78, 0x00, 0x28, 0xFF, 0xFF, 0x82, 0x6A, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00 ,
0x00, 0xD1, 0x8C, 0xE0, 0x03, 0x20, 0x17, 0x21, 0x89, 0x01, 0xA6, 0x46, 0x90, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x87, 0x48, 0x01, 0x78, 0x87, 0x48, 0x07, 0x78, 0x84, 0x4E, 0x83, 0x4D, 0xE0, 0x48, 0x00, 0x68, 0x00, 0x28, 0x2E, 0xD1, 0x07, 0x98, 0x41, 0x61, 0x06, 0x62, 0xC6, 0x48, 0x06, 0x9A, 0x10, 0x64, 0x02, 0x2F, 0x01, 0xD0, 0x03, 0x2F, 0x01, 0xD1, 0x03, 0x22, 0x00, 0xE0, 0x3A, 0x1C, 0x06, 0x9B, 0xDA, 0x63, 0x2A, 0x78, 0x9A, 0x63, 0x01, 0x2F, 0x03, 0xD1, 0x05, 0x29, 0x04, 0xD0, 0x0D, 0x29, 0x02, 0xD0, 0xEC, 0x48, 0xDB, 0x30, 0x64, 0xE0, 0x00, 0x25, 0x00, 0x95, 0x01, 0x91, 0x02, 0x96, 0x03, 0x95, 0x04, 0x90, 0x2B, 0x1C, 0x20, 0x1C, 0x01, 0x1C, 0x8E, 0x46, 0xE6, 0x4E, 0xFE, 0x44, 0x30, 0x47, 0xE6, 0x48, 0x04, 0x60, 0x28, 0x1C, 0xA6, 0x46, 0xE5, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x4C, 0xE0, 0x0D, 0x27, 0x00, 0x20, 0x39, 0x1C, 0x05, 0xAA, 0xA6, 0x46, 0xE3, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x68, 0x46 ,
0xFF, 0xFF, 0x18, 0x6B, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x80, 0x8A, 0x40, 0x08, 0x05, 0xD2, 0x38, 0x1C, 0x50, 0x21, 0xA6, 0x46, 0xDC, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x38, 0x1C, 0x21, 0x1C, 0x0B, 0x1C, 0x29, 0x1C, 0x00, 0x22, 0xA6, 0x46, 0xD9, 0x4F, 0xFE, 0x44, 0x38, 0x47, 0x2B, 0x78, 0x0D, 0x20, 0x31, 0x1C, 0x22, 0x1C, 0xA6, 0x46, 0xD5, 0x4E, 0xFE, 0x44, 0x30, 0x47, 0x28, 0x78, 0x01, 0x30, 0x02, 0x1C, 0x0D, 0x20, 0x57, 0x49, 0x23, 0x1C, 0xA6, 0x46, 0xD0, 0x4E, 0xFE, 0x44, 0x30, 0x47, 0x55, 0x4E, 0x28, 0x78, 0x02, 0x30, 0x02, 0x1C, 0x0D, 0x20, 0x31, 0x1C, 0x23, 0x1C, 0xA6, 0x46, 0xCA, 0x4F, 0xFE, 0x44, 0x38, 0x47, 0x30, 0x78, 0x00, 0x28, 0x0A, 0xD0, 0x28, 0x78, 0x03, 0x30, 0x02, 0x1C, 0x4C, 0x48, 0x03, 0x78, 0x0D, 0x20, 0x8F, 0x49, 0xA6, 0x46, 0xC3, 0x4D, 0xFE, 0x44, 0x28, 0x47, 0xBF, 0x48, 0x04, 0x60, 0x00, 0x20, 0xA6, 0x46, 0xBE, 0x49, 0xFE, 0x44, 0x08, 0x47, 0xB9, 0x48, 0xEC, 0x49 ,
0x08, 0x18, 0x08, 0xB0, 0xF0, 0xBD, 0xC0, 0x46, 0x7B, 0xC0, 0xFF, 0xFF, 0xAE, 0x6B, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x1C, 0xE9, 0x48, 0x02, 0x68, 0xE9, 0x48, 0x00, 0x2A, 0x04, 0xD0, 0x00, 0x22, 0x0A, 0x62, 0x8A, 0x61, 0x1D, 0x30, 0xF7, 0x46, 0xD7, 0x30, 0xF7, 0x46, 0xC0, 0x46, 0x9F, 0x03, 0x00, 0x00, 0x7D, 0xB8, 0x03, 0x00, 0x01, 0x1C, 0xE2, 0x48, 0x02, 0x68, 0xE2, 0x48, 0x00, 0x2A, 0x02, 0xD0, 0xFF, 0x30, 0xB4, 0x30, 0xF7, 0x46, 0x00, 0x22, 0xCA, 0x61, 0x8A, 0x61, 0x4F, 0x30, 0xF7, 0x46, 0xC9, 0x21, 0x01, 0x00, 0x91, 0xE1, 0x00, 0x00, 0xDB, 0x48, 0x01, 0x68, 0x8A, 0x69, 0x01, 0x20, 0xC0, 0x03, 0x10, 0x43, 0x88, 0x61, 0x00, 0x20, 0x08, 0x61, 0xD8, 0x48, 0x23, 0x30, 0xF7, 0x46, 0x89, 0x17, 0x02, 0x00, 0x70, 0xB5, 0x05, 0x1C, 0xD5, 0x4E, 0x29, 0x6A, 0xEA, 0x69, 0x30, 0x1C, 0x01, 0x24, 0xA6, 0x46, 0x0B, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x68, 0x69, 0xA6, 0x46, 0xD1, 0x49 ,
0xFE, 0x44, 0x08, 0x47, 0xA8, 0x69, 0x06, 0x30, 0xA8, 0x60, 0xCF, 0x48, 0x00, 0x68, 0x68, 0x60, 0xEE, 0x60, 0xCE, 0x48, 0xFF, 0xFF, 0x44, 0x6C, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x6D, 0x30, 0x70, 0xBD, 0x46, 0x17, 0x1B, 0x00, 0x30, 0x3F, 0x08, 0x00, 0x41, 0xEB, 0x00, 0x00, 0x09, 0xB4, 0x03, 0x00, 0x30, 0xB5, 0xEE, 0x48, 0x01, 0x6D, 0x80, 0x6C, 0x08, 0x43, 0x18, 0xD0, 0xEC, 0x49, 0x08, 0x1C, 0x07, 0x22, 0xFF, 0x23, 0x09, 0x33, 0x1B, 0x58, 0x00, 0x2B, 0x04, 0xD0, 0xFF, 0x30, 0x1D, 0x30, 0x01, 0x3A, 0xF6, 0xD1, 0x0B, 0xE0, 0x02, 0x20, 0xF0, 0x4A, 0xF1, 0x4B, 0x01, 0x24, 0xA6, 0x46, 0xF0, 0x4D, 0xFE, 0x44, 0x28, 0x47, 0xA6, 0x46, 0xEF, 0x48, 0xFE, 0x44, 0x00, 0x47, 0xEF, 0x48, 0xFF, 0x30, 0x5C, 0x30, 0x30, 0xBD, 0xC0, 0x46, 0x53, 0x53, 0x49, 0x44, 0x00, 0xC0, 0x46, 0xC0, 0x4B, 0x45, 0x59, 0x00, 0xEE, 0x62, 0x08, 0x00, 0xF0, 0x62, 0x08, 0x00, 0xEC, 0x62, 0x08, 0x00, 0xED, 0x62, 0x08, 0x00 ,
0xE7, 0x7E, 0x03, 0x00, 0xE8, 0x62, 0x08, 0x00, 0xE9, 0x62, 0x08, 0x00, 0xEA, 0x62, 0x08, 0x00, 0xEB, 0x62, 0x08, 0x00, 0xDD, 0x7E, 0x03, 0x00, 0x8F, 0xC6, 0x03, 0x00, 0xF0, 0xB5, 0xFF, 0xFF, 0xDA, 0x6C, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x87, 0xB0, 0x00, 0x91, 0x01, 0x90, 0x6B, 0x48, 0x01, 0x68, 0xCC, 0x4A, 0x14, 0x1C, 0x02, 0x94, 0x07, 0x26, 0x00, 0x25, 0x03, 0x95, 0x04, 0x94, 0x05, 0x95, 0xDF, 0x48, 0x00, 0x68, 0x08, 0x43, 0x27, 0xD0, 0xE0, 0x68, 0x03, 0x99, 0x88, 0x42, 0x0A, 0xDD, 0x03, 0x90, 0x40, 0x1C, 0x00, 0x99, 0x88, 0x60, 0xC2, 0x49, 0xFF, 0x20, 0x1D, 0x30, 0x68, 0x43, 0x0C, 0x18, 0xE0, 0x68, 0x04, 0x91, 0x02, 0x99, 0xC9, 0x68, 0x88, 0x42, 0x10, 0xDB, 0x88, 0x42, 0x10, 0xD1, 0x02, 0x98, 0x01, 0x27, 0xBE, 0x46, 0xCE, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x06, 0x90, 0x20, 0x1C, 0xBE, 0x46, 0xCB, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x06, 0x99, 0x88, 0x42, 0x01, 0xDA, 0x05, 0x95, 0x02, 0x94 ,
0x51, 0x48, 0x01, 0x68, 0xFF, 0x27, 0x09, 0x37, 0x38, 0x59, 0x00, 0x28, 0x06, 0xD0, 0xC7, 0x48, 0x00, 0x68, 0x07, 0x2E, 0x00, 0xD1, 0x2E, 0x1C, 0x08, 0x43, 0x04, 0xD0, 0xFF, 0x34, 0x1D, 0x34, 0x01, 0x35, 0x07, 0x2D, 0xC2, 0xDB, 0x07, 0x2E, 0xFF, 0xFF, 0x70, 0x6D, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x0A, 0xD1, 0xC0, 0x48, 0x00, 0x68, 0x08, 0x43, 0x06, 0xD0, 0x05, 0x9E, 0x30, 0x1C, 0x01, 0x21, 0x8E, 0x46, 0xBA, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x01, 0x98, 0x47, 0x61, 0x00, 0x21, 0x81, 0x61, 0xFF, 0x22, 0x1D, 0x32, 0x72, 0x43, 0x04, 0x99, 0x89, 0x18, 0xC1, 0x61, 0x06, 0x62, 0xB4, 0x48, 0x39, 0x30, 0x07, 0xB0, 0xF0, 0xBD, 0x10, 0xB5, 0x04, 0x1C, 0x00, 0x20, 0x01, 0x21, 0x8E, 0x46, 0xB1, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x40, 0x1E, 0x00, 0xD5, 0x00, 0x20, 0x60, 0x60, 0xE0, 0x61, 0xAE, 0x48, 0x21, 0x30, 0x10, 0xBD, 0xC0, 0x46, 0x10, 0x63, 0x08, 0x00, 0x70, 0xB5, 0x04, 0x1C, 0xE5, 0x69, 0x66, 0x69 ,
0x00, 0x20, 0x01, 0x21, 0x8E, 0x46, 0xA7, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x60, 0x60, 0xAB, 0x19, 0xA6, 0x4A, 0xA5, 0x49, 0x93, 0x42, 0x02, 0xD3, 0x9A, 0x1A, 0x82, 0x42, 0x02, 0xD9, 0x08, 0x1C, 0x99, 0x30, 0x70, 0xBD, 0x08, 0x1C, 0xAB, 0x30, 0x70, 0xBD, 0x08, 0x6B, 0x41, 0x7D, 0x02, 0x88, 0x92, 0x00, 0xFF, 0xFF, 0x06, 0x6E, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x51, 0x1A, 0x3C, 0x39, 0xFF, 0x22, 0x5F, 0x32, 0x91, 0x42, 0x03, 0xD9, 0x65, 0x21, 0x01, 0x80, 0x02, 0x21, 0x81, 0x73, 0x9B, 0x48, 0x99, 0x49, 0x08, 0x18, 0xF7, 0x46, 0xC0, 0x46, 0x30, 0x63, 0x08, 0x00, 0xF8, 0xB5, 0x40, 0x68, 0x24, 0x21, 0x41, 0x43, 0x97, 0x48, 0x45, 0x18, 0x28, 0x1D, 0x0C, 0x21, 0x49, 0x19, 0x04, 0x22, 0x01, 0x23, 0x9E, 0x46, 0x94, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x91, 0x4C, 0x00, 0x28, 0x1B, 0xD0, 0x2B, 0x1C, 0x04, 0x22, 0x6E, 0x46, 0x91, 0x49, 0x1F, 0x7B, 0x08, 0x78, 0xC0, 0x43, 0x38, 0x43, 0x30, 0x70, 0x01, 0x33 ,
0x01, 0x31, 0x01, 0x36, 0x01, 0x3A, 0xF5, 0xD1, 0x0C, 0x20, 0x41, 0x19, 0x68, 0x46, 0x04, 0x22, 0x01, 0x23, 0x9E, 0x46, 0x87, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x02, 0xD0, 0x20, 0x1C, 0x4A, 0x30, 0xF8, 0xBD, 0x20, 0x1C, 0xF8, 0xBD, 0xB1, 0xBD, 0x00, 0x00, 0x15, 0x95, 0x00, 0x00, 0x58, 0x3F, 0x08, 0x00, 0xF3, 0xF8, 0x00, 0x00, 0xE9, 0x09, 0x02, 0x00, 0xFF, 0xFF, 0x9C, 0x6E, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x2B, 0x09, 0x02, 0x00, 0xDD, 0x0A, 0x02, 0x00, 0xF8, 0xB5, 0x05, 0x1C, 0xAA, 0x69, 0x7D, 0x49, 0x00, 0x20, 0x08, 0x56, 0x24, 0x21, 0x41, 0x43, 0x76, 0x48, 0x43, 0x18, 0x04, 0x24, 0x6E, 0x46, 0x76, 0x49, 0x1F, 0x79, 0x08, 0x78, 0xC0, 0x43, 0x38, 0x43, 0x30, 0x70, 0x01, 0x33, 0x01, 0x31, 0x01, 0x36, 0x01, 0x3C, 0xF5, 0xD1, 0x11, 0x1D, 0x68, 0x46, 0x04, 0x22, 0x01, 0x24, 0xA6, 0x46, 0x6D, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x01, 0x1C, 0x6D, 0x48, 0x04, 0xD0, 0x6E, 0x49, 0x09, 0x78 ,
0x69, 0x60, 0x45, 0x30, 0xF8, 0xBD, 0xEC, 0x61, 0xAF, 0x30, 0xF8, 0xBD, 0x70, 0xB5, 0xC5, 0x68, 0x81, 0x68, 0x0A, 0x89, 0x6D, 0x4E, 0x00, 0x2A, 0x22, 0xD0, 0x01, 0x24, 0xC2, 0x6D, 0xA2, 0x18, 0xC2, 0x65, 0x08, 0x89, 0x0D, 0x28, 0x1B, 0xD1, 0x68, 0x6B, 0x21, 0x1C, 0xA6, 0x46, 0x63, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x22, 0x1C, 0x28, 0x1C, 0x00, 0x21, 0xA6, 0x46, 0x60, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x2C, 0x60, 0xE9, 0x6B, 0xFF, 0xFF, 0x32, 0x6F, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x28, 0x1C, 0xA6, 0x46, 0x5E, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x28, 0x1C, 0xA6, 0x46, 0x5C, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x30, 0x1C, 0x3D, 0x30, 0x70, 0xBD, 0x30, 0x1C, 0x23, 0x30, 0x70, 0xBD, 0xC0, 0x46, 0xB1, 0x02, 0x00, 0x00, 0x74, 0x3F, 0x08, 0x00, 0x19, 0xC6, 0x00, 0x00, 0x5C, 0x3F, 0x08, 0x00, 0x1D, 0xC2, 0x00, 0x00, 0x68, 0x44, 0x08, 0x00, 0x43, 0x12, 0x03, 0x00, 0x34, 0x63, 0x08, 0x00, 0x2F, 0x7A, 0x02, 0x00 ,
0xB4, 0x36, 0x08, 0x00, 0x8F, 0xF4, 0x01, 0x00, 0xF0, 0xB5, 0x05, 0x1C, 0xAB, 0x69, 0xEC, 0x69, 0x60, 0x68, 0x00, 0x68, 0x2A, 0x30, 0x01, 0x78, 0x0A, 0x06, 0x41, 0x78, 0x09, 0x04, 0x8A, 0x18, 0x81, 0x78, 0x09, 0x02, 0x8A, 0x18, 0xC1, 0x78, 0x8A, 0x18, 0x8E, 0x26, 0xF1, 0x5A, 0x09, 0x0A, 0x01, 0x70, 0xF0, 0x5C, 0x61, 0x68, 0x09, 0x68, 0x2B, 0x26, 0x70, 0x54, 0x8C, 0x20, 0xC0, 0x18, 0x61, 0x68, 0x0E, 0x68, 0x01, 0x88, 0x09, 0x0A, 0x2C, 0x27, 0xB9, 0x55, 0x61, 0x68, 0x09, 0x68, 0xFF, 0xFF, 0xC8, 0x6F, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x2D, 0x26, 0x00, 0x78, 0x70, 0x54, 0x60, 0x68, 0x01, 0x68, 0x32, 0x31, 0x08, 0x78, 0x00, 0x02, 0x49, 0x78, 0x08, 0x18, 0x00, 0x04, 0x00, 0x0C, 0x8C, 0x21, 0xCB, 0x58, 0x35, 0x49, 0x41, 0x40, 0x08, 0x04, 0x00, 0x0C, 0xC0, 0x18, 0x80, 0x1A, 0x01, 0x21, 0x8E, 0x46, 0x32, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x61, 0x68, 0x0A, 0x68, 0x32, 0x23, 0x01, 0x0A, 0x99, 0x54 ,
0x61, 0x68, 0x09, 0x68, 0x33, 0x22, 0x50, 0x54, 0x60, 0x68, 0x68, 0x60, 0x2C, 0x48, 0xF0, 0xBD, 0x00, 0x00, 0x1B, 0x00, 0x34, 0x04, 0x1B, 0x00, 0x02, 0x6A, 0x8B, 0x69, 0xDB, 0x69, 0x1B, 0x68, 0x83, 0x60, 0x88, 0x69, 0xC0, 0x69, 0x41, 0x68, 0x8A, 0x42, 0x00, 0xDA, 0x42, 0x60, 0x25, 0x48, 0x79, 0x30, 0xF7, 0x46, 0x24, 0x48, 0x57, 0x30, 0xF7, 0x46, 0x24, 0x48, 0x91, 0x30, 0xF7, 0x46, 0x32, 0x04, 0x00, 0x00, 0xC4, 0x07, 0x00, 0x00, 0x15, 0x09, 0x02, 0x00, 0xC5, 0x93, 0x00, 0x00, 0x0D, 0x91, 0x00, 0x00, 0x40, 0x1E, 0x80, 0x00, 0x1E, 0x4B, 0xFF, 0xFF, 0x5E, 0x70, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x19, 0x50, 0x1C, 0x49, 0x0A, 0x50, 0xF7, 0x46, 0xC0, 0x46, 0xBD, 0xB5, 0x00, 0x00, 0x95, 0x92, 0x00, 0x00, 0xFD, 0x93, 0x00, 0x00, 0x54, 0x3F, 0x08, 0x00, 0x29, 0x4F, 0x03, 0x00, 0xDF, 0xE8, 0x02, 0x00, 0x36, 0x89, 0x41, 0x00, 0x81, 0x06, 0x00, 0x00, 0xB1, 0x78, 0x00, 0x00, 0x94, 0xEC, 0x01, 0x00 ,
0x08, 0x19, 0x1B, 0x00, 0x8F, 0xC6, 0x03, 0x00, 0x1C, 0x17, 0x1B, 0x00, 0x67, 0x66, 0x03, 0x00, 0xA6, 0x44, 0x08, 0x00, 0x18, 0x17, 0x1B, 0x00, 0xA7, 0x2F, 0x02, 0x00, 0x91, 0x44, 0x03, 0x00, 0x91, 0x63, 0x03, 0x00, 0x5B, 0x44, 0x03, 0x00, 0xE7, 0x44, 0x03, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x61, 0xA2, 0x03, 0x00, 0x6A, 0x1E, 0x01, 0x00, 0x45, 0xDA, 0x00, 0x00, 0xD7, 0xE8, 0x01, 0x00, 0xE9, 0x78, 0x02, 0x00, 0x04, 0xF3, 0x1A, 0x00, 0x80, 0x7B, 0x08, 0x00, 0xFC, 0xB5, 0x04, 0x1C, 0xA5, 0x69, 0x60, 0x6A, 0x01, 0x90, 0x20, 0x69, 0x00, 0x28, 0x35, 0xD4, 0x08, 0x28, 0x33, 0xDA, 0xE1, 0x69, 0x09, 0x68, 0xFF, 0xFF, 0xF4, 0x70, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x10, 0x29, 0x2F, 0xD1, 0xAC, 0x21, 0x41, 0x43, 0x9E, 0x4A, 0x51, 0x5C, 0x49, 0x08, 0x27, 0xD3, 0x00, 0x06, 0x00, 0x16, 0xA2, 0x68, 0x69, 0x46, 0x01, 0x23, 0x9E, 0x46, 0x9A, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x06, 0x1C, 0x39, 0x30, 0x1F, 0xD0 ,
0x00, 0x2E, 0x1D, 0xD0, 0x00, 0x98, 0x07, 0x68, 0x00, 0x99, 0x0C, 0x39, 0x01, 0x98, 0x01, 0x60, 0x28, 0x1D, 0x10, 0x21, 0x79, 0x1A, 0x04, 0x22, 0x01, 0x23, 0x9E, 0x46, 0x91, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x02, 0x22, 0x2A, 0x80, 0xA8, 0x1C, 0x08, 0x21, 0x79, 0x1A, 0x01, 0x23, 0x9E, 0x46, 0x8C, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x03, 0xE0, 0x38, 0x20, 0x00, 0xE0, 0x00, 0x20, 0xC6, 0x43, 0x26, 0x60, 0x89, 0x48, 0x7C, 0x30, 0x20, 0x62, 0xFC, 0xBD, 0x30, 0xB5, 0x05, 0x1C, 0x28, 0x69, 0xA9, 0x69, 0x90, 0x29, 0x1D, 0xD1, 0x69, 0x69, 0x09, 0x78, 0x04, 0x29, 0x19, 0xD0, 0x05, 0x29, 0x17, 0xD0, 0x0A, 0x29, 0x15, 0xD0, 0x06, 0x29, 0x13, 0xD0, 0x0C, 0x29, 0x01, 0xDB, 0xFF, 0xFF, 0x8A, 0x71, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x10, 0x29, 0x0F, 0xD1, 0x01, 0x24, 0xA6, 0x46, 0x7D, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x7C, 0x48, 0x7D, 0x49, 0x00, 0x22, 0xA6, 0x46, 0x7C, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x7C, 0x48 ,
0xFF, 0x30, 0x5F, 0x30, 0x28, 0x62, 0x30, 0xBD, 0xF0, 0xB5, 0x89, 0xB0, 0x05, 0x90, 0x41, 0x69, 0x02, 0x69, 0x75, 0x48, 0x79, 0x4E, 0x82, 0x42, 0x3A, 0xD0, 0x04, 0x30, 0x82, 0x42, 0x25, 0xD0, 0x74, 0x4D, 0xAA, 0x42, 0x00, 0xD0, 0xCC, 0xE0, 0x08, 0x68, 0x06, 0x1C, 0x0C, 0x22, 0x8F, 0x1A, 0x4A, 0x68, 0x89, 0x18, 0x09, 0x1D, 0x10, 0x22, 0x01, 0x24, 0xA6, 0x46, 0x6E, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x01, 0x1C, 0x09, 0xD1, 0xAC, 0x22, 0x72, 0x43, 0xCB, 0x48, 0x80, 0x18, 0x46, 0x22, 0x12, 0x5C, 0x11, 0x2A, 0x01, 0xD1, 0x44, 0x22, 0x14, 0x54, 0x28, 0x1C, 0x3A, 0x1C, 0xA6, 0x46, 0x62, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x69, 0x48, 0xEC, 0x30, 0xAB, 0xE0, 0x08, 0x68, 0xC0, 0x00, 0x30, 0x18, 0x8A, 0x68, 0x02, 0x2A, 0x02, 0xD0, 0xFF, 0xFF, 0x20, 0x72, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xE7, 0x20, 0x80, 0x00, 0xA2, 0xE0, 0xCA, 0x68, 0x89, 0x18, 0x09, 0x7B, 0x41, 0x60, 0x80, 0x21, 0x01, 0x60, 0x3B, 0x20 ,
0x00, 0x01, 0x99, 0xE0, 0x08, 0x68, 0x06, 0x90, 0xC0, 0x00, 0x34, 0x58, 0x10, 0x20, 0x04, 0x90, 0x01, 0x25, 0xAE, 0x46, 0x57, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x07, 0x90, 0x00, 0x28, 0x00, 0xD1, 0x89, 0xE0, 0x0C, 0x21, 0x07, 0x98, 0x0F, 0x18, 0xB0, 0x49, 0xAC, 0x20, 0x06, 0x9A, 0x50, 0x43, 0x08, 0x18, 0x48, 0x22, 0x13, 0x5C, 0x5B, 0x06, 0x5B, 0x0E, 0x13, 0x54, 0x06, 0x9A, 0xD2, 0x00, 0xB6, 0x18, 0x71, 0x68, 0x00, 0x29, 0x47, 0xD1, 0x00, 0x2C, 0x01, 0xDD, 0x08, 0x2C, 0x21, 0xDB, 0x00, 0x22, 0x69, 0x46, 0x0A, 0x70, 0x01, 0x92, 0x0A, 0x81, 0x8A, 0x72, 0xCD, 0x72, 0x0D, 0x73, 0x4D, 0x73, 0x01, 0x88, 0x44, 0x48, 0x06, 0x23, 0xAE, 0x46, 0x44, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x04, 0x1C, 0x02, 0xDC, 0x00, 0x20, 0xC0, 0x43, 0x36, 0xE0, 0x34, 0x60, 0xAC, 0x20, 0x60, 0x43, 0x9A, 0x49, 0xFF, 0xFF, 0xB6, 0x72, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x09, 0x18, 0x5C, 0x22, 0x28, 0x1C, 0x50, 0x54, 0x48, 0x20 ,
0x42, 0x5C, 0x52, 0x06, 0x52, 0x0E, 0x42, 0x54, 0xAC, 0x20, 0x60, 0x43, 0x94, 0x49, 0x08, 0x18, 0x5C, 0x21, 0x09, 0x5C, 0x49, 0x1E, 0x02, 0x29, 0x16, 0xD9, 0x03, 0x39, 0x08, 0xD0, 0x00, 0x20, 0x30, 0x56, 0xAE, 0x46, 0xEA, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x80, 0x20, 0x30, 0x60, 0xDB, 0xE7, 0x08, 0x94, 0x80, 0x21, 0x31, 0x60, 0x48, 0x22, 0x13, 0x5C, 0x19, 0x43, 0x11, 0x54, 0xAE, 0x46, 0xE4, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x0A, 0xE0, 0x01, 0x20, 0xCE, 0xE7, 0x06, 0x98, 0x39, 0x1C, 0x04, 0xAA, 0xAE, 0x46, 0xE0, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x04, 0x1C, 0x08, 0x90, 0x06, 0x98, 0x38, 0x60, 0x08, 0x98, 0x78, 0x60, 0x00, 0x28, 0x15, 0xD0, 0xAC, 0x20, 0x60, 0x43, 0x7C, 0x49, 0x09, 0x18, 0x48, 0x88, 0x02, 0x04, 0x02, 0x20, 0x10, 0x43, 0xB8, 0x60, 0x48, 0x68, 0x02, 0x0E, 0x01, 0x02, 0x09, 0x0E, 0x09, 0x02, 0x11, 0x43, 0x02, 0x04, 0x12, 0x0E, 0xFF, 0xFF, 0x4C, 0x73, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00 ,
0x12, 0x04, 0x0A, 0x43, 0x00, 0x06, 0x10, 0x43, 0xF8, 0x60, 0x07, 0x98, 0x0D, 0x49, 0x00, 0x22, 0x10, 0x23, 0xAE, 0x46, 0xCE, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x13, 0x48, 0x00, 0xE0, 0x16, 0x20, 0xCC, 0x49, 0x09, 0x18, 0x05, 0x98, 0x01, 0x62, 0x09, 0xB0, 0xF0, 0xBD, 0x5D, 0x0D, 0x1B, 0x00, 0x81, 0xE7, 0x02, 0x00, 0x09, 0xB4, 0x03, 0x00, 0x27, 0x1A, 0x02, 0x00, 0x2F, 0x7A, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x05, 0x10, 0x00, 0x00, 0xCF, 0xF6, 0x00, 0x00, 0xD5, 0xF4, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x91, 0x19, 0x02, 0x00, 0x50, 0x65, 0x08, 0x00, 0x71, 0xC0, 0x02, 0x00, 0x50, 0x19, 0x1B, 0x00, 0x29, 0x16, 0x01, 0x00, 0x2A, 0x03, 0x00, 0x00, 0xF0, 0xB5, 0x8B, 0xB0, 0x07, 0x90, 0x05, 0x69, 0x47, 0x69, 0x0C, 0x20, 0x38, 0x1A, 0x08, 0x90, 0xB6, 0x49, 0x8D, 0x42, 0x16, 0xD1, 0x78, 0x68, 0x0F, 0x30, 0x00, 0x11, 0x00, 0x01, 0x78, 0x60, 0x38, 0x68, 0x0B, 0x28, 0x0E, 0xD8, 0x00, 0x23, 0x68, 0x46 ,
0xFF, 0xFF, 0xE2, 0x73, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x03, 0x70, 0x08, 0x98, 0x05, 0x22, 0x01, 0x24, 0xA6, 0x46, 0xAE, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0xAE, 0x48, 0xFF, 0x30, 0x95, 0x30, 0x07, 0x99, 0x08, 0x62, 0xAC, 0x48, 0x85, 0x42, 0x23, 0xD1, 0xAC, 0x48, 0x02, 0x78, 0x6C, 0x46, 0x22, 0x72, 0x43, 0x78, 0x63, 0x72, 0x81, 0x78, 0xA1, 0x72, 0xC0, 0x78, 0xE0, 0x72, 0x00, 0x91, 0x01, 0x90, 0x03, 0x20, 0xA6, 0x49, 0x01, 0x39, 0x01, 0x26, 0xB6, 0x46, 0xF3, 0x4E, 0xFE, 0x44, 0x30, 0x47, 0x04, 0x20, 0x20, 0x70, 0x08, 0x98, 0x9F, 0x49, 0x00, 0x22, 0x02, 0xAB, 0x01, 0x24, 0xA6, 0x46, 0x9B, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x9A, 0x48, 0xFF, 0x30, 0x95, 0x30, 0x07, 0x99, 0x08, 0x62, 0xEB, 0x49, 0x8D, 0x42, 0x14, 0xD1, 0x02, 0x22, 0x68, 0x46, 0x02, 0x70, 0x3A, 0x68, 0xAC, 0x20, 0x42, 0x43, 0x30, 0x48, 0x68, 0x30, 0x83, 0x18, 0x08, 0x98, 0x00, 0x22, 0x01, 0x24, 0xA6, 0x46, 0x8F, 0x4C, 0xFE, 0x44 ,
0x20, 0x47, 0x8E, 0x48, 0xFF, 0x30, 0x95, 0x30, 0x07, 0x99, 0xFF, 0xFF, 0x78, 0x74, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x08, 0x62, 0xEF, 0x48, 0x85, 0x42, 0x00, 0xD0, 0x04, 0xE1, 0x03, 0x20, 0x8C, 0x49, 0x01, 0x22, 0x96, 0x46, 0xEC, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x86, 0x48, 0xFF, 0x30, 0x95, 0x30, 0x09, 0x90, 0x38, 0x68, 0xEA, 0x4D, 0x00, 0x28, 0x00, 0xD1, 0xE2, 0xE0, 0x01, 0x24, 0xA6, 0x46, 0xE6, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x00, 0x28, 0x00, 0xD1, 0xD6, 0xE0, 0xE4, 0x48, 0x02, 0x68, 0x03, 0x20, 0x7F, 0x49, 0x01, 0x31, 0xA6, 0x46, 0xE2, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xDF, 0x48, 0x00, 0x68, 0x00, 0x28, 0x5A, 0xD1, 0xDF, 0x4D, 0x2E, 0x20, 0x41, 0x19, 0xB8, 0x68, 0x03, 0x30, 0x08, 0x70, 0x38, 0x7A, 0x48, 0x70, 0x2E, 0x1C, 0x30, 0x36, 0xB8, 0x68, 0x28, 0x18, 0x30, 0x30, 0xDA, 0x49, 0x0A, 0x68, 0x30, 0x3A, 0x31, 0x1C, 0xA6, 0x46, 0xD8, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x78, 0x68, 0x38, 0x18 ,
0x01, 0x1D, 0xBA, 0x68, 0x30, 0x1C, 0xA6, 0x46, 0xD9, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xB8, 0x68, 0x41, 0x19, 0x97, 0x22, 0xFF, 0xFF, 0x0E, 0x75, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x09, 0x30, 0x50, 0x54, 0xB8, 0x68, 0x46, 0x19, 0x9E, 0x36, 0x30, 0x70, 0x01, 0x36, 0xB8, 0x68, 0x01, 0xE0, 0x14, 0x0D, 0x1B, 0x00, 0x30, 0x18, 0xCA, 0x49, 0x0A, 0x68, 0x9E, 0x3A, 0x31, 0x1C, 0xA6, 0x46, 0xC8, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x78, 0x68, 0x38, 0x18, 0x01, 0x1D, 0xBA, 0x68, 0x30, 0x1C, 0xA6, 0x46, 0xC9, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xB8, 0x68, 0x40, 0x00, 0xC0, 0x49, 0x09, 0x68, 0x08, 0x18, 0x28, 0x18, 0xC0, 0x49, 0x0A, 0x79, 0x02, 0x70, 0x4A, 0x79, 0x42, 0x70, 0x8A, 0x79, 0x82, 0x70, 0xC9, 0x79, 0xC1, 0x70, 0x04, 0x30, 0x0F, 0x21, 0x41, 0x1A, 0x0A, 0x78, 0xBB, 0x68, 0x9A, 0x18, 0x0A, 0x70, 0x40, 0x1B, 0x00, 0x04, 0x00, 0x0C, 0xB5, 0x49, 0x08, 0x60, 0xB1, 0x48, 0x04, 0x60, 0x02, 0x20, 0x01, 0x1C ,
0x11, 0x22, 0xA6, 0x46, 0xB4, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x06, 0x1C, 0x63, 0xD4, 0x03, 0x20, 0xA6, 0x46, 0xB1, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x0A, 0x90, 0x00, 0x25, 0x01, 0x1C, 0xFF, 0xFF, 0xA4, 0x75, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x8D, 0x42, 0x50, 0xD0, 0x29, 0x1C, 0x2B, 0x22, 0xA6, 0x46, 0xAD, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x0C, 0x20, 0x0A, 0x99, 0x40, 0x18, 0xAC, 0x22, 0x72, 0x43, 0xAB, 0x49, 0x8F, 0x18, 0x78, 0x63, 0x29, 0x1C, 0x18, 0x22, 0xA6, 0x46, 0xA6, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x9F, 0x48, 0x02, 0x68, 0x79, 0x6B, 0x4A, 0x60, 0x0A, 0x98, 0xAC, 0x30, 0x08, 0x60, 0x08, 0x68, 0x9A, 0x49, 0xA6, 0x46, 0xA0, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x29, 0x1C, 0x03, 0xA8, 0x10, 0x22, 0xA6, 0x46, 0x9C, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xE0, 0x21, 0x68, 0x46, 0x01, 0x74, 0x45, 0x74, 0x85, 0x74, 0xFB, 0x21, 0xC1, 0x74, 0xEE, 0x49, 0xC1, 0x81, 0x02, 0x21, 0x81, 0x81, 0x79, 0x6B, 0xCA, 0x68 ,
0x01, 0x20, 0xC0, 0x03, 0x10, 0x43, 0xC8, 0x60, 0x48, 0x68, 0x00, 0x90, 0x2A, 0x1C, 0x30, 0x1C, 0x0A, 0x9D, 0x29, 0x1C, 0x03, 0xAB, 0xA6, 0x46, 0xE6, 0x4F, 0xFE, 0x44, 0x38, 0x47, 0x07, 0x1C, 0x30, 0x06, 0x00, 0x16, 0xA6, 0x46, 0xEF, 0x49, 0xFF, 0xFF, 0x3A, 0x76, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xFE, 0x44, 0x08, 0x47, 0x28, 0x1C, 0xA6, 0x46, 0xEE, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x11, 0xE0, 0x30, 0x06, 0x00, 0x16, 0xA6, 0x46, 0xE9, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x01, 0x20, 0xC7, 0x43, 0x08, 0xE0, 0x07, 0x1C, 0x06, 0xE0, 0x00, 0x20, 0x00, 0x21, 0xCF, 0x43, 0x01, 0xE0, 0x00, 0x20, 0x07, 0x1C, 0x28, 0x60, 0x00, 0x23, 0x68, 0x46, 0x03, 0x70, 0x3A, 0x06, 0x12, 0x0E, 0x08, 0x98, 0x6F, 0x49, 0x01, 0x24, 0xA6, 0x46, 0x09, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x07, 0x98, 0x09, 0x99, 0x01, 0x62, 0x0B, 0xB0, 0xF0, 0xBD, 0xC1, 0x18, 0x01, 0x00, 0xF1, 0x1B, 0x01, 0x00, 0xF3, 0x1C, 0x02, 0x00, 0x7B, 0xC0 ,
0x02, 0x00, 0x91, 0xF0, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0xA3, 0xC0, 0x02, 0x00, 0xA9, 0xE9, 0x00, 0x00, 0x07, 0x02, 0x00, 0x00, 0xE4, 0x62, 0x08, 0x00, 0xAC, 0x05, 0x00, 0x00, 0xFE, 0xB5, 0x07, 0x1C, 0x7D, 0x69, 0xBE, 0x69, 0x0C, 0x20, 0x30, 0x1A, 0x01, 0x90, 0xDF, 0x4C, 0x0A, 0x2D, 0x13, 0xD1, 0xFF, 0xFF, 0xD0, 0x76, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x30, 0x68, 0xDB, 0x49, 0x08, 0x60, 0x01, 0x20, 0x86, 0x46, 0xDA, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x0A, 0x20, 0x00, 0x21, 0x01, 0x9A, 0x01, 0x23, 0x9E, 0x46, 0xE6, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xF5, 0x20, 0x80, 0x00, 0x00, 0x19, 0x38, 0x62, 0x03, 0x2D, 0x79, 0xD1, 0xF5, 0x20, 0x80, 0x00, 0x00, 0x19, 0x02, 0x90, 0x70, 0x68, 0x00, 0x28, 0x0C, 0xD1, 0x00, 0x21, 0xCF, 0x48, 0x01, 0x60, 0xCF, 0x48, 0x00, 0x68, 0x00, 0x28, 0x61, 0xD0, 0x01, 0x21, 0x8E, 0x46, 0xCD, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x5B, 0xE0, 0xCC, 0x48, 0xB1, 0x68, 0x01, 0x60 ,
0xF1, 0x68, 0x41, 0x60, 0x31, 0x69, 0x81, 0x60, 0x71, 0x69, 0xC1, 0x60, 0xB1, 0x69, 0xC1, 0x63, 0xF1, 0x69, 0x01, 0x64, 0x31, 0x6A, 0xC1, 0x64, 0x01, 0x24, 0xA6, 0x46, 0xC5, 0x48, 0xFE, 0x44, 0x00, 0x47, 0xA6, 0x46, 0xC4, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x70, 0x68, 0x7D, 0x25, 0xED, 0x00, 0xA8, 0x42, 0x21, 0xD8, 0x01, 0x28, 0x18, 0xD0, 0x02, 0x28, 0x05, 0xD0, 0xFF, 0xFF, 0x66, 0x77, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x28, 0x1C, 0xA6, 0x46, 0xBE, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x1C, 0xE0, 0xB9, 0x48, 0x00, 0x23, 0x19, 0x1C, 0x59, 0x43, 0x3E, 0x22, 0x4A, 0x43, 0x82, 0x83, 0x02, 0x30, 0x01, 0x33, 0x10, 0x2B, 0xF6, 0xDB, 0xA6, 0x46, 0xB4, 0x48, 0xFE, 0x44, 0x00, 0x47, 0xB5, 0x48, 0x0D, 0xE0, 0xB5, 0x4D, 0x28, 0x1C, 0xA6, 0x46, 0xB2, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x04, 0xE0, 0xA6, 0x46, 0xAF, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x75, 0x68, 0xAE, 0x48, 0x05, 0x60, 0x05, 0x1C, 0xA7, 0x4E, 0x30, 0x68 ,
0x00, 0x28, 0x06, 0xD1, 0xAD, 0x48, 0x00, 0x68, 0xA6, 0x46, 0xAC, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x30, 0x60, 0x00, 0x94, 0x2B, 0x68, 0xAA, 0x49, 0xAB, 0x4A, 0xA6, 0x46, 0xAB, 0x4D, 0xFE, 0x44, 0x28, 0x47, 0x9C, 0x48, 0x04, 0x60, 0x03, 0x20, 0x00, 0x21, 0x01, 0x9A, 0x01, 0x23, 0x9E, 0x46, 0xA7, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x02, 0x98, 0x38, 0x62, 0xFE, 0xBD, 0xC0, 0x46, 0x13, 0x7F, 0x03, 0x00, 0x12, 0x10, 0x00, 0x00, 0xFF, 0xFF, 0xFC, 0x77, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x30, 0xB5, 0x05, 0x1C, 0x00, 0x20, 0x01, 0x24, 0xA6, 0x46, 0xA0, 0x49, 0xFE, 0x44, 0x08, 0x47, 0xA6, 0x46, 0x9F, 0x49, 0xFE, 0x44, 0x08, 0x47, 0xA6, 0x46, 0x9E, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x7D, 0x21, 0xC9, 0x00, 0xA6, 0x46, 0x9E, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0x9B, 0x49, 0x08, 0x18, 0x99, 0x49, 0x08, 0x80, 0x9B, 0x48, 0x0A, 0x30, 0x28, 0x62, 0x30, 0xBD, 0x11, 0x10, 0x00, 0x00, 0xDD, 0x7E, 0x03, 0x00, 0xB9, 0x90 ,
0x00, 0x00, 0x6C, 0x64, 0x08, 0x00, 0xE7, 0x7E, 0x03, 0x00, 0x74, 0x64, 0x08, 0x00, 0x70, 0x64, 0x08, 0x00, 0x6D, 0xC6, 0x03, 0x00, 0x08, 0x19, 0x1B, 0x00, 0x11, 0x18, 0x02, 0x00, 0xD1, 0x78, 0x02, 0x00, 0xC9, 0xBA, 0x03, 0x00, 0x09, 0xB4, 0x03, 0x00, 0x14, 0x0D, 0x1B, 0x00, 0xFE, 0xB5, 0x02, 0x90, 0x45, 0x69, 0x68, 0x46, 0x01, 0x21, 0x8E, 0x46, 0x89, 0x49, 0xFE, 0x44, 0x08, 0x47, 0x89, 0x48, 0x04, 0x1C, 0x68, 0x68, 0x01, 0x69, 0x4A, 0x78, 0x00, 0x27, 0x3E, 0x1C, 0x20, 0x88, 0xFF, 0xFF, 0x92, 0x78, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x40, 0x08, 0x22, 0xD3, 0x20, 0x1D, 0x89, 0x1C, 0x01, 0x23, 0x9E, 0x46, 0x83, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x00, 0x28, 0x07, 0xD1, 0x68, 0x68, 0x00, 0x69, 0x40, 0x78, 0x21, 0x88, 0x09, 0x04, 0x89, 0x16, 0x81, 0x42, 0x3D, 0xD0, 0x02, 0x20, 0x00, 0x5F, 0x00, 0x99, 0x08, 0x1A, 0x00, 0x04, 0x00, 0x14, 0x3C, 0x28, 0x03, 0xDD, 0x20, 0x88, 0x40, 0x10, 0x40, 0x00 ,
0x20, 0x80, 0x78, 0x1C, 0x07, 0x06, 0x3F, 0x0E, 0x68, 0x68, 0x01, 0x69, 0x4A, 0x78, 0x2A, 0x34, 0x01, 0x36, 0x14, 0x2E, 0xD5, 0xDB, 0x00, 0x2A, 0x02, 0xD1, 0xAB, 0x20, 0x40, 0x00, 0x50, 0xE0, 0x00, 0x9B, 0x6D, 0x48, 0x14, 0x21, 0x00, 0x22, 0x04, 0x88, 0x64, 0x08, 0x03, 0xD3, 0x2A, 0x30, 0x01, 0x32, 0x01, 0x39, 0xF8, 0xD1, 0x12, 0x06, 0x12, 0x0E, 0x14, 0x2F, 0x16, 0xD1, 0x66, 0x48, 0x00, 0x88, 0x00, 0x06, 0x44, 0x16, 0x64, 0x49, 0x00, 0x22, 0x01, 0x20, 0x4E, 0x8D, 0x36, 0x06, 0x76, 0x16, 0xA6, 0x42, 0x02, 0xDD, 0x34, 0x1C, 0x02, 0x06, 0xFF, 0xFF, 0x28, 0x79, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0x12, 0x0E, 0x2A, 0x31, 0x01, 0x30, 0x14, 0x28, 0xF3, 0xDB, 0x02, 0xE0, 0x32, 0x06, 0x12, 0x0E, 0x00, 0x9B, 0x2A, 0x20, 0x42, 0x43, 0x5A, 0x48, 0x11, 0x18, 0x0C, 0x88, 0x01, 0x20, 0x20, 0x43, 0x00, 0x04, 0x00, 0x0C, 0x08, 0x80, 0xFE, 0x24, 0xA0, 0x43, 0x14, 0x24, 0x64, 0x57, 0x64, 0x06, 0x24, 0x0E ,
0x04, 0x43, 0x52, 0x48, 0x14, 0x52, 0x14, 0x18, 0x63, 0x80, 0x08, 0x88, 0x80, 0x05, 0x82, 0x0D, 0x68, 0x68, 0x00, 0x69, 0x40, 0x78, 0x80, 0x02, 0x10, 0x43, 0x08, 0x80, 0x68, 0x68, 0x02, 0x69, 0x20, 0x1D, 0x91, 0x1C, 0x52, 0x78, 0x01, 0x23, 0x9E, 0x46, 0x4B, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x02, 0x98, 0x04, 0x61, 0xFE, 0x20, 0x47, 0x49, 0x09, 0x18, 0x02, 0x98, 0x01, 0x62, 0xFE, 0xBD, 0x82, 0x69, 0x41, 0x69, 0x03, 0x69, 0x02, 0x2B, 0x0A, 0xD1, 0x01, 0x2A, 0x01, 0xD1, 0x00, 0x29, 0x05, 0xD0, 0x02, 0x2A, 0x04, 0xD1, 0x00, 0x29, 0x02, 0xD1, 0x11, 0x21, 0x00, 0xE0, 0x06, 0x21, 0x41, 0x61, 0xF7, 0x46, 0xFF, 0xFF, 0xBE, 0x79, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xC0, 0x46, 0x14, 0xE9, 0x00, 0x00, 0xC9, 0x18, 0x02, 0x00, 0x30, 0xB5, 0x05, 0x1C, 0x3A, 0x48, 0x00, 0x78, 0x00, 0x28, 0x04, 0xD0, 0x01, 0x20, 0x86, 0x46, 0x38, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x01, 0x24, 0xA6, 0x46, 0x37, 0x48, 0xFE, 0x44 ,
0x00, 0x47, 0xA6, 0x46, 0x36, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x35, 0x48, 0x0E, 0x30, 0x28, 0x62, 0x30, 0xBD, 0x49, 0x19, 0x01, 0x00, 0x2F, 0x7A, 0x02, 0x00, 0x18, 0xB5, 0x43, 0x69, 0x81, 0x69, 0x31, 0x48, 0x81, 0x29, 0x00, 0xD1, 0x0B, 0x38, 0x00, 0x21, 0x00, 0x91, 0x1A, 0x68, 0x9B, 0x68, 0x01, 0x24, 0xA6, 0x46, 0x2D, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x18, 0xBD, 0x18, 0xB5, 0x40, 0x69, 0x00, 0x21, 0x00, 0x91, 0x02, 0x68, 0x83, 0x68, 0x27, 0x48, 0x01, 0x30, 0x01, 0x24, 0xA6, 0x46, 0x26, 0x4C, 0xFE, 0x44, 0x20, 0x47, 0x18, 0xBD, 0xC0, 0x46, 0x30, 0x63, 0x08, 0x00, 0x19, 0x9E, 0x00, 0x00, 0xB9, 0xEC, 0x00, 0x00, 0x74, 0x3F, 0x08, 0x00, 0x80, 0x3F, 0x08, 0x00, 0xFF, 0xFF, 0x54, 0x7A, 0x08, 0x00, 0x96, 0x00, 0x00, 0x00, 0xB7, 0x5D, 0x03, 0x00, 0x00, 0x00, 0x1B, 0x00, 0xD3, 0x8E, 0x00, 0x00, 0xF7, 0xC6, 0x00, 0x00, 0xE5, 0x90, 0x00, 0x00, 0x68, 0x64, 0x08, 0x00, 0xC0, 0x27, 0x09, 0x00, 0xA0, 0x3B ,
0x08, 0x00, 0x3D, 0x5D, 0x03, 0x00, 0x19, 0xC6, 0x00, 0x00, 0xE8, 0x3A, 0x08, 0x00, 0x81, 0x5D, 0x03, 0x00, 0xCF, 0xF6, 0x00, 0x00, 0x4B, 0x4F, 0x03, 0x00, 0x6B, 0xC0, 0x03, 0x00, 0x95, 0x1E, 0x01, 0x00, 0xDA, 0x40, 0x08, 0x00, 0xDC, 0x05, 0x00, 0x00, 0x55, 0xAA, 0x03, 0x00, 0x0D, 0x91, 0x00, 0x00, 0xD7, 0x56, 0x03, 0x00, 0x08, 0x51, 0x08, 0x00, 0x8F, 0xC6, 0x03, 0x00, 0x65, 0xB8, 0x00, 0x00, 0x09, 0xB4, 0x03, 0x00, 0x84, 0x17, 0x1B, 0x00, 0xB5, 0x86, 0x01, 0x00, 0x3D, 0x47, 0x02, 0x00, 0x73, 0x49, 0x02, 0x00, 0x5F, 0x90, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x00, 0xF7, 0xF6, 0x00, 0x00, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x76, 0xFF, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x5A, 0xFF, 0xFF, 0xBD, 0xFF, 0xB5, 0xFF, 0xFF, 0xEA, 0x7A, 0x08, 0x00, 0x58, 0x00, 0x00, 0x00, 0x68, 0x46, 0xFF, 0xF7, 0x99, 0xFF, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x83, 0xFF, 0xFF, 0xBD, 0xFF, 0xB5 ,
0x68, 0x46, 0xFF, 0xF7, 0xB6, 0xFE, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x55, 0xFC, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x27, 0xFB, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0xDD, 0xFA, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x68, 0xFE, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0x3D, 0xFB, 0xFF, 0xBD, 0xFF, 0xB5, 0x68, 0x46, 0xFF, 0xF7, 0xBE, 0xFD, 0xFF, 0xBD, 0x78, 0x7B, 0x08, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xF8, 0xF0, 0x43, 0xFA, 0x00, 0xBD, 0x35, 0x66, 0x08, 0x00, 0x67, 0x66, 0x08, 0x00, 0x71, 0x65, 0x08, 0x00, 0x4D, 0x66, 0x08, 0x00, 0x25, 0x64, 0x08, 0x00, 0x81, 0x66, 0x08, 0x00, 0x8D, 0x66, 0x08, 0x00, 0x99, 0x66, 0x08, 0x00, 0x87, 0x67, 0x08, 0x00, 0xA7, 0x67, 0x08, 0x00, 0xD1, 0x67, 0x08, 0x00, 0x1B, 0x68, 0x08, 0x00, 0x57, 0x68, 0x08, 0x00, 0x2D, 0x69, 0x08, 0x00, 0xB1, 0x6B, 0x08, 0x00, 0xD5, 0x6B, 0x08, 0x00, 0xF9, 0x6B ,
0x08, 0x00, 0x15, 0x6C, 0x08, 0x00, 0xA1, 0x68, 0x08, 0x00, 0x59, 0x6C, 0x08, 0x00, 0xA7, 0x6D, 0x08, 0x00, 0xFF, 0x6D, 0x08, 0x00, 0x29, 0x6E, 0x08, 0x00, 0xF9, 0x6E, 0x08, 0x00, 0xD9, 0x6C, 0x08, 0x00, 0xA5, 0x6E, 0x08, 0x00, 0xCD, 0x6D, 0x08, 0x00, 0x81, 0x6F, 0x08, 0x00, 0x1D, 0x70, 0x08, 0x00, 0x31, 0x64, 0x08, 0x00, 0x39, 0x70, 0x08, 0x00, 0x3F, 0x70, 0x08, 0x00, 0x04, 0xF3, 0x1A, 0x00, 0x80, 0x00, 0x00, 0x00, 0xB2, 0x4E, 0x01, 0x00, 0x5A, 0xC1, 0x00, 0x00, 0x96, 0x1A, 0x01, 0x00, 0x22, 0x0B, 0x02, 0x00, 0x60, 0xD0, 0x01, 0x00, 0x06, 0x1A, 0x00, 0x00, 0xB8, 0xC6, 0x01, 0x00, 0xD8, 0x42, 0x03, 0x00, 0x16, 0x42, 0x03, 0x00, 0xEE, 0xDB, 0x00, 0x00, 0x62, 0xDC, 0x00, 0x00, 0xC8, 0xE1, 0x00, 0x00, 0x8A, 0x17, 0x02, 0x00, 0x38, 0xBE, 0x00, 0x00, 0x26, 0xC6, 0x00, 0x00, 0x56, 0xC2, 0x00, 0x00, 0x62, 0x12, 0x03, 0x00, 0xE4, 0xF4, 0x01, 0x00, 0x3A, 0xEC, 0x00, 0x00, 0x5E, 0x92, 0x00, 0x00 ,
0xFE, 0xE8, 0x02, 0x00, 0x18, 0x7F, 0x00, 0x00, 0x64, 0xEC, 0x01, 0x00, 0xFE, 0x44, 0x03, 0x00, 0x1C, 0x94, 0x00, 0x00, 0xA8, 0x66, 0x03, 0x00, 0x74, 0xE9, 0x02, 0x00, 0x68, 0x1E, 0x01, 0x00, 0xBC, 0xDA, 0x00, 0x00, 0xEA, 0xE1, 0x00, 0x00, 0x24, 0xE9, 0x01, 0x00, 0x70, 0x79, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0x1C, 0xF0, 0xB5, 0x88, 0xB0, 0xCA, 0x4C, 0x03, 0x20, 0x22, 0x78, 0x63, 0x78, 0xCA, 0x4E, 0x31, 0x1C, 0x01, 0x39, 0x01, 0x25, 0xAE, 0x46, 0xC7, 0x4F, 0xFE, 0x44, 0x38, 0x47, 0xA2, 0x78, 0xE3, 0x78, 0x03, 0x20, 0x31, 0x1C, 0xAE, 0x46, 0xC3, 0x4F, 0xFE, 0x44, 0x38, 0x47, 0x03, 0x20, 0x31, 0x1C, 0x01, 0x31, 0xAE, 0x46, 0xC1, 0x4A, 0xFE, 0x44, 0x10, 0x47, 0xC1, 0x48, 0x21, 0x78, 0x01, 0x70, 0x61, 0x78, 0x41, 0x70, 0xE1, 0x78, 0xC1, 0x70, 0xA1, 0x78, 0x81, 0x70, 0xBF, 0x48, 0x04, 0x1C, 0x33, 0x3C, 0x20, 0x1C, 0x00, 0x21, 0xDC, 0x22, 0xAE, 0x46 ,
0xBA, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x84, 0x20, 0xA0, 0x70, 0x05, 0x27, 0xE7, 0x71, 0x0C, 0x26, 0x26, 0x73, 0x0D, 0x20, 0x00, 0x19, 0x98, 0xA1, 0x32, 0x1C, 0xAE, 0x46, 0xB4, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x04, 0x20, 0x60, 0x76, 0x1A, 0x20, 0x00, 0x19, 0x97, 0xA1, 0x06, 0x91, 0x04, 0x22, 0xAE, 0x46, 0xAE, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xFF, 0xFF, 0x96, 0x00, 0x18, 0x00, 0x96, 0x00, 0x00, 0x00, 0xA7, 0x77, 0x1F, 0x34, 0x95, 0xA1, 0x07, 0x91, 0x20, 0x1C, 0x3A, 0x1C, 0xAE, 0x46, 0xA9, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xE6, 0x71, 0x28, 0x1C, 0x60, 0x72, 0x11, 0x20, 0x20, 0x73, 0x94, 0x20, 0x60, 0x73, 0xC0, 0x25, 0x65, 0x74, 0xA6, 0x74, 0x09, 0x22, 0xE2, 0x74, 0xA3, 0x4C, 0x20, 0x1C, 0x8C, 0xA1, 0x01, 0x23, 0x9E, 0x46, 0x9F, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x07, 0x22, 0x62, 0x72, 0x9E, 0x4C, 0x0A, 0x34, 0x20, 0x1C, 0x89, 0xA1, 0x01, 0x23, 0x9E, 0x46, 0x9A, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x04, 0x20 ,
0xE0, 0x71, 0x98, 0x4C, 0x12, 0x34, 0x20, 0x1C, 0x06, 0x99, 0x04, 0x22, 0x01, 0x23, 0x9E, 0x46, 0x94, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x27, 0x71, 0x93, 0x4C, 0x17, 0x34, 0x20, 0x1C, 0x07, 0x99, 0x3A, 0x1C, 0x01, 0x23, 0x9E, 0x46, 0x8E, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0xE6, 0x71, 0x01, 0x20, 0x60, 0x72, 0x11, 0x20, 0x20, 0x73, 0x94, 0x20, 0x60, 0x73, 0x02, 0x20, 0xE0, 0x73, 0x25, 0x74, 0x66, 0x74, 0xFF, 0xFF, 0x2C, 0x01, 0x18, 0x00, 0x96, 0x00, 0x00, 0x00, 0xA5, 0x74, 0x2F, 0x27, 0xE7, 0x74, 0x10, 0x20, 0x60, 0x75, 0x80, 0x26, 0xA6, 0x75, 0x01, 0x20, 0xE0, 0x75, 0x11, 0x20, 0xA0, 0x76, 0x94, 0x20, 0xE0, 0x76, 0x24, 0x20, 0x60, 0x77, 0x0A, 0x22, 0xA2, 0x77, 0x80, 0x4C, 0x36, 0x34, 0x20, 0x1C, 0x6D, 0xA1, 0x01, 0x23, 0x9E, 0x46, 0x7C, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x18, 0x22, 0xA2, 0x72, 0x7A, 0x4C, 0x41, 0x34, 0x20, 0x1C, 0x6B, 0xA1, 0x01, 0x23, 0x9E, 0x46, 0x76, 0x4B, 0xFE, 0x44, 0x18, 0x47 ,
0x25, 0x76, 0x67, 0x76, 0x21, 0x20, 0xE0, 0x76, 0x26, 0x77, 0x01, 0x20, 0x60, 0x77, 0x72, 0x48, 0x61, 0x30, 0x11, 0x21, 0x01, 0x70, 0x94, 0x21, 0x41, 0x70, 0x04, 0x21, 0x01, 0x72, 0xD2, 0x21, 0x41, 0x72, 0xC5, 0x72, 0x1E, 0x21, 0x01, 0x73, 0x45, 0x73, 0x9E, 0x21, 0x81, 0x73, 0x01, 0x21, 0x01, 0x74, 0x46, 0x74, 0x81, 0x74, 0x11, 0x21, 0x41, 0x75, 0x94, 0x21, 0x81, 0x75, 0x04, 0x21, 0x01, 0x76, 0xAD, 0x20, 0x66, 0x49, 0x08, 0x60, 0x00, 0x24, 0x0F, 0x25, 0xFF, 0xFF, 0xC2, 0x01, 0x18, 0x00, 0x96, 0x00, 0x00, 0x00, 0x29, 0x06, 0x09, 0x0E, 0x00, 0x20, 0x6A, 0x46, 0x01, 0x23, 0x9E, 0x46, 0x62, 0x4B, 0xFE, 0x44, 0x18, 0x47, 0x6B, 0x46, 0x18, 0x88, 0x40, 0x08, 0x0E, 0xD3, 0xA0, 0x00, 0x0F, 0x21, 0xCA, 0x43, 0x69, 0x46, 0x0E, 0x88, 0x16, 0x40, 0x01, 0xAF, 0x3E, 0x52, 0x49, 0x88, 0x11, 0x40, 0x68, 0x44, 0xC1, 0x80, 0x60, 0x1C, 0x04, 0x04, 0x24, 0x0C, 0x01, 0x3D, 0x0B, 0x2D, 0xE0, 0xDA, 0x60, 0x1E ,
0x00, 0x04, 0x00, 0x0C, 0x1D, 0xD0, 0x86, 0x46, 0x01, 0x1C, 0x01, 0xAD, 0x01, 0x22, 0xAE, 0x88, 0x90, 0x00, 0xC7, 0x5A, 0xB7, 0x42, 0x0A, 0xDA, 0xBC, 0x46, 0x07, 0x1C, 0x6F, 0x44, 0x7F, 0x88, 0x68, 0x44, 0x06, 0x80, 0xEE, 0x88, 0x46, 0x80, 0x60, 0x46, 0xA8, 0x80, 0xEF, 0x80, 0x04, 0x35, 0x50, 0x1C, 0x02, 0x04, 0x12, 0x0C, 0x01, 0x39, 0xE9, 0xD1, 0x70, 0x46, 0x01, 0x38, 0x86, 0x46, 0xE2, 0xD1, 0x99, 0x88, 0x68, 0x46, 0xC0, 0x88, 0x40, 0x18, 0x00, 0x04, 0x00, 0x0C, 0x42, 0x4B, 0x18, 0x80, 0x42, 0x49, 0x08, 0x1A, 0xFF, 0xFF, 0x58, 0x02, 0x18, 0x00, 0x96, 0x00, 0x00, 0x00, 0x58, 0x80, 0x02, 0x2C, 0x1E, 0xDB, 0x65, 0x1E, 0x01, 0xAA, 0x01, 0x20, 0x01, 0x1C, 0x8C, 0x00, 0x6B, 0x46, 0xE6, 0x5A, 0x93, 0x88, 0xD4, 0x88, 0xE7, 0x18, 0xB7, 0x42, 0x0C, 0xDA, 0x06, 0x24, 0x44, 0x43, 0x38, 0x4B, 0x1B, 0x19, 0x1F, 0x80, 0x1C, 0x88, 0x34, 0x1B, 0x5C, 0x80, 0x01, 0x24, 0x1C, 0x71, 0x40, 0x1C, 0x00, 0x04 ,
0x00, 0x0C, 0x04, 0x32, 0x49, 0x1C, 0x09, 0x06, 0x09, 0x0E, 0x01, 0x3D, 0xE4, 0xD1, 0x00, 0x24, 0x31, 0x48, 0x04, 0x70, 0x31, 0x48, 0x04, 0x70, 0x31, 0x48, 0x04, 0x70, 0x31, 0x48, 0x04, 0x70, 0x01, 0x20, 0x86, 0x46, 0x30, 0x48, 0xFE, 0x44, 0x00, 0x47, 0x2F, 0x49, 0x22, 0x1C, 0x08, 0x68, 0x00, 0x28, 0x02, 0xD0, 0x01, 0x20, 0x90, 0x40, 0x04, 0x43, 0x04, 0x31, 0x01, 0x32, 0x20, 0x2A, 0xF5, 0xD3, 0x2A, 0x48, 0x04, 0x60, 0x08, 0xB0, 0xF0, 0xBD, 0x5F, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2D, 0x69, 0x6E, 0x66, 0x6F, 0x00, 0xC0, 0x46, 0xC0, 0x5F, 0x75, 0x64, 0x70, 0x00, 0xC0, 0xFF, 0xFF, 0xEE, 0x02, 0x18, 0x00, 0x96, 0x00, 0x00, 0x00, 0x46, 0xC0, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x00, 0xC0, 0x46, 0x5F, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0xC0, 0x46, 0x5F, 0x64, 0x6E, 0x73, 0x2D, 0x73, 0x64, 0x00, 0x64, 0x65, 0x76, 0x3D, 0x43, 0x43, 0x33, 0x30, 0x30, 0x30, 0x00, 0xC0, 0x76, 0x65 ,
0x6E, 0x64, 0x6F, 0x72, 0x3D, 0x54, 0x65, 0x78, 0x61, 0x73, 0x2D, 0x49, 0x6E, 0x73, 0x74, 0x72, 0x75, 0x6D, 0x65, 0x6E, 0x74, 0x73, 0x00, 0xC0, 0x46, 0xC0, 0x00, 0x00, 0x18, 0x00, 0xF3, 0x7E, 0x03, 0x00, 0xC6, 0x05, 0x00, 0x00, 0xDD, 0x7E, 0x03, 0x00, 0xE4, 0x62, 0x08, 0x00, 0xC9, 0xBA, 0x03, 0x00, 0x09, 0xB4, 0x03, 0x00, 0xA7, 0x64, 0x08, 0x00, 0x70, 0x64, 0x08, 0x00, 0xDD, 0x0A, 0x02, 0x00, 0x48, 0x32, 0x08, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xE8, 0x62, 0x08, 0x00, 0xE9, 0x62, 0x08, 0x00, 0xEA, 0x62, 0x08, 0x00, 0xEB, 0x62, 0x08, 0x00, 0x81, 0x03, 0x18, 0x00, 0x80, 0x7B, 0x08, 0x00, 0x84, 0xF3, 0x1A, 0x00, 0x0D, 0x49, 0x0E, 0x48, 0xFF, 0xFF, 0x84, 0x03, 0x18, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x88, 0x67, 0x0E, 0x48, 0x88, 0x64, 0x0E, 0x48, 0x48, 0x64, 0x0E, 0x48, 0xC8, 0x64, 0x0E, 0x48, 0x08, 0x65, 0x11, 0x48, 0x02, 0x1C, 0x04, 0x32, 0x0C, 0x4B, 0x13, 0x60, 0x0C, 0x4B, 0x93, 0x62, 0x0C, 0x4A ,
0x8A, 0x66, 0x0D, 0x49, 0x01, 0x60, 0x0D, 0x48, 0x0E, 0x49, 0x01, 0x60, 0x0E, 0x49, 0x41, 0x60, 0xF7, 0x46, 0x1C, 0x21, 0x08, 0x00, 0x1B, 0x7B, 0x08, 0x00, 0x11, 0x7B, 0x08, 0x00, 0x07, 0x7B, 0x08, 0x00, 0x39, 0x7B, 0x08, 0x00, 0x2F, 0x7B, 0x08, 0x00, 0x25, 0x7B, 0x08, 0x00, 0xFD, 0x7A, 0x08, 0x00, 0xDF, 0x7A, 0x08, 0x00, 0x50, 0x23, 0x08, 0x00, 0xD5, 0x7A, 0x08, 0x00, 0x58, 0x26, 0x08, 0x00, 0xF3, 0x7A, 0x08, 0x00, 0xE9, 0x7A, 0x08, 0x00 };
uint16_t drv_length = 8024;
//Service Pack version P1.12.7.15.15 - FW patches
unsigned char PROGMEM fw_patch[5700] = { 0x00, 0x01, 0x00, 0x00, 0x3C, 0x16, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x14, 0x03, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x46, 0x25, 0xF0, 0x95, 0xFB, 0xE0, 0x6B, 0xD0, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x25, 0xF0, 0x38, 0xFB, 0x2C, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x25, 0xF0, 0x0A, 0xFB, 0x04, 0x15, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xB8, 0xF1, 0x90, 0x0F, 0xA4, 0x16, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x66, 0xE0, 0x04, 0xA8, 0x35, 0x1D, 0x21, 0xF0, 0x99, 0xFC, 0x68, 0x46, 0x23, 0xF0, 0x28, 0xFB, 0x9A, 0xF8, 0x00, 0x00, 0x01, 0x28, 0x07, 0xD1, 0x28, 0x46, 0x05, 0xF0, 0xC3, 0xFE, 0x01, 0x46, 0x01, 0xAA, 0x00, 0x20, 0x21, 0xF0, 0x50, 0xF9, 0x28, 0x46, 0x05, 0xF0, 0xBB, 0xFE, 0x01, 0xA9, 0x21, 0xF0, 0x2A, 0xFA, 0xE9, 0x79, 0x4F, 0xEA, 0xE0, 0x00, 0x40, 0xB2, 0x11, 0xB1, 0x00, 0xF1, 0x06, 0x00, 0x40, 0xB2, 0xA8, 0x71, 0x1F, 0x38, 0x40, 0x00, 0xE8, 0x71, 0x30, 0x46 ,
0x01, 0xF0, 0x0D, 0xFF, 0x10, 0xF1, 0x00, 0x09, 0x4F, 0xF0, 0x00, 0x01, 0x09, 0xD0, 0x28, 0x68, 0x40, 0x0C, 0x09, 0xD3, 0xE8, 0x68, 0xC0, 0x0B, 0x03, 0xD2, 0x48, 0x46, 0xFF, 0xF7, 0xDD, 0xFE, 0x01, 0x21, 0x28, 0x68, 0x40, 0x0C, 0x0A, 0xD2, 0x38, 0x68, 0x40, 0x1C, 0x38, 0x60, 0x20, 0x68, 0x6F, 0xF3, 0x0F, 0x00, 0x20, 0x60, 0x22, 0x68, 0x38, 0x68, 0x10, 0x43, 0x20, 0x60, 0xE8, 0x68, 0xC0, 0x0B, 0x0F, 0xD3, 0xD8, 0xF8, 0x00, 0x00, 0x00, 0xF1, 0x01, 0x00, 0xC8, 0xF8, 0x00, 0x00, 0x20, 0x68, 0x6F, 0xF3, 0x1F, 0x40, 0x20, 0x60, 0xD8, 0xF8, 0x00, 0x20, 0x20, 0x68, 0x40, 0xEA, 0x02, 0x40, 0x20, 0x60, 0x49, 0xB9, 0xB9, 0xF1, 0x00, 0x0F, 0x03, 0xD1, 0x30, 0x46, 0x07, 0xF0, 0xBE, 0xF9, 0x02, 0xE0, 0x48, 0x46, 0x07, 0xF0, 0x06, 0xFA, 0x6C, 0x17, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x68, 0x46, 0x0E, 0xF0, 0x85, 0xFB, 0x00, 0x9E, 0x00, 0x2E, 0x96, 0xD1, 0x05, 0xB0, 0xBD, 0xE8, 0xF0, 0x87, 0xC0, 0x46 ,
0x9C, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0xF0, 0x2A, 0xFE, 0x74, 0x47, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0B, 0x21, 0x21, 0xF0, 0x41, 0xFA, 0x20, 0x68, 0x18, 0x4B, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x21, 0xF0, 0x1C, 0xF9, 0x0A, 0xE0, 0x20, 0x68, 0x00, 0x68, 0x0C, 0x21, 0x40, 0xF0, 0x20, 0x00, 0x21, 0xF0, 0x14, 0xF9, 0x10, 0x57, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0xA8, 0x20, 0xF0, 0x97, 0xF9, 0x01, 0x98, 0x5C, 0x57, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0xA8, 0x20, 0xF0, 0x71, 0xF9, 0x03, 0x98, 0x00, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0xF0, 0x20, 0xF9, 0x1C, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0xF0, 0x12, 0xF9, 0x54, 0x58, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0xA8, 0x20, 0xF0, 0xF5, 0xF8, 0x04, 0xAB, 0x04, 0x62, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x79, 0x1F, 0xF0, 0x1B, 0xFD, 0x69, 0xE0, 0x60, 0x93, 0x00, 0x00, 0x40, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0xA6, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x78, 0x1B, 0xF0, 0x39, 0xFB, 0x28, 0x46, 0x90, 0xA8, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x78, 0x1B, 0xF0, 0x69, 0xF9, 0x1E, 0x48, 0x34, 0xAD, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x09, 0x68, 0xFF, 0x29, 0x98, 0xAD, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10, 0xD4, 0x21, 0xD4, 0xB2, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0xD0, 0x1A, 0xF0, 0x47, 0xFC, 0x20, 0x98, 0xAC, 0xC5, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x78, 0x19, 0xF0 ,
0xDB, 0xFA, 0x09, 0x49, 0x28, 0xC6, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x19, 0xF0, 0x9E, 0xFA, 0xDC, 0xD3, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xB5, 0x18, 0xF0, 0xAB, 0xFC, 0x00, 0xF0, 0x03, 0xF8, 0x00, 0xBD, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xDF, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0xF0, 0xA8, 0xFD, 0xCC, 0xEB, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x38, 0x78, 0x17, 0xF0, 0x77, 0xF8, 0x38, 0x78, 0x16, 0xF0, 0xF0, 0xFF, 0xA8, 0xF7, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0E, 0x49, 0x09, 0x68, 0x23, 0x22, 0x41, 0x61, 0xC8, 0xF7, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x31, 0x2E, 0x31, 0x39, 0x2E, 0x33, 0x31, 0x34, 0x5F, 0x4E, 0x65, 0x77, 0x5F, 0x43, 0x43, 0x41, 0x5F, 0x61, 0x6C, 0x67, 0x6F, 0x72, 0x69, 0x74, 0x68, 0x6D, 0x00, 0xC0, 0x74, 0x56, 0x30, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0xF9, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0xA8, 0x16, 0xF0, 0x79, 0xF8 ,
0x12, 0xE0, 0x38, 0xFA, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0xA8, 0x16, 0xF0, 0x03, 0xF8, 0x32, 0x20, 0x94, 0xFB, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x0C, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x05, 0xA8, 0x14, 0xF0, 0x05, 0xFF, 0x01, 0xF0, 0x10, 0x1B, 0x01, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x1E, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0xF0, 0x46, 0xBF, 0x18, 0x30, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x30, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x12, 0xF0, 0xD8, 0xFC, 0x9C, 0x31, 0x01, 0x00, 0x08, 0x00 ,
0x00, 0x00, 0x68, 0x46, 0x12, 0xF0, 0x51, 0xFC, 0xFE, 0xF7, 0xF0, 0x35, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x46, 0x12, 0xF0, 0x27, 0xFA, 0xFE, 0xF7, 0xF0, 0x3D, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x05, 0xA9, 0x11, 0xF0, 0x27, 0xFE, 0x20, 0x6F, 0xD0, 0x62, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0F, 0xF0, 0xB8, 0xFB, 0x80, 0x7E, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0xDF, 0xF8, 0x58, 0x82, 0xE0, 0x7E, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0D, 0xF0, 0x6A, 0xFE, 0x0B, 0xF0, 0x9A, 0xF9, 0x03, 0x20, 0xA8, 0xF5, 0x88, 0x71, 0x08, 0x60, 0xF2, 0xF7, 0x16, 0xF9, 0x7A, 0x48, 0x6B, 0x49, 0x9C, 0x7F, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x70, 0x51, 0x4D, 0xC4, 0x7F, 0x01, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x40, 0x49, 0x00, 0xF1, 0x52, 0x00, 0x3A, 0x4A, 0xA8, 0x81, 0x28, 0x83, 0xE8, 0x83, 0xE8, 0x84, 0xA8, 0x85, 0x2A, 0x60, 0x39, 0x48, 0x41, 0xF2, 0x11, 0x12, 0x2A, 0x85, 0x18, 0x90, 0x19, 0x91 ,
0x39, 0x49, 0x1A, 0x91, 0x39, 0x49, 0x1B, 0x91, 0x39, 0x49, 0x20, 0x46, 0xDF, 0xF8, 0xC4, 0x90, 0x1C, 0x91, 0x38, 0x49, 0xDF, 0xF8, 0xC0, 0xB0, 0x31, 0x4E, 0x1D, 0x91, 0x48, 0x80, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0D, 0xF0, 0x7C, 0xFA, 0xB4, 0x80, 0x01, 0x00, 0x34, 0x00, 0x00, 0x00, 0x34, 0x12, 0x66, 0x09, 0x84, 0x6B, 0x00, 0x20, 0x94, 0x70, 0x00, 0x20, 0xB4, 0x70, 0x00, 0x20, 0xC4, 0x78, 0x00, 0x20, 0x50, 0x7A, 0x00, 0x20, 0xFE, 0xFF, 0x03, 0x00, 0xA4, 0x70, 0x00, 0x20, 0xB0, 0x70, 0x00, 0x20, 0xB8, 0x70, 0x00, 0x20, 0x60, 0x55, 0x30, 0x80, 0x3C, 0x5C, 0x00, 0x20, 0x04, 0x74, 0x00, 0x20, 0xB8, 0xE4, 0x01, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x20, 0x78, 0x07, 0xF0, 0x01, 0xFC, 0x20, 0x78, 0x07, 0xF0, 0x7A, 0xFB, 0x04, 0x4D, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x2D, 0xE9, 0xF0, 0x4F, 0xAD, 0xF1, 0x8C, 0x0D, 0x04, 0x68, 0x0F, 0x30, 0x03, 0x94, 0xFE, 0xF7, 0xDB, 0xFA, 0x04, 0xF1, 0x14, 0x00 ,
0x04, 0x90, 0x21, 0x7D, 0x00, 0x20, 0x21, 0xF0, 0x73, 0x01, 0x88, 0x29, 0x08, 0xBF, 0x01, 0x20, 0x05, 0x90, 0x03, 0x98, 0x00, 0x1D, 0x06, 0x90, 0x5D, 0x48, 0x00, 0x68, 0x01, 0x28, 0x40, 0xF0, 0xFA, 0x83, 0x5B, 0x4D, 0x5C, 0x48, 0xDF, 0xF8, 0x70, 0x91, 0x29, 0x68, 0xDF, 0xF8, 0x70, 0x81, 0xDF, 0xF8, 0x74, 0xA1, 0x88, 0x42, 0x21, 0xD1, 0x10, 0x22, 0x00, 0x21, 0x48, 0x46, 0x4F, 0x46, 0xFB, 0xF7, 0xB7, 0xFE, 0x10, 0x22, 0x00, 0x21, 0x40, 0x46, 0xFB, 0xF7, 0xB2, 0xFE, 0x54, 0x49, 0x08, 0x68, 0x40, 0xF4, 0x80, 0x10, 0x08, 0x60, 0x01, 0x20, 0x51, 0x46, 0x08, 0x60, 0x00, 0x21, 0x29, 0x60, 0x39, 0x78, 0x46, 0x46, 0x00, 0x91, 0x31, 0x78, 0x41, 0xF2, 0x11, 0x13, 0x04, 0x22, 0x01, 0x91, 0x07, 0x21, 0x02, 0x90, 0x03, 0x20, 0xF3, 0xF7, 0x41, 0xFC, 0x51, 0x46, 0x07, 0x91, 0x08, 0x68, 0x56, 0x49, 0xDF, 0xF8, 0x5C, 0xB1, 0x01, 0x28, 0x08, 0x91, 0x56, 0x49, 0xDF, 0xF8, 0x48, 0xA1, 0x09, 0x91, 0x55, 0x49 ,
0x0A, 0x91, 0x44, 0x49, 0x0B, 0x91, 0x44, 0x49, 0x0C, 0x91, 0x44, 0x49, 0x0D, 0x91, 0x44, 0x49, 0x0E, 0x91, 0x44, 0x49, 0x0F, 0x91, 0x44, 0x49, 0x10, 0x91, 0x44, 0x49, 0xCC, 0x4D, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x11, 0x91, 0x44, 0x49, 0x12, 0x91, 0x44, 0x49, 0x13, 0x91, 0x44, 0x49, 0x14, 0x91, 0x44, 0x49, 0x15, 0x91, 0x44, 0x49, 0x16, 0x91, 0x9F, 0x49, 0x17, 0x91, 0x9F, 0x49, 0x18, 0x91, 0x9F, 0x49, 0x19, 0x91, 0x9F, 0x49, 0x1A, 0x91, 0x9F, 0x49, 0x1B, 0x91, 0x9F, 0x49, 0x1C, 0x91, 0x9F, 0x49, 0x1D, 0x91, 0x9F, 0x49, 0x1E, 0x91, 0x9F, 0x49, 0x1F, 0x91, 0x40, 0xF0, 0x00, 0x81, 0x04, 0x98, 0x40, 0x78, 0x00, 0xF0, 0x03, 0x01, 0x01, 0x29, 0x40, 0xF0, 0xF9, 0x80, 0x04, 0x99, 0x09, 0x78, 0x01, 0xF0, 0x0C, 0x01, 0x08, 0x29, 0x40, 0xF0, 0xF2, 0x80, 0x06, 0x99, 0x09, 0x88, 0xA1, 0xF1, 0x3C, 0x01, 0x0E, 0xB2, 0x05, 0x99, 0x11, 0xB1, 0xA6, 0xF1, 0x02, 0x06, 0x36, 0xB2, 0xC0, 0x09, 0x4F, 0xF0 ,
0x00, 0x07, 0x15, 0xD3, 0x08, 0x3E, 0x36, 0xB2, 0x03, 0x2E, 0x10, 0xD0, 0x17, 0x2E, 0x0E, 0xD0, 0x08, 0x3E, 0x36, 0xB2, 0x03, 0x2E, 0x08, 0xD0, 0x17, 0x2E, 0x06, 0xD0, 0x36, 0x1F, 0x36, 0xB2, 0x03, 0x2E, 0x14, 0xBF, 0x17, 0x2E, 0x02, 0x27, 0x02, 0xE0, 0x03, 0x27, 0x00, 0xE0, 0x01, 0x27, 0x03, 0x2E, 0x18, 0xBF, 0x17, 0x2E, 0x04, 0x9A, 0x40, 0xF0, 0xC8, 0x80, 0x0A, 0x32, 0x12, 0xF8, 0x01, 0x1B, 0x05, 0x24, 0x12, 0xF8, 0x01, 0x3B, 0x4B, 0x40, 0x64, 0x1E, 0xD9, 0xB2, 0xF9, 0xD1, 0x81, 0xEA, 0x21, 0x11, 0x03, 0x2E, 0x94, 0x4E, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x01, 0xF0, 0x0F, 0x01, 0x48, 0x46, 0x35, 0xD0, 0x43, 0x46, 0xCA, 0x5C, 0x52, 0x1C, 0xCA, 0x54, 0x0C, 0x18, 0x33, 0xE0, 0x50, 0x57, 0x02, 0x00, 0x04, 0x74, 0x00, 0x20, 0x34, 0x12, 0x66, 0x09, 0x60, 0x57, 0x02, 0x00, 0x70, 0x57, 0x02, 0x00, 0xC8, 0x48, 0x30, 0x80, 0x4C, 0x57, 0x02, 0x00, 0x88, 0x57, 0x02, 0x00, 0x80, 0x57, 0x02, 0x00 ,
0x18, 0x58, 0x02, 0x00, 0x20, 0x58, 0x02, 0x00, 0x28, 0x58, 0x02, 0x00, 0x30, 0x58, 0x02, 0x00, 0x38, 0x58, 0x02, 0x00, 0x40, 0x58, 0x02, 0x00, 0xE4, 0x58, 0x02, 0x00, 0xE2, 0x58, 0x02, 0x00, 0x14, 0x58, 0x02, 0x00, 0xEF, 0x58, 0x02, 0x00, 0xE0, 0x58, 0x02, 0x00, 0xEE, 0x58, 0x02, 0x00, 0x5C, 0x57, 0x02, 0x00, 0xE6, 0x58, 0x02, 0x00, 0xE8, 0x58, 0x02, 0x00, 0x0C, 0x18, 0x20, 0x78, 0x40, 0x1C, 0x20, 0x70, 0x20, 0x78, 0x43, 0x46, 0x03, 0xEB, 0x01, 0x08, 0x0A, 0x28, 0x76, 0xDB, 0x98, 0xF8, 0x00, 0x00, 0x0A, 0x28, 0x72, 0xDB, 0x94, 0x48, 0x00, 0x25, 0x01, 0x60, 0x04, 0x98, 0x00, 0xF1, 0x0A, 0x09, 0x40, 0x78, 0x41, 0x08, 0x24, 0xBF, 0x04, 0x99, 0x09, 0x1D, 0x04, 0xD2, 0x80, 0x08, 0x2E, 0xBF, 0x49, 0x46, 0x04, 0x99, 0x10, 0x31, 0x0B, 0x98, 0x06, 0x22, 0xFA, 0xF7, 0xB9, 0xFC, 0x0C, 0x98, 0x06, 0x22, 0x49, 0x46, 0xFA, 0xF7, 0xB4, 0xFC, 0x9B, 0x48, 0x9A, 0x49, 0x5C, 0x4F, 0x02, 0x00, 0xC8, 0x00 ,
0x00, 0x00, 0x00, 0x78, 0x08, 0x22, 0x08, 0x60, 0x58, 0x46, 0x07, 0x60, 0x0D, 0x98, 0x29, 0x46, 0xFB, 0xF7, 0xAF, 0xFD, 0x08, 0x22, 0x0E, 0x98, 0x29, 0x46, 0xFB, 0xF7, 0xAA, 0xFD, 0x08, 0x22, 0x0F, 0x98, 0x29, 0x46, 0xFB, 0xF7, 0xA5, 0xFD, 0x08, 0x22, 0x10, 0x98, 0x29, 0x46, 0xFB, 0xF7, 0xA0, 0xFD, 0x08, 0x22, 0x11, 0x98, 0x29, 0x46, 0xFB, 0xF7, 0x9B, 0xFD, 0x08, 0x22, 0x12, 0x98, 0x29, 0x46, 0xFB, 0xF7, 0x96, 0xFD, 0x07, 0x99, 0x02, 0x20, 0x08, 0x60, 0x13, 0x99, 0x28, 0x46, 0x08, 0x80, 0x08, 0x99, 0x08, 0x70, 0x14, 0x99, 0x08, 0x70, 0x15, 0x99, 0x08, 0x60, 0x16, 0x99, 0x08, 0x70, 0x17, 0x99, 0x08, 0x60, 0x18, 0x99, 0x08, 0x60, 0x19, 0x99, 0x08, 0x60, 0x09, 0x99, 0x08, 0x80, 0x0A, 0x99, 0x08, 0x80, 0x1A, 0x99, 0x08, 0x80, 0x7D, 0x49, 0x0D, 0x60, 0x1B, 0x99, 0x08, 0x70, 0x1C, 0x99, 0x08, 0x70, 0x1D, 0x99, 0x08, 0x70, 0x1E, 0x99, 0x08, 0x80, 0x1F, 0x99, 0x08, 0x80, 0x51, 0x46, 0x08, 0x80 ,
0x20, 0x78, 0x00, 0x96, 0x04, 0x22, 0x01, 0x90, 0x98, 0xF8, 0x00, 0x00, 0x41, 0xF2, 0x14, 0x13, 0x07, 0x21, 0x02, 0x90, 0x03, 0x20, 0xF3, 0xF7, 0x07, 0xFB, 0x07, 0x98, 0xA2, 0x49, 0x00, 0x68, 0x20, 0x91, 0xA2, 0x49, 0x05, 0x28, 0x21, 0x91, 0x9E, 0x49, 0x22, 0x91, 0x40, 0xF0, 0x37, 0x82, 0x04, 0x98, 0x40, 0x78, 0x24, 0x50, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x41, 0x08, 0x24, 0xBF, 0x04, 0x99, 0x09, 0x1D, 0x05, 0xD2, 0x80, 0x08, 0x27, 0xBF, 0x04, 0x99, 0x0A, 0x31, 0x04, 0x99, 0x10, 0x31, 0x0B, 0x98, 0xF8, 0xF7, 0x2D, 0xFC, 0x01, 0x28, 0x04, 0x98, 0x40, 0xF0, 0x23, 0x82, 0x40, 0x78, 0x00, 0xF0, 0x03, 0x00, 0x03, 0x28, 0x18, 0xD0, 0x02, 0x28, 0x07, 0xBF, 0x04, 0x99, 0x10, 0x31, 0x04, 0x99, 0x0A, 0x31, 0x13, 0xE0, 0x48, 0x58, 0x02, 0x00, 0x4C, 0x58, 0x02, 0x00, 0x50, 0x58, 0x02, 0x00, 0xF0, 0x58, 0x02, 0x00, 0xF2, 0x58, 0x02, 0x00, 0xF3, 0x58, 0x02, 0x00, 0xF4, 0x58, 0x02, 0x00, 0xEA, 0x58 ,
0x02, 0x00, 0xEC, 0x58, 0x02, 0x00, 0x04, 0x99, 0x18, 0x31, 0x0C, 0x98, 0xF8, 0xF7, 0x06, 0xFC, 0x04, 0x99, 0x01, 0x28, 0x40, 0xF0, 0xFC, 0x81, 0x49, 0x78, 0x01, 0xF0, 0x03, 0x01, 0x01, 0x29, 0x40, 0xF0, 0xF6, 0x81, 0x59, 0x46, 0x09, 0x68, 0x04, 0x9A, 0x8E, 0x46, 0x51, 0x46, 0xD2, 0x8A, 0x0B, 0x88, 0x12, 0x11, 0x93, 0x42, 0x00, 0xF0, 0x37, 0x82, 0x0A, 0x80, 0x06, 0x99, 0x09, 0x88, 0x3C, 0x39, 0x0B, 0xB2, 0x71, 0x46, 0x49, 0x1E, 0x09, 0xD0, 0x49, 0x1E, 0x04, 0xD0, 0x49, 0x1E, 0x08, 0xD1, 0xA3, 0xF1, 0x10, 0x03, 0x04, 0xE0, 0xA3, 0xF1, 0x14, 0x03, 0x01, 0xE0, 0xA3, 0xF1, 0x08, 0x03, 0x1B, 0xB2, 0x05, 0x98, 0x10, 0xB1, 0xA3, 0xF1, 0x02, 0x03, 0x1B, 0xB2, 0xEC, 0x50, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x00, 0xF1, 0xCE, 0x81, 0x16, 0x98, 0x40, 0xF2, 0x77, 0x51, 0x99, 0x42, 0x0B, 0x90, 0x14, 0x98, 0x05, 0x90, 0x00, 0xF0, 0xA3, 0x81, 0x08, 0x46, 0x00, 0xF1, 0x3C, 0x00, 0x98, 0x42 ,
0x05, 0x9A, 0x00, 0xF0, 0x9A, 0x81, 0xDF, 0xF8, 0x48, 0x82, 0x14, 0x78, 0x0B, 0x9A, 0xBB, 0x2C, 0x12, 0x78, 0x0C, 0x92, 0x63, 0xD1, 0xDD, 0xF8, 0x68, 0xC0, 0xBC, 0xF9, 0x00, 0x20, 0x91, 0x42, 0x18, 0xBF, 0x90, 0x42, 0x5B, 0xD1, 0x1C, 0x2B, 0x4F, 0xF0, 0x00, 0x00, 0xC0, 0xF2, 0x82, 0x81, 0x3D, 0x2B, 0x13, 0x9D, 0x80, 0xF2, 0x7E, 0x81, 0xA3, 0xF1, 0x1C, 0x01, 0x09, 0xB2, 0x29, 0x80, 0x1E, 0x9A, 0xDD, 0xF8, 0x30, 0x90, 0xB2, 0xF9, 0x00, 0x60, 0xB9, 0xF1, 0x01, 0x0F, 0x15, 0xD1, 0xDD, 0xF8, 0x24, 0x90, 0x03, 0x2E, 0x0D, 0xDA, 0xB9, 0xF9, 0x00, 0x70, 0xB9, 0x42, 0x07, 0xD0, 0x01, 0x26, 0x16, 0x80, 0x4A, 0x46, 0x0E, 0x46, 0x03, 0xE0, 0xC0, 0x46, 0x90, 0x57, 0x02, 0x00, 0x76, 0x1C, 0x16, 0x80, 0x1B, 0x9A, 0x16, 0x78, 0x1D, 0x9A, 0x16, 0x70, 0x0C, 0x9A, 0x1F, 0x9E, 0x02, 0x2A, 0x28, 0xD1, 0xB6, 0xF9, 0x00, 0x20, 0xBE, 0xF1, 0x00, 0x0F, 0x1A, 0xD0, 0x03, 0x2A, 0x35, 0x46, 0x0B, 0xDA, 0x0A, 0x9E ,
0xB6, 0xF9, 0x00, 0x70, 0xB9, 0x42, 0x04, 0xD0, 0x01, 0x22, 0x2A, 0x80, 0x0A, 0x46, 0x35, 0x46, 0x00, 0xE0, 0xB4, 0x51, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x52, 0x1C, 0x2A, 0x80, 0x1C, 0x99, 0x0A, 0x78, 0x1D, 0x99, 0x0A, 0x70, 0x0F, 0xE0, 0xC0, 0x46, 0x58, 0x57, 0x02, 0x00, 0xA6, 0x64, 0x00, 0x20, 0x54, 0x57, 0x02, 0x00, 0x28, 0x80, 0x05, 0x99, 0x08, 0x70, 0x08, 0x9A, 0x11, 0x78, 0x41, 0xF0, 0x04, 0x01, 0x11, 0x70, 0x04, 0x46, 0x45, 0x46, 0xAC, 0xF8, 0x00, 0x00, 0x28, 0x70, 0xCC, 0x2C, 0x09, 0x9A, 0x40, 0xF0, 0x00, 0x81, 0xDD, 0xF8, 0x7C, 0xC0, 0x0A, 0x99, 0x1E, 0x9F, 0x45, 0x46, 0xB1, 0xF9, 0x00, 0x60, 0xB2, 0xF9, 0x00, 0x90, 0x28, 0x78, 0xCD, 0xF8, 0x50, 0xC0, 0x16, 0x91, 0x0A, 0x97, 0x13, 0x92, 0x09, 0x95, 0x0C, 0x99, 0x01, 0x29, 0x05, 0xD1, 0x05, 0x9A, 0xB0, 0xEB, 0x49, 0x0F, 0x01, 0xD1, 0x00, 0x21, 0x11, 0x70, 0x0C, 0x99, 0x02, 0x29, 0x05, 0xD1, 0x05, 0x9A, 0xB0, 0xEB, 0x46, 0x0F ,
0x01, 0xD1, 0x00, 0x21, 0x11, 0x70, 0xB3, 0xF5, 0x14, 0x7F, 0x40, 0xF3, 0xBA, 0x80, 0x40, 0xF2, 0x51, 0x31, 0x99, 0x42, 0x08, 0x99, 0x40, 0xF3, 0xB4, 0x80, 0x09, 0x78, 0x06, 0x29, 0x00, 0xF0, 0xB0, 0x80, 0xA3, 0xF2, 0x51, 0x21, 0x0B, 0xB2, 0x4F, 0xEA, 0xE3, 0x01, 0x03, 0xEB, 0x11, 0x71, 0x4F, 0xEA, 0x21, 0x11, 0xCA, 0xB2, 0x4F, 0xEA, 0xE3, 0x01, 0x03, 0xEB, 0x11, 0x71, 0x15, 0x9D, 0x21, 0xF0, 0x0F, 0x01, 0xA3, 0xEB, 0x01, 0x03, 0x1D, 0x99, 0x2E, 0x68, 0x7C, 0x52, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x91, 0xF8, 0x00, 0xE0, 0x5F, 0xFA, 0x83, 0xF8, 0x60, 0xB1, 0x31, 0x18, 0x11, 0xF8, 0x01, 0x1C, 0x51, 0x40, 0xCB, 0xB2, 0x07, 0xE0, 0xC0, 0x46, 0x58, 0x58, 0x02, 0x00, 0x54, 0x58, 0x02, 0x00, 0xDC, 0x58, 0x02, 0x00, 0x13, 0x46, 0x19, 0x99, 0xDD, 0xF8, 0x6C, 0xA0, 0xDD, 0xF8, 0x70, 0xB0, 0xD1, 0xF8, 0x00, 0xC0, 0x00, 0xF0, 0x0F, 0x01, 0x99, 0x42, 0x22, 0xD0, 0x0A, 0x9B, 0x86, 0x45, 0x9A, 0xF8 ,
0x00, 0x10, 0xB3, 0xF9, 0x00, 0x30, 0x9B, 0xF8, 0x00, 0x50, 0x15, 0xDD, 0x37, 0x5C, 0x44, 0x1C, 0x82, 0xEA, 0x07, 0x0C, 0x04, 0xF0, 0x0F, 0x07, 0x67, 0x45, 0x0B, 0xD0, 0xA6, 0x45, 0x06, 0x44, 0x0A, 0xDD, 0x76, 0x78, 0x72, 0x40, 0x86, 0x1C, 0x06, 0xF0, 0x0F, 0x06, 0x96, 0x42, 0x03, 0xD1, 0xC0, 0x1C, 0x4D, 0xE0, 0x80, 0x1C, 0x4B, 0xE0, 0x05, 0x9E, 0x00, 0x22, 0x32, 0x70, 0x4A, 0xE0, 0x00, 0xF0, 0x1F, 0x01, 0x01, 0x22, 0x8A, 0x40, 0x17, 0x99, 0xC4, 0x10, 0x0B, 0x68, 0x24, 0xF0, 0x03, 0x01, 0x5C, 0xF8, 0x01, 0x70, 0x3A, 0x42, 0x32, 0xD1, 0x5F, 0x58, 0x3A, 0x42, 0x06, 0x44, 0x1F, 0xD0, 0x18, 0x9B, 0x37, 0x78, 0x1B, 0x68, 0xB8, 0x45, 0x04, 0xD1, 0x58, 0x58, 0x02, 0x42, 0x19, 0xD0, 0x63, 0x46, 0x15, 0xE0, 0xA1, 0x10, 0x8C, 0x00, 0x19, 0x59, 0x91, 0x43, 0x19, 0x51, 0x00, 0x90, 0x30, 0x78, 0x01, 0x90, 0x44, 0x53, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x03, 0x20, 0x06, 0x21, 0x02, 0x46, 0x4D, 0xF6 ,
0x80, 0x53, 0xF3, 0xF7, 0x63, 0xF9, 0x09, 0x99, 0x28, 0x68, 0x0E, 0x78, 0x36, 0x18, 0x06, 0xE0, 0xE3, 0x58, 0x02, 0x00, 0xA0, 0x10, 0x81, 0x00, 0x58, 0x58, 0x02, 0x43, 0x5A, 0x50, 0x86, 0xF8, 0x00, 0x80, 0x0B, 0x98, 0x00, 0x78, 0x0C, 0x90, 0x13, 0x98, 0xB0, 0xF9, 0x00, 0x90, 0x09, 0x98, 0x00, 0x78, 0x0A, 0x9A, 0x40, 0x1C, 0x9B, 0xF8, 0x00, 0x50, 0x9A, 0xF8, 0x00, 0x10, 0xB2, 0xF9, 0x00, 0x30, 0x09, 0x9A, 0xC0, 0xB2, 0x10, 0x70, 0x0C, 0x9A, 0x01, 0x2A, 0x03, 0xD1, 0x88, 0x42, 0xC8, 0xBF, 0x8A, 0xF8, 0x00, 0x00, 0x0C, 0x99, 0x02, 0x29, 0x07, 0xD1, 0xA8, 0x42, 0xC8, 0xBF, 0x8B, 0xF8, 0x00, 0x00, 0x02, 0xE0, 0x0A, 0x98, 0xB0, 0xF9, 0x00, 0x30, 0xB9, 0xF1, 0x00, 0x0F, 0x06, 0xDD, 0x03, 0x2B, 0x04, 0xD1, 0x11, 0x98, 0x01, 0x22, 0x49, 0x46, 0x00, 0xF0, 0x72, 0xFB, 0x16, 0x98, 0xB0, 0xF9, 0x00, 0x10, 0x14, 0x98, 0x00, 0x29, 0xB0, 0xF9, 0x00, 0x00, 0x05, 0xDD, 0x03, 0x28, 0x03, 0xD1, 0x12, 0x98 ,
0x02, 0x22, 0x00, 0xF0, 0x64, 0xFB, 0x05, 0x98, 0x04, 0x78, 0x0B, 0x98, 0x00, 0x78, 0x0C, 0x90, 0x08, 0x98, 0xBB, 0x2C, 0x01, 0x78, 0x02, 0xD0, 0xAA, 0x2C, 0x2F, 0xD0, 0x31, 0xE0, 0x0C, 0x98, 0x01, 0x28, 0x0B, 0xD1, 0x0D, 0x98, 0x17, 0x9A, 0x10, 0x60, 0x0C, 0x54, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x0F, 0x98, 0x18, 0x9A, 0x10, 0x60, 0x19, 0x9A, 0x11, 0x98, 0x10, 0x60, 0x47, 0x4A, 0x15, 0x98, 0x02, 0x60, 0x0C, 0x98, 0x02, 0x28, 0x0B, 0xD1, 0x0E, 0x98, 0x17, 0x9A, 0x10, 0x60, 0x10, 0x98, 0x18, 0x9A, 0x10, 0x60, 0x19, 0x9A, 0x12, 0x98, 0x10, 0x60, 0x41, 0x4A, 0x15, 0x98, 0x02, 0x60, 0xCC, 0x20, 0x0F, 0xE0, 0x08, 0x99, 0x09, 0x78, 0x0C, 0xE0, 0x02, 0x20, 0x00, 0xE0, 0x01, 0x20, 0x0B, 0x99, 0x08, 0x70, 0x1A, 0x99, 0x0B, 0x80, 0x13, 0x99, 0x00, 0x20, 0x08, 0x80, 0x08, 0x98, 0x01, 0x78, 0xBB, 0x20, 0x05, 0x9A, 0x10, 0x70, 0x06, 0x29, 0x07, 0x99, 0x11, 0xD1, 0x06, 0x20, 0x08, 0x60, 0x20, 0x98 ,
0x00, 0x25, 0x05, 0x70, 0x21, 0x98, 0x29, 0x46, 0x04, 0x22, 0xFB, 0xF7, 0x27, 0xFB, 0x01, 0x20, 0x00, 0xF0, 0x3A, 0xFA, 0x02, 0x20, 0x00, 0xF0, 0x37, 0xFA, 0x22, 0x98, 0x05, 0x60, 0x07, 0x98, 0x04, 0x99, 0x00, 0x68, 0x07, 0x28, 0x44, 0xD1, 0x09, 0x78, 0x03, 0x9C, 0x80, 0x29, 0x40, 0xD1, 0x38, 0x34, 0x21, 0x78, 0x64, 0x1C, 0x22, 0x46, 0x00, 0x29, 0x3A, 0xD1, 0x20, 0x98, 0x90, 0xF8, 0x00, 0xA0, 0x22, 0x98, 0x05, 0x90, 0xD0, 0xF8, 0x00, 0x90, 0x51, 0x46, 0x48, 0x46, 0xFD, 0xF7, 0x79, 0xF9, 0x5F, 0xFA, 0x80, 0xF8, 0x21, 0x9F, 0x15, 0x78, 0x51, 0x46, 0x48, 0x46, 0x17, 0xF8, 0x08, 0x30, 0xFD, 0xF7, 0xD4, 0x54, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x6F, 0xF9, 0x1E, 0x46, 0x1B, 0x1D, 0xC0, 0xB2, 0x38, 0x5C, 0x00, 0x1D, 0xA8, 0x42, 0x28, 0x46, 0x07, 0xDD, 0x80, 0x18, 0x82, 0x1C, 0x10, 0x78, 0x2D, 0x18, 0xAD, 0x1C, 0xAD, 0xB2, 0xAB, 0x42, 0xF7, 0xDC, 0x04, 0xF8, 0x01, 0x6B, 0x11, 0x49, 0x32, 0x46 ,
0x20, 0x46, 0x01, 0xEB, 0x48, 0x11, 0xFA, 0xF7, 0xDC, 0xF9, 0xAD, 0x1B, 0xFF, 0x20, 0x34, 0x19, 0xAD, 0x1E, 0x04, 0xF8, 0x01, 0x0B, 0x25, 0x70, 0x05, 0x98, 0x01, 0x68, 0x49, 0x1C, 0x01, 0x60, 0x07, 0x98, 0x00, 0x68, 0x07, 0x28, 0x04, 0xD0, 0x06, 0x99, 0x08, 0x68, 0x20, 0xF4, 0x80, 0x30, 0x08, 0x60, 0x23, 0xB0, 0xBD, 0xE8, 0xF0, 0x8F, 0xC0, 0x46, 0x94, 0x57, 0x02, 0x00, 0xD4, 0x57, 0x02, 0x00, 0x5C, 0x58, 0x02, 0x00, 0x6E, 0x48, 0x2D, 0xE9, 0xF0, 0x47, 0x6E, 0x4D, 0x82, 0x89, 0x4A, 0xF6, 0x55, 0x21, 0xAD, 0xF5, 0xFE, 0x7D, 0x91, 0x42, 0x4F, 0xF0, 0x00, 0x01, 0xAD, 0xF1, 0x38, 0x0D, 0x12, 0xD1, 0x29, 0x60, 0x68, 0x4A, 0x11, 0x70, 0x41, 0xF2, 0x10, 0x41, 0x81, 0x81, 0x4F, 0xF6, 0xFF, 0x70, 0x66, 0x49, 0x08, 0x60, 0x28, 0x68, 0x00, 0x90, 0x02, 0x22, 0x05, 0x21, 0x03, 0x20, 0x41, 0xF2, 0x34, 0x23, 0xF3, 0xF7, 0x48, 0xF8, 0x29, 0x68, 0x61, 0x4C, 0x01, 0x29, 0x20, 0x68, 0x40, 0xF0, 0xAF, 0x80 ,
0x5F, 0x4D, 0x02, 0x28, 0x29, 0x68, 0x23, 0xD1, 0x9C, 0x55, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x5E, 0x48, 0x00, 0x68, 0x5F, 0x4A, 0x12, 0x5C, 0x00, 0x92, 0x01, 0x91, 0x5E, 0x49, 0x09, 0x68, 0x02, 0x91, 0x5B, 0x49, 0x0B, 0x5C, 0x03, 0x20, 0x07, 0x21, 0x04, 0x22, 0xF3, 0xF7, 0x2E, 0xF8, 0x5B, 0x49, 0x4A, 0x79, 0x59, 0x48, 0x00, 0x92, 0x02, 0x79, 0x01, 0x92, 0x40, 0x79, 0x04, 0x22, 0x02, 0x90, 0x03, 0x20, 0x0B, 0x79, 0x07, 0x21, 0xF3, 0xF7, 0x20, 0xF8, 0x03, 0x20, 0x20, 0x60, 0xEC, 0xF7, 0x1A, 0xFF, 0x20, 0x68, 0x29, 0x68, 0x04, 0x28, 0x15, 0xD1, 0x0D, 0x20, 0x8D, 0xF8, 0x10, 0x00, 0x00, 0x25, 0x8D, 0xF8, 0x14, 0x50, 0x8D, 0xF8, 0x15, 0x10, 0x28, 0x46, 0x63, 0x21, 0x00, 0xF0, 0xAA, 0xFB, 0x63, 0x21, 0x28, 0x46, 0x00, 0xF0, 0xFA, 0xFA, 0x03, 0xA9, 0x04, 0xA8, 0xE0, 0xF7, 0xCA, 0xFC, 0x05, 0x20, 0x20, 0x60, 0x46, 0x4D, 0x05, 0x28, 0x29, 0x68, 0x01, 0xF1, 0x01, 0x01, 0x29, 0x60, 0x1D, 0xD1 ,
0x44, 0x4A, 0x8A, 0x42, 0x1A, 0xD1, 0x43, 0x48, 0x01, 0x68, 0x00, 0x91, 0x40, 0x68, 0x01, 0x90, 0x03, 0x20, 0x02, 0x46, 0x06, 0x21, 0x41, 0x4E, 0x33, 0x46, 0x22, 0x3B, 0xF2, 0xF7, 0xEB, 0xFF, 0x3E, 0x48, 0x01, 0x68, 0x00, 0x91, 0x40, 0x68, 0x33, 0x46, 0x06, 0x21, 0x01, 0x90, 0x03, 0x20, 0x02, 0x46, 0xF2, 0xF7, 0xE0, 0xFF, 0x00, 0x20, 0x28, 0x60, 0x20, 0x68, 0x06, 0x28, 0x47, 0xD1, 0x4F, 0xF0, 0x64, 0x56, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x07, 0x0A, 0xC4, 0xF8, 0x00, 0xA0, 0x03, 0x20, 0x48, 0xF2, 0x70, 0x53, 0x01, 0x22, 0x04, 0x21, 0xF2, 0xF7, 0xD0, 0xFF, 0xDF, 0xF8, 0xCC, 0x80, 0x31, 0x4F, 0x48, 0xF2, 0x70, 0x59, 0x01, 0x25, 0x49, 0xEA, 0x05, 0x03, 0x01, 0x22, 0x04, 0x21, 0x03, 0x20, 0xF2, 0xF7, 0xC3, 0xFF, 0x00, 0x24, 0x17, 0xF8, 0x02, 0x0F, 0x20, 0xE0, 0x69, 0x01, 0x04, 0xEB, 0x08, 0x02, 0x88, 0x18, 0xC6, 0x1C, 0x43, 0x78, 0x00, 0x93, 0x80, 0x78, 0x01, 0x90, 0x30, 0x78, 0x02, 0x90 ,
0x53, 0x5C, 0x51, 0x46, 0x04, 0x22, 0x03, 0x20, 0xF2, 0xF7, 0xAE, 0xFF, 0x38, 0x78, 0x01, 0x1B, 0xB1, 0xF1, 0xFF, 0x3F, 0x08, 0xD1, 0xF0, 0x78, 0x00, 0x90, 0xB3, 0x78, 0x03, 0x20, 0x02, 0x22, 0x05, 0x21, 0xF2, 0xF7, 0xA1, 0xFF, 0x38, 0x78, 0x24, 0x1D, 0xE4, 0xB2, 0xA0, 0x42, 0xDC, 0xDC, 0xAD, 0x1C, 0xED, 0xB2, 0x04, 0x2D, 0xCD, 0xDB, 0x63, 0x21, 0x4F, 0xF4, 0x05, 0x70, 0xF1, 0xF7, 0xA3, 0xFC, 0xE1, 0xF7, 0x85, 0xFD, 0x7F, 0xB0, 0x0E, 0xB0, 0xBD, 0xE8, 0xF0, 0x87, 0xC0, 0x46, 0x04, 0x74, 0x00, 0x20, 0x50, 0x57, 0x02, 0x00, 0x6C, 0x5D, 0x02, 0x00, 0x40, 0x00, 0x3D, 0x80, 0x4C, 0x57, 0x02, 0x00, 0x58, 0x57, 0x02, 0x00, 0x90, 0x57, 0x02, 0x00, 0x60, 0x57, 0x02, 0x00, 0x70, 0x57, 0x02, 0x00, 0x5C, 0x57, 0x02, 0x00, 0x80, 0x57, 0x02, 0x00, 0x2C, 0x57, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x88, 0x57, 0x02, 0x00, 0x54, 0x57, 0x02, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x38, 0x58, 0x02, 0x00, 0x40, 0x58 ,
0x02, 0x00, 0x66, 0x55, 0xDD, 0xEE, 0xDB, 0x58, 0x02, 0x00, 0x5C, 0x58, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0x57, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBC, 0x58, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2D, 0xE9, 0xFE, 0x4F, 0x4A, 0x4A, 0x49, 0x4D, 0x00, 0x90, 0xB2, 0xF9, 0x00, 0x20, 0x43, 0xA3, 0x29, 0x78, 0x01, 0x93, 0x43, 0xA3, 0x01, 0x28, 0x02, 0x93, 0x47, 0x4E, 0xDF, 0xF8, 0x1C, 0x81, 0xDF, 0xF8, 0x1C, 0x91, 0x1E, 0xD0, 0x43, 0x48, 0x04, 0x78, 0x48, 0x01, 0x87, 0x19, 0x30, 0x18, 0x01, 0x99, 0x06, 0x22, 0xF9, 0xF7, 0xC8, 0xFF, 0x40, 0x46, 0x01, 0x78, 0x00, 0x68, 0x07, 0xF1, 0x06, 0x07, 0x07, 0xF8, 0x01, 0x1B, 0x07, 0xF8, 0x01, 0x4B, 0x4F, 0xF0, 0x00, 0x01, 0x07, 0xF8, 0x01, 0x1B, 0x20, 0xB9, 0x39, 0x70, 0x28, 0x78, 0x4E, 0x46, 0x0A, 0x21, 0x58, 0xE0, 0xDF, 0xF8, 0xE4, 0xB0, 0x0F, 0xE0, 0xD4, 0xB2, 0x48, 0x01, 0x87, 0x19, 0x30, 0x18, 0x02, 0x99, 0x07, 0x22, 0xF9, 0xF7, 0xAA, 0xFF, 0xFF, 0x1D, 0x00, 0x20, 0xDF, 0xF8, 0xCC, 0xB0, 0x07, 0xF8, 0x01, 0x4B, 0x07, 0xF8, 0x01, 0x0B, 0x16, 0x2C, 0xB2, 0x46, 0xAE, 0xBF, 0x14, 0x20, 0x84, 0x59 ,
0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x60, 0x1E, 0xC0, 0xB2, 0x38, 0x70, 0x4E, 0x46, 0x7F, 0x1C, 0x40, 0x1C, 0xC2, 0xB2, 0x28, 0x78, 0x5B, 0x46, 0x00, 0x21, 0x32, 0x54, 0x38, 0x46, 0x00, 0xF0, 0xBC, 0xF9, 0x28, 0x78, 0x16, 0x2C, 0x31, 0x5C, 0x01, 0xF1, 0x0A, 0x01, 0x31, 0x54, 0x00, 0xF1, 0x01, 0x00, 0xC0, 0xB2, 0x28, 0x70, 0x2B, 0xDB, 0x00, 0x99, 0x0A, 0xEB, 0x40, 0x10, 0x07, 0x46, 0x01, 0x29, 0xA4, 0xF1, 0x01, 0x09, 0x09, 0xD0, 0x01, 0x99, 0x06, 0x22, 0xF9, 0xF7, 0x79, 0xFF, 0x40, 0x46, 0x00, 0x78, 0xBF, 0x1D, 0x07, 0xF8, 0x01, 0x0B, 0x04, 0xE0, 0x02, 0x99, 0x07, 0x22, 0xF9, 0xF7, 0x6F, 0xFF, 0xFF, 0x1D, 0x07, 0xF8, 0x01, 0x4B, 0x15, 0x3C, 0x15, 0x21, 0x28, 0x78, 0xE2, 0xB2, 0x5B, 0x46, 0x07, 0xF8, 0x01, 0x1B, 0x32, 0x54, 0x07, 0xF8, 0x01, 0x9B, 0x38, 0x46, 0x00, 0xF0, 0x8B, 0xF9, 0x28, 0x78, 0x31, 0x5C, 0x0A, 0x31, 0x31, 0x54, 0x40, 0x1C, 0x28, 0x70, 0xBD, 0xE8, 0xFE, 0x8F, 0xC0, 0x46 ,
0x54, 0x54, 0x54, 0x4B, 0x45, 0x59, 0x00, 0xC0, 0x54, 0x54, 0x54, 0x53, 0x53, 0x49, 0x44, 0x00, 0x54, 0x58, 0x02, 0x00, 0xE6, 0x58, 0x02, 0x00, 0xE8, 0x58, 0x02, 0x00, 0x5C, 0x58, 0x02, 0x00, 0x5C, 0x57, 0x02, 0x00, 0xDC, 0x58, 0x02, 0x00, 0xD4, 0x57, 0x02, 0x00, 0x94, 0x57, 0x02, 0x00, 0xFF, 0xB5, 0x0C, 0x46, 0x06, 0x46, 0xF7, 0xF7, 0x4C, 0x5A, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0xE3, 0xFE, 0x15, 0x49, 0x15, 0x4A, 0x0D, 0x68, 0x01, 0xA9, 0x92, 0xE8, 0x8C, 0x00, 0x81, 0xE8, 0x8C, 0x00, 0xF7, 0xF7, 0xFD, 0xFE, 0x01, 0x98, 0x11, 0x49, 0x28, 0x1A, 0x03, 0x9D, 0x25, 0x60, 0x02, 0x9A, 0x80, 0x18, 0x82, 0x42, 0x30, 0x60, 0x0E, 0xD8, 0x08, 0x46, 0x00, 0x68, 0x22, 0x68, 0x82, 0x42, 0x0E, 0xD2, 0x68, 0x46, 0xE8, 0xF7, 0xB9, 0xFF, 0x9D, 0xF8, 0x00, 0x00, 0x05, 0xF1, 0x01, 0x05, 0x30, 0xB9, 0x03, 0x95, 0x03, 0xE0, 0x25, 0x68, 0x6D, 0x1C, 0x25, 0x60, 0x0C, 0x46, 0x25, 0x60, 0x00, 0x20, 0x00, 0x90 ,
0xFF, 0xBD, 0x60, 0x55, 0x30, 0x80, 0x24, 0x5D, 0x00, 0x20, 0x6C, 0x5D, 0x02, 0x00, 0x70, 0xB5, 0x4D, 0x00, 0x20, 0x2D, 0x4F, 0xF0, 0x00, 0x01, 0x0C, 0x46, 0x4F, 0xEA, 0x55, 0x13, 0x09, 0xD3, 0x50, 0xF8, 0x21, 0x60, 0xB6, 0xF1, 0xFF, 0x3F, 0x04, 0xD1, 0x49, 0x1C, 0xC9, 0xB2, 0x20, 0x3D, 0x5B, 0x1E, 0xF5, 0xD1, 0x4D, 0xB1, 0x20, 0x2D, 0x09, 0xD2, 0x01, 0x23, 0xAB, 0x40, 0x5B, 0x1E, 0x50, 0xF8, 0x21, 0x00, 0x18, 0x40, 0x83, 0x42, 0x01, 0xD1, 0x4F, 0xF0, 0x01, 0x04, 0x07, 0x48, 0x03, 0x78, 0x2C, 0xB9, 0x01, 0x21, 0x91, 0x40, 0xC9, 0x43, 0xC9, 0xB2, 0x0B, 0x40, 0x03, 0xE0, 0x01, 0x21, 0x91, 0x40, 0xC9, 0xB2, 0x0B, 0x43, 0x03, 0x70, 0x70, 0xBD, 0xC0, 0x46, 0xEE, 0x58, 0x02, 0x00, 0x14, 0x5B, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x7E, 0xB5, 0x05, 0x46, 0x95, 0xF8, 0x36, 0x20, 0x0E, 0x46, 0x0F, 0x49, 0x07, 0x2A, 0x12, 0xBF, 0x08, 0x68, 0x01, 0x20, 0x08, 0x60, 0x0D, 0x4C, 0x00, 0x92, 0x21, 0x68 ,
0x41, 0xF2, 0x12, 0x13, 0x04, 0x22, 0x01, 0x91, 0x07, 0x21, 0x02, 0x90, 0x03, 0x20, 0xF2, 0xF7, 0x6B, 0xFD, 0x31, 0x46, 0x28, 0x46, 0xE7, 0xF7, 0x21, 0xFC, 0x21, 0x68, 0x00, 0x22, 0x05, 0x29, 0x02, 0xD1, 0x04, 0x49, 0x08, 0x31, 0x0A, 0x60, 0x7E, 0xBD, 0xC0, 0x46, 0x50, 0x57, 0x02, 0x00, 0x4C, 0x57, 0x02, 0x00, 0x00, 0x7C, 0x00, 0x20, 0x0E, 0x49, 0x09, 0x68, 0x49, 0x08, 0x15, 0xD2, 0x0D, 0x49, 0x09, 0x78, 0x91, 0xB1, 0x44, 0xF2, 0xE9, 0x21, 0x68, 0xB9, 0x0B, 0x48, 0x01, 0x78, 0x07, 0x48, 0x01, 0x29, 0x03, 0xD1, 0x0A, 0x49, 0x09, 0x78, 0x0E, 0x29, 0x02, 0xD0, 0x44, 0xF2, 0xDE, 0x21, 0x41, 0x60, 0x01, 0x21, 0x00, 0xE0, 0x06, 0x48, 0x01, 0x60, 0x70, 0x47, 0xC0, 0x46, 0x00, 0x97, 0x3C, 0x80, 0x10, 0x0C, 0x30, 0x80, 0xDD, 0x6A, 0x00, 0x20, 0xE0, 0x7C, 0x00, 0x20, 0xA6, 0x64, 0x00, 0x20, 0x04, 0x97, 0x3C, 0x80, 0x00, 0xB5, 0xAD, 0xF1, 0x18, 0x0D, 0x4F, 0xF0, 0x09, 0x00, 0x00, 0x90, 0x4F, 0xF4 ,
0x0C, 0x60, 0x03, 0x90, 0x4F, 0xF0, 0x00, 0x00, 0x01, 0x90, 0x02, 0x90, 0x08, 0x48, 0x08, 0x49, 0x05, 0x90, 0x08, 0x68, 0x20, 0xB9, 0xDC, 0x5B, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x68, 0x46, 0x03, 0x22, 0xED, 0xF7, 0x3A, 0xFA, 0x03, 0xE0, 0x68, 0x46, 0x03, 0x22, 0xED, 0xF7, 0xC1, 0xFC, 0x06, 0xB0, 0x00, 0xBD, 0xC0, 0x46, 0x81, 0x5C, 0x02, 0x00, 0xDC, 0x7C, 0x00, 0x20, 0x1C, 0xB5, 0x0F, 0x4C, 0x22, 0x68, 0x01, 0x2A, 0x15, 0xD1, 0x0C, 0x48, 0x00, 0x68, 0x07, 0x28, 0x14, 0xBF, 0x40, 0x20, 0x4F, 0xF4, 0x05, 0x70, 0x63, 0x21, 0xF1, 0xF7, 0x0F, 0xFA, 0x20, 0x68, 0x00, 0x90, 0x43, 0xF2, 0x33, 0x33, 0x06, 0x21, 0x40, 0x20, 0x01, 0x90, 0x03, 0x20, 0x02, 0x46, 0xF2, 0xF7, 0xF4, 0xFC, 0x1C, 0xBD, 0xF1, 0xF7, 0x01, 0xFA, 0x1C, 0xBD, 0x4C, 0x57, 0x02, 0x00, 0x50, 0x57, 0x02, 0x00, 0x1E, 0xB5, 0x04, 0x46, 0x0A, 0x49, 0x00, 0x20, 0x0A, 0x4A, 0x08, 0x60, 0x0A, 0x49, 0x00, 0x90, 0x01, 0x90, 0x11, 0x60 ,
0x09, 0x4A, 0x45, 0xF2, 0x55, 0x53, 0x02, 0x91, 0x10, 0x60, 0x07, 0x21, 0x04, 0x22, 0x03, 0x20, 0xF2, 0xF7, 0xD8, 0xFC, 0x20, 0x46, 0xE7, 0xF7, 0x59, 0xFD, 0x1E, 0xBD, 0x50, 0x57, 0x02, 0x00, 0x04, 0x74, 0x00, 0x20, 0x34, 0x12, 0x66, 0x09, 0x4C, 0x57, 0x02, 0x00, 0x00, 0xB5, 0x0B, 0x49, 0x00, 0x20, 0x08, 0x60, 0xE0, 0x20, 0xF7, 0xF7, 0xAA, 0xFD, 0x09, 0x49, 0x09, 0x78, 0x49, 0xB1, 0x08, 0x49, 0x0A, 0x78, 0x08, 0x49, 0x00, 0x2A, 0x06, 0xBF, 0x01, 0x22, 0x09, 0x1F, 0x44, 0xF2, 0xA4, 0x5C, 0x02, 0x00, 0xC8, 0x00, 0x00, 0x00, 0xE9, 0x22, 0x0A, 0x60, 0xF7, 0xF7, 0xA1, 0xFD, 0x00, 0xBD, 0xC0, 0x46, 0xDC, 0x7C, 0x00, 0x20, 0xDD, 0x6A, 0x00, 0x20, 0xA7, 0x64, 0x00, 0x20, 0x04, 0x97, 0x3C, 0x80, 0x50, 0xB9, 0x09, 0x48, 0x00, 0x78, 0x01, 0x28, 0x06, 0xD1, 0x08, 0x48, 0x00, 0x78, 0x0E, 0x28, 0x08, 0xBF, 0x44, 0xF2, 0xCB, 0x20, 0x01, 0xD0, 0x44, 0xF2, 0xDE, 0x20, 0x04, 0x49, 0x08, 0x60, 0x01, 0x20 ,
0x41, 0xF8, 0x04, 0x0C, 0x70, 0x47, 0xE0, 0x7C, 0x00, 0x20, 0xA6, 0x64, 0x00, 0x20, 0x04, 0x97, 0x3C, 0x80, 0x30, 0xB5, 0x0D, 0x46, 0x84, 0x69, 0xDC, 0xF7, 0x97, 0xFB, 0x24, 0x1D, 0x01, 0x28, 0x04, 0xEB, 0x45, 0x01, 0x06, 0xD1, 0x89, 0x8E, 0x04, 0xEB, 0x85, 0x04, 0x11, 0xB9, 0x21, 0x69, 0x01, 0xB9, 0x00, 0x20, 0x30, 0xBD, 0x30, 0xB5, 0x05, 0x46, 0x5A, 0xB1, 0x03, 0xEB, 0x41, 0x03, 0x1C, 0x78, 0x59, 0x78, 0x41, 0xEA, 0x04, 0x11, 0x52, 0x1E, 0x03, 0xF1, 0x02, 0x03, 0x05, 0xF8, 0x01, 0x1B, 0xF5, 0xD1, 0x30, 0xBD, 0x00, 0xB5, 0x00, 0x20, 0xE7, 0xF7, 0xD6, 0xFE, 0x03, 0x48, 0x01, 0x68, 0x03, 0x29, 0x04, 0xBF, 0x04, 0x21, 0x01, 0x60, 0x00, 0xBD, 0xC0, 0x46, 0x4C, 0x57, 0x02, 0x00, 0x03, 0x4A, 0x12, 0x68, 0x01, 0x2A, 0x04, 0xBF, 0x02, 0x48, 0x63, 0x21, 0xF1, 0xF7, 0x76, 0xB9, 0x50, 0x57, 0x02, 0x00, 0x02, 0x20, 0x01, 0x00, 0x6C, 0x5D, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint16_t fw_length = 5700;

View File

@ -0,0 +1,217 @@
/***************************************************
This is an example for the Adafruit CC3000 Wifi Breakout & Shield
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Kevin Townsend & Limor Fried & Rick Lesniak for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
/*
This example does a test of the SNTP (Simple Network Time Protocol) client:
* Initialization
* SSID Scan
* AP connection
* DHCP printout
* SNTP time synchronization
* Extract and print current time and date information
*/
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
//#include "utility/NetTime.h"
#include <string.h>
#include "utility/debug.h"
#include "utility/sntp.h"
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIVIDER); // you can change this clock speed but DI
#define WLAN_SSID "myNetwork" // cannot be longer than 32 characters!
#define WLAN_PASS "myPassword"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY WLAN_SEC_WPA2
//Arguments to SNTP client constructor:
// 1 - Primary Network Time Server URL (can be NULL)
// 2 - Secondary Network Time Server URL (also can be NULL)
// 3 - Local UTC offset in minutes (US Eastern Time is UTC - 5:00
// 4 - Local UTC offset in minutes for Daylight Savings Time (US Eastern DST is UTC - 4:00
// 5 - Enable Daylight Savings Time adjustment (not implemented yet)
//
sntp mysntp = sntp(NULL, "time.nist.gov", (short)(-5 * 60), (short)(-4 * 60), true);
// Type SNTP_Timestamp is 64-bit NTP time. High-order 32-bits is seconds since 1/1/1900
// Low order 32-bits is fractional seconds
SNTP_Timestamp_t now;
// Type NetTime_t contains NTP time broken out to human-oriented values:
// uint16_t millis; ///< Milliseconds after the second (0..999)
// uint8_t sec; ///< Seconds after the minute (0..59)
// uint8_t min; ///< Minutes after the hour (0..59)
// uint8_t hour; ///< Hours since midnight (0..23)
// uint8_t mday; ///< Day of the month (1..31)
// uint8_t mon; ///< Months since January (0..11)
// uint16_t year; ///< Year.
// uint8_t wday; ///< Days since Sunday (0..6)
// uint8_t yday; ///< Days since January 1 (0..365)
// bool isdst; ///< Daylight savings time flag, currently not supported
NetTime_t timeExtract;
#define pF(string_pointer) (reinterpret_cast<const __FlashStringHelper *>(pgm_read_word(string_pointer)))
const prog_char janStr[] PROGMEM = "January";
const prog_char febStr[] PROGMEM = "February";
const prog_char marStr[] PROGMEM = "March";
const prog_char aprStr[] PROGMEM = "April";
const prog_char mayStr[] PROGMEM = "May";
const prog_char junStr[] PROGMEM = "June";
const prog_char julStr[] PROGMEM = "July";
const prog_char augStr[] PROGMEM = "August";
const prog_char sepStr[] PROGMEM = "September";
const prog_char octStr[] PROGMEM = "October";
const prog_char novStr[] PROGMEM = "November";
const prog_char decStr[] PROGMEM = "December";
PROGMEM const char* const monthStrs[] = { janStr, febStr, marStr, aprStr, mayStr, junStr,
julStr, augStr, sepStr, octStr, novStr, decStr};
const prog_char sunStr[] PROGMEM = "Sunday";
const prog_char monStr[] PROGMEM = "Monday";
const prog_char tueStr[] PROGMEM = "Tuesday";
const prog_char wedStr[] PROGMEM = "Wednesday";
const prog_char thuStr[] PROGMEM = "Thursday";
const prog_char friStr[] PROGMEM = "Friday";
const prog_char satStr[] PROGMEM = "Saturday";
PROGMEM const char* const dayStrs[] = { sunStr, monStr, tueStr, wedStr,
thuStr, friStr, satStr};
/**************************************************************************/
/*!
@brief Sets up the HW and the CC3000 module (called automatically
on startup)
*/
/**************************************************************************/
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC);
/* Initialise the module */
Serial.println(F("\nInitialising the CC3000 ..."));
if (!cc3000.begin())
{
Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
while(1);
}
/* Optional: Update the Mac Address to a known value */
/*
uint8_t macAddress[6] = { 0x08, 0x00, 0x28, 0x01, 0x79, 0xB7 };
if (!cc3000.setMacAddress(macAddress))
{
Serial.println(F("Failed trying to update the MAC address"));
while(1);
}
*/
uint16_t firmware = checkFirmwareVersion();
if (firmware < 0x113) {
Serial.println(F("Wrong firmware version!"));
for(;;);
}
/* Delete any old connection data on the module */
Serial.println(F("\nDeleting old connection profiles"));
if (!cc3000.deleteProfiles()) {
Serial.println(F("Failed!"));
while(1);
}
/* Attempt to connect to an access point */
char *ssid = WLAN_SSID; /* Max 32 chars */
Serial.print(F("\nAttempting to connect to ")); Serial.println(ssid);
/* NOTE: Secure connections are not available in 'Tiny' mode! */
if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println(F("Failed!"));
while(1);
}
Serial.println(F("Connected!"));
/* Wait for DHCP to complete */
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP())
{
delay(100); // ToDo: Insert a DHCP timeout!
}
Serial.println(F("UpdateNTPTime"));
mysntp.UpdateNTPTime();
Serial.println(F("Current local time is:"));
mysntp.ExtractNTPTime(mysntp.NTPGetTime(&now, true), &timeExtract);
Serial.print(timeExtract.hour); Serial.print(F(":")); Serial.print(timeExtract.min); Serial.print(F(":"));Serial.print(timeExtract.sec); Serial.print(F("."));Serial.println(timeExtract.millis);
Serial.print(pF(&dayStrs[timeExtract.wday])); Serial.print(F(", ")); Serial.print(pF(&monthStrs[timeExtract.mon])); Serial.print(F(" ")); Serial.print(timeExtract.mday); Serial.print(F(", "));Serial.println(timeExtract.year);
Serial.print(F("Day of year: ")); Serial.println(timeExtract.yday + 1);
/* You need to make sure to clean up after yourself or the CC3000 can freak out */
/* the next time you try to connect ... */
Serial.println(F("\n\nClosing the connection"));
cc3000.disconnect();
}
void loop(void)
{
delay(1000);
}
/**************************************************************************/
/*!
@brief Tries to read the CC3000's internal firmware patch ID
*/
/**************************************************************************/
uint16_t checkFirmwareVersion(void)
{
uint8_t major, minor;
uint16_t version;
#ifndef CC3000_TINY_DRIVER
if(!cc3000.getFirmwareVersion(&major, &minor))
{
Serial.println(F("Unable to retrieve the firmware version!\r\n"));
version = 0;
}
else
{
Serial.print(F("Firmware V. : "));
Serial.print(major); Serial.print(F(".")); Serial.println(minor);
version = major; version <<= 8; version |= minor;
}
#endif
return version;
}

View File

@ -0,0 +1,20 @@
=====
Copyright (c) 2013-2014
Limor Fried, Kevin Townsend for Adafruit Industries & Tony DiCola (tony@tonydicola.com)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
All rights reserved.
=====
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,199 @@
/***************************************************
Client_fastrprint test
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Tony DiCola, based on code example code written by
Limor Fried & Kevin Townsend for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <string.h>
#include "utility/debug.h"
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIV2); // you can change this clock speed
#define WLAN_SSID "myNetwork" // cannot be longer than 32 characters!
#define WLAN_PASS "myPassword"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY WLAN_SEC_WPA2
// Test server configuration
const uint8_t SERVER_IP[4] = { 192, 168, 1, 101 };
const uint16_t SERVER_PORT = 9000;
#define ASSERT_EQ(expected, actual) { \
if (actual != expected) { \
Serial.print("FAILURE: Expected "); \
Serial.print(actual); \
Serial.print(" to equal "); \
Serial.println(expected); \
} \
}
#define TEST_FASTRPRINT(message, client) { \
Serial.print("Testing fastrprint with char* input: "); \
Serial.println(message); \
unsigned long n = client.fastrprint(message); \
ASSERT_EQ(sizeof(message)-1, n); \
}
#define TEST_FASTRPRINTLN(message, client) { \
Serial.print("Testing fastrprintln with char* input: "); \
Serial.println(message); \
unsigned long n = client.fastrprintln(message); \
ASSERT_EQ(sizeof(message)+1, n); \
}
#define TEST_FASTRPRINT_F(message, client) { \
Serial.print("Testing fastrprint with flash string input: "); \
Serial.println(F(message)); \
unsigned long n = client.fastrprint(F(message)); \
ASSERT_EQ(sizeof(message)-1, n); \
}
#define TEST_FASTRPRINTLN_F(message, client) { \
Serial.print("Testing fastrprintln with flash string input: "); \
Serial.println(F(message)); \
unsigned long n = client.fastrprintln(F(message)); \
ASSERT_EQ(sizeof(message)+1, n); \
}
// Run the test
void runTest(void) {
// Make two connections to the server running listener.py
Serial.println(F("Connecting to server..."));
Adafruit_CC3000_Client client1 = cc3000.connectTCP(cc3000.IP2U32(SERVER_IP[0], SERVER_IP[1], SERVER_IP[2], SERVER_IP[3]),
SERVER_PORT);
if (!client1.connected()) {
Serial.println(F("Couldn't connect to server! Make sure listener.py is running on the server."));
while(1);
}
Adafruit_CC3000_Client client2 = cc3000.connectTCP(cc3000.IP2U32(SERVER_IP[0], SERVER_IP[1], SERVER_IP[2], SERVER_IP[3]),
SERVER_PORT);
if (!client2.connected()) {
Serial.println(F("Couldn't connect to server! Make sure listener.py is running on the server."));
while(1);
}
Serial.println(F("Connected!"));
// Start the test
Serial.print(F("Free RAM: ")); Serial.println(getFreeRam(), DEC);
Serial.println(F("Starting tests..."));
unsigned long start = millis();
// Test character strings
TEST_FASTRPRINT("Fastrprint string.", client1);
TEST_FASTRPRINT("Fastrprint with a large (>32 character) character string!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", client1);
TEST_FASTRPRINTLN("Fastrprintln string.", client1);
TEST_FASTRPRINTLN("Fastrprintln with a large (>32 character) character string!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", client1);
// Test flash strings
TEST_FASTRPRINT_F("Fastrprint flash.", client1);
TEST_FASTRPRINT_F("Fastrprint with a large (>32 character) flash string!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", client1);
TEST_FASTRPRINTLN_F("Fastrprintln flash.", client1);
TEST_FASTRPRINTLN_F("Fastrprintln with a large (>32 character) flash string!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", client1);
// Test empty strings
TEST_FASTRPRINT("", client1);
TEST_FASTRPRINTLN("", client1);
TEST_FASTRPRINT_F("", client1);
TEST_FASTRPRINTLN_F("", client1);
// Test printing to multiple clients
TEST_FASTRPRINT("This is a message for client 1.", client1);
TEST_FASTRPRINT("This is a message for client 2.", client2);
TEST_FASTRPRINT_F("This is a flash message for client 1.", client1);
TEST_FASTRPRINT_F("This is a flash message for client 2.", client2);
TEST_FASTRPRINT_F("This is a large (>32 character) flash message for client 1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", client1);
TEST_FASTRPRINT_F("This is a large (>32 character) flash message for client 2!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", client2);
unsigned long finish = millis();
Serial.println(F("Tests finished!"));
Serial.print(F("Free RAM: ")); Serial.println(getFreeRam(), DEC);
Serial.print(F("Time taken to run test (MS): ")); Serial.println(finish - start, DEC);
client1.close();
client2.close();
cc3000.disconnect();
}
// Set up the HW and the CC3000 module (called automatically on startup)
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
/* Initialise the module */
Serial.println(F("\nInitializing..."));
if (!cc3000.begin())
{
Serial.println(F("Couldn't begin()! Check your wiring?"));
while(1);
}
if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println(F("Failed!"));
while(1);
}
Serial.println(F("Connected!"));
/* Wait for DHCP to complete */
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP())
{
delay(100); // ToDo: Insert a DHCP timeout!
}
/* Display the IP address DNS, Gateway, etc. */
while (! displayConnectionDetails()) {
delay(1000);
}
runTest();
}
void loop(void)
{
delay(1000);
}
// Tries to read the IP address and other connection details
bool displayConnectionDetails(void)
{
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
{
Serial.println(F("Unable to retrieve the IP Address!\r\n"));
return false;
}
else
{
Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
Serial.println();
return true;
}
}

View File

@ -0,0 +1,27 @@
Adafruit CC3000 Library Tests
=============================
This folder is meant to contain tests that are written to verify the CC3000 library. Consumers
of the library probably want to ignore the contents of this folder.
Files:
------
- listener.py
Python script to run a TCP socket server which listens by default on port 9000 (but can be
changed by specifying a different port in the first command line parameter), accepts any
connections and echos all received data to standard output. This is required for running some
of the tests. In general you'll want to run listener.py with stdout directed to a file and then
run the test sketch on the CC3000 to capture what is output. Compare the output of test runs
before and after making a change/bugfix to the library and diff the results to ensure no
unexpected changes in functionality.
Tests:
------
- Client\_fastrprint
Manual test to verify the fastrprint and fastrprintln functions of the client library. Must
update the sketch to connect to your wireless network and set the SERVER_IP value to the IP
of a server running listener.py.

View File

@ -0,0 +1,45 @@
# Adafruit CC3000 Library Test Listener
# Created by Tony DiCola (tony@tonydicola.com)
# Released with the same license as the Adafruit CC3000 library (BSD)
# Create a simple server to listen by default on port 9000 (or on the port specified in
# the first command line parameter), accept any connections and print all data received
# to standard output. Must be terminated by hitting ctrl-c to kill the process!
from socket import *
import sys
import threading
SERVER_PORT = 9000
if len(sys.argv) > 1:
SERVER_PORT = sys.argv[1]
# Create listening socket
server = socket(AF_INET, SOCK_STREAM)
# Ignore waiting for the socket to close if it's already open. See the python socket
# doc for more info (very bottom of http://docs.python.org/2/library/socket.html).
server.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
# Listen on any network interface for the specified port
server.bind(('', SERVER_PORT))
server.listen(5)
# Worker process to print all data received to standard output.
def process_connection(client):
while True:
data = client.recv(1024)
sys.stdout.write(data) # Don't use print because it appends spaces and newlines
sys.stdout.flush()
if not data:
break
client.close()
try:
# Wait for connections and spawn worker threads to process them.
while True:
client, address = server.accept()
thread = threading.Thread(target=process_connection, args=(client,))
thread.start()
except:
server.close()

View File

@ -0,0 +1,195 @@
/*****************************************************************************
*
* cc3000_common.c.c - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
//*****************************************************************************
//
//! \addtogroup common_api
//! @{
//
//*****************************************************************************
/******************************************************************************
*
* Include files
*
*****************************************************************************/
#include "cc3000_common.h"
#include "socket.h"
#include "wlan.h"
#include "evnt_handler.h"
#include "debug.h"
#include <Arduino.h>
//*****************************************************************************
//
//! __error__
//!
//! @param pcFilename - file name, where error occurred
//! @param ulLine - line number, where error occurred
//!
//! @return none
//!
//! @brief stub function for ASSERT macro
//
//*****************************************************************************
void
__error__(char *pcFilename, unsigned long ulLine)
{
//TODO full up function
}
//*****************************************************************************
//
//! UINT32_TO_STREAM_f
//!
//! @param p pointer to the new stream
//! @param u32 pointer to the 32 bit
//!
//! @return pointer to the new stream
//!
//! @brief This function is used for copying 32 bit to stream
//! while converting to little endian format.
//
//*****************************************************************************
uint8_t* UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32)
{
*(p)++ = (uint8_t)(u32);
*(p)++ = (uint8_t)((u32) >> 8);
*(p)++ = (uint8_t)((u32) >> 16);
*(p)++ = (uint8_t)((u32) >> 24);
return p;
}
//*****************************************************************************
//
//! UINT16_TO_STREAM_f
//!
//! @param p pointer to the new stream
//! @param u32 pointer to the 16 bit
//!
//! @return pointer to the new stream
//!
//! @brief This function is used for copying 16 bit to stream
//! while converting to little endian format.
//
//*****************************************************************************
uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16)
{
*(p)++ = (uint8_t)(u16);
*(p)++ = (uint8_t)((u16) >> 8);
return p;
}
//*****************************************************************************
//
//! STREAM_TO_UINT16_f
//!
//! @param p pointer to the stream
//! @param offset offset in the stream
//!
//! @return pointer to the new 16 bit
//!
//! @brief This function is used for copying received stream to
//! 16 bit in little endian format.
//
//*****************************************************************************
uint16_t STREAM_TO_UINT16_f(char* cp, uint16_t offset)
{
uint8_t *p = (uint8_t *)cp;
/*
DEBUGPRINT_F("Stream2u16: ");
DEBUGPRINT_HEX(cp[offset+1]);
DEBUGPRINT_F(" + ");
DEBUGPRINT_HEX(cp[offset]);
DEBUGPRINT_F("\n\r");
*/
return (uint16_t)((uint16_t)
((uint16_t)(*(p + offset + 1)) << 8) +
(uint16_t)(*(p + offset)));
}
//*****************************************************************************
//
//! STREAM_TO_UINT32_f
//!
//! @param p pointer to the stream
//! @param offset offset in the stream
//!
//! @return pointer to the new 32 bit
//!
//! @brief This function is used for copying received stream to
//! 32 bit in little endian format.
//
//*****************************************************************************
uint32_t STREAM_TO_UINT32_f(char * cp, uint16_t offset)
{
uint8_t *p = (uint8_t *)cp;
/*
DEBUGPRINT_F("\tStream2u32: ");
DEBUGPRINT_HEX(cp[offset+3]); DEBUGPRINT_F(" + ");
DEBUGPRINT_HEX(cp[offset+2]); DEBUGPRINT_F(" + ");
DEBUGPRINT_HEX(cp[offset+1]); DEBUGPRINT_F(" + ");
DEBUGPRINT_HEX(cp[offset]);
DEBUGPRINT_F("\n\r");
*/
return (uint32_t)((uint32_t)((uint32_t)
(*(p + offset + 3)) << 24) + (uint32_t)((uint32_t)
(*(p + offset + 2)) << 16) + (uint32_t)((uint32_t)
(*(p + offset + 1)) << 8) + (uint32_t)(*(p + offset)));
}
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

View File

@ -0,0 +1,385 @@
/*****************************************************************************
*
* cc3000_common.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __COMMON_H__
#define __COMMON_H__
//******************************************************************************
// Include files
//******************************************************************************
#include <stdlib.h>
#include <errno.h>
#include <stdint.h>
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C" {
#endif
//*****************************************************************************
// ERROR CODES
//*****************************************************************************
#define ESUCCESS 0
#define EFAIL -1
#define EERROR EFAIL
//*****************************************************************************
// COMMON DEFINES
//*****************************************************************************
#define ERROR_SOCKET_INACTIVE -57
#define WLAN_ENABLE (1)
#define WLAN_DISABLE (0)
#define MAC_ADDR_LEN (6)
#define SP_PORTION_SIZE (32)
// #define CC3000_TINY_DRIVER
/*Defines for minimal and maximal RX buffer size. This size includes the spi
header and hci header.
The maximal buffer size derives from:
MTU + HCI header + SPI header + sendto() agrs size
The minimum buffer size derives from:
HCI header + SPI header + max args size
This buffer is used for receiving events and data.
The packet can not be longer than MTU size and CC3000 does not support
fragmentation. Note that the same buffer is used for reception of the data
and events from CC3000. That is why the minimum is defined.
The calculation for the actual size of buffer for reception is:
Given the maximal data size MAX_DATA that is expected to be received by
application, the required buffer is:
Using recv() or recvfrom():
max(CC3000_MINIMAL_RX_SIZE, MAX_DATA + HEADERS_SIZE_DATA + fromlen
+ ucArgsize + 1)
Using gethostbyname() with minimal buffer size will limit the host name
returned to 99 bytes only.
The 1 is used for the overrun detection
Buffer size increased to 130 following the add_profile() with WEP security
which requires TX buffer size of 130 bytes:
HEADERS_SIZE_EVNT + WLAN_ADD_PROFILE_WEP_PARAM_LEN + MAX SSID LEN + 4 * MAX KEY LEN = 130
MAX SSID LEN = 32
MAX SSID LEN = 13 (with add_profile only ascii key setting is supported,
therfore maximum key size is 13)
*/
#define CC3000_MINIMAL_RX_SIZE (130 + 1)
#define CC3000_MAXIMAL_RX_SIZE (1519 + 1)
/*Defines for minimal and maximal TX buffer size.
This buffer is used for sending events and data.
The packet can not be longer than MTU size and CC3000 does not support
fragmentation. Note that the same buffer is used for transmission of the data
and commands. That is why the minimum is defined.
The calculation for the actual size of buffer for transmission is:
Given the maximal data size MAX_DATA, the required buffer is:
Using Sendto():
max(CC3000_MINIMAL_TX_SIZE, MAX_DATA + SPI_HEADER_SIZE
+ SOCKET_SENDTO_PARAMS_LEN + SIMPLE_LINK_HCI_DATA_HEADER_SIZE + 1)
Using Send():
max(CC3000_MINIMAL_TX_SIZE, MAX_DATA + SPI_HEADER_SIZE
+ HCI_CMND_SEND_ARG_LENGTH + SIMPLE_LINK_HCI_DATA_HEADER_SIZE + 1)
The 1 is used for the overrun detection */
#define CC3000_MINIMAL_TX_SIZE (130 + 1)
#define CC3000_MAXIMAL_TX_SIZE (1519 + 1)
//TX and RX buffer sizes, allow to receive and transmit maximum data at length 8.
#ifdef CC3000_TINY_DRIVER
#define TINY_CC3000_MAXIMAL_RX_SIZE 44
#define TINY_CC3000_MAXIMAL_TX_SIZE 59
#endif
/*In order to determine your preferred buffer size,
change CC3000_MAXIMAL_RX_SIZE and CC3000_MAXIMAL_TX_SIZE to a value between
the minimal and maximal specified above.
Note that the buffers are allocated by SPI.
In case you change the size of those buffers, you might need also to change
the linker file, since for example on MSP430 FRAM devices the buffers are
allocated in the FRAM section that is allocated manually and not by IDE.
*/
#ifndef CC3000_TINY_DRIVER
#define CC3000_RX_BUFFER_SIZE (CC3000_MINIMAL_RX_SIZE)
#define CC3000_TX_BUFFER_SIZE (CC3000_MINIMAL_TX_SIZE)
//if defined TINY DRIVER we use smaller RX and TX buffer in order to minimize RAM consumption
#else
#define CC3000_RX_BUFFER_SIZE (TINY_CC3000_MAXIMAL_RX_SIZE)
#define CC3000_TX_BUFFER_SIZE (TINY_CC3000_MAXIMAL_TX_SIZE)
#endif
//*****************************************************************************
// Compound Types
//*****************************************************************************
#ifdef __AVR__
typedef unsigned long time_t; /* KTown: Updated to be compatible with Arduino Time.h */
#else
typedef long time_t;
#endif
typedef unsigned long clock_t;
typedef long suseconds_t;
typedef struct timeval timeval;
struct timeval
{
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};
typedef char *(*tFWPatches)(unsigned long *usLength);
typedef char *(*tDriverPatches)(unsigned long *usLength);
typedef char *(*tBootLoaderPatches)(unsigned long *usLength);
typedef void (*tWlanCB)(long event_type, char * data, unsigned char length );
typedef long (*tWlanReadInteruptPin)(void);
typedef void (*tWlanInterruptEnable)(void);
typedef void (*tWlanInterruptDisable)(void);
typedef void (*tWriteWlanPin)(unsigned char val);
typedef struct
{
unsigned short usRxEventOpcode;
unsigned short usEventOrDataReceived;
unsigned char *pucReceivedData;
unsigned char *pucTxCommandBuffer;
tFWPatches sFWPatches;
tDriverPatches sDriverPatches;
tBootLoaderPatches sBootLoaderPatches;
tWlanCB sWlanCB;
tWlanReadInteruptPin ReadWlanInterruptPin;
tWlanInterruptEnable WlanInterruptEnable;
tWlanInterruptDisable WlanInterruptDisable;
tWriteWlanPin WriteWlanPin;
signed long slTransmitDataError;
unsigned short usNumberOfFreeBuffers;
unsigned short usSlBufferLength;
unsigned short usBufferSize;
unsigned short usRxDataPending;
unsigned long NumberOfSentPackets;
unsigned long NumberOfReleasedPackets;
unsigned char InformHostOnTxComplete;
}sSimplLinkInformation;
extern volatile sSimplLinkInformation tSLInformation;
//*****************************************************************************
// Prototypes for the APIs.
//*****************************************************************************
//*****************************************************************************
//
//! SimpleLinkWaitEvent
//!
//! @param usOpcode command operation code
//! @param pRetParams command return parameters
//!
//! @return none
//!
//! @brief Wait for event, pass it to the hci_event_handler and
//! update the event opcode in a global variable.
//
//*****************************************************************************
extern void SimpleLinkWaitEvent(unsigned short usOpcode, void *pRetParams);
//*****************************************************************************
//
//! SimpleLinkWaitData
//!
//! @param pBuf data buffer
//! @param from from information
//! @param fromlen from information length
//!
//! @return none
//!
//! @brief Wait for data, pass it to the hci_event_handler
//! and update in a global variable that there is
//! data to read.
//
//*****************************************************************************
extern void SimpleLinkWaitData(uint8_t *pBuf, uint8_t *from, uint8_t *fromlen);
//*****************************************************************************
//
//! UINT32_TO_STREAM_f
//!
//! \param p pointer to the new stream
//! \param u32 pointer to the 32 bit
//!
//! \return pointer to the new stream
//!
//! \brief This function is used for copying 32 bit to stream
//! while converting to little endian format.
//
//*****************************************************************************
extern uint8_t* UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32);
//*****************************************************************************
//
//! UINT16_TO_STREAM_f
//!
//! \param p pointer to the new stream
//! \param u32 pointer to the 16 bit
//!
//! \return pointer to the new stream
//!
//! \brief This function is used for copying 16 bit to stream
//! while converting to little endian format.
//
//*****************************************************************************
extern uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16);
//*****************************************************************************
//
//! STREAM_TO_UINT16_f
//!
//! \param p pointer to the stream
//! \param offset offset in the stream
//!
//! \return pointer to the new 16 bit
//!
//! \brief This function is used for copying received stream to
//! 16 bit in little endian format.
//
//*****************************************************************************
extern uint16_t STREAM_TO_UINT16_f(char* p, uint16_t offset);
//*****************************************************************************
//
//! STREAM_TO_UINT32_f
//!
//! \param p pointer to the stream
//! \param offset offset in the stream
//!
//! \return pointer to the new 32 bit
//!
//! \brief This function is used for copying received stream to
//! 32 bit in little endian format.
//
//*****************************************************************************
extern uint32_t STREAM_TO_UINT32_f(char* p, uint16_t offset);
//*****************************************************************************
//
//! cc3k_int_poll
//!
//! \brief checks if the interrupt pin is low
//! just in case the hardware missed a falling edge
//! function is in ccspi.cpp
//
//*****************************************************************************
extern void cc3k_int_poll();
//*****************************************************************************
// COMMON MACROs
//*****************************************************************************
//This macro is used for copying 8 bit to stream while converting to little endian format.
#define UINT8_TO_STREAM(_p, _val) {*(_p)++ = (_val);}
//This macro is used for copying 16 bit to stream while converting to little endian format.
#define UINT16_TO_STREAM(_p, _u16) (UINT16_TO_STREAM_f(_p, _u16))
//This macro is used for copying 32 bit to stream while converting to little endian format.
#define UINT32_TO_STREAM(_p, _u32) (UINT32_TO_STREAM_f(_p, _u32))
//This macro is used for copying a specified value length bits (l) to stream while converting to little endian format.
#define ARRAY_TO_STREAM(p, a, l) {register short _i; for (_i = 0; _i < l; _i++) *(p)++ = ((uint8_t *) a)[_i];}
//This macro is used for copying received stream to 8 bit in little endian format.
#define STREAM_TO_UINT8(_p, _offset, _u8) {_u8 = (uint8_t)(*(_p + _offset));}
//This macro is used for copying received stream to 16 bit in little endian format.
#define STREAM_TO_UINT16(_p, _offset, _u16) {_u16 = STREAM_TO_UINT16_f(_p, _offset);}
//This macro is used for copying received stream to 32 bit in little endian format.
#define STREAM_TO_UINT32(_p, _offset, _u32) {_u32 = STREAM_TO_UINT32_f(_p, _offset);}
#define STREAM_TO_STREAM(p, a, l) {register short _i; for (_i = 0; _i < l; _i++) *(a)++= ((uint8_t *) p)[_i];}
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __COMMON_H__

View File

@ -0,0 +1,124 @@
/**************************************************************************/
/*!
@file Adafruit_CC3000.cpp
@author KTOWN (Kevin Townsend Adafruit Industries)
@license BSD (see license.txt)
This is a library for the Adafruit CC3000 WiFi breakout board
This library works with the Adafruit CC3000 breakout
----> https://www.adafruit.com/products/1469
Check out the links above for our tutorials and wiring diagrams
These chips use SPI to communicate.
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
@section HISTORY
v1.0 - Initial release
*/
/**************************************************************************/
#include "debug.h"
/**************************************************************************/
/*!
@brief This function will display the number of bytes currently free
in RAM ... useful for debugging!
*/
/**************************************************************************/
#if defined (__arm__) && defined (__SAM3X8E__) // Arduino Due
// should use uinstd.h to define sbrk but on Arduino Due this causes a conflict
extern "C" char* sbrk(int incr);
int getFreeRam(void) {
char top;
return &top - reinterpret_cast<char*>(sbrk(0));
}
#else // AVR
int getFreeRam(void)
{
extern int __bss_end;
extern int *__brkval;
int free_memory;
if((int)__brkval == 0) {
free_memory = ((int)&free_memory) - ((int)&__bss_end);
}
else {
free_memory = ((int)&free_memory) - ((int)__brkval);
}
return free_memory;
}
#endif
void displayFreeRam(void)
{
if (CC3KPrinter == 0) {
return;
}
CC3KPrinter->print(F("Free RAM: "));
CC3KPrinter->print(getFreeRam());
CC3KPrinter->println(F(" bytes"));
}
void uart_putchar(char c) {
if (CC3KPrinter != 0) {
CC3KPrinter->write(c);
}
}
void printDec(uint8_t h) {
uart_putchar((h / 100) + '0');
h %= 100;
uart_putchar((h / 10) + '0');
h %= 10;
uart_putchar(h + '0');
}
void printHex(uint8_t h) {
uint8_t d = h >> 4;
if (d >= 10) {
uart_putchar(d - 10 + 'A');
} else {
uart_putchar(d + '0');
}
h &= 0xF;
if (h >= 10) {
uart_putchar(h - 10 + 'A');
} else {
uart_putchar(h + '0');
}
}
void printHex16(uint16_t h) {
uart_putchar('0');
uart_putchar('x');
DEBUGPRINT_HEX(h >> 8);
DEBUGPRINT_HEX(h);
}
void printDec16(uint16_t h) {
uart_putchar((h / 10000) + '0');
h %= 10000;
uart_putchar((h / 1000) + '0');
h %= 1000;
uart_putchar((h / 100) + '0');
h %= 100;
uart_putchar((h / 10) + '0');
h %= 10;
uart_putchar(h + '0');
}
void DEBUGPRINT(const prog_char *fstr)
{
char c;
if(!fstr) return;
while((c = pgm_read_byte(fstr++)))
uart_putchar(c);
}

View File

@ -0,0 +1,67 @@
/**************************************************************************/
/*!
@file Adafruit_CC3000.cpp
@author KTOWN (Kevin Townsend for Adafruit Industries)
@license BSD (see license.txt)
This is a library for the Adafruit CC3000 WiFi breakout board
This library works with the Adafruit CC3000 breakout
----> https://www.adafruit.com/products/1469
Check out the links above for our tutorials and wiring diagrams
These chips use SPI to communicate.
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
@section HISTORY
v1.0 - Initial release
*/
/**************************************************************************/
#include <Arduino.h>
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#if (GCC_VERSION >= 40702) || !defined(prog_char)
typedef char PROGMEM prog_char;
#endif
#ifndef _CC3000_DEBUG
#define _CC3000_DEBUG
#define DEBUG_MODE (0)
int getFreeRam(void);
void displayFreeRam(void);
void uart_putchar(char c);
void printHex(uint8_t h);
void printHex16(uint16_t h);
void DEBUGPRINT(const prog_char *fstr);
void printDec(uint8_t h);
void printDec16(uint16_t h);
#ifndef FLASHIFY
#define FLASHIFY(s) ({static const char c[] __attribute__ ((progmem)) = s;c;})
#endif
#define PRINT_F(__s) DEBUGPRINT(FLASHIFY(__s))
#if (DEBUG_MODE != 0)
#define DEBUGPRINT_F(__s) DEBUGPRINT(FLASHIFY(__s))
#define DEBUGPRINT_DEC(x) printDec(x)
#define DEBUGPRINT_DEC16(x) printDec16(x)
#define DEBUGPRINT_HEX(x) printHex(x)
#define DEBUGPRINT_HEX16(x) printHex16(x)
#else
#define DEBUGPRINT_F(__s) /* do nothing! */
#define DEBUGPRINT_DEC(x)
#define DEBUGPRINT_DEC16(x)
#define DEBUGPRINT_HEX(x)
#define DEBUGPRINT_HEX16(x)
#endif
extern Print* CC3KPrinter;
#endif

View File

@ -0,0 +1,871 @@
/*****************************************************************************
*
* evnt_handler.c - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
//*****************************************************************************
//
//! \addtogroup evnt_handler_api
//! @{
//
//******************************************************************************
//******************************************************************************
// INCLUDE FILES
//******************************************************************************
#include "cc3000_common.h"
#include "string.h"
#include "hci.h"
#include "evnt_handler.h"
#include "wlan.h"
#include "socket.h"
#include "netapp.h"
#include "../ccspi.h"
#include "debug.h"
//*****************************************************************************
// COMMON DEFINES
//*****************************************************************************
#define FLOW_CONTROL_EVENT_HANDLE_OFFSET (0)
#define FLOW_CONTROL_EVENT_BLOCK_MODE_OFFSET (1)
#define FLOW_CONTROL_EVENT_FREE_BUFFS_OFFSET (2)
#define FLOW_CONTROL_EVENT_SIZE (4)
#define BSD_RSP_PARAMS_SOCKET_OFFSET (0)
#define BSD_RSP_PARAMS_STATUS_OFFSET (4)
#define GET_HOST_BY_NAME_RETVAL_OFFSET (0)
#define GET_HOST_BY_NAME_ADDR_OFFSET (4)
#define ACCEPT_SD_OFFSET (0)
#define ACCEPT_RETURN_STATUS_OFFSET (4)
#define ACCEPT_ADDRESS__OFFSET (8)
#define SL_RECEIVE_SD_OFFSET (0)
#define SL_RECEIVE_NUM_BYTES_OFFSET (4)
#define SL_RECEIVE__FLAGS__OFFSET (8)
#define SELECT_STATUS_OFFSET (0)
#define SELECT_READFD_OFFSET (4)
#define SELECT_WRITEFD_OFFSET (8)
#define SELECT_EXFD_OFFSET (12)
#define NETAPP_IPCONFIG_IP_OFFSET (0)
#define NETAPP_IPCONFIG_SUBNET_OFFSET (4)
#define NETAPP_IPCONFIG_GW_OFFSET (8)
#define NETAPP_IPCONFIG_DHCP_OFFSET (12)
#define NETAPP_IPCONFIG_DNS_OFFSET (16)
#define NETAPP_IPCONFIG_MAC_OFFSET (20)
#define NETAPP_IPCONFIG_SSID_OFFSET (26)
#define NETAPP_IPCONFIG_IP_LENGTH (4)
#define NETAPP_IPCONFIG_MAC_LENGTH (6)
#define NETAPP_IPCONFIG_SSID_LENGTH (32)
#define NETAPP_PING_PACKETS_SENT_OFFSET (0)
#define NETAPP_PING_PACKETS_RCVD_OFFSET (4)
#define NETAPP_PING_MIN_RTT_OFFSET (8)
#define NETAPP_PING_MAX_RTT_OFFSET (12)
#define NETAPP_PING_AVG_RTT_OFFSET (16)
#define GET_SCAN_RESULTS_TABlE_COUNT_OFFSET (0)
#define GET_SCAN_RESULTS_SCANRESULT_STATUS_OFFSET (4)
#define GET_SCAN_RESULTS_ISVALID_TO_SSIDLEN_OFFSET (8)
#define GET_SCAN_RESULTS_FRAME_TIME_OFFSET (10)
#define GET_SCAN_RESULTS_SSID_MAC_LENGTH (38)
//*****************************************************************************
// GLOBAL VARAIABLES
//*****************************************************************************
unsigned long socket_active_status = SOCKET_STATUS_INIT_VAL;
//*****************************************************************************
// Prototypes for the static functions
//*****************************************************************************
static long hci_event_unsol_flowcontrol_handler(char *pEvent);
static void update_socket_active_status(char *resp_params);
//*****************************************************************************
//
//! hci_unsol_handle_patch_request
//!
//! @param event_hdr event header
//!
//! @return none
//!
//! @brief Handle unsolicited event from type patch request
//
//*****************************************************************************
void hci_unsol_handle_patch_request(char *event_hdr)
{
char *params = (char *)(event_hdr) + HCI_EVENT_HEADER_SIZE;
unsigned long ucLength = 0;
char *patch;
switch (*params)
{
case HCI_EVENT_PATCHES_DRV_REQ:
if (tSLInformation.sDriverPatches)
{
patch = tSLInformation.sDriverPatches(&ucLength);
if (patch)
{
hci_patch_send(HCI_EVENT_PATCHES_DRV_REQ,
tSLInformation.pucTxCommandBuffer, patch, ucLength);
return;
}
}
// Send 0 length Patches response event
hci_patch_send(HCI_EVENT_PATCHES_DRV_REQ,
tSLInformation.pucTxCommandBuffer, 0, 0);
break;
case HCI_EVENT_PATCHES_FW_REQ:
if (tSLInformation.sFWPatches)
{
patch = tSLInformation.sFWPatches(&ucLength);
// Build and send a patch
if (patch)
{
hci_patch_send(HCI_EVENT_PATCHES_FW_REQ,
tSLInformation.pucTxCommandBuffer, patch, ucLength);
return;
}
}
// Send 0 length Patches response event
hci_patch_send(HCI_EVENT_PATCHES_FW_REQ,
tSLInformation.pucTxCommandBuffer, 0, 0);
break;
case HCI_EVENT_PATCHES_BOOTLOAD_REQ:
if (tSLInformation.sBootLoaderPatches)
{
patch = tSLInformation.sBootLoaderPatches(&ucLength);
if (patch)
{
hci_patch_send(HCI_EVENT_PATCHES_BOOTLOAD_REQ,
tSLInformation.pucTxCommandBuffer, patch, ucLength);
return;
}
}
// Send 0 length Patches response event
hci_patch_send(HCI_EVENT_PATCHES_BOOTLOAD_REQ,
tSLInformation.pucTxCommandBuffer, 0, 0);
break;
}
}
//*****************************************************************************
//
//! hci_event_handler
//!
//! @param pRetParams incoming data buffer
//! @param from from information (in case of data received)
//! @param fromlen from information length (in case of data received)
//!
//! @return none
//!
//! @brief Parse the incoming events packets and issues corresponding
//! event handler from global array of handlers pointers
//
//*****************************************************************************
unsigned char *
hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
{
unsigned char *pucReceivedData, ucArgsize;
unsigned short usLength;
unsigned char *pucReceivedParams;
unsigned short usReceivedEventOpcode = 0;
unsigned long retValue32;
unsigned char * RecvParams;
unsigned char *RetParams;
while (1)
{
cc3k_int_poll();
if (tSLInformation.usEventOrDataReceived != 0)
{
pucReceivedData = (tSLInformation.pucReceivedData);
if (*pucReceivedData == HCI_TYPE_EVNT)
{
// Event Received
STREAM_TO_UINT16((char *)pucReceivedData,
HCI_EVENT_OPCODE_OFFSET,
usReceivedEventOpcode);
pucReceivedParams = pucReceivedData + HCI_EVENT_HEADER_SIZE;
RecvParams = pucReceivedParams;
RetParams = (unsigned char *)pRetParams;
// In case unsolicited event received - here the handling finished
if (hci_unsol_event_handler((char *)pucReceivedData) == 0)
{
STREAM_TO_UINT8(pucReceivedData, HCI_DATA_LENGTH_OFFSET, usLength);
switch(usReceivedEventOpcode)
{
case HCI_CMND_READ_BUFFER_SIZE:
{
STREAM_TO_UINT8((char *)pucReceivedParams, 0,
tSLInformation.usNumberOfFreeBuffers);
STREAM_TO_UINT16((char *)pucReceivedParams, 1,
tSLInformation.usSlBufferLength);
}
break;
case HCI_CMND_WLAN_CONFIGURE_PATCH:
case HCI_NETAPP_DHCP:
case HCI_NETAPP_PING_SEND:
case HCI_NETAPP_PING_STOP:
case HCI_NETAPP_ARP_FLUSH:
case HCI_NETAPP_SET_DEBUG_LEVEL:
case HCI_NETAPP_SET_TIMERS:
case HCI_EVNT_NVMEM_READ:
case HCI_EVNT_NVMEM_CREATE_ENTRY:
case HCI_CMND_NVMEM_WRITE_PATCH:
case HCI_NETAPP_PING_REPORT:
case HCI_EVNT_MDNS_ADVERTISE:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET
,*(unsigned char *)pRetParams);
break;
case HCI_CMND_SETSOCKOPT:
case HCI_CMND_WLAN_CONNECT:
case HCI_CMND_WLAN_IOCTL_STATUSGET:
case HCI_EVNT_WLAN_IOCTL_ADD_PROFILE:
case HCI_CMND_WLAN_IOCTL_DEL_PROFILE:
case HCI_CMND_WLAN_IOCTL_SET_CONNECTION_POLICY:
case HCI_CMND_WLAN_IOCTL_SET_SCANPARAM:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_START:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_STOP:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_SET_PREFIX:
case HCI_CMND_EVENT_MASK:
case HCI_EVNT_WLAN_DISCONNECT:
case HCI_EVNT_SOCKET:
case HCI_EVNT_BIND:
case HCI_CMND_LISTEN:
case HCI_EVNT_CLOSE_SOCKET:
case HCI_EVNT_CONNECT:
case HCI_EVNT_NVMEM_WRITE:
STREAM_TO_UINT32((char *)pucReceivedParams,0
,*(unsigned long *)pRetParams);
break;
case HCI_EVNT_READ_SP_VERSION:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET
,*(unsigned char *)pRetParams);
pRetParams = ((char *)pRetParams) + 1;
STREAM_TO_UINT32((char *)pucReceivedParams, 0, retValue32);
UINT32_TO_STREAM((unsigned char *)pRetParams, retValue32);
break;
case HCI_EVNT_BSD_GETHOSTBYNAME:
STREAM_TO_UINT32((char *)pucReceivedParams
,GET_HOST_BY_NAME_RETVAL_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams
,GET_HOST_BY_NAME_ADDR_OFFSET,*(unsigned long *)pRetParams);
break;
case HCI_EVNT_ACCEPT:
{
STREAM_TO_UINT32((char *)pucReceivedParams,ACCEPT_SD_OFFSET
,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams
,ACCEPT_RETURN_STATUS_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
//This argument returns in network order
memcpy((unsigned char *)pRetParams,
pucReceivedParams + ACCEPT_ADDRESS__OFFSET, sizeof(sockaddr));
break;
}
case HCI_EVNT_RECV:
case HCI_EVNT_RECVFROM:
{
STREAM_TO_UINT32((char *)pucReceivedParams,SL_RECEIVE_SD_OFFSET ,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,SL_RECEIVE_NUM_BYTES_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,SL_RECEIVE__FLAGS__OFFSET,*(unsigned long *)pRetParams);
tBsdReadReturnParams *tread = (tBsdReadReturnParams *)pRetParams;
if(((tBsdReadReturnParams *)pRetParams)->iNumberOfBytes == ERROR_SOCKET_INACTIVE)
{
set_socket_active_status(((tBsdReadReturnParams *)pRetParams)->iSocketDescriptor,SOCKET_STATUS_INACTIVE);
}
break;
}
case HCI_EVNT_SEND:
case HCI_EVNT_SENDTO:
{
STREAM_TO_UINT32((char *)pucReceivedParams,SL_RECEIVE_SD_OFFSET ,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,SL_RECEIVE_NUM_BYTES_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
break;
}
case HCI_EVNT_SELECT:
{
STREAM_TO_UINT32((char *)pucReceivedParams,SELECT_STATUS_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,SELECT_READFD_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,SELECT_WRITEFD_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,SELECT_EXFD_OFFSET,*(unsigned long *)pRetParams);
break;
}
case HCI_CMND_GETSOCKOPT:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET,((tBsdGetSockOptReturnParams *)pRetParams)->iStatus);
//This argument returns in network order
memcpy((unsigned char *)pRetParams, pucReceivedParams, 4);
break;
case HCI_CMND_WLAN_IOCTL_GET_SCAN_RESULTS:
STREAM_TO_UINT32((char *)pucReceivedParams,GET_SCAN_RESULTS_TABlE_COUNT_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,GET_SCAN_RESULTS_SCANRESULT_STATUS_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT16((char *)pucReceivedParams,GET_SCAN_RESULTS_ISVALID_TO_SSIDLEN_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 2;
STREAM_TO_UINT16((char *)pucReceivedParams,GET_SCAN_RESULTS_FRAME_TIME_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 2;
memcpy((unsigned char *)pRetParams, (char *)(pucReceivedParams + GET_SCAN_RESULTS_FRAME_TIME_OFFSET + 2), GET_SCAN_RESULTS_SSID_MAC_LENGTH);
break;
case HCI_CMND_SIMPLE_LINK_START:
break;
case HCI_NETAPP_IPCONFIG:
//Read IP address
STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_IP_LENGTH);
RecvParams += 4;
//Read subnet
STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_IP_LENGTH);
RecvParams += 4;
//Read default GW
STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_IP_LENGTH);
RecvParams += 4;
//Read DHCP server
STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_IP_LENGTH);
RecvParams += 4;
//Read DNS server
STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_IP_LENGTH);
RecvParams += 4;
//Read Mac address
STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_MAC_LENGTH);
RecvParams += 6;
//Read SSID
STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_SSID_LENGTH);
}
}
if (usReceivedEventOpcode == tSLInformation.usRxEventOpcode)
{
tSLInformation.usRxEventOpcode = 0;
}
}
else
{
pucReceivedParams = pucReceivedData;
STREAM_TO_UINT8((char *)pucReceivedData, HCI_PACKET_ARGSIZE_OFFSET, ucArgsize);
STREAM_TO_UINT16((char *)pucReceivedData, HCI_PACKET_LENGTH_OFFSET, usLength);
// Data received: note that the only case where from and from length
// are not null is in recv from, so fill the args accordingly
if (from)
{
STREAM_TO_UINT32((char *)(pucReceivedData + HCI_DATA_HEADER_SIZE), BSD_RECV_FROM_FROMLEN_OFFSET, *(unsigned long *)fromlen);
memcpy(from, (pucReceivedData + HCI_DATA_HEADER_SIZE + BSD_RECV_FROM_FROM_OFFSET) ,*fromlen);
}
memcpy(pRetParams, pucReceivedParams + HCI_DATA_HEADER_SIZE + ucArgsize,
usLength - ucArgsize);
tSLInformation.usRxDataPending = 0;
}
tSLInformation.usEventOrDataReceived = 0;
SpiResumeSpi();
// Since we are going to TX - we need to handle this event after the
// ResumeSPi since we need interrupts
if ((*pucReceivedData == HCI_TYPE_EVNT) &&
(usReceivedEventOpcode == HCI_EVNT_PATCHES_REQ))
{
hci_unsol_handle_patch_request((char *)pucReceivedData);
}
if ((tSLInformation.usRxEventOpcode == 0) && (tSLInformation.usRxDataPending == 0))
{
return NULL;
}
}
}
}
//*****************************************************************************
//
//! hci_unsol_event_handler
//!
//! @param event_hdr event header
//!
//! @return 1 if event supported and handled
//! 0 if event is not supported
//!
//! @brief Handle unsolicited events
//
//*****************************************************************************
long
hci_unsol_event_handler(char *event_hdr)
{
char * data = NULL;
long event_type;
unsigned long NumberOfReleasedPackets;
unsigned long NumberOfSentPackets;
STREAM_TO_UINT16(event_hdr, HCI_EVENT_OPCODE_OFFSET,event_type);
DEBUGPRINT_F("\tHCI_UNSOL_EVT: ");
DEBUGPRINT_HEX16(event_type);
if (event_type & HCI_EVNT_UNSOL_BASE)
{
switch(event_type)
{
case HCI_EVNT_DATA_UNSOL_FREE_BUFF:
{
hci_event_unsol_flowcontrol_handler(event_hdr);
NumberOfReleasedPackets = tSLInformation.NumberOfReleasedPackets;
NumberOfSentPackets = tSLInformation.NumberOfSentPackets;
if (NumberOfReleasedPackets == NumberOfSentPackets)
{
if (tSLInformation.InformHostOnTxComplete)
{
tSLInformation.sWlanCB(HCI_EVENT_CC3000_CAN_SHUT_DOWN, NULL, 0);
}
}
return 1;
}
}
}
if(event_type & HCI_EVNT_WLAN_UNSOL_BASE)
{
switch(event_type)
{
case HCI_EVNT_WLAN_KEEPALIVE:
case HCI_EVNT_WLAN_UNSOL_CONNECT:
case HCI_EVNT_WLAN_UNSOL_DISCONNECT:
case HCI_EVNT_WLAN_UNSOL_INIT:
case HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE:
if( tSLInformation.sWlanCB )
{
tSLInformation.sWlanCB(event_type, 0, 0);
}
break;
case HCI_EVNT_WLAN_UNSOL_DHCP:
{
unsigned char params[NETAPP_IPCONFIG_MAC_OFFSET + 1]; // extra byte is for the status
unsigned char *recParams = params;
data = (char*)(event_hdr) + HCI_EVENT_HEADER_SIZE;
//Read IP address
STREAM_TO_STREAM(data,recParams,NETAPP_IPCONFIG_IP_LENGTH);
data += 4;
//Read subnet
STREAM_TO_STREAM(data,recParams,NETAPP_IPCONFIG_IP_LENGTH);
data += 4;
//Read default GW
STREAM_TO_STREAM(data,recParams,NETAPP_IPCONFIG_IP_LENGTH);
data += 4;
//Read DHCP server
STREAM_TO_STREAM(data,recParams,NETAPP_IPCONFIG_IP_LENGTH);
data += 4;
//Read DNS server
STREAM_TO_STREAM(data,recParams,NETAPP_IPCONFIG_IP_LENGTH);
// read the status
STREAM_TO_UINT8(event_hdr, HCI_EVENT_STATUS_OFFSET, *recParams);
if( tSLInformation.sWlanCB )
{
tSLInformation.sWlanCB(event_type, (char *)params, sizeof(params));
}
}
break;
case HCI_EVNT_WLAN_ASYNC_PING_REPORT:
{
netapp_pingreport_args_t params;
data = (char*)(event_hdr) + HCI_EVENT_HEADER_SIZE;
STREAM_TO_UINT32(data, NETAPP_PING_PACKETS_SENT_OFFSET, params.packets_sent);
STREAM_TO_UINT32(data, NETAPP_PING_PACKETS_RCVD_OFFSET, params.packets_received);
STREAM_TO_UINT32(data, NETAPP_PING_MIN_RTT_OFFSET, params.min_round_time);
STREAM_TO_UINT32(data, NETAPP_PING_MAX_RTT_OFFSET, params.max_round_time);
STREAM_TO_UINT32(data, NETAPP_PING_AVG_RTT_OFFSET, params.avg_round_time);
if( tSLInformation.sWlanCB )
{
tSLInformation.sWlanCB(event_type, (char *)&params, sizeof(params));
}
}
break;
case HCI_EVNT_BSD_TCP_CLOSE_WAIT:
{
DEBUGPRINT_F("\tTCP Close Wait\n\r");
uint8_t socketnum;
data = (char*)(event_hdr) + HCI_EVENT_HEADER_SIZE;
/*
printHex(data[0]); PRINT_F("\t");
printHex(data[1]); PRINT_F("\t");
printHex(data[2]); PRINT_F("\t");
printHex(data[3]); PRINT_F("\t");
printHex(data[4]); PRINT_F("\t");
printHex(data[5]); PRINT_F("\t");
*/
socketnum = data[0];
//STREAM_TO_UINT16(data, 0, socketnum);
if( tSLInformation.sWlanCB )
{
tSLInformation.sWlanCB(event_type, (char *)&socketnum, 1);
}
}
break;
//'default' case which means "event not supported"
default:
return (0);
}
return(1);
}
if ((event_type == HCI_EVNT_SEND) || (event_type == HCI_EVNT_SENDTO)
|| (event_type == HCI_EVNT_WRITE))
{
char *pArg;
long status;
DEBUGPRINT_F("\tSEND event response\n\r");
pArg = M_BSD_RESP_PARAMS_OFFSET(event_hdr);
STREAM_TO_UINT32(pArg, BSD_RSP_PARAMS_STATUS_OFFSET,status);
if (ERROR_SOCKET_INACTIVE == status)
{
// The only synchronous event that can come from SL device in form of
// command complete is "Command Complete" on data sent, in case SL device
// was unable to transmit
STREAM_TO_UINT8(event_hdr, HCI_EVENT_STATUS_OFFSET, tSLInformation.slTransmitDataError);
update_socket_active_status(M_BSD_RESP_PARAMS_OFFSET(event_hdr));
return (1);
}
else
return (0);
}
return(0);
}
//*****************************************************************************
//
//! hci_unsolicited_event_handler
//!
//! @param None
//!
//! @return ESUCCESS if successful, EFAIL if an error occurred
//!
//! @brief Parse the incoming unsolicited event packets and issues
//! corresponding event handler.
//
//*****************************************************************************
long
hci_unsolicited_event_handler(void)
{
unsigned long res = 0;
unsigned char *pucReceivedData;
if (tSLInformation.usEventOrDataReceived != 0)
{
pucReceivedData = (tSLInformation.pucReceivedData);
if (*pucReceivedData == HCI_TYPE_EVNT)
{
// In case unsolicited event received - here the handling finished
if (hci_unsol_event_handler((char *)pucReceivedData) == 1)
{
// There was an unsolicited event received - we can release the buffer
// and clean the event received
tSLInformation.usEventOrDataReceived = 0;
res = 1;
SpiResumeSpi();
}
}
}
return res;
}
//*****************************************************************************
//
//! set_socket_active_status
//!
//! @param Sd
//! @param Status
//! @return none
//!
//! @brief Check if the socket ID and status are valid and set
//! accordingly the global socket status
//
//*****************************************************************************
void set_socket_active_status(long Sd, long Status)
{
if(M_IS_VALID_SD(Sd) && M_IS_VALID_STATUS(Status))
{
socket_active_status &= ~(1 << Sd); /* clean socket's mask */
socket_active_status |= (Status << Sd); /* set new socket's mask */
}
}
//*****************************************************************************
//
//! hci_event_unsol_flowcontrol_handler
//!
//! @param pEvent pointer to the string contains parameters for IPERF
//! @return ESUCCESS if successful, EFAIL if an error occurred
//!
//! @brief Called in case unsolicited event from type
//! HCI_EVNT_DATA_UNSOL_FREE_BUFF has received.
//! Keep track on the number of packets transmitted and update the
//! number of free buffer in the SL device.
//
//*****************************************************************************
long
hci_event_unsol_flowcontrol_handler(char *pEvent)
{
long temp, value;
unsigned short i;
unsigned short pusNumberOfHandles=0;
char *pReadPayload;
STREAM_TO_UINT16((char *)pEvent,HCI_EVENT_HEADER_SIZE,pusNumberOfHandles);
pReadPayload = ((char *)pEvent +
HCI_EVENT_HEADER_SIZE + sizeof(pusNumberOfHandles));
temp = 0;
for(i = 0; i < pusNumberOfHandles ; i++)
{
STREAM_TO_UINT16(pReadPayload, FLOW_CONTROL_EVENT_FREE_BUFFS_OFFSET, value);
temp += value;
pReadPayload += FLOW_CONTROL_EVENT_SIZE;
}
tSLInformation.usNumberOfFreeBuffers += temp;
tSLInformation.NumberOfReleasedPackets += temp;
return(ESUCCESS);
}
//*****************************************************************************
//
//! get_socket_active_status
//!
//! @param Sd Socket IS
//! @return Current status of the socket.
//!
//! @brief Retrieve socket status
//
//*****************************************************************************
long
get_socket_active_status(long Sd)
{
if(M_IS_VALID_SD(Sd))
{
return (socket_active_status & (1 << Sd)) ? SOCKET_STATUS_INACTIVE : SOCKET_STATUS_ACTIVE;
}
return SOCKET_STATUS_INACTIVE;
}
//*****************************************************************************
//
//! update_socket_active_status
//!
//! @param resp_params Socket IS
//! @return Current status of the socket.
//!
//! @brief Retrieve socket status
//
//*****************************************************************************
void
update_socket_active_status(char *resp_params)
{
long status, sd;
STREAM_TO_UINT32(resp_params, BSD_RSP_PARAMS_SOCKET_OFFSET,sd);
STREAM_TO_UINT32(resp_params, BSD_RSP_PARAMS_STATUS_OFFSET,status);
if(ERROR_SOCKET_INACTIVE == status)
{
set_socket_active_status(sd, SOCKET_STATUS_INACTIVE);
}
}
//*****************************************************************************
//
//! SimpleLinkWaitEvent
//!
//! @param usOpcode command operation code
//! @param pRetParams command return parameters
//!
//! @return none
//!
//! @brief Wait for event, pass it to the hci_event_handler and
//! update the event opcode in a global variable.
//
//*****************************************************************************
void
SimpleLinkWaitEvent(unsigned short usOpcode, void *pRetParams)
{
// In the blocking implementation the control to caller will be returned only
// after the end of current transaction
tSLInformation.usRxEventOpcode = usOpcode;
hci_event_handler(pRetParams, 0, 0);
}
//*****************************************************************************
//
//! SimpleLinkWaitData
//!
//! @param pBuf data buffer
//! @param from from information
//! @param fromlen from information length
//!
//! @return none
//!
//! @brief Wait for data, pass it to the hci_event_handler
//! and update in a global variable that there is
//! data to read.
//
//*****************************************************************************
void
SimpleLinkWaitData(unsigned char *pBuf, unsigned char *from,
unsigned char *fromlen)
{
// In the blocking implementation the control to caller will be returned only
// after the end of current transaction, i.e. only after data will be received
tSLInformation.usRxDataPending = 1;
hci_event_handler(pBuf, from, fromlen);
}
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

View File

@ -0,0 +1,175 @@
/*****************************************************************************
*
* evnt_handler.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __EVENT_HANDLER_H__
#define __EVENT_HANDLER_H__
#include "hci.h"
#include "socket.h"
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C" {
#endif
//*****************************************************************************
//
// Prototypes for the APIs.
//
//*****************************************************************************
//*****************************************************************************
//
//! hci_event_handler
//!
//! @param pRetParams incoming data buffer
//! @param from from information (in case of data received)
//! @param fromlen from information length (in case of data received)
//!
//! @return none
//!
//! @brief Parse the incoming events packets and issues corresponding
//! event handler from global array of handlers pointers
//
//*****************************************************************************
extern unsigned char *hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen);
//*****************************************************************************
//
//! hci_unsol_event_handler
//!
//! @param event_hdr event header
//!
//! @return 1 if event supported and handled
//! 0 if event is not supported
//!
//! @brief Handle unsolicited events
//
//*****************************************************************************
extern long hci_unsol_event_handler(char *event_hdr);
//*****************************************************************************
//
//! hci_unsolicited_event_handler
//!
//! @param None
//!
//! @return ESUCCESS if successful, EFAIL if an error occurred
//!
//! @brief Parse the incoming unsolicited event packets and issues
//! corresponding event handler.
//
//*****************************************************************************
extern long hci_unsolicited_event_handler(void);
#define M_BSD_RESP_PARAMS_OFFSET(hci_event_hdr)((char *)(hci_event_hdr) + HCI_EVENT_HEADER_SIZE)
#define SOCKET_STATUS_ACTIVE 0
#define SOCKET_STATUS_INACTIVE 1
/* Init socket_active_status = 'all ones': init all sockets with SOCKET_STATUS_INACTIVE.
Will be changed by 'set_socket_active_status' upon 'connect' and 'accept' calls */
#define SOCKET_STATUS_INIT_VAL 0xFFFF
#define M_IS_VALID_SD(sd) ((0 <= (sd)) && ((sd) <= 7))
#define M_IS_VALID_STATUS(status) (((status) == SOCKET_STATUS_ACTIVE)||((status) == SOCKET_STATUS_INACTIVE))
extern unsigned long socket_active_status;
extern void set_socket_active_status(long Sd, long Status);
extern long get_socket_active_status(long Sd);
typedef struct _bsd_accept_return_t
{
long iSocketDescriptor;
long iStatus;
sockaddr tSocketAddress;
} tBsdReturnParams;
typedef struct _bsd_read_return_t
{
long iSocketDescriptor;
long iNumberOfBytes;
unsigned long uiFlags;
} tBsdReadReturnParams;
#define BSD_RECV_FROM_FROMLEN_OFFSET (4)
#define BSD_RECV_FROM_FROM_OFFSET (16)
typedef struct _bsd_select_return_t
{
long iStatus;
unsigned long uiRdfd;
unsigned long uiWrfd;
unsigned long uiExfd;
} tBsdSelectRecvParams;
typedef struct _bsd_getsockopt_return_t
{
unsigned char ucOptValue[4];
char iStatus;
} tBsdGetSockOptReturnParams;
typedef struct _bsd_gethostbyname_return_t
{
long retVal;
long outputAddress;
} tBsdGethostbynameParams;
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __EVENT_HANDLER_H__

View File

@ -0,0 +1,239 @@
/*****************************************************************************
*
* hci.c - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
//*****************************************************************************
//
//! \addtogroup hci_app
//! @{
//
//*****************************************************************************
#include "cc3000_common.h"
#include "hci.h"
#include "../ccspi.h"
#include "evnt_handler.h"
#include "wlan.h"
#define SL_PATCH_PORTION_SIZE (1000)
//*****************************************************************************
//
//! hci_command_send
//!
//! @param usOpcode command operation code
//! @param pucBuff pointer to the command's arguments buffer
//! @param ucArgsLength length of the arguments
//!
//! @return none
//!
//! @brief Initiate an HCI command.
//
//*****************************************************************************
unsigned short
hci_command_send(unsigned short usOpcode, unsigned char *pucBuff,
unsigned char ucArgsLength)
{
unsigned char *stream;
stream = (pucBuff + SPI_HEADER_SIZE);
UINT8_TO_STREAM(stream, HCI_TYPE_CMND);
stream = UINT16_TO_STREAM(stream, usOpcode);
UINT8_TO_STREAM(stream, ucArgsLength);
//Update the opcode of the event we will be waiting for
SpiWrite(pucBuff, ucArgsLength + SIMPLE_LINK_HCI_CMND_HEADER_SIZE);
return(0);
}
//*****************************************************************************
//
//! hci_data_send
//!
//! @param usOpcode command operation code
//! @param ucArgs pointer to the command's arguments buffer
//! @param usArgsLength length of the arguments
//! @param ucTail pointer to the data buffer
//! @param usTailLength buffer length
//!
//! @return none
//!
//! @brief Initiate an HCI data write operation
//
//*****************************************************************************
long
hci_data_send(unsigned char ucOpcode,
unsigned char *ucArgs,
unsigned short usArgsLength,
unsigned short usDataLength,
const unsigned char *ucTail,
unsigned short usTailLength)
{
unsigned char *stream;
stream = ((ucArgs) + SPI_HEADER_SIZE);
UINT8_TO_STREAM(stream, HCI_TYPE_DATA);
UINT8_TO_STREAM(stream, ucOpcode);
UINT8_TO_STREAM(stream, usArgsLength);
stream = UINT16_TO_STREAM(stream, usArgsLength + usDataLength + usTailLength);
// Send the packet over the SPI
SpiWrite(ucArgs, SIMPLE_LINK_HCI_DATA_HEADER_SIZE + usArgsLength + usDataLength + usTailLength);
return(ESUCCESS);
}
//*****************************************************************************
//
//! hci_data_command_send
//!
//! @param usOpcode command operation code
//! @param pucBuff pointer to the data buffer
//! @param ucArgsLength arguments length
//! @param ucDataLength data length
//!
//! @return none
//!
//! @brief Prepeare HCI header and initiate an HCI data write operation
//
//*****************************************************************************
void hci_data_command_send(unsigned short usOpcode, unsigned char *pucBuff,
unsigned char ucArgsLength,unsigned short ucDataLength)
{
unsigned char *stream = (pucBuff + SPI_HEADER_SIZE);
UINT8_TO_STREAM(stream, HCI_TYPE_DATA);
UINT8_TO_STREAM(stream, usOpcode);
UINT8_TO_STREAM(stream, ucArgsLength);
stream = UINT16_TO_STREAM(stream, ucArgsLength + ucDataLength);
// Send the command over SPI on data channel
SpiWrite(pucBuff, ucArgsLength + ucDataLength + SIMPLE_LINK_HCI_DATA_CMND_HEADER_SIZE);
return;
}
//*****************************************************************************
//
//! hci_patch_send
//!
//! @param usOpcode command operation code
//! @param pucBuff pointer to the command's arguments buffer
//! @param patch pointer to patch content buffer
//! @param usDataLength data length
//!
//! @return none
//!
//! @brief Prepeare HCI header and initiate an HCI patch write operation
//
//*****************************************************************************
void
hci_patch_send(unsigned char ucOpcode, unsigned char *pucBuff, char *patch, unsigned short usDataLength)
{
unsigned char *data_ptr = (pucBuff + SPI_HEADER_SIZE);
unsigned short usTransLength;
unsigned char *stream = (pucBuff + SPI_HEADER_SIZE);
UINT8_TO_STREAM(stream, HCI_TYPE_PATCH);
UINT8_TO_STREAM(stream, ucOpcode);
stream = UINT16_TO_STREAM(stream, usDataLength + SIMPLE_LINK_HCI_PATCH_HEADER_SIZE);
if (usDataLength <= SL_PATCH_PORTION_SIZE)
{
UINT16_TO_STREAM(stream, usDataLength);
stream = UINT16_TO_STREAM(stream, usDataLength);
memcpy((pucBuff + SPI_HEADER_SIZE) + HCI_PATCH_HEADER_SIZE, patch, usDataLength);
// Update the opcode of the event we will be waiting for
SpiWrite(pucBuff, usDataLength + HCI_PATCH_HEADER_SIZE);
}
else
{
usTransLength = (usDataLength/SL_PATCH_PORTION_SIZE);
UINT16_TO_STREAM(stream, usDataLength + SIMPLE_LINK_HCI_PATCH_HEADER_SIZE + usTransLength*SIMPLE_LINK_HCI_PATCH_HEADER_SIZE);
stream = UINT16_TO_STREAM(stream, SL_PATCH_PORTION_SIZE);
memcpy(pucBuff + SPI_HEADER_SIZE + HCI_PATCH_HEADER_SIZE, patch, SL_PATCH_PORTION_SIZE);
usDataLength -= SL_PATCH_PORTION_SIZE;
patch += SL_PATCH_PORTION_SIZE;
// Update the opcode of the event we will be waiting for
SpiWrite(pucBuff, SL_PATCH_PORTION_SIZE + HCI_PATCH_HEADER_SIZE);
while (usDataLength)
{
cc3k_int_poll();
if (usDataLength <= SL_PATCH_PORTION_SIZE)
{
usTransLength = usDataLength;
usDataLength = 0;
}
else
{
usTransLength = SL_PATCH_PORTION_SIZE;
usDataLength -= usTransLength;
}
*(unsigned short *)data_ptr = usTransLength;
memcpy(data_ptr + SIMPLE_LINK_HCI_PATCH_HEADER_SIZE, patch, usTransLength);
patch += usTransLength;
// Update the opcode of the event we will be waiting for
SpiWrite((unsigned char *)data_ptr, usTransLength + sizeof(usTransLength));
}
}
}
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//
//*****************************************************************************

View File

@ -0,0 +1,336 @@
/*****************************************************************************
*
* hci.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __HCI_H__
#define __HCI_H__
#include "cc3000_common.h"
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C" {
#endif
#define SPI_HEADER_SIZE (5)
#define SIMPLE_LINK_HCI_CMND_HEADER_SIZE (4)
#define HEADERS_SIZE_CMD (SPI_HEADER_SIZE + SIMPLE_LINK_HCI_CMND_HEADER_SIZE)
#define SIMPLE_LINK_HCI_DATA_CMND_HEADER_SIZE (5)
#define SIMPLE_LINK_HCI_DATA_HEADER_SIZE (5)
#define SIMPLE_LINK_HCI_PATCH_HEADER_SIZE (2)
//*****************************************************************************
//
// Values that can be used as HCI Commands and HCI Packet header defines
//
//*****************************************************************************
#define HCI_TYPE_CMND 0x1
#define HCI_TYPE_DATA 0x2
#define HCI_TYPE_PATCH 0x3
#define HCI_TYPE_EVNT 0x4
#define HCI_EVENT_PATCHES_DRV_REQ (1)
#define HCI_EVENT_PATCHES_FW_REQ (2)
#define HCI_EVENT_PATCHES_BOOTLOAD_REQ (3)
#define HCI_CMND_WLAN_BASE (0x0000)
#define HCI_CMND_WLAN_CONNECT 0x0001
#define HCI_CMND_WLAN_DISCONNECT 0x0002
#define HCI_CMND_WLAN_IOCTL_SET_SCANPARAM 0x0003
#define HCI_CMND_WLAN_IOCTL_SET_CONNECTION_POLICY 0x0004
#define HCI_CMND_WLAN_IOCTL_ADD_PROFILE 0x0005
#define HCI_CMND_WLAN_IOCTL_DEL_PROFILE 0x0006
#define HCI_CMND_WLAN_IOCTL_GET_SCAN_RESULTS 0x0007
#define HCI_CMND_EVENT_MASK 0x0008
#define HCI_CMND_WLAN_IOCTL_STATUSGET 0x0009
#define HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_START 0x000A
#define HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_STOP 0x000B
#define HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_SET_PREFIX 0x000C
#define HCI_CMND_WLAN_CONFIGURE_PATCH 0x000D
#define HCI_CMND_SOCKET_BASE 0x1000
#define HCI_CMND_SOCKET 0x1001
#define HCI_CMND_BIND 0x1002
#define HCI_CMND_RECV 0x1004
#define HCI_CMND_ACCEPT 0x1005
#define HCI_CMND_LISTEN 0x1006
#define HCI_CMND_CONNECT 0x1007
#define HCI_CMND_BSD_SELECT 0x1008
#define HCI_CMND_SETSOCKOPT 0x1009
#define HCI_CMND_GETSOCKOPT 0x100A
#define HCI_CMND_CLOSE_SOCKET 0x100B
#define HCI_CMND_RECVFROM 0x100D
#define HCI_CMND_GETHOSTNAME 0x1010
#define HCI_CMND_MDNS_ADVERTISE 0x1011
#define HCI_DATA_BASE 0x80
#define HCI_CMND_SEND (0x01 + HCI_DATA_BASE)
#define HCI_CMND_SENDTO (0x03 + HCI_DATA_BASE)
#define HCI_DATA_BSD_RECVFROM (0x04 + HCI_DATA_BASE)
#define HCI_DATA_BSD_RECV (0x05 + HCI_DATA_BASE)
#define HCI_CMND_NVMEM_CBASE (0x0200)
#define HCI_CMND_NVMEM_CREATE_ENTRY (0x0203)
#define HCI_CMND_NVMEM_SWAP_ENTRY (0x0205)
#define HCI_CMND_NVMEM_READ (0x0201)
#define HCI_CMND_NVMEM_WRITE (0x0090)
#define HCI_CMND_NVMEM_WRITE_PATCH (0x0204)
#define HCI_CMND_READ_SP_VERSION (0x0207)
#define HCI_CMND_READ_BUFFER_SIZE 0x400B
#define HCI_CMND_SIMPLE_LINK_START 0x4000
#define HCI_CMND_NETAPP_BASE 0x2000
#define HCI_NETAPP_DHCP (0x0001 + HCI_CMND_NETAPP_BASE)
#define HCI_NETAPP_PING_SEND (0x0002 + HCI_CMND_NETAPP_BASE)
#define HCI_NETAPP_PING_REPORT (0x0003 + HCI_CMND_NETAPP_BASE)
#define HCI_NETAPP_PING_STOP (0x0004 + HCI_CMND_NETAPP_BASE)
#define HCI_NETAPP_IPCONFIG (0x0005 + HCI_CMND_NETAPP_BASE)
#define HCI_NETAPP_ARP_FLUSH (0x0006 + HCI_CMND_NETAPP_BASE)
#define HCI_NETAPP_SET_DEBUG_LEVEL (0x0008 + HCI_CMND_NETAPP_BASE)
#define HCI_NETAPP_SET_TIMERS (0x0009 + HCI_CMND_NETAPP_BASE)
//*****************************************************************************
//
// Values that can be used as HCI Events defines
//
//*****************************************************************************
#define HCI_EVNT_WLAN_BASE 0x0000
#define HCI_EVNT_WLAN_CONNECT 0x0001
#define HCI_EVNT_WLAN_DISCONNECT \
0x0002
#define HCI_EVNT_WLAN_IOCTL_ADD_PROFILE \
0x0005
#define HCI_EVNT_SOCKET HCI_CMND_SOCKET
#define HCI_EVNT_BIND HCI_CMND_BIND
#define HCI_EVNT_RECV HCI_CMND_RECV
#define HCI_EVNT_ACCEPT HCI_CMND_ACCEPT
#define HCI_EVNT_LISTEN HCI_CMND_LISTEN
#define HCI_EVNT_CONNECT HCI_CMND_CONNECT
#define HCI_EVNT_SELECT HCI_CMND_BSD_SELECT
#define HCI_EVNT_CLOSE_SOCKET HCI_CMND_CLOSE_SOCKET
#define HCI_EVNT_RECVFROM HCI_CMND_RECVFROM
#define HCI_EVNT_SETSOCKOPT HCI_CMND_SETSOCKOPT
#define HCI_EVNT_GETSOCKOPT HCI_CMND_GETSOCKOPT
#define HCI_EVNT_BSD_GETHOSTBYNAME HCI_CMND_GETHOSTNAME
#define HCI_EVNT_MDNS_ADVERTISE HCI_CMND_MDNS_ADVERTISE
#define HCI_EVNT_SEND 0x1003
#define HCI_EVNT_WRITE 0x100E
#define HCI_EVNT_SENDTO 0x100F
#define HCI_EVNT_PATCHES_REQ 0x1000
#define HCI_EVNT_UNSOL_BASE 0x4000
#define HCI_EVNT_WLAN_UNSOL_BASE (0x8000)
#define HCI_EVNT_WLAN_UNSOL_CONNECT (0x0001 + HCI_EVNT_WLAN_UNSOL_BASE)
#define HCI_EVNT_WLAN_UNSOL_DISCONNECT (0x0002 + HCI_EVNT_WLAN_UNSOL_BASE)
#define HCI_EVNT_WLAN_UNSOL_INIT (0x0004 + HCI_EVNT_WLAN_UNSOL_BASE)
#define HCI_EVNT_WLAN_TX_COMPLETE (0x0008 + HCI_EVNT_WLAN_UNSOL_BASE)
#define HCI_EVNT_WLAN_UNSOL_DHCP (0x0010 + HCI_EVNT_WLAN_UNSOL_BASE)
#define HCI_EVNT_WLAN_ASYNC_PING_REPORT (0x0040 + HCI_EVNT_WLAN_UNSOL_BASE)
#define HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE (0x0080 + HCI_EVNT_WLAN_UNSOL_BASE)
#define HCI_EVNT_WLAN_KEEPALIVE (0x0200 + HCI_EVNT_WLAN_UNSOL_BASE)
#define HCI_EVNT_BSD_TCP_CLOSE_WAIT (0x0800 + HCI_EVNT_WLAN_UNSOL_BASE)
#define HCI_EVNT_DATA_UNSOL_FREE_BUFF \
0x4100
#define HCI_EVNT_NVMEM_CREATE_ENTRY \
HCI_CMND_NVMEM_CREATE_ENTRY
#define HCI_EVNT_NVMEM_SWAP_ENTRY HCI_CMND_NVMEM_SWAP_ENTRY
#define HCI_EVNT_NVMEM_READ HCI_CMND_NVMEM_READ
#define HCI_EVNT_NVMEM_WRITE (0x0202)
#define HCI_EVNT_READ_SP_VERSION \
HCI_CMND_READ_SP_VERSION
#define HCI_EVNT_INPROGRESS 0xFFFF
#define HCI_DATA_RECVFROM 0x84
#define HCI_DATA_RECV 0x85
#define HCI_DATA_NVMEM 0x91
#define HCI_EVENT_CC3000_CAN_SHUT_DOWN 0x99
//*****************************************************************************
//
// Prototypes for the structures for APIs.
//
//*****************************************************************************
#define HCI_DATA_HEADER_SIZE (5)
#define HCI_EVENT_HEADER_SIZE (5)
#define HCI_DATA_CMD_HEADER_SIZE (5)
#define HCI_PATCH_HEADER_SIZE (6)
#define HCI_PACKET_TYPE_OFFSET (0)
#define HCI_PACKET_ARGSIZE_OFFSET (2)
#define HCI_PACKET_LENGTH_OFFSET (3)
#define HCI_EVENT_OPCODE_OFFSET (1)
#define HCI_EVENT_LENGTH_OFFSET (3)
#define HCI_EVENT_STATUS_OFFSET (4)
#define HCI_DATA_LENGTH_OFFSET (3)
//*****************************************************************************
//
// Prototypes for the APIs.
//
//*****************************************************************************
//*****************************************************************************
//
//! hci_command_send
//!
//! @param usOpcode command operation code
//! @param pucBuff pointer to the command's arguments buffer
//! @param ucArgsLength length of the arguments
//!
//! @return none
//!
//! @brief Initiate an HCI command.
//
//*****************************************************************************
extern unsigned short hci_command_send(unsigned short usOpcode,
unsigned char *ucArgs,
unsigned char ucArgsLength);
//*****************************************************************************
//
//! hci_data_send
//!
//! @param usOpcode command operation code
//! @param ucArgs pointer to the command's arguments buffer
//! @param usArgsLength length of the arguments
//! @param ucTail pointer to the data buffer
//! @param usTailLength buffer length
//!
//! @return none
//!
//! @brief Initiate an HCI data write operation
//
//*****************************************************************************
extern long hci_data_send(unsigned char ucOpcode,
unsigned char *ucArgs,
unsigned short usArgsLength,
unsigned short usDataLength,
const unsigned char *ucTail,
unsigned short usTailLength);
//*****************************************************************************
//
//! hci_data_command_send
//!
//! @param usOpcode command operation code
//! @param pucBuff pointer to the data buffer
//! @param ucArgsLength arguments length
//! @param ucDataLength data length
//!
//! @return none
//!
//! @brief Prepare HCI header and initiate an HCI data write operation
//
//*****************************************************************************
extern void hci_data_command_send(unsigned short usOpcode, unsigned char *pucBuff,
unsigned char ucArgsLength, unsigned short ucDataLength);
//*****************************************************************************
//
//! hci_patch_send
//!
//! @param usOpcode command operation code
//! @param pucBuff pointer to the command's arguments buffer
//! @param patch pointer to patch content buffer
//! @param usDataLength data length
//!
//! @return none
//!
//! @brief Prepare HCI header and initiate an HCI patch write operation
//
//*****************************************************************************
extern void hci_patch_send(unsigned char ucOpcode, unsigned char *pucBuff, char *patch, unsigned short usDataLength);
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __HCI_H__

View File

@ -0,0 +1,55 @@
/*****************************************************************************
*
* host_driver_version.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __HOST_DRIVER_VERSION_H__
#define __HOST_DRIVER_VERSION_H__
#define DRIVER_VERSION_NUMBER 13
#endif // __VERSION_H__

View File

@ -0,0 +1,476 @@
/*****************************************************************************
*
* netapp.c - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#include <string.h>
#include "netapp.h"
#include "hci.h"
#include "socket.h"
#include "evnt_handler.h"
#include "nvmem.h"
#define MIN_TIMER_VAL_SECONDS 20
#define MIN_TIMER_SET(t) if ((0 != t) && (t < MIN_TIMER_VAL_SECONDS)) \
{ \
t = MIN_TIMER_VAL_SECONDS; \
}
#define NETAPP_DHCP_PARAMS_LEN (20)
#define NETAPP_SET_TIMER_PARAMS_LEN (20)
#define NETAPP_SET_DEBUG_LEVEL_PARAMS_LEN (4)
#define NETAPP_PING_SEND_PARAMS_LEN (16)
//*****************************************************************************
//
//! netapp_config_mac_adrress
//!
//! @param mac device mac address, 6 bytes. Saved: yes
//!
//! @return return on success 0, otherwise error.
//!
//! @brief Configure device MAC address and store it in NVMEM.
//! The value of the MAC address configured through the API will
//! be stored in CC3000 non volatile memory, thus preserved
//! over resets.
//
//*****************************************************************************
long netapp_config_mac_adrress(unsigned char * mac)
{
return nvmem_set_mac_address(mac);
}
//*****************************************************************************
//
//! netapp_dhcp
//!
//! @param aucIP device mac address, 6 bytes. Saved: yes
//! @param aucSubnetMask device mac address, 6 bytes. Saved: yes
//! @param aucDefaultGateway device mac address, 6 bytes. Saved: yes
//! @param aucDNSServer device mac address, 6 bytes. Saved: yes
//!
//! @return return on success 0, otherwise error.
//!
//! @brief netapp_dhcp is used to configure the network interface,
//! static or dynamic (DHCP).\n In order to activate DHCP mode,
//! aucIP, aucSubnetMask, aucDefaultGateway must be 0.
//! The default mode of CC3000 is DHCP mode.
//! Note that the configuration is saved in non volatile memory
//! and thus preserved over resets.
//!
//! @note If the mode is altered a reset of CC3000 device is required
//! in order to apply changes.\nAlso note that asynchronous event
//! of DHCP_EVENT, which is generated when an IP address is
//! allocated either by the DHCP server or due to static
//! allocation is generated only upon a connection to the
//! AP was established.
//!
//*****************************************************************************
long netapp_dhcp(unsigned long *aucIP, unsigned long *aucSubnetMask,unsigned long *aucDefaultGateway, unsigned long *aucDNSServer)
{
signed char scRet;
unsigned char *ptr;
unsigned char *args;
scRet = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
// Fill in temporary command buffer
ARRAY_TO_STREAM(args,aucIP,4);
ARRAY_TO_STREAM(args,aucSubnetMask,4);
ARRAY_TO_STREAM(args,aucDefaultGateway,4);
args = UINT32_TO_STREAM(args, 0);
ARRAY_TO_STREAM(args,aucDNSServer,4);
// Initiate a HCI command
hci_command_send(HCI_NETAPP_DHCP, ptr, NETAPP_DHCP_PARAMS_LEN);
// Wait for command complete event
SimpleLinkWaitEvent(HCI_NETAPP_DHCP, &scRet);
return(scRet);
}
//*****************************************************************************
//
//! netapp_timeout_values
//!
//! @param aucDHCP DHCP lease time request, also impact
//! the DHCP renew timeout. Range: [0-0xffffffff] seconds,
//! 0 or 0xffffffff == infinity lease timeout.
//! Resolution:10 seconds. Influence: only after
//! reconnecting to the AP.
//! Minimal bound value: MIN_TIMER_VAL_SECONDS - 20 seconds.
//! The parameter is saved into the CC3000 NVMEM.
//! The default value on CC3000 is 14400 seconds.
//!
//! @param aucARP ARP refresh timeout, if ARP entry is not updated by
//! incoming packet, the ARP entry will be deleted by
//! the end of the timeout.
//! Range: [0-0xffffffff] seconds, 0 == infinity ARP timeout
//! Resolution: 10 seconds. Influence: on runtime.
//! Minimal bound value: MIN_TIMER_VAL_SECONDS - 20 seconds
//! The parameter is saved into the CC3000 NVMEM.
//! The default value on CC3000 is 3600 seconds.
//!
//! @param aucKeepalive Keepalive event sent by the end of keepalive timeout
//! Range: [0-0xffffffff] seconds, 0 == infinity timeout
//! Resolution: 10 seconds.
//! Influence: on runtime.
//! Minimal bound value: MIN_TIMER_VAL_SECONDS - 20 sec
//! The parameter is saved into the CC3000 NVMEM.
//! The default value on CC3000 is 10 seconds.
//!
//! @param aucInactivity Socket inactivity timeout, socket timeout is
//! refreshed by incoming or outgoing packet, by the
//! end of the socket timeout the socket will be closed
//! Range: [0-0xffffffff] sec, 0 == infinity timeout.
//! Resolution: 10 seconds. Influence: on runtime.
//! Minimal bound value: MIN_TIMER_VAL_SECONDS - 20 sec
//! The parameter is saved into the CC3000 NVMEM.
//! The default value on CC3000 is 60 seconds.
//!
//! @return return on success 0, otherwise error.
//!
//! @brief Set new timeout values. Function set new timeout values for:
//! DHCP lease timeout, ARP refresh timeout, keepalive event
//! timeout and socket inactivity timeout
//!
//! @note If a parameter set to non zero value which is less than 20s,
//! it will be set automatically to 20s.
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
long
netapp_timeout_values(unsigned long *aucDHCP, unsigned long *aucARP,unsigned long *aucKeepalive, unsigned long *aucInactivity)
{
signed char scRet;
unsigned char *ptr;
unsigned char *args;
scRet = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
// Set minimal values of timers
MIN_TIMER_SET(*aucDHCP)
MIN_TIMER_SET(*aucARP)
MIN_TIMER_SET(*aucKeepalive)
MIN_TIMER_SET(*aucInactivity)
// Fill in temporary command buffer
args = UINT32_TO_STREAM(args, *aucDHCP);
args = UINT32_TO_STREAM(args, *aucARP);
args = UINT32_TO_STREAM(args, *aucKeepalive);
args = UINT32_TO_STREAM(args, *aucInactivity);
// Initiate a HCI command
hci_command_send(HCI_NETAPP_SET_TIMERS, ptr, NETAPP_SET_TIMER_PARAMS_LEN);
// Wait for command complete event
SimpleLinkWaitEvent(HCI_NETAPP_SET_TIMERS, &scRet);
return(scRet);
}
#endif
//*****************************************************************************
//
//! netapp_ping_send
//!
//! @param ip destination IP address
//! @param pingAttempts number of echo requests to send
//! @param pingSize send buffer size which may be up to 1400 bytes
//! @param pingTimeout Time to wait for a response,in milliseconds.
//!
//! @return return on success 0, otherwise error.
//!
//! @brief send ICMP ECHO_REQUEST to network hosts
//!
//! @note If an operation finished successfully asynchronous ping report
//! event will be generated. The report structure is as defined
//! by structure netapp_pingreport_args_t.
//!
//! @warning Calling this function while a previous Ping Requests are in
//! progress will stop the previous ping request.
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
long
netapp_ping_send(uint32_t *ip, uint32_t ulPingAttempts, uint32_t ulPingSize, uint32_t ulPingTimeout)
{
signed char scRet;
unsigned char *ptr, *args;
scRet = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
// Fill in temporary command buffer
args = UINT32_TO_STREAM(args, *ip);
args = UINT32_TO_STREAM(args, ulPingAttempts);
args = UINT32_TO_STREAM(args, ulPingSize);
args = UINT32_TO_STREAM(args, ulPingTimeout);
/*
if (CC3KPrinter != 0)
{
for(uint8_t i=0; i<4+4+4+4; i++) {
CC3KPrinter->print(" 0x"); CC3KPrinter->( (ptr + HEADERS_SIZE_CMD)[i], HEX);
}
}
*/
// Initiate a HCI command
hci_command_send(HCI_NETAPP_PING_SEND, ptr, NETAPP_PING_SEND_PARAMS_LEN);
// Wait for command complete event
SimpleLinkWaitEvent(HCI_NETAPP_PING_SEND, &scRet);
return(scRet);
}
#endif
//*****************************************************************************
//
//! netapp_ping_report
//!
//! @param none
//!
//! @return none
//!
//! @brief Request for ping status. This API triggers the CC3000 to send
//! asynchronous events: HCI_EVNT_WLAN_ASYNC_PING_REPORT.
//! This event will carry the report structure:
//! netapp_pingreport_args_t. This structure is filled in with ping
//! results up till point of triggering API.
//! netapp_pingreport_args_t:\n packets_sent - echo sent,
//! packets_received - echo reply, min_round_time - minimum
//! round time, max_round_time - max round time,
//! avg_round_time - average round time
//!
//! @note When a ping operation is not active, the returned structure
//! fields are 0.
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
void netapp_ping_report()
{
unsigned char *ptr;
ptr = tSLInformation.pucTxCommandBuffer;
signed char scRet;
scRet = EFAIL;
// Initiate a HCI command
hci_command_send(HCI_NETAPP_PING_REPORT, ptr, 0);
// Wait for command complete event
SimpleLinkWaitEvent(HCI_NETAPP_PING_REPORT, &scRet);
}
#endif
//*****************************************************************************
//
//! netapp_ping_stop
//!
//! @param none
//!
//! @return On success, zero is returned. On error, -1 is returned.
//!
//! @brief Stop any ping request.
//!
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
long netapp_ping_stop()
{
signed char scRet;
unsigned char *ptr;
scRet = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer;
// Initiate a HCI command
hci_command_send(HCI_NETAPP_PING_STOP, ptr, 0);
// Wait for command complete event
SimpleLinkWaitEvent(HCI_NETAPP_PING_STOP, &scRet);
return(scRet);
}
#endif
//*****************************************************************************
//
//! netapp_ipconfig
//!
//! @param[out] ipconfig This argument is a pointer to a
//! tNetappIpconfigRetArgs structure. This structure is
//! filled in with the network interface configuration.
//! tNetappIpconfigRetArgs:\n aucIP - ip address,
//! aucSubnetMask - mask, aucDefaultGateway - default
//! gateway address, aucDHCPServer - dhcp server address
//! aucDNSServer - dns server address, uaMacAddr - mac
//! address, uaSSID - connected AP ssid
//!
//! @return none
//!
//! @brief Obtain the CC3000 Network interface information.
//! Note that the information is available only after the WLAN
//! connection was established. Calling this function before
//! associated, will cause non-defined values to be returned.
//!
//! @note The function is useful for figuring out the IP Configuration of
//! the device when DHCP is used and for figuring out the SSID of
//! the Wireless network the device is associated with.
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
void netapp_ipconfig( tNetappIpconfigRetArgs * ipconfig )
{
unsigned char *ptr;
ptr = tSLInformation.pucTxCommandBuffer;
// Initiate a HCI command
hci_command_send(HCI_NETAPP_IPCONFIG, ptr, 0);
// Wait for command complete event
SimpleLinkWaitEvent(HCI_NETAPP_IPCONFIG, ipconfig );
}
#else
void netapp_ipconfig( tNetappIpconfigRetArgs * ipconfig )
{
}
#endif
//*****************************************************************************
//
//! netapp_arp_flush
//!
//! @param none
//!
//! @return none
//!
//! @brief Flushes ARP table
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
long netapp_arp_flush(void)
{
signed char scRet;
unsigned char *ptr;
scRet = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer;
// Initiate a HCI command
hci_command_send(HCI_NETAPP_ARP_FLUSH, ptr, 0);
// Wait for command complete event
SimpleLinkWaitEvent(HCI_NETAPP_ARP_FLUSH, &scRet);
return(scRet);
}
#endif
//*****************************************************************************
//
//! netapp_set_debug_level
//!
//! @param[in] level debug level. Bitwise [0-8],
//! 0(disable)or 1(enable).\n Bitwise map: 0 - Critical
//! message, 1 information message, 2 - core messages, 3 -
//! HCI messages, 4 - Network stack messages, 5 - wlan
//! messages, 6 - wlan driver messages, 7 - epprom messages,
//! 8 - general messages. Default: 0x13f. Saved: no
//!
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief Debug messages sent via the UART debug channel, this function
//! enable/disable the debug level
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
long netapp_set_debug_level(unsigned long ulLevel)
{
signed char scRet;
unsigned char *ptr, *args;
scRet = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
//
// Fill in temporary command buffer
//
args = UINT32_TO_STREAM(args, ulLevel);
//
// Initiate a HCI command
//
hci_command_send(HCI_NETAPP_SET_DEBUG_LEVEL, ptr, NETAPP_SET_DEBUG_LEVEL_PARAMS_LEN);
//
// Wait for command complete event
//
SimpleLinkWaitEvent(HCI_NETAPP_SET_DEBUG_LEVEL, &scRet);
return(scRet);
}
#endif

View File

@ -0,0 +1,353 @@
/*****************************************************************************
*
* netapp.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __NETAPP_H__
#define __NETAPP_H__
#include <Arduino.h>
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C" {
#endif
//*****************************************************************************
//
//! \addtogroup netapp_api
//! @{
//
//*****************************************************************************
typedef struct _netapp_dhcp_ret_args_t
{
unsigned char aucIP[4];
unsigned char aucSubnetMask[4];
unsigned char aucDefaultGateway[4];
unsigned char aucDHCPServer[4];
unsigned char aucDNSServer[4];
}tNetappDhcpParams;
typedef struct _netapp_ipconfig_ret_args_t
{
unsigned char aucIP[4];
unsigned char aucSubnetMask[4];
unsigned char aucDefaultGateway[4];
unsigned char aucDHCPServer[4];
unsigned char aucDNSServer[4];
unsigned char uaMacAddr[6];
unsigned char uaSSID[32];
}tNetappIpconfigRetArgs;
/*Ping send report parameters*/
typedef struct _netapp_pingreport_args
{
unsigned long packets_sent;
unsigned long packets_received;
unsigned long min_round_time;
unsigned long max_round_time;
unsigned long avg_round_time;
} netapp_pingreport_args_t;
//*****************************************************************************
//
//! netapp_config_mac_adrress
//!
//! @param mac device mac address, 6 bytes. Saved: yes
//!
//! @return return on success 0, otherwise error.
//!
//! @brief Configure device MAC address and store it in NVMEM.
//! The value of the MAC address configured through the API will
//! be stored in CC3000 non volatile memory, thus preserved
//! over resets.
//
//*****************************************************************************
extern long netapp_config_mac_adrress( unsigned char *mac );
//*****************************************************************************
//
//! netapp_dhcp
//!
//! @param aucIP device mac address, 6 bytes. Saved: yes
//! @param aucSubnetMask device mac address, 6 bytes. Saved: yes
//! @param aucDefaultGateway device mac address, 6 bytes. Saved: yes
//! @param aucDNSServer device mac address, 6 bytes. Saved: yes
//!
//! @return return on success 0, otherwise error.
//!
//! @brief netapp_dhcp is used to configure the network interface,
//! static or dynamic (DHCP).\n In order to activate DHCP mode,
//! aucIP, aucSubnetMask, aucDefaultGateway must be 0.
//! The default mode of CC3000 is DHCP mode.
//! Note that the configuration is saved in non volatile memory
//! and thus preserved over resets.
//!
//! @note If the mode is altered a reset of CC3000 device is required
//! in order to apply changes.\nAlso note that asynchronous event
//! of DHCP_EVENT, which is generated when an IP address is
//! allocated either by the DHCP server or due to static
//! allocation is generated only upon a connection to the
//! AP was established.
//!
//*****************************************************************************
extern long netapp_dhcp(unsigned long *aucIP, unsigned long *aucSubnetMask,unsigned long *aucDefaultGateway, unsigned long *aucDNSServer);
//*****************************************************************************
//
//! netapp_timeout_values
//!
//! @param aucDHCP DHCP lease time request, also impact
//! the DHCP renew timeout. Range: [0-0xffffffff] seconds,
//! 0 or 0xffffffff == infinity lease timeout.
//! Resolution:10 seconds. Influence: only after
//! reconnecting to the AP.
//! Minimal bound value: MIN_TIMER_VAL_SECONDS - 20 seconds.
//! The parameter is saved into the CC3000 NVMEM.
//! The default value on CC3000 is 14400 seconds.
//!
//! @param aucARP ARP refresh timeout, if ARP entry is not updated by
//! incoming packet, the ARP entry will be deleted by
//! the end of the timeout.
//! Range: [0-0xffffffff] seconds, 0 == infinity ARP timeout
//! Resolution: 10 seconds. Influence: on runtime.
//! Minimal bound value: MIN_TIMER_VAL_SECONDS - 20 seconds
//! The parameter is saved into the CC3000 NVMEM.
//! The default value on CC3000 is 3600 seconds.
//!
//! @param aucKeepalive Keepalive event sent by the end of keepalive timeout
//! Range: [0-0xffffffff] seconds, 0 == infinity timeout
//! Resolution: 10 seconds.
//! Influence: on runtime.
//! Minimal bound value: MIN_TIMER_VAL_SECONDS - 20 sec
//! The parameter is saved into the CC3000 NVMEM.
//! The default value on CC3000 is 10 seconds.
//!
//! @param aucInactivity Socket inactivity timeout, socket timeout is
//! refreshed by incoming or outgoing packet, by the
//! end of the socket timeout the socket will be closed
//! Range: [0-0xffffffff] sec, 0 == infinity timeout.
//! Resolution: 10 seconds. Influence: on runtime.
//! Minimal bound value: MIN_TIMER_VAL_SECONDS - 20 sec
//! The parameter is saved into the CC3000 NVMEM.
//! The default value on CC3000 is 60 seconds.
//!
//! @return return on success 0, otherwise error.
//!
//! @brief Set new timeout values. Function set new timeout values for:
//! DHCP lease timeout, ARP refresh timeout, keepalive event
//! timeout and socket inactivity timeout
//!
//! @note If a parameter set to non zero value which is less than 20s,
//! it will be set automatically to 20s.
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
extern long netapp_timeout_values(unsigned long *aucDHCP, unsigned long *aucARP,unsigned long *aucKeepalive, unsigned long *aucInactivity);
#endif
//*****************************************************************************
//
//! netapp_ping_send
//!
//! @param ip destination IP address
//! @param pingAttempts number of echo requests to send
//! @param pingSize send buffer size which may be up to 1400 bytes
//! @param pingTimeout Time to wait for a response,in milliseconds.
//!
//! @return return on success 0, otherwise error.
//!
//! @brief send ICMP ECHO_REQUEST to network hosts
//!
//! @note If an operation finished successfully asynchronous ping report
//! event will be generated. The report structure is as defined
//! by structure netapp_pingreport_args_t.
//!
//! @warning Calling this function while a previous Ping Requests are in
//! progress will stop the previous ping request.
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
extern long netapp_ping_send(uint32_t *ip, uint32_t ulPingAttempts, uint32_t ulPingSize, uint32_t ulPingTimeout);
#endif
//*****************************************************************************
//
//! netapp_ping_stop
//!
//! @param none
//!
//! @return On success, zero is returned. On error, -1 is returned.
//!
//! @brief Stop any ping request.
//!
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
extern long netapp_ping_stop();
#endif
//*****************************************************************************
//
//! netapp_ping_report
//!
//! @param none
//!
//! @return none
//!
//! @brief Request for ping status. This API triggers the CC3000 to send
//! asynchronous events: HCI_EVNT_WLAN_ASYNC_PING_REPORT.
//! This event will carry the report structure:
//! netapp_pingreport_args_t. This structure is filled in with ping
//! results up till point of triggering API.
//! netapp_pingreport_args_t:\n packets_sent - echo sent,
//! packets_received - echo reply, min_round_time - minimum
//! round time, max_round_time - max round time,
//! avg_round_time - average round time
//!
//! @note When a ping operation is not active, the returned structure
//! fields are 0.
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
extern void netapp_ping_report();
#endif
//*****************************************************************************
//
//! netapp_ipconfig
//!
//! @param[out] ipconfig This argument is a pointer to a
//! tNetappIpconfigRetArgs structure. This structure is
//! filled in with the network interface configuration.
//! tNetappIpconfigRetArgs:\n aucIP - ip address,
//! aucSubnetMask - mask, aucDefaultGateway - default
//! gateway address, aucDHCPServer - dhcp server address
//! aucDNSServer - dns server address, uaMacAddr - mac
//! address, uaSSID - connected AP ssid
//!
//! @return none
//!
//! @brief Obtain the CC3000 Network interface information.
//! Note that the information is available only after the WLAN
//! connection was established. Calling this function before
//! associated, will cause non-defined values to be returned.
//!
//! @note The function is useful for figuring out the IP Configuration of
//! the device when DHCP is used and for figuring out the SSID of
//! the Wireless network the device is associated with.
//!
//*****************************************************************************
extern void netapp_ipconfig( tNetappIpconfigRetArgs * ipconfig );
//*****************************************************************************
//
//! netapp_arp_flush
//!
//! @param none
//!
//! @return none
//!
//! @brief Flushes ARP table
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
extern long netapp_arp_flush();
#endif
//*****************************************************************************
//
//! netapp_set_debug_level
//!
//! @param[in] level debug level. Bitwise [0-8],
//! 0(disable)or 1(enable).\n Bitwise map: 0 - Critical
//! message, 1 information message, 2 - core messages, 3 -
//! HCI messages, 4 - Network stack messages, 5 - wlan
//! messages, 6 - wlan driver messages, 7 - epprom messages,
//! 8 - general messages. Default: 0x13f. Saved: no
//!
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief Debug messages sent via the UART debug channel, this function
//! enable/disable the debug level
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
long netapp_set_debug_level(unsigned long ulLevel);
#endif
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif // __cplusplus
extern Print* CC3KPrinter;
#endif // __NETAPP_H__

View File

@ -0,0 +1,376 @@
/*****************************************************************************
*
* nvmem.c - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
//*****************************************************************************
//
//! \addtogroup nvmem_api
//! @{
//
//*****************************************************************************
#include <stdio.h>
#include <string.h>
#include <avr/pgmspace.h>
#ifdef __AVR__
#include <avr/io.h>
#endif
#include "nvmem.h"
#include "hci.h"
#include "socket.h"
#include "evnt_handler.h"
#include "debug.h"
//*****************************************************************************
//
// Prototypes for the structures for APIs.
//
//*****************************************************************************
#define NVMEM_READ_PARAMS_LEN (12)
#define NVMEM_CREATE_PARAMS_LEN (8)
#define NVMEM_WRITE_PARAMS_LEN (16)
//*****************************************************************************
//
//! nvmem_read
//!
//! @param ulFileId nvmem file id:\n
//! NVMEM_NVS_FILEID, NVMEM_NVS_SHADOW_FILEID,
//! NVMEM_WLAN_CONFIG_FILEID, NVMEM_WLAN_CONFIG_SHADOW_FILEID,
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
//! NVMEM_MAC_FILEID, NVMEM_FRONTEND_VARS_FILEID,
//! NVMEM_IP_CONFIG_FILEID, NVMEM_IP_CONFIG_SHADOW_FILEID,
//! NVMEM_BOOTLOADER_SP_FILEID, NVMEM_RM_FILEID,
//! and user files 12-15.
//! @param ulLength number of bytes to read
//! @param ulOffset ulOffset in file from where to read
//! @param buff output buffer pointer
//!
//! @return number of bytes read, otherwise error.
//!
//! @brief Reads data from the file referred by the ulFileId parameter.
//! Reads data from file ulOffset till length. Err if the file can't
//! be used, is invalid, or if the read is out of bounds.
//!
//*****************************************************************************
signed long
nvmem_read(unsigned long ulFileId, unsigned long ulLength, unsigned long ulOffset, unsigned char *buff)
{
unsigned char ucStatus = 0xFF;
unsigned char *ptr;
unsigned char *args;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
// Fill in HCI packet structure
args = UINT32_TO_STREAM(args, ulFileId);
args = UINT32_TO_STREAM(args, ulLength);
args = UINT32_TO_STREAM(args, ulOffset);
// Initiate a HCI command
hci_command_send(HCI_CMND_NVMEM_READ, ptr, NVMEM_READ_PARAMS_LEN);
SimpleLinkWaitEvent(HCI_CMND_NVMEM_READ, &ucStatus);
// In case there is data - read it - even if an error code is returned
// Note: It is the user responsibility to ignore the data in case of an error code
// Wait for the data in a synchronous way. Here we assume that the buffer is
// big enough to store also parameters of nvmem
SimpleLinkWaitData(buff, 0, 0);
return(ucStatus);
}
//*****************************************************************************
//
//! nvmem_write
//!
//! @param ulFileId nvmem file id:\n
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
//! NVMEM_MAC_FILEID, NVMEM_BOOTLOADER_SP_FILEID,
//! and user files 12-15.
//! @param ulLength number of bytes to write
//! @param ulEntryOffset offset in file to start write operation from
//! @param buff data to write
//!
//! @return on success 0, error otherwise.
//!
//! @brief Write data to nvmem.
//! writes data to file referred by the ulFileId parameter.
//! Writes data to file ulOffset till ulLength.The file id will be
//! marked invalid till the write is done. The file entry doesn't
//! need to be valid - only allocated.
//!
//*****************************************************************************
signed long
nvmem_write(unsigned long ulFileId, unsigned long ulLength, unsigned long
ulEntryOffset, unsigned char *buff)
{
long iRes;
unsigned char *ptr;
unsigned char *args;
iRes = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + SPI_HEADER_SIZE + HCI_DATA_CMD_HEADER_SIZE);
// Fill in HCI packet structure
args = UINT32_TO_STREAM(args, ulFileId);
args = UINT32_TO_STREAM(args, 12);
args = UINT32_TO_STREAM(args, ulLength);
args = UINT32_TO_STREAM(args, ulEntryOffset);
memcpy((ptr + SPI_HEADER_SIZE + HCI_DATA_CMD_HEADER_SIZE +
NVMEM_WRITE_PARAMS_LEN),buff,ulLength);
#if (DEBUG_MODE == 1)
PRINT_F("Writing:\t");
for (uint8_t i=0; i<ulLength; i++) {
PRINT_F("0x");
printHex(buff[i]);
PRINT_F(", ");
}
PRINT_F("\n\r");
#endif
// Initiate a HCI command but it will come on data channel
hci_data_command_send(HCI_CMND_NVMEM_WRITE, ptr, NVMEM_WRITE_PARAMS_LEN,
ulLength);
SimpleLinkWaitEvent(HCI_EVNT_NVMEM_WRITE, &iRes);
return(iRes);
}
//*****************************************************************************
//
//! nvmem_set_mac_address
//!
//! @param mac mac address to be set
//!
//! @return on success 0, error otherwise.
//!
//! @brief Write MAC address to EEPROM.
//! mac address as appears over the air (OUI first)
//!
//*****************************************************************************
unsigned char nvmem_set_mac_address(unsigned char *mac)
{
return nvmem_write(NVMEM_MAC_FILEID, MAC_ADDR_LEN, 0, mac);
}
//*****************************************************************************
//
//! nvmem_get_mac_address
//!
//! @param[out] mac mac address
//!
//! @return on success 0, error otherwise.
//!
//! @brief Read MAC address from EEPROM.
//! mac address as appears over the air (OUI first)
//!
//*****************************************************************************
unsigned char nvmem_get_mac_address(unsigned char *mac)
{
return nvmem_read(NVMEM_MAC_FILEID, MAC_ADDR_LEN, 0, mac);
}
//*****************************************************************************
//
//! nvmem_write_patch
//!
//! @param ulFileId nvmem file id:\n
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
//! @param spLength number of bytes to write
//! @param spData SP data to write
//!
//! @return on success 0, error otherwise.
//!
//! @brief program a patch to a specific file ID.
//! The SP data is assumed to be organized in 2-dimensional.
//! Each line is SP_PORTION_SIZE bytes long. Actual programming is
//! applied in SP_PORTION_SIZE bytes portions.
//!
//*****************************************************************************
unsigned char nvmem_write_patch(unsigned long ulFileId, unsigned long spLength, const uint8_t *spData)
{
unsigned char status = 0;
unsigned short offset = 0;
unsigned char* spDataPtr = (unsigned char*)spData;
uint8_t rambuffer[SP_PORTION_SIZE];
while ((status == 0) && (spLength >= SP_PORTION_SIZE))
{
for (uint8_t i=0; i<SP_PORTION_SIZE; i++) {
rambuffer[i] = pgm_read_byte(spData + i + offset);
}
#if (DEBUG_MODE == 1)
PRINT_F("Writing: "); printDec16(offset); PRINT_F("\t");
for (uint8_t i=0; i<SP_PORTION_SIZE; i++) {
PRINT_F("0x");
printHex(rambuffer[i]);
PRINT_F(", ");
}
PRINT_F("\n\r");
#endif
status = nvmem_write(ulFileId, SP_PORTION_SIZE, offset, rambuffer);
offset += SP_PORTION_SIZE;
spLength -= SP_PORTION_SIZE;
spDataPtr += SP_PORTION_SIZE;
}
if (status !=0)
{
// NVMEM error occurred
return status;
}
if (spLength != 0)
{
memcpy_P(rambuffer, spDataPtr, SP_PORTION_SIZE);
// if reached here, a reminder is left
status = nvmem_write(ulFileId, spLength, offset, rambuffer);
}
return status;
}
//*****************************************************************************
//
//! nvmem_read_sp_version
//!
//! @param[out] patchVer first number indicates package ID and the second
//! number indicates package build number
//!
//! @return on success 0, error otherwise.
//!
//! @brief Read patch version. read package version (WiFi FW patch,
//! driver-supplicant-NS patch, bootloader patch)
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
uint8_t nvmem_read_sp_version(uint8_t* patchVer)
{
uint8_t *ptr;
// 1st byte is the status and the rest is the SP version
uint8_t retBuf[5];
ptr = tSLInformation.pucTxCommandBuffer;
// Initiate a HCI command, no args are required
hci_command_send(HCI_CMND_READ_SP_VERSION, ptr, 0);
SimpleLinkWaitEvent(HCI_CMND_READ_SP_VERSION, retBuf);
// package ID
*patchVer = retBuf[3];
// package build number
*(patchVer+1) = retBuf[4];
return(retBuf[0]);
}
#endif
//*****************************************************************************
//
//! nvmem_create_entry
//!
//! @param ulFileId nvmem file Id:\n
//! * NVMEM_AES128_KEY_FILEID: 12
//! * NVMEM_SHARED_MEM_FILEID: 13
//! * and fileIDs 14 and 15
//! @param ulNewLen entry ulLength
//!
//! @return on success 0, error otherwise.
//!
//! @brief Create new file entry and allocate space on the NVMEM.
//! Applies only to user files.
//! Modify the size of file.
//! If the entry is unallocated - allocate it to size
//! ulNewLen (marked invalid).
//! If it is allocated then deallocate it first.
//! To just mark the file as invalid without resizing -
//! set ulNewLen=0.
//!
//*****************************************************************************
int8_t
nvmem_create_entry(unsigned long ulFileId, unsigned long ulNewLen)
{
unsigned char *ptr;
unsigned char *args;
int8_t retval;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
// Fill in HCI packet structure
args = UINT32_TO_STREAM(args, ulFileId);
args = UINT32_TO_STREAM(args, ulNewLen);
// Initiate a HCI command
hci_command_send(HCI_CMND_NVMEM_CREATE_ENTRY,ptr, NVMEM_CREATE_PARAMS_LEN);
SimpleLinkWaitEvent(HCI_CMND_NVMEM_CREATE_ENTRY, &retval);
return(retval);
}
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

View File

@ -0,0 +1,256 @@
/*****************************************************************************
*
* nvmem.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __NVRAM_H__
#define __NVRAM_H__
#include "cc3000_common.h"
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C" {
#endif
//*****************************************************************************
//
//! \addtogroup nvmem_api
//! @{
//
//*****************************************************************************
/****************************************************************************
**
** Definitions for File IDs
**
****************************************************************************/
/* NVMEM file ID - system files*/
#define NVMEM_NVS_FILEID (0)
#define NVMEM_NVS_SHADOW_FILEID (1)
#define NVMEM_WLAN_CONFIG_FILEID (2)
#define NVMEM_WLAN_CONFIG_SHADOW_FILEID (3)
#define NVMEM_WLAN_DRIVER_SP_FILEID (4)
#define NVMEM_WLAN_FW_SP_FILEID (5)
#define NVMEM_MAC_FILEID (6)
#define NVMEM_FRONTEND_VARS_FILEID (7)
#define NVMEM_IP_CONFIG_FILEID (8)
#define NVMEM_IP_CONFIG_SHADOW_FILEID (9)
#define NVMEM_BOOTLOADER_SP_FILEID (10)
#define NVMEM_RM_FILEID (11)
/* NVMEM file ID - user files*/
#define NVMEM_AES128_KEY_FILEID (12)
#define NVMEM_SHARED_MEM_FILEID (13)
/* max entry in order to invalid nvmem */
#define NVMEM_MAX_ENTRY (16)
//*****************************************************************************
//
//! nvmem_read
//!
//! @param ulFileId nvmem file id:\n
//! NVMEM_NVS_FILEID, NVMEM_NVS_SHADOW_FILEID,
//! NVMEM_WLAN_CONFIG_FILEID, NVMEM_WLAN_CONFIG_SHADOW_FILEID,
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
//! NVMEM_MAC_FILEID, NVMEM_FRONTEND_VARS_FILEID,
//! NVMEM_IP_CONFIG_FILEID, NVMEM_IP_CONFIG_SHADOW_FILEID,
//! NVMEM_BOOTLOADER_SP_FILEID, NVMEM_RM_FILEID,
//! and user files 12-15.
//! @param ulLength number of bytes to read
//! @param ulOffset ulOffset in file from where to read
//! @param buff output buffer pointer
//!
//! @return number of bytes read, otherwise error.
//!
//! @brief Reads data from the file referred by the ulFileId parameter.
//! Reads data from file ulOffset till length. Err if the file can't
//! be used, is invalid, or if the read is out of bounds.
//!
//*****************************************************************************
extern signed long nvmem_read(unsigned long file_id, unsigned long length, unsigned long offset, unsigned char *buff);
//*****************************************************************************
//
//! nvmem_write
//!
//! @param ulFileId nvmem file id:\n
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
//! NVMEM_MAC_FILEID, NVMEM_BOOTLOADER_SP_FILEID,
//! and user files 12-15.
//! @param ulLength number of bytes to write
//! @param ulEntryOffset offset in file to start write operation from
//! @param buff data to write
//!
//! @return on success 0, error otherwise.
//!
//! @brief Write data to nvmem.
//! writes data to file referred by the ulFileId parameter.
//! Writes data to file ulOffset till ulLength.The file id will be
//! marked invalid till the write is done. The file entry doesn't
//! need to be valid - only allocated.
//!
//*****************************************************************************
extern signed long nvmem_write(unsigned long ulFileId, unsigned long ulLength, unsigned long ulEntryOffset, unsigned char *buff);
//*****************************************************************************
//
//! nvmem_set_mac_address
//!
//! @param mac mac address to be set
//!
//! @return on success 0, error otherwise.
//!
//! @brief Write MAC address to EEPROM.
//! mac address as appears over the air (OUI first)
//!
//*****************************************************************************
extern unsigned char nvmem_set_mac_address(unsigned char *mac);
//*****************************************************************************
//
//! nvmem_get_mac_address
//!
//! @param[out] mac mac address
//!
//! @return on success 0, error otherwise.
//!
//! @brief Read MAC address from EEPROM.
//! mac address as appears over the air (OUI first)
//!
//*****************************************************************************
extern unsigned char nvmem_get_mac_address(unsigned char *mac);
//*****************************************************************************
//
//! nvmem_write_patch
//!
//! @param ulFileId nvmem file id:\n
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
//! @param spLength number of bytes to write
//! @param spData SP data to write
//!
//! @return on success 0, error otherwise.
//!
//! @brief program a patch to a specific file ID.
//! The SP data is assumed to be organized in 2-dimensional.
//! Each line is SP_PORTION_SIZE bytes long. Actual programming is
//! applied in SP_PORTION_SIZE bytes portions.
//!
//*****************************************************************************
extern unsigned char nvmem_write_patch(unsigned long ulFileId, unsigned long spLength, const unsigned char *spData);
//*****************************************************************************
//
//! nvmem_read_sp_version
//!
//! @param[out] patchVer first number indicates package ID and the second
//! number indicates package build number
//!
//! @return on success 0, error otherwise.
//!
//! @brief Read patch version. read package version (WiFi FW patch,
//! driver-supplicant-NS patch, bootloader patch)
//!
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
extern unsigned char nvmem_read_sp_version(unsigned char* patchVer);
#endif
//*****************************************************************************
//
//! nvmem_create_entry
//!
//! @param ulFileId nvmem file Id:\n
//! * NVMEM_AES128_KEY_FILEID: 12
//! * NVMEM_SHARED_MEM_FILEID: 13
//! * and fileIDs 14 and 15
//! @param ulNewLen entry ulLength
//!
//! @return on success 0, error otherwise.
//!
//! @brief Create new file entry and allocate space on the NVMEM.
//! Applies only to user files.
//! Modify the size of file.
//! If the entry is unallocated - allocate it to size
//! ulNewLen (marked invalid).
//! If it is allocated then deallocate it first.
//! To just mark the file as invalid without resizing -
//! set ulNewLen=0.
//!
//*****************************************************************************
extern int8_t nvmem_create_entry(unsigned long file_id, unsigned long newlen);
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __NVRAM_H__

View File

@ -0,0 +1,533 @@
/*****************************************************************************
*
* security.c - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
//*****************************************************************************
//
//! \addtogroup security_api
//! @{
//
//*****************************************************************************
#include "security.h"
#ifndef CC3000_UNENCRYPTED_SMART_CONFIG
// foreward sbox
const unsigned char sbox[256] = {
//0 1 2 3 4 5 6 7 8 9 A B C D E F
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, //0
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, //1
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, //2
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, //3
0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, //4
0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, //5
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, //6
0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, //7
0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, //8
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, //9
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, //A
0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, //B
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, //C
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, //D
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, //E
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; //F
// inverse sbox
const unsigned char rsbox[256] =
{ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb
, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e
, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25
, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92
, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84
, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06
, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b
, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73
, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e
, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b
, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4
, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f
, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef
, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d };
// round constant
const unsigned char Rcon[11] = {
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36};
unsigned char expandedKey[176];
//*****************************************************************************
//
//! expandKey
//!
//! @param key AES128 key - 16 bytes
//! @param expandedKey expanded AES128 key
//!
//! @return none
//!
//! @brief expend a 16 bytes key for AES128 implementation
//!
//*****************************************************************************
void expandKey(unsigned char *expandedKey,
unsigned char *key)
{
unsigned short ii, buf1;
for (ii=0;ii<16;ii++)
expandedKey[ii] = key[ii];
for (ii=1;ii<11;ii++){
buf1 = expandedKey[ii*16 - 4];
expandedKey[ii*16 + 0] = sbox[expandedKey[ii*16 - 3]]^expandedKey[(ii-1)*16 + 0]^Rcon[ii];
expandedKey[ii*16 + 1] = sbox[expandedKey[ii*16 - 2]]^expandedKey[(ii-1)*16 + 1];
expandedKey[ii*16 + 2] = sbox[expandedKey[ii*16 - 1]]^expandedKey[(ii-1)*16 + 2];
expandedKey[ii*16 + 3] = sbox[buf1 ]^expandedKey[(ii-1)*16 + 3];
expandedKey[ii*16 + 4] = expandedKey[(ii-1)*16 + 4]^expandedKey[ii*16 + 0];
expandedKey[ii*16 + 5] = expandedKey[(ii-1)*16 + 5]^expandedKey[ii*16 + 1];
expandedKey[ii*16 + 6] = expandedKey[(ii-1)*16 + 6]^expandedKey[ii*16 + 2];
expandedKey[ii*16 + 7] = expandedKey[(ii-1)*16 + 7]^expandedKey[ii*16 + 3];
expandedKey[ii*16 + 8] = expandedKey[(ii-1)*16 + 8]^expandedKey[ii*16 + 4];
expandedKey[ii*16 + 9] = expandedKey[(ii-1)*16 + 9]^expandedKey[ii*16 + 5];
expandedKey[ii*16 +10] = expandedKey[(ii-1)*16 +10]^expandedKey[ii*16 + 6];
expandedKey[ii*16 +11] = expandedKey[(ii-1)*16 +11]^expandedKey[ii*16 + 7];
expandedKey[ii*16 +12] = expandedKey[(ii-1)*16 +12]^expandedKey[ii*16 + 8];
expandedKey[ii*16 +13] = expandedKey[(ii-1)*16 +13]^expandedKey[ii*16 + 9];
expandedKey[ii*16 +14] = expandedKey[(ii-1)*16 +14]^expandedKey[ii*16 +10];
expandedKey[ii*16 +15] = expandedKey[(ii-1)*16 +15]^expandedKey[ii*16 +11];
}
}
//*****************************************************************************
//
//! galois_mul2
//!
//! @param value argument to multiply
//!
//! @return multiplied argument
//!
//! @brief multiply by 2 in the galois field
//!
//*****************************************************************************
unsigned char galois_mul2(unsigned char value)
{
if (value>>7)
{
value = value << 1;
return (value^0x1b);
} else
return value<<1;
}
//*****************************************************************************
//
//! aes_encr
//!
//! @param[in] expandedKey expanded AES128 key
//! @param[in/out] state 16 bytes of plain text and cipher text
//!
//! @return none
//!
//! @brief internal implementation of AES128 encryption.
//! straight forward aes encryption implementation
//! first the group of operations
//! - addRoundKey
//! - subbytes
//! - shiftrows
//! - mixcolums
//! is executed 9 times, after this addroundkey to finish the 9th
//! round, after that the 10th round without mixcolums
//! no further subfunctions to save cycles for function calls
//! no structuring with "for (....)" to save cycles.
//!
//!
//*****************************************************************************
void aes_encr(unsigned char *state, unsigned char *expandedKey)
{
unsigned char buf1, buf2, buf3, round;
for (round = 0; round < 9; round ++){
// addroundkey, sbox and shiftrows
// row 0
state[ 0] = sbox[(state[ 0] ^ expandedKey[(round*16) ])];
state[ 4] = sbox[(state[ 4] ^ expandedKey[(round*16) + 4])];
state[ 8] = sbox[(state[ 8] ^ expandedKey[(round*16) + 8])];
state[12] = sbox[(state[12] ^ expandedKey[(round*16) + 12])];
// row 1
buf1 = state[1] ^ expandedKey[(round*16) + 1];
state[ 1] = sbox[(state[ 5] ^ expandedKey[(round*16) + 5])];
state[ 5] = sbox[(state[ 9] ^ expandedKey[(round*16) + 9])];
state[ 9] = sbox[(state[13] ^ expandedKey[(round*16) + 13])];
state[13] = sbox[buf1];
// row 2
buf1 = state[2] ^ expandedKey[(round*16) + 2];
buf2 = state[6] ^ expandedKey[(round*16) + 6];
state[ 2] = sbox[(state[10] ^ expandedKey[(round*16) + 10])];
state[ 6] = sbox[(state[14] ^ expandedKey[(round*16) + 14])];
state[10] = sbox[buf1];
state[14] = sbox[buf2];
// row 3
buf1 = state[15] ^ expandedKey[(round*16) + 15];
state[15] = sbox[(state[11] ^ expandedKey[(round*16) + 11])];
state[11] = sbox[(state[ 7] ^ expandedKey[(round*16) + 7])];
state[ 7] = sbox[(state[ 3] ^ expandedKey[(round*16) + 3])];
state[ 3] = sbox[buf1];
// mixcolums //////////
// col1
buf1 = state[0] ^ state[1] ^ state[2] ^ state[3];
buf2 = state[0];
buf3 = state[0]^state[1]; buf3=galois_mul2(buf3); state[0] = state[0] ^ buf3 ^ buf1;
buf3 = state[1]^state[2]; buf3=galois_mul2(buf3); state[1] = state[1] ^ buf3 ^ buf1;
buf3 = state[2]^state[3]; buf3=galois_mul2(buf3); state[2] = state[2] ^ buf3 ^ buf1;
buf3 = state[3]^buf2; buf3=galois_mul2(buf3); state[3] = state[3] ^ buf3 ^ buf1;
// col2
buf1 = state[4] ^ state[5] ^ state[6] ^ state[7];
buf2 = state[4];
buf3 = state[4]^state[5]; buf3=galois_mul2(buf3); state[4] = state[4] ^ buf3 ^ buf1;
buf3 = state[5]^state[6]; buf3=galois_mul2(buf3); state[5] = state[5] ^ buf3 ^ buf1;
buf3 = state[6]^state[7]; buf3=galois_mul2(buf3); state[6] = state[6] ^ buf3 ^ buf1;
buf3 = state[7]^buf2; buf3=galois_mul2(buf3); state[7] = state[7] ^ buf3 ^ buf1;
// col3
buf1 = state[8] ^ state[9] ^ state[10] ^ state[11];
buf2 = state[8];
buf3 = state[8]^state[9]; buf3=galois_mul2(buf3); state[8] = state[8] ^ buf3 ^ buf1;
buf3 = state[9]^state[10]; buf3=galois_mul2(buf3); state[9] = state[9] ^ buf3 ^ buf1;
buf3 = state[10]^state[11]; buf3=galois_mul2(buf3); state[10] = state[10] ^ buf3 ^ buf1;
buf3 = state[11]^buf2; buf3=galois_mul2(buf3); state[11] = state[11] ^ buf3 ^ buf1;
// col4
buf1 = state[12] ^ state[13] ^ state[14] ^ state[15];
buf2 = state[12];
buf3 = state[12]^state[13]; buf3=galois_mul2(buf3); state[12] = state[12] ^ buf3 ^ buf1;
buf3 = state[13]^state[14]; buf3=galois_mul2(buf3); state[13] = state[13] ^ buf3 ^ buf1;
buf3 = state[14]^state[15]; buf3=galois_mul2(buf3); state[14] = state[14] ^ buf3 ^ buf1;
buf3 = state[15]^buf2; buf3=galois_mul2(buf3); state[15] = state[15] ^ buf3 ^ buf1;
}
// 10th round without mixcols
state[ 0] = sbox[(state[ 0] ^ expandedKey[(round*16) ])];
state[ 4] = sbox[(state[ 4] ^ expandedKey[(round*16) + 4])];
state[ 8] = sbox[(state[ 8] ^ expandedKey[(round*16) + 8])];
state[12] = sbox[(state[12] ^ expandedKey[(round*16) + 12])];
// row 1
buf1 = state[1] ^ expandedKey[(round*16) + 1];
state[ 1] = sbox[(state[ 5] ^ expandedKey[(round*16) + 5])];
state[ 5] = sbox[(state[ 9] ^ expandedKey[(round*16) + 9])];
state[ 9] = sbox[(state[13] ^ expandedKey[(round*16) + 13])];
state[13] = sbox[buf1];
// row 2
buf1 = state[2] ^ expandedKey[(round*16) + 2];
buf2 = state[6] ^ expandedKey[(round*16) + 6];
state[ 2] = sbox[(state[10] ^ expandedKey[(round*16) + 10])];
state[ 6] = sbox[(state[14] ^ expandedKey[(round*16) + 14])];
state[10] = sbox[buf1];
state[14] = sbox[buf2];
// row 3
buf1 = state[15] ^ expandedKey[(round*16) + 15];
state[15] = sbox[(state[11] ^ expandedKey[(round*16) + 11])];
state[11] = sbox[(state[ 7] ^ expandedKey[(round*16) + 7])];
state[ 7] = sbox[(state[ 3] ^ expandedKey[(round*16) + 3])];
state[ 3] = sbox[buf1];
// last addroundkey
state[ 0]^=expandedKey[160];
state[ 1]^=expandedKey[161];
state[ 2]^=expandedKey[162];
state[ 3]^=expandedKey[163];
state[ 4]^=expandedKey[164];
state[ 5]^=expandedKey[165];
state[ 6]^=expandedKey[166];
state[ 7]^=expandedKey[167];
state[ 8]^=expandedKey[168];
state[ 9]^=expandedKey[169];
state[10]^=expandedKey[170];
state[11]^=expandedKey[171];
state[12]^=expandedKey[172];
state[13]^=expandedKey[173];
state[14]^=expandedKey[174];
state[15]^=expandedKey[175];
}
//*****************************************************************************
//
//! aes_decr
//!
//! @param[in] expandedKey expanded AES128 key
//! @param[in\out] state 16 bytes of cipher text and plain text
//!
//! @return none
//!
//! @brief internal implementation of AES128 decryption.
//! straight forward aes decryption implementation
//! the order of substeps is the exact reverse of decryption
//! inverse functions:
//! - addRoundKey is its own inverse
//! - rsbox is inverse of sbox
//! - rightshift instead of leftshift
//! - invMixColumns = barreto + mixColumns
//! no further subfunctions to save cycles for function calls
//! no structuring with "for (....)" to save cycles
//!
//*****************************************************************************
void aes_decr(unsigned char *state, unsigned char *expandedKey)
{
unsigned char buf1, buf2, buf3;
signed char round;
round = 9;
// initial addroundkey
state[ 0]^=expandedKey[160];
state[ 1]^=expandedKey[161];
state[ 2]^=expandedKey[162];
state[ 3]^=expandedKey[163];
state[ 4]^=expandedKey[164];
state[ 5]^=expandedKey[165];
state[ 6]^=expandedKey[166];
state[ 7]^=expandedKey[167];
state[ 8]^=expandedKey[168];
state[ 9]^=expandedKey[169];
state[10]^=expandedKey[170];
state[11]^=expandedKey[171];
state[12]^=expandedKey[172];
state[13]^=expandedKey[173];
state[14]^=expandedKey[174];
state[15]^=expandedKey[175];
// 10th round without mixcols
state[ 0] = rsbox[state[ 0]] ^ expandedKey[(round*16) ];
state[ 4] = rsbox[state[ 4]] ^ expandedKey[(round*16) + 4];
state[ 8] = rsbox[state[ 8]] ^ expandedKey[(round*16) + 8];
state[12] = rsbox[state[12]] ^ expandedKey[(round*16) + 12];
// row 1
buf1 = rsbox[state[13]] ^ expandedKey[(round*16) + 1];
state[13] = rsbox[state[ 9]] ^ expandedKey[(round*16) + 13];
state[ 9] = rsbox[state[ 5]] ^ expandedKey[(round*16) + 9];
state[ 5] = rsbox[state[ 1]] ^ expandedKey[(round*16) + 5];
state[ 1] = buf1;
// row 2
buf1 = rsbox[state[ 2]] ^ expandedKey[(round*16) + 10];
buf2 = rsbox[state[ 6]] ^ expandedKey[(round*16) + 14];
state[ 2] = rsbox[state[10]] ^ expandedKey[(round*16) + 2];
state[ 6] = rsbox[state[14]] ^ expandedKey[(round*16) + 6];
state[10] = buf1;
state[14] = buf2;
// row 3
buf1 = rsbox[state[ 3]] ^ expandedKey[(round*16) + 15];
state[ 3] = rsbox[state[ 7]] ^ expandedKey[(round*16) + 3];
state[ 7] = rsbox[state[11]] ^ expandedKey[(round*16) + 7];
state[11] = rsbox[state[15]] ^ expandedKey[(round*16) + 11];
state[15] = buf1;
for (round = 8; round >= 0; round--){
// barreto
//col1
buf1 = galois_mul2(galois_mul2(state[0]^state[2]));
buf2 = galois_mul2(galois_mul2(state[1]^state[3]));
state[0] ^= buf1; state[1] ^= buf2; state[2] ^= buf1; state[3] ^= buf2;
//col2
buf1 = galois_mul2(galois_mul2(state[4]^state[6]));
buf2 = galois_mul2(galois_mul2(state[5]^state[7]));
state[4] ^= buf1; state[5] ^= buf2; state[6] ^= buf1; state[7] ^= buf2;
//col3
buf1 = galois_mul2(galois_mul2(state[8]^state[10]));
buf2 = galois_mul2(galois_mul2(state[9]^state[11]));
state[8] ^= buf1; state[9] ^= buf2; state[10] ^= buf1; state[11] ^= buf2;
//col4
buf1 = galois_mul2(galois_mul2(state[12]^state[14]));
buf2 = galois_mul2(galois_mul2(state[13]^state[15]));
state[12] ^= buf1; state[13] ^= buf2; state[14] ^= buf1; state[15] ^= buf2;
// mixcolums //////////
// col1
buf1 = state[0] ^ state[1] ^ state[2] ^ state[3];
buf2 = state[0];
buf3 = state[0]^state[1]; buf3=galois_mul2(buf3); state[0] = state[0] ^ buf3 ^ buf1;
buf3 = state[1]^state[2]; buf3=galois_mul2(buf3); state[1] = state[1] ^ buf3 ^ buf1;
buf3 = state[2]^state[3]; buf3=galois_mul2(buf3); state[2] = state[2] ^ buf3 ^ buf1;
buf3 = state[3]^buf2; buf3=galois_mul2(buf3); state[3] = state[3] ^ buf3 ^ buf1;
// col2
buf1 = state[4] ^ state[5] ^ state[6] ^ state[7];
buf2 = state[4];
buf3 = state[4]^state[5]; buf3=galois_mul2(buf3); state[4] = state[4] ^ buf3 ^ buf1;
buf3 = state[5]^state[6]; buf3=galois_mul2(buf3); state[5] = state[5] ^ buf3 ^ buf1;
buf3 = state[6]^state[7]; buf3=galois_mul2(buf3); state[6] = state[6] ^ buf3 ^ buf1;
buf3 = state[7]^buf2; buf3=galois_mul2(buf3); state[7] = state[7] ^ buf3 ^ buf1;
// col3
buf1 = state[8] ^ state[9] ^ state[10] ^ state[11];
buf2 = state[8];
buf3 = state[8]^state[9]; buf3=galois_mul2(buf3); state[8] = state[8] ^ buf3 ^ buf1;
buf3 = state[9]^state[10]; buf3=galois_mul2(buf3); state[9] = state[9] ^ buf3 ^ buf1;
buf3 = state[10]^state[11]; buf3=galois_mul2(buf3); state[10] = state[10] ^ buf3 ^ buf1;
buf3 = state[11]^buf2; buf3=galois_mul2(buf3); state[11] = state[11] ^ buf3 ^ buf1;
// col4
buf1 = state[12] ^ state[13] ^ state[14] ^ state[15];
buf2 = state[12];
buf3 = state[12]^state[13]; buf3=galois_mul2(buf3); state[12] = state[12] ^ buf3 ^ buf1;
buf3 = state[13]^state[14]; buf3=galois_mul2(buf3); state[13] = state[13] ^ buf3 ^ buf1;
buf3 = state[14]^state[15]; buf3=galois_mul2(buf3); state[14] = state[14] ^ buf3 ^ buf1;
buf3 = state[15]^buf2; buf3=galois_mul2(buf3); state[15] = state[15] ^ buf3 ^ buf1;
// addroundkey, rsbox and shiftrows
// row 0
state[ 0] = rsbox[state[ 0]] ^ expandedKey[(round*16) ];
state[ 4] = rsbox[state[ 4]] ^ expandedKey[(round*16) + 4];
state[ 8] = rsbox[state[ 8]] ^ expandedKey[(round*16) + 8];
state[12] = rsbox[state[12]] ^ expandedKey[(round*16) + 12];
// row 1
buf1 = rsbox[state[13]] ^ expandedKey[(round*16) + 1];
state[13] = rsbox[state[ 9]] ^ expandedKey[(round*16) + 13];
state[ 9] = rsbox[state[ 5]] ^ expandedKey[(round*16) + 9];
state[ 5] = rsbox[state[ 1]] ^ expandedKey[(round*16) + 5];
state[ 1] = buf1;
// row 2
buf1 = rsbox[state[ 2]] ^ expandedKey[(round*16) + 10];
buf2 = rsbox[state[ 6]] ^ expandedKey[(round*16) + 14];
state[ 2] = rsbox[state[10]] ^ expandedKey[(round*16) + 2];
state[ 6] = rsbox[state[14]] ^ expandedKey[(round*16) + 6];
state[10] = buf1;
state[14] = buf2;
// row 3
buf1 = rsbox[state[ 3]] ^ expandedKey[(round*16) + 15];
state[ 3] = rsbox[state[ 7]] ^ expandedKey[(round*16) + 3];
state[ 7] = rsbox[state[11]] ^ expandedKey[(round*16) + 7];
state[11] = rsbox[state[15]] ^ expandedKey[(round*16) + 11];
state[15] = buf1;
}
}
//*****************************************************************************
//
//! aes_encrypt
//!
//! @param[in] key AES128 key of size 16 bytes
//! @param[in\out] state 16 bytes of plain text and cipher text
//!
//! @return none
//!
//! @brief AES128 encryption:
//! Given AES128 key and 16 bytes plain text, cipher text of 16 bytes
//! is computed. The AES implementation is in mode ECB (Electronic
//! Code Book).
//!
//!
//*****************************************************************************
void aes_encrypt(unsigned char *state,
unsigned char *key)
{
// expand the key into 176 bytes
expandKey(expandedKey, key);
aes_encr(state, expandedKey);
}
//*****************************************************************************
//
//! aes_decrypt
//!
//! @param[in] key AES128 key of size 16 bytes
//! @param[in\out] state 16 bytes of cipher text and plain text
//!
//! @return none
//!
//! @brief AES128 decryption:
//! Given AES128 key and 16 bytes cipher text, plain text of 16 bytes
//! is computed The AES implementation is in mode ECB
//! (Electronic Code Book).
//!
//!
//*****************************************************************************
void aes_decrypt(unsigned char *state,
unsigned char *key)
{
expandKey(expandedKey, key); // expand the key into 176 bytes
aes_decr(state, expandedKey);
}
//*****************************************************************************
//
//! aes_read_key
//!
//! @param[out] key AES128 key of size 16 bytes
//!
//! @return on success 0, error otherwise.
//!
//! @brief Reads AES128 key from EEPROM
//! Reads the AES128 key from fileID #12 in EEPROM
//! returns an error if the key does not exist.
//!
//!
//*****************************************************************************
signed long aes_read_key(unsigned char *key)
{
signed long returnValue;
returnValue = nvmem_read(NVMEM_AES128_KEY_FILEID, AES128_KEY_SIZE, 0, key);
return returnValue;
}
//*****************************************************************************
//
//! aes_write_key
//!
//! @param[out] key AES128 key of size 16 bytes
//!
//! @return on success 0, error otherwise.
//!
//! @brief writes AES128 key from EEPROM
//! Writes the AES128 key to fileID #12 in EEPROM
//!
//!
//*****************************************************************************
signed long aes_write_key(unsigned char *key)
{
signed long returnValue;
returnValue = nvmem_write(NVMEM_AES128_KEY_FILEID, AES128_KEY_SIZE, 0, key);
return returnValue;
}
#endif //CC3000_UNENCRYPTED_SMART_CONFIG
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

View File

@ -0,0 +1,135 @@
/*****************************************************************************
*
* security.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __SECURITY__
#define __SECURITY__
#include "nvmem.h"
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C" {
#endif
#define AES128_KEY_SIZE 16
#ifndef CC3000_UNENCRYPTED_SMART_CONFIG
//*****************************************************************************
//
//! aes_encrypt
//!
//! @param[in] key AES128 key of size 16 bytes
//! @param[in\out] state 16 bytes of plain text and cipher text
//!
//! @return none
//!
//! @brief AES128 encryption:
//! Given AES128 key and 16 bytes plain text, cipher text of 16 bytes
//! is computed. The AES implementation is in mode ECB (Electronic
//! Code Book).
//!
//!
//*****************************************************************************
extern void aes_encrypt(unsigned char *state, unsigned char *key);
//*****************************************************************************
//
//! aes_decrypt
//!
//! @param[in] key AES128 key of size 16 bytes
//! @param[in\out] state 16 bytes of cipher text and plain text
//!
//! @return none
//!
//! @brief AES128 decryption:
//! Given AES128 key and 16 bytes cipher text, plain text of 16 bytes
//! is computed The AES implementation is in mode ECB
//! (Electronic Code Book).
//!
//!
//*****************************************************************************
extern void aes_decrypt(unsigned char *state, unsigned char *key);
//*****************************************************************************
//
//! aes_read_key
//!
//! @param[out] key AES128 key of size 16 bytes
//!
//! @return on success 0, error otherwise.
//!
//! @brief Reads AES128 key from EEPROM
//! Reads the AES128 key from fileID #12 in EEPROM
//! returns an error if the key does not exist.
//!
//!
//*****************************************************************************
extern signed long aes_read_key(unsigned char *key);
//*****************************************************************************
//
//! aes_write_key
//!
//! @param[out] key AES128 key of size 16 bytes
//!
//! @return on success 0, error otherwise.
//!
//! @brief writes AES128 key from EEPROM
//! Writes the AES128 key to fileID #12 in EEPROM
//!
//!
//*****************************************************************************
extern signed long aes_write_key(unsigned char *key);
#endif //CC3000_UNENCRYPTED_SMART_CONFIG
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif // __cplusplus
#endif

View File

@ -0,0 +1,673 @@
//
//
//
#include "sntp.h"
//Lists of pool servers
const char* ntp_us_pool_list[] = { "0.us.pool.ntp.org",
"1.us.pool.ntp.org",
"2.us.pool.ntp.org",
"3.us.pool.ntp.org",
"0.north-america.pool.ntp.org",
"1.north-america.pool.ntp.org",
"2.north-america.pool.ntp.org",
"3.north-america.pool.ntp.org",
NULL
};
const char* ntp_global_pool_list[] = { "0.pool.ntp.org",
"1.pool.ntp.org",
"2.pool.ntp.org",
"pool.ntp.org",
NULL
};
// ExtractNTPTime - convert ntp seconds into calendar time
// Notes:
// - 1900 was NOT a leap-year.
// - This routine deals with the overflow of the 32-bit seconds value,
// which will happen on 02/07/2036 at 06:28:16.
//
#define SECS_DAY (24L * 60 * 60) /* number of seconds in a day */
#define BASE_YEAR (1900) /* NTP time starts at 1/1/1900 00:00:00 */
#define FIX_PT_DAYS_YEAR ((365L * 256) + (256 / 4))
// It may not look that way, but this is (365.25 * 256)
// That is, it's (365 * 256) + (0.25 * 256) = (365.25 * 256). Why are we doing this?
// There are 365 days in a year. After you factor out seconds in the current day,
// you're left with days since 1/1/1900. Dividing by 365 would therefore give you
// the number of years since 1900, if it wasn't for leap years. If you include
// leap-years, you get 365.25 days per year. So, we have to divide ntp days by 365.25
// to get the proper year. Instead of doing a floating point divide by 365.25, we do
// fixed point arithmetic, placing the binary-point at 8 bits (i.e., 256 decimal).
//There's only one small fly in this ointment - 1900 was not a leap year.
// Fortunately, we can compensate by adding 1 to the NTP days, as if 1900 WAS a
// leap-year. When we divide days down to years, the extra day is lost in
// the roundoff. Problem solved.
// days in each month: {jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec};
char monthDays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
#ifdef CLOCK_DEBUG
void dumpBlock1(char* buf, short len) /*rdl 2/16/2008*/
{
uint8_t* offset = (uint8_t*)buf;
int16_t count = 0;
int lineCount = 0;
char ascii[17] = "";
char* pAscii = ascii;
delay(10);
if (CC3KPrinter != 0) { CC3KPrinter->print(F("Block: (addr ")); CC3KPrinter->print((uint16_t)buf, HEX); CC3KPrinter->print(F(", length ")); CC3KPrinter->print(len, HEX); }
// traceFn("Block: (addr %p, length 0x%04x)", buf, len);
while (count < len)
{
if (CC3KPrinter != 0) { CC3KPrinter->println(); CC3KPrinter->print((uint16_t)offset,HEX); CC3KPrinter->print(F(": ")); }
// traceFn("\r\n %p: ", offset);
lineCount = 0;
pAscii = (char*)&ascii;
memset(ascii,' ',16);
while ((count < len) && (lineCount < 8))
{
if ((*offset <= ' ') || (*offset == 0xFF)) *pAscii++ = '.'; else *pAscii++ = *offset; *pAscii++ = ' ';
if (CC3KPrinter != 0) { CC3KPrinter->print((*offset)>>4,HEX); CC3KPrinter->print((*offset++)&0x0F,HEX); CC3KPrinter->print(F(" ")); }
// traceFn("0x%02bx ", *offset++);
count++;
lineCount++;
}
while (lineCount++ < 8)
{
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" ")); }
// traceFn(" ");
}
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" | ")); CC3KPrinter->print(ascii); CC3KPrinter->print(F("|")); }
// traceFn(" | %s|", ascii);
delay(10);
}
if (CC3KPrinter != 0) { CC3KPrinter->println(); }
// traceFn("\r\n");
}
#endif
//Calculates (time / 2) for NTP timestamp values (64-bit fixed point, normalized to 32-bit)
// ORIGINAL VALUE OF time IS DESTROYED, and replaced with result of calculation.
// performs a signed divide
void NTPdiv2(SNTP_Timestamp_t* time)
{
uint32_t carry = time->seconds & 1; //this bit will shift from 'seconds' to 'fraction'
time->fraction >>= 1; //divide 'fraction' by 2
time->fraction |= carry << 31; //OR in the low bit of 'seconds' as the high bit of 'fraction
time->seconds >>= 1; //signed divide of 'seconds' by 2
}
//Calculates (time1 + time2) for NTP timestamp values (64-bit fixed point, normalized to 32-bit)
// ORIGINAL VALUE OF time2 IS DESTROYED, and replaced with result of calculation.
// Returns overflow
uint8_t AddNTPtime(SNTP_Timestamp_t* time1, SNTP_Timestamp_t* time2)
{
uint8_t carry = ((time2->fraction>>1)+(time1->fraction>>1) & 0x80000000)>>31;
time2->fraction += time1->fraction;
time2->seconds += carry;
carry = ((time2->seconds>>1)+(time1->seconds>>1) & 0x80000000)>>31;
time2->seconds += time1->seconds;
return carry; //if there's still a carry, then we have an overflow.
}
//Calculates (time2 - time1) for NTP timestamp values (64-bit fixed point, normalized to 32-bit)
// ORIGINAL VALUE OF time2 IS DESTROYED, and replaced with result of calculation.
// Returns underflow
uint8_t DiffNTPtime(SNTP_Timestamp_t* time1, SNTP_Timestamp_t* time2)
{
uint8_t borrow = ((time2->fraction>>1)-(time1->fraction>>1) & 0x80000000)>>31;
time2->fraction -= time1->fraction;
time2->seconds -= borrow;
borrow = ((time2->seconds>>1)-(time1->seconds>>1) & 0x80000000)>>31;
time2->seconds -= time1->seconds;
return borrow; //if there's still a borrow, then we have an underflow.
}
int sntp::GetSystemClockAsNTPTime(SNTP_Timestamp_t* ntpSystemTime)
{
long systemMillis;
if (ntpSystemTime)
{
ntpSystemTime->seconds = millis() / 1000;
systemMillis = millis() - (ntpSystemTime->seconds * 1000);
systemMillis = (systemMillis << 10) / 1000;
ntpSystemTime->fraction = systemMillis << 22;
}
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" GetSystemClockAsNTPTime: ")); CC3KPrinter->print(ntpSystemTime->seconds,HEX); CC3KPrinter->print(F(".")); CC3KPrinter->println(ntpSystemTime->fraction,HEX); }
#endif
return 0;
}
SNTP_Timestamp_t* sntp::NTPGetTime(SNTP_Timestamp_t* ntpTime, bool local)
{
SNTP_Timestamp_t ntpSystemTime;
if (ntpTime)
{
GetSystemClockAsNTPTime(&ntpSystemTime);
*ntpTime = m_NTPReferenceTime;
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" NTPGetTime m_NTPReferenceTime: ")); CC3KPrinter->print(ntpTime->seconds,HEX); CC3KPrinter->print(F(".")); CC3KPrinter->println(ntpTime->fraction,HEX); }
#endif
AddNTPtime(&ntpSystemTime, ntpTime);
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" NTPGetTime NTP Current UTC: ")); CC3KPrinter->print(ntpTime->seconds,HEX); CC3KPrinter->print(F(".")); CC3KPrinter->println(ntpTime->fraction,HEX); }
#endif
if (local) //if true, add in local offset from UTC
{
AddNTPtime(m_cur_UTC_offset, ntpTime);
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" NTPGetTime NTP Current Local: ")); CC3KPrinter->print(ntpTime->seconds,HEX); CC3KPrinter->print(F(".")); CC3KPrinter->println(ntpTime->fraction,HEX); }
#endif
}
}
return ntpTime;
}
SNTP_Timestamp_t* sntp::NTPSetTime(SNTP_Timestamp_t* ntpTime, bool local)
{
SNTP_Timestamp_t ntpSystemTime;
if (ntpTime)
{
if (local)
{
DiffNTPtime(m_cur_UTC_offset, ntpTime); //take out local offset to set clock as UTC
}
GetSystemClockAsNTPTime(&ntpSystemTime);
m_NTPReferenceTime = *ntpTime;
DiffNTPtime(&ntpSystemTime, &m_NTPReferenceTime);
m_timeIsSet = true;
}
return ntpTime;
}
NetTime_t *sntp::ExtractNTPTime(/*in*/ SNTP_Timestamp_t *ntpTime, /*out*/ NetTime_t *extractedTime)
{
uint32_t time = ntpTime->seconds;
uint32_t dayclock, dayno;
int year;
char month;
int day;
bool dateOverflow = (0 == (time & 0x80000000)); //32-bit counter overflowed?
extractedTime->millis = ((ntpTime->fraction >>22) * 1000) >>10;
dayclock = time % SECS_DAY; //seconds since midnight
dayno = time / SECS_DAY; //days since 1/1/1900 (or since 2/7/2036)
#ifdef CLOCK_DEEP_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F("dayclock = ")); CC3KPrinter->print(dayclock); CC3KPrinter->print(F("dayno = ")); CC3KPrinter->println(dayno); }
#endif
if (dateOverflow) //if the date overflowed, we'll effectively add the overflowed bit
{ // back into dayno and dayclock. They've got plenty of room for it now
dayclock = (dayclock + 23296); //new zero-point for dayclock is 06:28:16
dayno += 49710; //new zero-point for dayno is 02/07/2036
dayno += (dayclock / SECS_DAY); // PLUS 6:28:16, or 49710 days, 23296 seconds since 1/1/1900 00:00:00
dayclock %= SECS_DAY; // get rid of any overflow (we already added it to dayno in previous line)
#ifdef CLOCK_DEEP_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" date overflow: dayclock =")); CC3KPrinter->print(dayclock); CC3KPrinter->print(F("dayno = ")); CC3KPrinter->println(dayno); }
#endif
}
extractedTime->sec = dayclock % 60; //seconds in current minute
extractedTime->min = (dayclock % 3600) / 60; //minutes in current hour
extractedTime->hour = dayclock / 3600; //hours in current day
extractedTime->wday = (dayno + 1) % 7; //days since Sunday (0..6). Biased since 1/1/1900 was a thursday
dayno += 1; //No leap-year in 1900, as there should have been. This throws off the
// calculation of year = dayno / 365.25. So we add one to line things back
// up again, just for the year calculation.
dayno <<= 8; //fixed point arithmetic - multiply by 256 so we can do an integer divide by
year = (dayno / FIX_PT_DAYS_YEAR) + BASE_YEAR; // (365.25 * 256)instead of doing a floating-point divide by 365.25
#ifdef CLOCK_DEEP_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(year); CC3KPrinter->print(F(" = (")); CC3KPrinter->print(dayno); CC3KPrinter->print(F(" // ")); CC3KPrinter->print(FIX_PT_DAYS_YEAR); CC3KPrinter->print(F(") + ")); CC3KPrinter->println(BASE_YEAR); }
#endif
extractedTime->year = year;
dayno = (dayno % FIX_PT_DAYS_YEAR) >> 8;
extractedTime->yday = dayno;
//if year is evenly divisible by 4, it's a leap-year, except for 1900. Change February days in table accordingly
monthDays[1] = ((0 == (year & 3)) && (1900 != year))? 29 : 28;
//Now, we're going to loop through the month table, subtracting days from dayno until dayno goes negative
// that will give us the current month
day = (int)dayno;
month = 0;
while (0 <= day)
day-= monthDays[month++];
month -= 1; //we need to return month as zero-based. Phooey!
extractedTime->mon = month;
extractedTime->mday = day + monthDays[month] + 1; //Since we looped until days went negative, we need add back in days in current month
extractedTime->isdst = 0; //currently ignored.
#ifdef CLOCK_DEEP_DEBUG
dumpBlock1((char*)extractedTime, sizeof(NetTime_t));
#endif
return extractedTime;
}
//bool GetGatewayAddress(char* gatewayAddr)
//{
//bool success = false;
//tNetappIpconfigRetArgs ipconfig;
//netapp_ipconfig(&ipconfig);
//
///* If byte 1 is 0 we don't have a valid address */
//if (ipconfig.aucIP[3] != 0)
//{
//snprintf(gatewayAddr, MAX_URL_NAME, "%d.%d.%d.%d",ipconfig.aucIP+11,ipconfig.aucIP+10,ipconfig.aucIP+9,ipconfig.aucIP+8);
//success = true;
//}
//return success;
//}
sntp::sntp()
{
m_localPool = ntp_us_pool_list;
m_globalPool = ntp_global_pool_list;
m_NTPReferenceTime.seconds = 0X80000000; //initial base time for real-time clock (1/20/1968 03:14:08)
m_NTPReferenceTime.fraction = 0;
m_std_UTC_offset.seconds = 0; //Local standard-time offset from UTC. Example: Eastern Standard is UTC - 5 hours
m_std_UTC_offset.fraction = 0;
m_dst_UTC_offset.seconds = 0; //Local daylight-savings-time offset from UTC. Ex: Eastern Daylght is UTC - 4 hours
m_dst_UTC_offset.fraction = 0;
m_cur_UTC_offset = &m_std_UTC_offset; //Current offset from UTC. Pointer to either std_UTC_offset or dst_UTC_offset
m_twelveHour = false; //use 12-hour time when true, 24-hour time when false
m_enable_dst = false; //enable daylight savings time
//GetGatewayAddress((char*)&m_userServerStrings[1]);
//m_userServers[0] = (char*)&m_userServerStrings[1];
}
sntp::sntp(char* ntp_server_url1, char* ntp_server_url2, short local_utc_offset, short dst_utc_offset, bool enable_dst)
{
int user_server_count = 0;
sntp();
m_std_UTC_offset.seconds = (uint32_t)(60L * local_utc_offset);
m_dst_UTC_offset.seconds = (uint32_t)(60L * dst_utc_offset);
m_cur_UTC_offset = &m_dst_UTC_offset;
m_enable_dst = enable_dst;
if (ntp_server_url1)
{
strncpy((char*)&m_userServerStrings[user_server_count], ntp_server_url1, MAX_URL_NAME);
m_userServers[user_server_count] = (char*)&m_userServerStrings[user_server_count];
user_server_count++;
}
if (ntp_server_url2)
{
strncpy((char*)&m_userServerStrings[user_server_count], ntp_server_url2, MAX_URL_NAME);
m_userServers[user_server_count] = (char*)&m_userServerStrings[user_server_count];
user_server_count++;
}
}
sntp::sntp(char* ntp_server_url1, short local_utc_offset)
{
sntp(ntp_server_url1, NULL, local_utc_offset, 0, false);
}
sntp::sntp(char* ntp_server_url1, char* ntp_server_url2, short local_utc_offset)
{
sntp(ntp_server_url1, ntp_server_url2, local_utc_offset, 0, false);
}
sntp::sntp(char* ntp_server_url1, short local_utc_offset, short dst_utc_offset, bool enable_dst)
{
sntp(ntp_server_url1, NULL, local_utc_offset, dst_utc_offset, enable_dst);
}
//To spread the load of NTP client request, ntp.org maintains DNS servers that will return a list of
// available NTP servers from a pool. This routine gets a list of servers from the specified pool
// and returns it, along with a count of the servers in the list.
char sntp::GetNTPServerList(const char** ntp_pool_list, uint32_t* addrBuffer, int maxServerCount)
{
uint32_t ntpServer= NULL;
const char **ntpPoolName;
uint8_t serverCount = 0;
if ((ntp_pool_list) && (addrBuffer))
{
ntpPoolName = ntp_pool_list;
while ((*ntpPoolName) && (!ntpServer))
{
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F("Checking NTP server/pool address ")); CC3KPrinter->println(*ntpPoolName); }
#endif
gethostbyname(*ntpPoolName, strlen(*ntpPoolName), &ntpServer);
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" returns ntpServer: ")); CC3KPrinter->println(ntpServer,HEX); }
#endif
ntpPoolName++;
}
if (ntpServer)
{
*addrBuffer = ntpServer;
serverCount += 1;
}
}
return serverCount;
}
//Called by task to poll specific NTP server for current time.
bool sntp::SNTP_GetTime(int sntpSocket, uint32_t *ntpServerAddr)
{
sockaddr_in socketAddr;
socklen_t sockLen;
int32_t recvTimeout = 30000;
int8_t byteCount;
SNTP_Timestamp_t tsDestination;
bool result = false;
SNTP_Message_t sntp_message; // sntp message buffer
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->println(F("SNTP_GetTime")); }
#endif
// set the ntp server address and port
memset(&socketAddr, 0, sizeof(sockaddr_in));
socketAddr.sin_family = AF_INET;
memcpy(&(socketAddr.sin_addr), ntpServerAddr, 4);
socketAddr.sin_port = htons(SNTP_PORT);
//Prepare the outgoing ntp request packet
memset(&sntp_message, 0, sizeof(SNTP_Message_t)); //zero the outgoing message
sntp_message.mode = client; // NTP client request
sntp_message.VN = 3; // NTP version 3
NTPGetTime(&sntp_message.tsTransmit, false); //transmitting at current UTC time
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F("SNTP sendto server ")); CC3KPrinter->println(socketAddr.sin_addr.s_addr,HEX); }
dumpBlock1((char*)&sntp_message, sizeof(SNTP_Message_t));
#endif
sockLen = sizeof(sockaddr_in);
byteCount = sendto(sntpSocket, &sntp_message, sizeof(SNTP_Message_t), 0, (sockaddr*)&socketAddr, sockLen);
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F("sendto transmitted ")); CC3KPrinter->print(byteCount,HEX); CC3KPrinter->println(F(" bytes")); }
#endif
if (sizeof(SNTP_Message_t) == byteCount)
{
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->println(F("Waiting for response")); }
#endif
setsockopt(sntpSocket, SOL_SOCKET, SOCKOPT_RECV_TIMEOUT, &recvTimeout, (socklen_t)sizeof(recvTimeout));
sockLen = sizeof(sockaddr_in);
byteCount = recvfrom(sntpSocket, &sntp_message, sizeof(SNTP_Message_t), 0, (sockaddr*)&socketAddr, &sockLen);
//tsDestination = UTC time when we received reply
NTPGetTime(&tsDestination, false);
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F("SNTP received ")); CC3KPrinter->print(byteCount); CC3KPrinter->println(F(" bytes")); }
#endif
//If we got a good response packet, go ahead and calculate the current time.
// This is done according the the following equation:
// ((Receive time - Originate Time) + (Transmit Time - Destination Time)) / 2
if (sizeof(SNTP_Message_t) == byteCount)
{
//Change the byte order of the received timestamps to big-endian
sntp_message.tsReceive.seconds = htonl(sntp_message.tsReceive.seconds);
sntp_message.tsReceive.fraction = htonl(sntp_message.tsReceive.fraction);
sntp_message.tsTransmit.seconds = htonl(sntp_message.tsTransmit.seconds);
sntp_message.tsTransmit.fraction = htonl(sntp_message.tsTransmit.fraction);
//we don't use tsReference for anything, so don't bother swapping it.
// sntp_message.tsReference.seconds = htonl(sntp_message.tsReference.seconds);
// sntp_message.tsReference.fraction = htonl(sntp_message.tsReference.fraction);
#ifdef CLOCK_DEBUG
dumpBlock1((char*)&sntp_message, sizeof(SNTP_Message_t));
if (CC3KPrinter != 0) { CC3KPrinter->println(F("Received at ")); }
dumpBlock1((char*)&tsDestination, sizeof(tsDestination));
#endif
//Formula is: correction = ((tsReceive-tsOriginate)/2) + ((tsTransmit-tsDestination)/2)
//
//Server received request at tsReceive, we sent request at tsOriginate
DiffNTPtime(&sntp_message.tsOriginate, &sntp_message.tsReceive);
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" (R - O): ")); CC3KPrinter->print(sntp_message.tsReceive.seconds,HEX); CC3KPrinter->print(F(".")); CC3KPrinter->println(sntp_message.tsReceive.fraction,HEX); }
#endif
NTPdiv2(&sntp_message.tsReceive);
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" (R - O)/2: ")); CC3KPrinter->print(sntp_message.tsReceive.seconds,HEX); CC3KPrinter->print(F(".")); CC3KPrinter->println(sntp_message.tsReceive.fraction,HEX); }
#endif
//Server sent reply at tsTransmit, we received reply at tsDestination
DiffNTPtime(&tsDestination, &sntp_message.tsTransmit);
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" (T - D): ")); CC3KPrinter->print(sntp_message.tsTransmit.seconds,HEX); CC3KPrinter->print(F(".")); CC3KPrinter->println(sntp_message.tsTransmit.fraction,HEX); }
#endif
NTPdiv2(&sntp_message.tsTransmit);
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" (T - D)/2: ")); CC3KPrinter->print(sntp_message.tsTransmit.seconds,HEX); CC3KPrinter->print(F(".")); CC3KPrinter->println(sntp_message.tsTransmit.fraction,HEX); }
#endif
//Correction is returned in tsTransmit
AddNTPtime(&sntp_message.tsReceive, &sntp_message.tsTransmit);
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" Offset: ")); CC3KPrinter->print(sntp_message.tsTransmit.seconds,HEX); CC3KPrinter->print(F(".")); CC3KPrinter->println(sntp_message.tsTransmit.fraction,HEX); }
#endif
//Add correction to current ntp reference time
AddNTPtime(&sntp_message.tsTransmit, &m_NTPReferenceTime); //adjust NTP reference time
m_timeIsSet = true;
#ifdef CLOCK_DEBUG
NTPGetTime(&tsDestination, false); //we'll display local time
if (CC3KPrinter != 0) { CC3KPrinter->print(F(" time is ")); CC3KPrinter->print(tsDestination.seconds,HEX); CC3KPrinter->print(F(".")); CC3KPrinter->println(tsDestination.fraction,HEX); }
#endif
result = true;
}
}
return result;
}
bool sntp::UpdateNTPTime()
{
bool portIsBound = false;
int sntpSocket;
sockaddr_in socketAddr;
uint16_t localPort;
NTP_Pool_t ntp_pool_list; // list of NTP server pools
NTP_Server_List_t *pServerList; // pointer to list of ntp servers returned by a server pool
NTP_Server_List_t ntp_server_list; // local buffer for list of ntp servers returned by a server pool
uint8_t ntp_server_count; // number of ntp servers in ntp_server_list
bool checkLocal; // true if we haven't searched the local NTP server list.
bool checkGlobal; // true if we haven't searched the global NTP server list.
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->println(F("sntp.update")); }
#endif
sntpSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sntpSocket >= 0) //got one?
{
while (!portIsBound)
{ //set up the sockAddr
memset(&socketAddr, 0, sizeof(sockaddr_in)); //zero it
localPort = (uint16_t)random(0xC000, 0xFFFF); //generate random port number in range C000-FFFF
socketAddr.sin_family = AF_INET; //IP version 4
socketAddr.sin_addr.s_addr = 0; //local socket address
socketAddr.sin_port = htons(localPort); //well-known NTP port number, assigned by IANA
// bind the socket to the local port
portIsBound = (0 == bind(sntpSocket, (sockaddr*)&socketAddr, sizeof(sockaddr_in)));
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F("local: ")); CC3KPrinter->print(socketAddr.sin_addr.s_addr, HEX); CC3KPrinter->print(F(": ")); CC3KPrinter->println(socketAddr.sin_port, HEX); }
#endif
}
if (portIsBound)
{
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F("Init SNTP bind socket ")); CC3KPrinter->print(sntpSocket); CC3KPrinter->print(F("to port ")); CC3KPrinter->print(socketAddr.sin_port); CC3KPrinter->println(F(" succeeded")); }
#endif
m_change_DST = 0;
m_timeIsSet = false;
while (!m_timeIsSet) //stay here until we either get a time, or run out of servers
{
//start with user's NTP servers. These may not be pool servers, so they'll only get one IP address from DNS
ntp_pool_list = m_userServers; //start with user's ntp server list
m_localPool = ntp_us_pool_list;
m_globalPool = ntp_global_pool_list;
checkLocal = (NULL != m_localPool); // if that craps out, we'll try the local server-pool list
checkGlobal = (NULL != m_globalPool); //if that craps out, we'll try the global server-pool list
#ifdef CLOCK_DEEP_DEBUG
if (CC3KPrinter != 0)
{
CC3KPrinter->print(F("m_localPool: ")); CC3KPrinter->print(*m_localPool); CC3KPrinter->print(F("checkLocal: ")); CC3KPrinter->println(checkLocal);
CC3KPrinter->print(F("m_globalPool: ")); CC3KPrinter->print(*m_globalPool); CC3KPrinter->print(F("checkGlobal: ")); CC3KPrinter->println(checkGlobal);
}
#endif
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F("try user's ntp server list: ")); CC3KPrinter->println((uint32_t)*ntp_pool_list); }
#endif
memset(&ntp_server_list, 0, sizeof(NTP_Server_List_t));
pServerList = &ntp_server_list; //server ip addresses returned here
while ((!m_timeIsSet) && (pServerList))
{
//try to get a server list.
ntp_server_count = GetNTPServerList(ntp_pool_list, (uint32_t*)pServerList, MAX_NTP_SERVERS); // Just returns if pServerList is NULL
#ifdef CLOCK_DEEP_DEBUG
dumpBlock1((char*)pServerList, ntp_server_count * sizeof(uint32_t));
#endif
int i = 0;
while ((!m_timeIsSet) && (i++ < ntp_server_count) && (pServerList))
{
uint32_t serverAddr = htonl(*(uint32_t*)pServerList++);
m_timeIsSet = SNTP_GetTime(sntpSocket, &serverAddr);
}
if (!m_timeIsSet)
{
pServerList = &ntp_server_list; //reset pServerList pointer
if (checkLocal)
{
ntp_pool_list = m_localPool; //try local ntp server pool list ('local' means 'regional', e.g., US, North America, etc)
checkLocal = false;
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F("try local ntp_pool_list: ")); CC3KPrinter->println((uint32_t)*ntp_pool_list); }
#endif
}
else
{
if (checkGlobal)
{
ntp_pool_list = m_globalPool; //now try global (i.e., default) ntp server pool list
checkGlobal = false;
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0) { CC3KPrinter->print(F("try global ntp_pool_list: ")); CC3KPrinter->println((uint32_t)*ntp_pool_list); }
#endif
}
else
{
pServerList = NULL; //rats. came up empty. This will get us out of the loop
ntp_server_count = 0;
} //else not checkGlobal
} //else not checkLocal
} //if (!m_timeIsSet)
} //while ((!m_timeIsSet) && (pServerList))
if (m_timeIsSet)
{
// //If necessary, make change to/from Daylight Savings Time
// // NOTE: m_change_DST will have been set on the previous iteration of the loop, so that
// // we update the time AFTER we wake up. This is because the timer will have been adjusted
// // to wake up when the time-change happens
// // 'm_change_DST' is tri-state: 0 or no change, +1 for spring change, -1 for fall change.
// UpdateDST(m_change_DST);
//
// //Now, see if the time change will happen before the next scheduled wake-up.
// // If so, shorten sleep-time so we wake up at the time-change
// TaskLock(&Clock.lock);
// m_change_DST = Check_DST(NTPGetTime(&m_tempTS, false), &m_sleepTime); //if necessary, shortens m_sleepTime so we wake up at the time-change
// TaskUnlock(&Clock.lock); // Also makes sure current DST settings are correct.
//
// strBufLen = 32;
// Trace("The time is now %s\r\n", FormatFullNTPtime(NTPGetTime(&m_tempTS, true), strBuf, &strBufLen, true));
//
//
}
} // while (!m_timeIsSet)
closesocket(sntpSocket);
sntpSocket = -1;
} //if (portIsBound)
else //socket bind failed
{
if (CC3KPrinter != 0) { CC3KPrinter->print(F("Init SNTP bind socket ")); CC3KPrinter->print(sntpSocket); CC3KPrinter->print(F("to port ")); CC3KPrinter->print(SNTP_PORT); CC3KPrinter->println(F("failed")); }
closesocket(sntpSocket);
sntpSocket = -1;
}
} //if (sntpSocket >= 0)
else // didn't get a socket
{
if (CC3KPrinter != 0) { CC3KPrinter->println(F("Failed to get a socket")); }
}
#ifdef CLOCK_DEBUG
if (CC3KPrinter != 0)
{
CC3KPrinter->println(F("exit sntp.update"));
CC3KPrinter->print(F("m_std_UTC_offset.seconds: ")); CC3KPrinter->println(m_std_UTC_offset.seconds, HEX);
CC3KPrinter->print(F("m_dst_UTC_offset.seconds: ")); CC3KPrinter->println(m_dst_UTC_offset.seconds, HEX);
}
#endif
return m_timeIsSet;
}
//sntp SNTP;

View File

@ -0,0 +1,409 @@
// sntp.h
#ifndef _SNTP_h
#define _SNTP_h
// Notes on NTP packet format from IETF RFC-2030, SNTP Specification (http://www.ietf.org/rfc/rfc2030.txt?number=2030) :
//
//NTP Timestamp Format
//
// SNTP uses the standard NTP timestamp format described in RFC-1305 and
// previous versions of that document. In conformance with standard
// Internet practice, NTP data are specified as integer or fixed-point
// quantities, with bits numbered in big-endian fashion from 0 starting
// at the left, or high-order, position. Unless specified otherwise, all
// quantities are unsigned and may occupy the full field width with an
// implied 0 preceding bit 0.
//
// Since NTP timestamps are cherished data and, in fact, represent the
// main product of the protocol, a special timestamp format has been
// established. NTP timestamps are represented as a 64-bit unsigned
// fixed-point number, in seconds relative to 0h on 1 January 1900. The
// integer part is in the first 32 bits and the fraction part in the
// last 32 bits. In the fraction part, the non-significant low order can
// be set to 0.
//
// It is advisable to fill the non-significant low order bits of the
// timestamp with a random, unbiased bitstring, both to avoid
// systematic roundoff errors and as a means of loop detection and
// replay detection (see below). One way of doing this is to generate
// a random bitstring in a 64-bit word, then perform an arithmetic
// right shift a number of bits equal to the number of significant
// bits of the timestamp, then add the result to the original
// timestamp.
//
//
//
//
//Mills Informational [Page 6]
//
//RFC 2030 SNTPv4 for IPv4, IPv6 and OSI October 1996
//
//
// This format allows convenient multiple-precision arithmetic and
// conversion to UDP/TIME representation (seconds), but does complicate
// the conversion to ICMP Timestamp message representation, which is in
// milliseconds. The maximum number that can be represented is
// 4,294,967,295 seconds with a precision of about 200 picoseconds,
// which should be adequate for even the most exotic requirements.
//
// 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Seconds |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Seconds Fraction (0-padded) |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// Note that, since some time in 1968 (second 2,147,483,648) the most
// significant bit (bit 0 of the integer part) has been set and that the
// 64-bit field will overflow some time in 2036 (second 4,294,967,296).
// Should NTP or SNTP be in use in 2036, some external means will be
// necessary to qualify time relative to 1900 and time relative to 2036
// (and other multiples of 136 years). There will exist a 200-picosecond
// interval, henceforth ignored, every 136 years when the 64-bit field
// will be 0, which by convention is interpreted as an invalid or
// unavailable timestamp.
//
// As the NTP timestamp format has been in use for the last 17 years,
// it remains a possibility that it will be in use 40 years from now
// when the seconds field overflows. As it is probably inappropriate
// to archive NTP timestamps before bit 0 was set in 1968, a
// convenient way to extend the useful life of NTP timestamps is the
// following convention: If bit 0 is set, the UTC time is in the
// range 1968-2036 and UTC time is reckoned from 0h 0m 0s UTC on 1
// January 1900. If bit 0 is not set, the time is in the range 2036-
// 2104 and UTC time is reckoned from 6h 28m 16s UTC on 7 February
// 2036. Note that when calculating the correspondence, 2000 is not a
// leap year. Note also that leap seconds are not counted in the
// reckoning.
//
//4. NTP Message Format
//
// Both NTP and SNTP are clients of the User Datagram Protocol (UDP)
// [POS80], which itself is a client of the Internet Protocol (IP)
// [DAR81]. The structure of the IP and UDP headers is described in the
// cited specification documents and will not be detailed further here.
// The UDP port number assigned to NTP is 123, which should be used in
// both the Source Port and Destination Port fields in the UDP header.
// The remaining UDP header fields should be set as described in the
// specification.
//
//
//
//Mills Informational [Page 7]
//
//RFC 2030 SNTPv4 for IPv4, IPv6 and OSI October 1996
//
//
// Below is a description of the NTP/SNTP Version 4 message format,
// which follows the IP and UDP headers. This format is identical to
// that described in RFC-1305, with the exception of the contents of the
// reference identifier field. The header fields are defined as follows:
//
// 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// |LI | VN |Mode | Stratum | Poll | Precision |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Root Delay |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Root Dispersion |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Reference Identifier |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | |
// | Reference Timestamp (64) |
// | |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | |
// | Originate Timestamp (64) |
// | |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | |
// | Receive Timestamp (64) |
// | |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | |
// | Transmit Timestamp (64) |
// | |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Key Identifier (optional) (32) |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | |
// | |
// | Message Digest (optional) (128) |
// | |
// | |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// As described in the next section, in SNTP most of these fields are
// initialized with pre-specified data. For completeness, the function
// of each field is briefly summarized below.
//
//
// Leap Indicator (LI): This is a two-bit code warning of an impending
// leap second to be inserted/deleted in the last minute of the current
// day, with bit 0 and bit 1, respectively, coded as follows:
//
// LI Value Meaning
// -------------------------------------------------------
// 00 0 no warning
// 01 1 last minute has 61 seconds
// 10 2 last minute has 59 seconds)
// 11 3 alarm condition (clock not synchronized)
//
// Version Number (VN): This is a three-bit integer indicating the
// NTP/SNTP version number. The version number is 3 for Version 3 (IPv4
// only) and 4 for Version 4 (IPv4, IPv6 and OSI). If necessary to
// distinguish between IPv4, IPv6 and OSI, the encapsulating context
// must be inspected.
//
// Mode: This is a three-bit integer indicating the mode, with values
// defined as follows:
//
// Mode Meaning
// ------------------------------------
// 0 reserved
// 1 symmetric active
// 2 symmetric passive
// 3 client
// 4 server
// 5 broadcast
// 6 reserved for NTP control message
// 7 reserved for private use
//
// In unicast and anycast modes, the client sets this field to 3
// (client) in the request and the server sets it to 4 (server) in the
// reply. In multicast mode, the server sets this field to 5
// (broadcast).
//
// Stratum: This is a eight-bit unsigned integer indicating the stratum
// level of the local clock, with values defined as follows:
//
// Stratum Meaning
// ----------------------------------------------
// 0 unspecified or unavailable
// 1 primary reference (e.g., radio clock)
// 2-15 secondary reference (via NTP or SNTP)
// 16-255 reserved
//
//
// Poll Interval: This is an eight-bit signed integer indicating the
// maximum interval between successive messages, in seconds to the
// nearest power of two. The values that can appear in this field
// presently range from 4 (16 s) to 14 (16284 s); however, most
// applications use only the sub-range 6 (64 s) to 10 (1024 s).
//
// Precision: This is an eight-bit signed integer indicating the
// precision of the local clock, in seconds to the nearest power of two.
// The values that normally appear in this field range from -6 for
// mains-frequency clocks to -20 for microsecond clocks found in some
// workstations.
//
// Root Delay: This is a 32-bit signed fixed-point number indicating the
// total roundtrip delay to the primary reference source, in seconds
// with fraction point between bits 15 and 16. Note that this variable
// can take on both positive and negative values, depending on the
// relative time and frequency offsets. The values that normally appear
// in this field range from negative values of a few milliseconds to
// positive values of several hundred milliseconds.
//
// Root Dispersion: This is a 32-bit unsigned fixed-point number
// indicating the nominal error relative to the primary reference
// source, in seconds with fraction point between bits 15 and 16. The
// values that normally appear in this field range from 0 to several
// hundred milliseconds.
//
// Reference Identifier: This is a 32-bit bitstring identifying the
// particular reference source. In the case of NTP Version 3 or Version
// 4 stratum-0 (unspecified) or stratum-1 (primary) servers, this is a
// four-character ASCII string, left justified and zero padded to 32
// bits. In NTP Version 3 secondary servers, this is the 32-bit IPv4
// address of the reference source. In NTP Version 4 secondary servers,
// this is the low order 32 bits of the latest transmit timestamp of the
// reference source. NTP primary (stratum 1) servers should set this
// field to a code identifying the external reference source according
// to the following list. If the external reference is one of those
// listed, the associated code should be used. Codes for sources not
// listed can be contrived as appropriate.
//
//
// Code External Reference Source
// ----------------------------------------------------------------
// LOCL uncalibrated local clock used as a primary reference for
// a subnet without external means of synchronization
// PPS atomic clock or other pulse-per-second source
// individually calibrated to national standards
// ACTS NIST dialup modem service
// USNO USNO modem service
// PTB PTB (Germany) modem service
// TDF Allouis (France) Radio 164 kHz
// DCF Mainflingen (Germany) Radio 77.5 kHz
// MSF Rugby (UK) Radio 60 kHz
// WWV Ft. Collins (US) Radio 2.5, 5, 10, 15, 20 MHz
// WWVB Boulder (US) Radio 60 kHz
// WWVH Kaui Hawaii (US) Radio 2.5, 5, 10, 15 MHz
// CHU Ottawa (Canada) Radio 3330, 7335, 14670 kHz
// LORC LORAN-C radionavigation system
// OMEG OMEGA radionavigation system
// GPS Global Positioning Service
// GOES Geostationary Orbit Environment Satellite
//
// Reference Timestamp: This is the time at which the local clock was
// last set or corrected, in 64-bit timestamp format.
//
// Originate Timestamp: This is the time at which the request departed
// the client for the server, in 64-bit timestamp format.
//
// Receive Timestamp: This is the time at which the request arrived at
// the server, in 64-bit timestamp format.
//
// Transmit Timestamp: This is the time at which the reply departed the
// server for the client, in 64-bit timestamp format.
//
// Authenticator (optional): When the NTP authentication scheme is
// implemented, the Key Identifier and Message Digest fields contain the
// message authentication code (MAC) information defined in Appendix C
// of RFC-1305.
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "utility/socket.h"
#include "utility/netapp.h"
//#define CLOCK_DEBUG
//#define CLOCK_DEEP_DEBUG
//
#define SNTP_PORT ((uint16_t)123) /* well-known NTP port number, assigned by IANA */
#define MAX_URL_NAME 31
#define MAX_NTP_SERVERS 2
#define NUMBER_OF_TIME_ZONES 34
typedef enum SNTP_LI_t { no_warning = 0,
sixty_One,
fifty_Nine,
alarm
} SNTP_LI_t;
typedef enum SNTP_Mode_t { reserved = 0,
sym_active,
sym_passive,
client,
server,
broadcast,
reserved_control,
reserved_private
} SNTP_Mode_t;
typedef struct SNTP_Stratum_t
{
uint8_t primary : 1;
uint8_t secondary : 3;
uint8_t reserved : 4;
}SNTP_Stratum_t;
typedef struct SNTP_Timestamp_t
{
uint32_t seconds;
int32_t fraction;
}SNTP_Timestamp_t;
typedef struct SNTP_Message_t
{
SNTP_Mode_t mode : 3;
uint8_t VN : 3;
SNTP_LI_t LI : 2;
SNTP_Stratum_t stratum;
char poll;
char precision;
long delay;
uint32_t dispersion;
uint32_t referenceID;
SNTP_Timestamp_t tsReference;
SNTP_Timestamp_t tsOriginate;
SNTP_Timestamp_t tsReceive;
SNTP_Timestamp_t tsTransmit;
// uint32_t key; //optional field - ignore
// uint8_t messageDigest[128]; //optional field - ignore
}SNTP_Message_t;
typedef const char** NTP_Pool_t; //Name of NTP server pool
typedef uint32_t NTP_Server_List_t[MAX_NTP_SERVERS]; //list of ntp server addresses (as returned by NTP server pool)
/**
* Structure for NTP calendar time.
*
*/
typedef struct NetTime_t
{
uint16_t millis; ///< Milliseconds after the second (0..999)
uint8_t sec; ///< Seconds after the minute (0..59)
uint8_t min; ///< Minutes after the hour (0..59)
uint8_t hour; ///< Hours since midnight (0..23)
uint8_t mday; ///< Day of the month (1..31)
uint8_t mon; ///< Months since January (0..11)
uint16_t year; ///< Year.
uint8_t wday; ///< Days since Sunday (0..6)
uint16_t yday; ///< Days since January 1 (0..365)
bool isdst; ///< Daylight savings time flag, currently not supported
}NetTime_t;
class sntp
{
public:
sntp();
sntp(char* ntp_server_url1, short local_utc_offset);
sntp(char* ntp_server_url1, char* ntp_server_url2, short local_utc_offset);
sntp(char* ntp_server_url1, short local_utc_offset, short dst_utc_offset, bool enable_dst);
sntp(char* ntp_server_url1, char* ntp_server_url2, short local_utc_offset, short dst_utc_offset, bool enable_dst);
virtual ~sntp() {};
NetTime_t *ExtractNTPTime(/*in*/ SNTP_Timestamp_t *ntpTime, /*out*/ NetTime_t *extractedTime);
bool UpdateNTPTime();
SNTP_Timestamp_t* NTPGetTime(SNTP_Timestamp_t* ntpTime, bool local);
SNTP_Timestamp_t* NTPSetTime(SNTP_Timestamp_t* ntpTime, bool local);
int GetSystemClockAsNTPTime(SNTP_Timestamp_t* ntpSystemTime);
private:
char GetNTPServerList(const char** ntp_pool_list, uint32_t* addrBuffer, int maxServerCount);
bool SNTP_GetTime(int sntpSocket, uint32_t *ntpServerAddr);
NetTime_t m_timeStruct;
uint8_t m_change_DST; // 0 if no daylight savings time change, +1 if spring change, -1 if fall change
SNTP_Timestamp_t m_NTPReferenceTime; //base time for real-time clock real time = this + millisecond ticker
SNTP_Timestamp_t m_std_UTC_offset; //Local standard-time offset from UTC. Example: Eastern Standard is UTC - 5 hours
SNTP_Timestamp_t m_dst_UTC_offset; //Local daylight-savings-time offset from UTC. Ex: Eastern Daylght is UTC - 4 hours
SNTP_Timestamp_t* m_cur_UTC_offset; //Current offset from UTC. Pointer to either std_UTC_offset or dst_UTC_offset
bool m_twelveHour; //use 12-hour time when true, 24-hour time when false
bool m_enable_dst; //enable daylight savings time
SNTP_Timestamp_t m_dst_start; // next date when DST starts
SNTP_Timestamp_t m_dst_end; // next date when DST ends
uint32_t m_pollTime; // in seconds, how often to poll NTP to update clock
NTP_Pool_t m_localPool; //list of pool servers for current geographical location
NTP_Pool_t m_globalPool; //list of global pool servers if no local servers respond
uint8_t m_userServerCount; //number of NTP servers provded by user (not pool servers)
const char* m_userServers[MAX_NTP_SERVERS]; //list of NTP or NTP pool servers provided by user (pointers to userServerStrings)
char m_userServerStrings[MAX_NTP_SERVERS][MAX_URL_NAME+1]; //storage for user's NTP server URL strings
bool m_timeIsSet; //false = current time is not set
};
//extern sntp SNTP;
extern Print* CC3KPrinter;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,691 @@
/*****************************************************************************
*
* socket.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __SOCKET_H__
#define __SOCKET_H__
//*****************************************************************************
//
//! \addtogroup socket_api
//! @{
//
//*****************************************************************************
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C" {
#endif
#define HOSTNAME_MAX_LENGTH (230) // 230 bytes + header shouldn't exceed 8 bit value
//--------- Address Families --------
#define AF_INET 2
#define AF_INET6 23
//------------ Socket Types ------------
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
#define SOCK_RAW 3 // Raw sockets allow new IPv4 protocols to be implemented in user space. A raw socket receives or sends the raw datagram not including link level headers
#define SOCK_RDM 4
#define SOCK_SEQPACKET 5
//----------- Socket Protocol ----------
#define IPPROTO_IP 0 // dummy for IP
#define IPPROTO_ICMP 1 // control message protocol
#define IPPROTO_IPV4 IPPROTO_IP // IP inside IP
#define IPPROTO_TCP 6 // tcp
#define IPPROTO_UDP 17 // user datagram protocol
#define IPPROTO_IPV6 41 // IPv6 in IPv6
#define IPPROTO_NONE 59 // No next header
#define IPPROTO_RAW 255 // raw IP packet
#define IPPROTO_MAX 256
//----------- Socket retunr codes -----------
#define SOC_ERROR (-1) // error
#define SOC_IN_PROGRESS (-2) // socket in progress
//----------- Socket Options -----------
#define SOL_SOCKET 0xffff // socket level
#define SOCKOPT_RECV_NONBLOCK 0 // recv non block mode, set SOCK_ON or SOCK_OFF (default block mode)
#define SOCKOPT_RECV_TIMEOUT 1 // optname to configure recv and recvfromtimeout
#define SOCKOPT_ACCEPT_NONBLOCK 2 // accept non block mode, set SOCK_ON or SOCK_OFF (default block mode)
#define SOCK_ON 0 // socket non-blocking mode is enabled
#define SOCK_OFF 1 // socket blocking mode is enabled
#define TCP_NODELAY 0x0001
#define TCP_BSDURGENT 0x7000
#define MAX_PACKET_SIZE 1500
#define MAX_LISTEN_QUEUE 4
#define IOCTL_SOCKET_EVENTMASK
#ifdef ENOBUFS
#undef ENOBUFS
#endif
#define ENOBUFS 55 // No buffer space available
#define __FD_SETSIZE 32
#define ASIC_ADDR_LEN 8
#define NO_QUERY_RECIVED -3
typedef struct _in_addr_t
{
unsigned long s_addr; // load with inet_aton()
} in_addr;
typedef struct _sockaddr_t
{
unsigned short int sa_family;
unsigned char sa_data[14];
} sockaddr;
typedef struct _sockaddr_in_t
{
short sin_family; // e.g. AF_INET
unsigned short sin_port; // e.g. htons(3490)
in_addr sin_addr; // see struct in_addr, below
char sin_zero[8]; // zero this if you want to
} sockaddr_in;
typedef unsigned long socklen_t;
// The fd_set member is required to be an array of longs.
typedef long int __fd_mask;
// It's easier to assume 8-bit bytes than to get CHAR_BIT.
#define __NFDBITS (8 * sizeof (__fd_mask))
#define __FDELT(d) ((d) / __NFDBITS)
#define __FDMASK(d) ((__fd_mask) 1 << ((d) % __NFDBITS))
#ifdef fd_set
#undef fd_set // for compatibility with newlib, which defines fd_set
#endif
// fd_set for select and pselect.
typedef struct
{
__fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
#define __FDS_BITS(set) ((set)->fds_bits)
} fd_set;
// We don't use `memset' because this would require a prototype and
// the array isn't too big.
#define __FD_ZERO(set) \
do { \
unsigned int __i; \
fd_set *__arr = (set); \
for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \
__FDS_BITS (__arr)[__i] = 0; \
} while (0)
#define __FD_SET(d, set) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d))
#define __FD_CLR(d, set) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d))
#define __FD_ISSET(d, set) (__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d))
// Access macros for 'fd_set'.
#ifdef FD_SET
#undef FD_SET
#endif
#ifdef FD_CLR
#undef FD_CLR
#endif
#ifdef FD_ISSET
#undef FD_ISSET
#endif
#ifdef FD_ZERO
#undef FD_ZERO
#endif
#define FD_SET(fd, fdsetp) __FD_SET (fd, fdsetp)
#define FD_CLR(fd, fdsetp) __FD_CLR (fd, fdsetp)
#define FD_ISSET(fd, fdsetp) __FD_ISSET (fd, fdsetp)
#define FD_ZERO(fdsetp) __FD_ZERO (fdsetp)
//Use in case of Big Endian only
#define htonl(A) ((((unsigned long)(A) & 0xff000000) >> 24) | \
(((unsigned long)(A) & 0x00ff0000) >> 8) | \
(((unsigned long)(A) & 0x0000ff00) << 8) | \
(((unsigned long)(A) & 0x000000ff) << 24))
#define ntohl htonl
//Use in case of Big Endian only
#define htons(A) ((((unsigned long)(A) & 0xff00) >> 8) | \
(((unsigned long)(A) & 0x00ff) << 8))
#define ntohs htons
// mDNS port - 5353 mDNS multicast address - 224.0.0.251
#define SET_mDNS_ADD(sockaddr) sockaddr.sa_data[0] = 0x14; \
sockaddr.sa_data[1] = 0xe9; \
sockaddr.sa_data[2] = 0xe0; \
sockaddr.sa_data[3] = 0x0; \
sockaddr.sa_data[4] = 0x0; \
sockaddr.sa_data[5] = 0xfb;
//*****************************************************************************
//
// Prototypes for the APIs.
//
//*****************************************************************************
//*****************************************************************************
//
//! socket
//!
//! @param domain selects the protocol family which will be used for
//! communication. On this version only AF_INET is supported
//! @param type specifies the communication semantics. On this version
//! only SOCK_STREAM, SOCK_DGRAM, SOCK_RAW are supported
//! @param protocol specifies a particular protocol to be used with the
//! socket IPPROTO_TCP, IPPROTO_UDP or IPPROTO_RAW are
//! supported.
//!
//! @return On success, socket handle that is used for consequent socket
//! operations. On error, -1 is returned.
//!
//! @brief create an endpoint for communication
//! The socket function creates a socket that is bound to a specific
//! transport service provider. This function is called by the
//! application layer to obtain a socket handle.
//
//*****************************************************************************
extern int socket(long domain, long type, long protocol);
//*****************************************************************************
//
//! closesocket
//!
//! @param sd socket handle.
//!
//! @return On success, zero is returned. On error, -1 is returned.
//!
//! @brief The socket function closes a created socket.
//
//*****************************************************************************
extern long closesocket(long sd);
//*****************************************************************************
//
//! accept
//!
//! @param[in] sd socket descriptor (handle)
//! @param[out] addr the argument addr is a pointer to a sockaddr structure
//! This structure is filled in with the address of the
//! peer socket, as known to the communications layer.
//! determined. The exact format of the address returned
//! addr is by the socket's address sockaddr.
//! On this version only AF_INET is supported.
//! This argument returns in network order.
//! @param[out] addrlen the addrlen argument is a value-result argument:
//! it should initially contain the size of the structure
//! pointed to by addr.
//!
//! @return For socket in blocking mode:
//! On success, socket handle. on failure negative
//! For socket in non-blocking mode:
//! - On connection establishment, socket handle
//! - On connection pending, SOC_IN_PROGRESS (-2)
//! - On failure, SOC_ERROR (-1)
//!
//! @brief accept a connection on a socket:
//! This function is used with connection-based socket types
//! (SOCK_STREAM). It extracts the first connection request on the
//! queue of pending connections, creates a new connected socket, and
//! returns a new file descriptor referring to that socket.
//! The newly created socket is not in the listening state.
//! The original socket sd is unaffected by this call.
//! The argument sd is a socket that has been created with socket(),
//! bound to a local address with bind(), and is listening for
//! connections after a listen(). The argument addr is a pointer
//! to a sockaddr structure. This structure is filled in with the
//! address of the peer socket, as known to the communications layer.
//! The exact format of the address returned addr is determined by the
//! socket's address family. The addrlen argument is a value-result
//! argument: it should initially contain the size of the structure
//! pointed to by addr, on return it will contain the actual
//! length (in bytes) of the address returned.
//!
//! @sa socket ; bind ; listen
//
//*****************************************************************************
extern long accept(long sd, sockaddr *addr, socklen_t *addrlen);
//*****************************************************************************
//
//! bind
//!
//! @param[in] sd socket descriptor (handle)
//! @param[out] addr specifies the destination address. On this version
//! only AF_INET is supported.
//! @param[out] addrlen contains the size of the structure pointed to by addr.
//!
//! @return On success, zero is returned. On error, -1 is returned.
//!
//! @brief assign a name to a socket
//! This function gives the socket the local address addr.
//! addr is addrlen bytes long. Traditionally, this is called when a
//! socket is created with socket, it exists in a name space (address
//! family) but has no name assigned.
//! It is necessary to assign a local address before a SOCK_STREAM
//! socket may receive connections.
//!
//! @sa socket ; accept ; listen
//
//*****************************************************************************
extern long bind(long sd, const sockaddr *addr, long addrlen);
//*****************************************************************************
//
//! listen
//!
//! @param[in] sd socket descriptor (handle)
//! @param[in] backlog specifies the listen queue depth. On this version
//! backlog is not supported.
//! @return On success, zero is returned. On error, -1 is returned.
//!
//! @brief listen for connections on a socket
//! The willingness to accept incoming connections and a queue
//! limit for incoming connections are specified with listen(),
//! and then the connections are accepted with accept.
//! The listen() call applies only to sockets of type SOCK_STREAM
//! The backlog parameter defines the maximum length the queue of
//! pending connections may grow to.
//!
//! @sa socket ; accept ; bind
//!
//! @note On this version, backlog is not supported
//
//*****************************************************************************
extern long listen(long sd, long backlog);
//*****************************************************************************
//
//! gethostbyname
//!
//! @param[in] hostname host name
//! @param[in] usNameLen name length
//! @param[out] out_ip_addr This parameter is filled in with host IP address.
//! In case that host name is not resolved,
//! out_ip_addr is zero.
//! @return On success, positive is returned. On error, negative is returned
//!
//! @brief Get host IP by name. Obtain the IP Address of machine on network,
//! by its name.
//!
//! @note On this version, only blocking mode is supported. Also note that
//! the function requires DNS server to be configured prior to its usage.
//
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
extern int gethostbyname(const char * hostname, uint8_t usNameLen, uint32_t* out_ip_addr);
#endif
//*****************************************************************************
//
//! connect
//!
//! @param[in] sd socket descriptor (handle)
//! @param[in] addr specifies the destination addr. On this version
//! only AF_INET is supported.
//! @param[out] addrlen contains the size of the structure pointed to by addr
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief initiate a connection on a socket
//! Function connects the socket referred to by the socket descriptor
//! sd, to the address specified by addr. The addrlen argument
//! specifies the size of addr. The format of the address in addr is
//! determined by the address space of the socket. If it is of type
//! SOCK_DGRAM, this call specifies the peer with which the socket is
//! to be associated; this address is that to which datagrams are to be
//! sent, and the only address from which datagrams are to be received.
//! If the socket is of type SOCK_STREAM, this call attempts to make a
//! connection to another socket. The other socket is specified by
//! address, which is an address in the communications space of the
//! socket. Note that the function implements only blocking behavior
//! thus the caller will be waiting either for the connection
//! establishment or for the connection establishment failure.
//!
//! @sa socket
//
//*****************************************************************************
extern long connect(long sd, const sockaddr *addr, long addrlen);
//*****************************************************************************
//
//! select
//!
//! @param[in] nfds the highest-numbered file descriptor in any of the
//! three sets, plus 1.
//! @param[out] writesds socket descriptors list for write monitoring
//! @param[out] readsds socket descriptors list for read monitoring
//! @param[out] exceptsds socket descriptors list for exception monitoring
//! @param[in] timeout is an upper bound on the amount of time elapsed
//! before select() returns. Null means infinity
//! timeout. The minimum timeout is 5 milliseconds,
//! less than 5 milliseconds will be set
//! automatically to 5 milliseconds.
//! @return On success, select() returns the number of file descriptors
//! contained in the three returned descriptor sets (that is, the
//! total number of bits that are set in readfds, writefds,
//! exceptfds) which may be zero if the timeout expires before
//! anything interesting happens.
//! On error, -1 is returned.
//! *readsds - return the sockets on which Read request will
//! return without delay with valid data.
//! *writesds - return the sockets on which Write request
//! will return without delay.
//! *exceptsds - return the sockets which closed recently.
//!
//! @brief Monitor socket activity
//! Select allow a program to monitor multiple file descriptors,
//! waiting until one or more of the file descriptors become
//! "ready" for some class of I/O operation
//!
//! @Note If the timeout value set to less than 5ms it will automatically set
//! to 5ms to prevent overload of the system
//!
//! @sa socket
//
//*****************************************************************************
extern int select(long nfds, fd_set *readsds, fd_set *writesds,
fd_set *exceptsds, struct timeval *timeout);
//*****************************************************************************
//
//! setsockopt
//!
//! @param[in] sd socket handle
//! @param[in] level defines the protocol level for this option
//! @param[in] optname defines the option name to Interrogate
//! @param[in] optval specifies a value for the option
//! @param[in] optlen specifies the length of the option value
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief set socket options
//! This function manipulate the options associated with a socket.
//! Options may exist at multiple protocol levels; they are always
//! present at the uppermost socket level.
//! When manipulating socket options the level at which the option
//! resides and the name of the option must be specified.
//! To manipulate options at the socket level, level is specified as
//! SOL_SOCKET. To manipulate options at any other level the protocol
//! number of the appropriate protocol controlling the option is
//! supplied. For example, to indicate that an option is to be
//! interpreted by the TCP protocol, level should be set to the
//! protocol number of TCP;
//! The parameters optval and optlen are used to access optval -
//! use for setsockopt(). For getsockopt() they identify a buffer
//! in which the value for the requested option(s) are to
//! be returned. For getsockopt(), optlen is a value-result
//! parameter, initially containing the size of the buffer
//! pointed to by option_value, and modified on return to
//! indicate the actual size of the value returned. If no option
//! value is to be supplied or returned, option_value may be NULL.
//!
//! @Note On this version the following two socket options are enabled:
//! The only protocol level supported in this version
//! is SOL_SOCKET (level).
//! 1. SOCKOPT_RECV_TIMEOUT (optname)
//! SOCKOPT_RECV_TIMEOUT configures recv and recvfrom timeout
//! in milliseconds.
//! In that case optval should be pointer to unsigned long.
//! 2. SOCKOPT_NONBLOCK (optname). sets the socket non-blocking mode on
//! or off.
//! In that case optval should be SOCK_ON or SOCK_OFF (optval).
//!
//! @sa getsockopt
//
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
extern int setsockopt(long sd, long level, long optname, const void *optval,
socklen_t optlen);
#endif
//*****************************************************************************
//
//! getsockopt
//!
//! @param[in] sd socket handle
//! @param[in] level defines the protocol level for this option
//! @param[in] optname defines the option name to Interrogate
//! @param[out] optval specifies a value for the option
//! @param[out] optlen specifies the length of the option value
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief set socket options
//! This function manipulate the options associated with a socket.
//! Options may exist at multiple protocol levels; they are always
//! present at the uppermost socket level.
//! When manipulating socket options the level at which the option
//! resides and the name of the option must be specified.
//! To manipulate options at the socket level, level is specified as
//! SOL_SOCKET. To manipulate options at any other level the protocol
//! number of the appropriate protocol controlling the option is
//! supplied. For example, to indicate that an option is to be
//! interpreted by the TCP protocol, level should be set to the
//! protocol number of TCP;
//! The parameters optval and optlen are used to access optval -
//! use for setsockopt(). For getsockopt() they identify a buffer
//! in which the value for the requested option(s) are to
//! be returned. For getsockopt(), optlen is a value-result
//! parameter, initially containing the size of the buffer
//! pointed to by option_value, and modified on return to
//! indicate the actual size of the value returned. If no option
//! value is to be supplied or returned, option_value may be NULL.
//!
//! @Note On this version the following two socket options are enabled:
//! The only protocol level supported in this version
//! is SOL_SOCKET (level).
//! 1. SOCKOPT_RECV_TIMEOUT (optname)
//! SOCKOPT_RECV_TIMEOUT configures recv and recvfrom timeout
//! in milliseconds.
//! In that case optval should be pointer to unsigned long.
//! 2. SOCKOPT_NONBLOCK (optname). sets the socket non-blocking mode on
//! or off.
//! In that case optval should be SOCK_ON or SOCK_OFF (optval).
//!
//! @sa setsockopt
//
//*****************************************************************************
extern int getsockopt(long sd, long level, long optname, void *optval,
socklen_t *optlen);
//*****************************************************************************
//
//! recv
//!
//! @param[in] sd socket handle
//! @param[out] buf Points to the buffer where the message should be stored
//! @param[in] len Specifies the length in bytes of the buffer pointed to
//! by the buffer argument.
//! @param[in] flags Specifies the type of message reception.
//! On this version, this parameter is not supported.
//!
//! @return Return the number of bytes received, or -1 if an error
//! occurred
//!
//! @brief function receives a message from a connection-mode socket
//!
//! @sa recvfrom
//!
//! @Note On this version, only blocking mode is supported.
//
//*****************************************************************************
extern int recv(long sd, void *buf, long len, long flags);
//*****************************************************************************
//
//! recvfrom
//!
//! @param[in] sd socket handle
//! @param[out] buf Points to the buffer where the message should be stored
//! @param[in] len Specifies the length in bytes of the buffer pointed to
//! by the buffer argument.
//! @param[in] flags Specifies the type of message reception.
//! On this version, this parameter is not supported.
//! @param[in] from pointer to an address structure indicating the source
//! address: sockaddr. On this version only AF_INET is
//! supported.
//! @param[in] fromlen source address structure size
//!
//! @return Return the number of bytes received, or -1 if an error
//! occurred
//!
//! @brief read data from socket
//! function receives a message from a connection-mode or
//! connectionless-mode socket. Note that raw sockets are not
//! supported.
//!
//! @sa recv
//!
//! @Note On this version, only blocking mode is supported.
//
//*****************************************************************************
extern int recvfrom(long sd, void *buf, long len, long flags, sockaddr *from,
socklen_t *fromlen);
//*****************************************************************************
//
//! send
//!
//! @param sd socket handle
//! @param buf Points to a buffer containing the message to be sent
//! @param len message size in bytes
//! @param flags On this version, this parameter is not supported
//!
//! @return Return the number of bytes transmitted, or -1 if an
//! error occurred
//!
//! @brief Write data to TCP socket
//! This function is used to transmit a message to another
//! socket.
//!
//! @Note On this version, only blocking mode is supported.
//!
//! @sa sendto
//
//*****************************************************************************
extern int send(long sd, const void *buf, long len, long flags);
//*****************************************************************************
//
//! sendto
//!
//! @param sd socket handle
//! @param buf Points to a buffer containing the message to be sent
//! @param len message size in bytes
//! @param flags On this version, this parameter is not supported
//! @param to pointer to an address structure indicating the destination
//! address: sockaddr. On this version only AF_INET is
//! supported.
//! @param tolen destination address structure size
//!
//! @return Return the number of bytes transmitted, or -1 if an
//! error occurred
//!
//! @brief Write data to TCP socket
//! This function is used to transmit a message to another
//! socket.
//!
//! @Note On this version, only blocking mode is supported.
//!
//! @sa send
//
//*****************************************************************************
extern int sendto(long sd, const void *buf, long len, long flags,
const sockaddr *to, socklen_t tolen);
//*****************************************************************************
//
//! mdnsAdvertiser
//!
//! @param[in] mdnsEnabled flag to enable/disable the mDNS feature
//! @param[in] deviceServiceName Service name as part of the published
//! canonical domain name
//! @param[in] deviceServiceNameLength Length of the service name
//!
//!
//! @return On success, zero is returned, return SOC_ERROR if socket was not
//! opened successfully, or if an error occurred.
//!
//! @brief Set CC3000 in mDNS advertiser mode in order to advertise itself.
//
//*****************************************************************************
extern int mdnsAdvertiser(unsigned short mdnsEnabled, char * deviceServiceName, unsigned short deviceServiceNameLength);
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __SOCKET_H__

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,533 @@
/*****************************************************************************
*
* wlan.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
Adapted for use with the Arduino/AVR by KTOWN for Adafruit Industries
This library works with the Adafruit CC3000 breakout
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
*****************************************************************************/
#ifndef __WLAN_H__
#define __WLAN_H__
#include "cc3000_common.h"
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C" {
#endif
#define WLAN_SEC_UNSEC (0)
#define WLAN_SEC_WEP (1)
#define WLAN_SEC_WPA (2)
#define WLAN_SEC_WPA2 (3)
//*****************************************************************************
//
//! \addtogroup wlan_api
//! @{
//
//*****************************************************************************
//*****************************************************************************
//
//! wlan_init
//!
//! @param sWlanCB Asynchronous events callback.
//! 0 no event call back.
//! -call back parameters:
//! 1) event_type: HCI_EVNT_WLAN_UNSOL_CONNECT connect event,
//! HCI_EVNT_WLAN_UNSOL_DISCONNECT disconnect event,
//! HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE config done,
//! HCI_EVNT_WLAN_UNSOL_DHCP dhcp report,
//! HCI_EVNT_WLAN_ASYNC_PING_REPORT ping report OR
//! HCI_EVNT_WLAN_KEEPALIVE keepalive.
//! 2) data: pointer to extra data that received by the event
//! (NULL no data).
//! 3) length: data length.
//! -Events with extra data:
//! HCI_EVNT_WLAN_UNSOL_DHCP: 4 bytes IP, 4 bytes Mask,
//! 4 bytes default gateway, 4 bytes DHCP server and 4 bytes
//! for DNS server.
//! HCI_EVNT_WLAN_ASYNC_PING_REPORT: 4 bytes Packets sent,
//! 4 bytes Packets received, 4 bytes Min round time,
//! 4 bytes Max round time and 4 bytes for Avg round time.
//!
//! @param sFWPatches 0 no patch or pointer to FW patches
//! @param sDriverPatches 0 no patch or pointer to driver patches
//! @param sBootLoaderPatches 0 no patch or pointer to bootloader patches
//! @param sReadWlanInterruptPin init callback. the callback read wlan
//! interrupt status.
//! @param sWlanInterruptEnable init callback. the callback enable wlan
//! interrupt.
//! @param sWlanInterruptDisable init callback. the callback disable wlan
//! interrupt.
//! @param sWriteWlanPin init callback. the callback write value
//! to device pin.
//!
//! @return none
//!
//! @sa wlan_set_event_mask , wlan_start , wlan_stop
//!
//! @brief Initialize wlan driver
//!
//! @warning This function must be called before ANY other wlan driver function
//
//*****************************************************************************
extern void wlan_init( tWlanCB sWlanCB,
tFWPatches sFWPatches,
tDriverPatches sDriverPatches,
tBootLoaderPatches sBootLoaderPatches,
tWlanReadInteruptPin sReadWlanInterruptPin,
tWlanInterruptEnable sWlanInterruptEnable,
tWlanInterruptDisable sWlanInterruptDisable,
tWriteWlanPin sWriteWlanPin);
//*****************************************************************************
//
//! wlan_start
//!
//! @param usPatchesAvailableAtHost - flag to indicate if patches available
//! from host or from EEPROM. Due to the
//! fact the patches are burn to the EEPROM
//! using the patch programmer utility, the
//! patches will be available from the EEPROM
//! and not from the host.
//!
//! @return none
//!
//! @brief Start WLAN device. This function asserts the enable pin of
//! the device (WLAN_EN), starting the HW initialization process.
//! The function blocked until device Initialization is completed.
//! Function also configure patches (FW, driver or bootloader)
//! and calls appropriate device callbacks.
//!
//! @Note Prior calling the function wlan_init shall be called.
//! @Warning This function must be called after wlan_init and before any
//! other wlan API
//! @sa wlan_init , wlan_stop
//!
//
//*****************************************************************************
extern void wlan_start(unsigned short usPatchesAvailableAtHost);
//*****************************************************************************
//
//! wlan_stop
//!
//! @param none
//!
//! @return none
//!
//! @brief Stop WLAN device by putting it into reset state.
//!
//! @sa wlan_start
//
//*****************************************************************************
extern void wlan_stop(void);
//*****************************************************************************
//
//! wlan_connect
//!
//! @param sec_type security options:
//! WLAN_SEC_UNSEC,
//! WLAN_SEC_WEP (ASCII support only),
//! WLAN_SEC_WPA or WLAN_SEC_WPA2
//! @param ssid up to 32 bytes and is ASCII SSID of the AP
//! @param ssid_len length of the SSID
//! @param bssid 6 bytes specified the AP bssid
//! @param key up to 16 bytes specified the AP security key
//! @param key_len key length
//!
//! @return On success, zero is returned. On error, negative is returned.
//! Note that even though a zero is returned on success to trigger
//! connection operation, it does not mean that CCC3000 is already
//! connected. An asynchronous "Connected" event is generated when
//! actual association process finishes and CC3000 is connected to
//! the AP. If DHCP is set, An asynchronous "DHCP" event is
//! generated when DHCP process is finish.
//!
//!
//! @brief Connect to AP
//! @warning Please Note that when connection to AP configured with security
//! type WEP, please confirm that the key is set as ASCII and not
//! as HEX.
//! @sa wlan_disconnect
//
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
extern long wlan_connect(unsigned long ulSecType, const char *ssid, long ssid_len,
unsigned char *bssid, unsigned char *key, long key_len);
#else
extern long wlan_connect(const char *ssid, long ssid_len);
#endif
//*****************************************************************************
//
//! wlan_disconnect
//!
//! @return 0 disconnected done, other CC3000 already disconnected
//!
//! @brief Disconnect connection from AP.
//!
//! @sa wlan_connect
//
//*****************************************************************************
extern long wlan_disconnect(void);
//*****************************************************************************
//
//! wlan_add_profile
//!
//! @param ulSecType WLAN_SEC_UNSEC,WLAN_SEC_WEP,WLAN_SEC_WPA,WLAN_SEC_WPA2
//! @param ucSsid ssid SSID up to 32 bytes
//! @param ulSsidLen ssid length
//! @param ucBssid bssid 6 bytes
//! @param ulPriority ulPriority profile priority. Lowest priority:0.
//! @param ulPairwiseCipher_Or_TxKeyLen key length for WEP security
//! @param ulGroupCipher_TxKeyIndex key index
//! @param ulKeyMgmt KEY management
//! @param ucPf_OrKey security key
//! @param ulPassPhraseLen security key length for WPA\WPA2
//!
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief When auto start is enabled, the device connects to
//! station from the profiles table. Up to 7 profiles are supported.
//! If several profiles configured the device choose the highest
//! priority profile, within each priority group, device will choose
//! profile based on security policy, signal strength, etc
//! parameters. All the profiles are stored in CC3000 NVMEM.
//!
//! @sa wlan_ioctl_del_profile
//
//*****************************************************************************
extern long wlan_add_profile(unsigned long ulSecType, unsigned char* ucSsid,
unsigned long ulSsidLen,
unsigned char *ucBssid,
unsigned long ulPriority,
unsigned long ulPairwiseCipher_Or_Key,
unsigned long ulGroupCipher_TxKeyLen,
unsigned long ulKeyMgmt,
unsigned char* ucPf_OrKey,
unsigned long ulPassPhraseLen);
//*****************************************************************************
//
//! wlan_ioctl_del_profile
//!
//! @param index number of profile to delete
//!
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief Delete WLAN profile
//!
//! @Note In order to delete all stored profile, set index to 255.
//!
//! @sa wlan_add_profile
//
//*****************************************************************************
extern long wlan_ioctl_del_profile(unsigned long ulIndex);
//*****************************************************************************
//
//! wlan_set_event_mask
//!
//! @param mask mask option:
//! HCI_EVNT_WLAN_UNSOL_CONNECT connect event
//! HCI_EVNT_WLAN_UNSOL_DISCONNECT disconnect event
//! HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE smart config done
//! HCI_EVNT_WLAN_UNSOL_INIT init done
//! HCI_EVNT_WLAN_UNSOL_DHCP dhcp event report
//! HCI_EVNT_WLAN_ASYNC_PING_REPORT ping report
//! HCI_EVNT_WLAN_KEEPALIVE keepalive
//! HCI_EVNT_WLAN_TX_COMPLETE - disable information on end of transmission
//! Saved: no.
//!
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief Mask event according to bit mask. In case that event is
//! masked (1), the device will not send the masked event to host.
//
//*****************************************************************************
extern long wlan_set_event_mask(unsigned long ulMask);
//*****************************************************************************
//
//! wlan_ioctl_statusget
//!
//! @param none
//!
//! @return WLAN_STATUS_DISCONNECTED, WLAN_STATUS_SCANING,
//! STATUS_CONNECTING or WLAN_STATUS_CONNECTED
//!
//! @brief get wlan status: disconnected, scanning, connecting or connected
//
//*****************************************************************************
extern long wlan_ioctl_statusget(void);
//*****************************************************************************
//
//! wlan_ioctl_set_connection_policy
//!
//! @param should_connect_to_open_ap enable(1), disable(0) connect to any
//! available AP. This parameter corresponds to the configuration of
//! item # 3 in the brief description.
//! @param should_use_fast_connect enable(1), disable(0). if enabled, tries
//! to connect to the last connected AP. This parameter corresponds
//! to the configuration of item # 1 in the brief description.
//! @param auto_start enable(1), disable(0) auto connect
//! after reset and periodically reconnect if needed. This
//! configuration configures option 2 in the above description.
//!
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief When auto is enabled, the device tries to connect according
//! the following policy:
//! 1) If fast connect is enabled and last connection is valid,
//! the device will try to connect to it without the scanning
//! procedure (fast). The last connection will be marked as
//! invalid, due to adding/removing profile.
//! 2) If profile exists, the device will try to connect it
//! (Up to seven profiles).
//! 3) If fast and profiles are not found, and open mode is
//! enabled, the device will try to connect to any AP.
//! * Note that the policy settings are stored in the CC3000 NVMEM.
//!
//! @sa wlan_add_profile , wlan_ioctl_del_profile
//
//*****************************************************************************
extern long wlan_ioctl_set_connection_policy(
unsigned long should_connect_to_open_ap,
unsigned long should_use_fast_connect,
unsigned long ulUseProfiles);
//*****************************************************************************
//
//! wlan_ioctl_get_scan_results
//!
//! @param[in] scan_timeout parameter not supported
//! @param[out] ucResults scan result (_wlan_full_scan_results_args_t)
//!
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief Gets entry from scan result table.
//! The scan results are returned one by one, and each entry
//! represents a single AP found in the area. The following is a
//! format of the scan result:
//! - 4 Bytes: number of networks found
//! - 4 Bytes: The status of the scan: 0 - aged results,
//! 1 - results valid, 2 - no results
//! - 42 bytes: Result entry, where the bytes are arranged as follows:
//!
//! - 1 bit isValid - is result valid or not
//! - 7 bits rssi - RSSI value;
//! - 2 bits: securityMode - security mode of the AP:
//! 0 - Open, 1 - WEP, 2 WPA, 3 WPA2
//! - 6 bits: SSID name length
//! - 2 bytes: the time at which the entry has entered into
//! scans result table
//! - 32 bytes: SSID name
//! - 6 bytes: BSSID
//!
//! @Note scan_timeout, is not supported on this version.
//!
//! @sa wlan_ioctl_set_scan_params
//
//*****************************************************************************
extern long wlan_ioctl_get_scan_results(unsigned long ulScanTimeout,
unsigned char *ucResults);
//*****************************************************************************
//
//! wlan_ioctl_set_scan_params
//!
//! @param uiEnable - start/stop application scan:
//! 1 = start scan with default interval value of 10 min.
//! in order to set a different scan interval value apply the value
//! in milliseconds. minimum 1 second. 0=stop). Wlan reset
//! (wlan_stop() wlan_start()) is needed when changing scan interval
//! value. Saved: No
//! @param uiMinDwellTime minimum dwell time value to be used for each
//! channel, in milliseconds. Saved: yes
//! Recommended Value: 100 (Default: 20)
//! @param uiMaxDwellTime maximum dwell time value to be used for each
//! channel, in milliseconds. Saved: yes
//! Recommended Value: 100 (Default: 30)
//! @param uiNumOfProbeRequests max probe request between dwell time.
//! Saved: yes. Recommended Value: 5 (Default:2)
//! @param uiChannelMask bitwise, up to 13 channels (0x1fff).
//! Saved: yes. Default: 0x7ff
//! @param uiRSSIThreshold RSSI threshold. Saved: yes (Default: -80)
//! @param uiSNRThreshold NSR threshold. Saved: yes (Default: 0)
//! @param uiDefaultTxPower probe Tx power. Saved: yes (Default: 205)
//! @param aiIntervalList pointer to array with 16 entries (16 channels)
//! each entry (unsigned long) holds timeout between periodic scan
//! (connection scan) - in milliseconds. Saved: yes. Default 2000ms.
//!
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief start and stop scan procedure. Set scan parameters.
//!
//! @Note uiDefaultTxPower, is not supported on this version.
//!
//! @sa wlan_ioctl_get_scan_results
//
//*****************************************************************************
extern long wlan_ioctl_set_scan_params(unsigned long uiEnable, unsigned long
uiMinDwellTime,unsigned long uiMaxDwellTime,
unsigned long uiNumOfProbeRequests,
unsigned long uiChannelMask,
long iRSSIThreshold,unsigned long uiSNRThreshold,
unsigned long uiDefaultTxPower,
unsigned long *aiIntervalList);
//*****************************************************************************
//
//! wlan_smart_config_start
//!
//! @param algoEncryptedFlag indicates whether the information is encrypted
//!
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief Start to acquire device profile. The device acquire its own
//! profile, if profile message is found. The acquired AP information
//! is stored in CC3000 EEPROM only in case AES128 encryption is used.
//! In case AES128 encryption is not used, a profile is created by
//! CC3000 internally.
//!
//! @Note An asynchronous event - Smart Config Done will be generated as soon
//! as the process finishes successfully.
//!
//! @sa wlan_smart_config_set_prefix , wlan_smart_config_stop
//
//*****************************************************************************
extern long wlan_smart_config_start(unsigned long algoEncryptedFlag);
//*****************************************************************************
//
//! wlan_smart_config_stop
//!
//! @param algoEncryptedFlag indicates whether the information is encrypted
//!
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief Stop the acquire profile procedure
//!
//! @sa wlan_smart_config_start , wlan_smart_config_set_prefix
//
//*****************************************************************************
extern long wlan_smart_config_stop(void);
//*****************************************************************************
//
//! wlan_smart_config_set_prefix
//!
//! @param newPrefix 3 bytes identify the SSID prefix for the Smart Config.
//!
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief Configure station ssid prefix. The prefix is used internally
//! in CC3000. It should always be TTT.
//!
//! @Note The prefix is stored in CC3000 NVMEM
//!
//! @sa wlan_smart_config_start , wlan_smart_config_stop
//
//*****************************************************************************
extern long wlan_smart_config_set_prefix(char* cNewPrefix);
//*****************************************************************************
//
//! wlan_smart_config_process
//!
//! @param none
//!
//! @return On success, zero is returned. On error, -1 is returned
//!
//! @brief process the acquired data and store it as a profile. The acquired
//! AP information is stored in CC3000 EEPROM encrypted.
//! The encrypted data is decrypted and stored as a profile.
//! behavior is as defined by connection policy.
//
//*****************************************************************************
extern long wlan_smart_config_process(void);
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __WLAN_H__

View File

@ -0,0 +1,7 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
[env:microduino]
platform = atmelavr
framework = arduino
board = 644pa16m

View File

@ -0,0 +1,185 @@
/***************************************************
Adafruit CC3000 Breakout/Shield TCP Echo Server
This is a simple implementation of the echo
protocol, RFC 862 http://tools.ietf.org/html/rfc862 ,
for the Arduino platform and Adafruit CC3000 breakout
or shield. This sketch will create a TCP server that
listens by default on port 7 and echos back any data
received. Up to 3 clients can be connected concurrently
to the server. This sketch is meant as an example of how
to write a simple server with the Arduino and CC3000.
See the CC3000 tutorial on Adafruit's learning system
for more information on setting up and using the
CC3000:
http://learn.adafruit.com/adafruit-cc3000-wifi
Requirements:
This sketch requires the Adafruit CC3000 library. You can
download the library from:
https://github.com/adafruit/Adafruit_CC3000_Library
For information on installing libraries in the Arduino IDE
see this page:
http://arduino.cc/en/Guide/Libraries
Usage:
Update the SSID and, if necessary, the CC3000 hardware pin
information below, then run the sketch and check the
output of the serial port. After connecting to the
wireless network successfully the sketch will output
the IP address of the server and start listening for
connections. Once listening for connections, connect
to the server from your computer using a telnet client
on port 7.
For example on Linux or Mac OSX, if your CC3000 has an
IP address 192.168.1.100 you would execute in a command
window:
telnet 192.168.1.100 7
After connecting, notice that as you type input and
press enter to send it the CC3000 will echo back exactly
what you typed. Press ctrl-] and type quit at the prompt
to close the telnet session.
On Windows you'll need to download a telnet client. PuTTY
is a good, free GUI client:
http://www.chiark.greenend.org.uk/~sgtatham/putty/
License:
This example is copyright (c) 2013 Tony DiCola (tony@tonydicola.com)
and is released under an open source MIT license. See details at:
http://opensource.org/licenses/MIT
This code was adapted from Adafruit CC3000 library example
code which has the following license:
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried & Kevin Townsend for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#include <Adafruit_CC3000.h>
#include <SPI.h>
#include "utility/debug.h"
#include "utility/socket.h"
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIVIDER); // you can change this clock speed
#define WLAN_SSID "myNetwork" // cannot be longer than 32 characters!
#define WLAN_PASS "myPassword"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY WLAN_SEC_WPA2
#define LISTEN_PORT 7 // What TCP port to listen on for connections. The echo protocol uses port 7.
Adafruit_CC3000_Server echoServer(LISTEN_PORT);
void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC);
/* Initialise the module */
Serial.println(F("\nInitializing..."));
if (!cc3000.begin())
{
Serial.println(F("Couldn't begin()! Check your wiring?"));
while(1);
}
Serial.print(F("\nAttempting to connect to ")); Serial.println(WLAN_SSID);
if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println(F("Failed!"));
while(1);
}
Serial.println(F("Connected!"));
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP())
{
delay(100); // ToDo: Insert a DHCP timeout!
}
/* Display the IP address DNS, Gateway, etc. */
while (! displayConnectionDetails()) {
delay(1000);
}
/*********************************************************/
/* You can safely remove this to save some flash memory! */
/*********************************************************/
Serial.println(F("\r\nNOTE: This sketch may cause problems with other sketches"));
Serial.println(F("since the .disconnect() function is never called, so the"));
Serial.println(F("AP may refuse connection requests from the CC3000 until a"));
Serial.println(F("timeout period passes. This is normal behaviour since"));
Serial.println(F("there isn't an obvious moment to disconnect with a server.\r\n"));
// Start listening for connections
echoServer.begin();
Serial.println(F("Listening for connections..."));
}
void loop(void)
{
// Try to get a client which is connected.
Adafruit_CC3000_ClientRef client = echoServer.available();
if (client) {
// Check if there is data available to read.
if (client.available() > 0) {
// Read a byte and write it to all clients.
uint8_t ch = client.read();
client.write(ch);
}
}
}
/**************************************************************************/
/*!
@brief Tries to read the IP address and other connection details
*/
/**************************************************************************/
bool displayConnectionDetails(void)
{
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
{
Serial.println(F("Unable to retrieve the IP Address!\r\n"));
return false;
}
else
{
Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
Serial.println();
return true;
}
}

View File

@ -1,18 +1,18 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
VERSION = (0, 4, 0)
VERSION = (0, 9, 0)
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"
__description__ = ("A console tool to build code with different "
"development platforms")
__url__ = "https://github.com/ivankravets/platformio"
__description__ = ("A cross-platform code builder and "
"the missing library manager")
__url__ = "http://platformio.ikravets.com"
__author__ = "Ivan Kravets"
__email__ = "me@ikravets.com"
__license__ = "MIT Licence"
__license__ = "MIT License"
__copyright__ = "Copyright (C) 2014 Ivan Kravets"
__pkgmanifesturl__ = "http://platformio.ikravets.com/packages/manifest.json"
__apiurl__ = "http://api.platformio.ikravets.com"

View File

@ -6,14 +6,14 @@ from os.path import join
from sys import exit as sys_exit
from traceback import format_exc
from click import command, MultiCommand, version_option
import click
from platformio import __version__
from platformio import __version__, maintenance
from platformio.exception import PlatformioException, UnknownCLICommand
from platformio.util import get_source_dir
class PlatformioCLI(MultiCommand):
class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
def list_commands(self, ctx):
cmds = []
@ -26,6 +26,7 @@ class PlatformioCLI(MultiCommand):
return cmds
def get_command(self, ctx, name):
mod = None
try:
mod = __import__("platformio.commands." + name,
None, None, ["cli"])
@ -34,18 +35,27 @@ class PlatformioCLI(MultiCommand):
return mod.cli
@command(cls=PlatformioCLI)
@version_option(__version__, prog_name="PlatformIO")
def cli():
pass
@click.command(cls=PlatformioCLI)
@click.version_option(__version__, prog_name="PlatformIO")
@click.pass_context
def cli(ctx):
maintenance.on_platformio_start(ctx)
@cli.resultcallback()
@click.pass_context
def process_result(ctx, result):
maintenance.on_platformio_end(ctx, result)
def main():
try:
cli()
cli(None)
except Exception as e: # pylint: disable=W0703
maintenance.on_platformio_exception(e)
if isinstance(e, PlatformioException):
sys_exit("Error: " + str(e))
click.echo("Error: " + str(e))
sys_exit(1)
else:
print format_exc()

111
platformio/app.py Normal file
View File

@ -0,0 +1,111 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import json
from os.path import isfile, join
from platformio import __version__
from platformio.exception import InvalidSettingName, InvalidSettingValue
from platformio.util import get_home_dir
DEFAULT_SETTINGS = {
"check_platformio_interval": {
"description": "Check for the new PlatformIO interval (days)",
"value": 3
},
"check_platforms_interval": {
"description": "Check for the platform updates interval (days)",
"value": 7
},
"check_libraries_interval": {
"description": "Check for the library updates interval (days)",
"value": 7
},
"auto_update_platforms": {
"description": "Automatically update platforms (Yes/No)",
"value": True
},
"auto_update_libraries": {
"description": "Automatically update libraries (Yes/No)",
"value": True
},
"enable_telemetry": {
"description": ("Shares commands, platforms and libraries usage"
" to help us make PlatformIO better (Yes/No)"),
"value": True
}
}
class State(object):
def __init__(self, path=None):
self.path = path
if not self.path:
self.path = join(get_home_dir(), "appstate.json")
self._state = {}
def __enter__(self):
try:
if isfile(self.path):
with open(self.path, "r") as fp:
self._state = json.load(fp)
except ValueError:
self._state = {}
return self._state
def __exit__(self, type_, value, traceback):
with open(self.path, "w") as fp:
if "dev" in __version__:
json.dump(self._state, fp, indent=4)
else:
json.dump(self._state, fp)
def get_state_item(name, default=None):
with State() as data:
return data.get(name, default)
def set_state_item(name, value):
with State() as data:
data[name] = value
def get_setting(name):
if name not in DEFAULT_SETTINGS:
raise InvalidSettingName(name)
with State() as data:
if "settings" in data and name in data['settings']:
return data['settings'][name]
return DEFAULT_SETTINGS[name]['value']
def set_setting(name, value):
if name not in DEFAULT_SETTINGS:
raise InvalidSettingName(name)
defdata = DEFAULT_SETTINGS[name]
try:
if "validator" in defdata:
value = defdata['validator']()
elif (isinstance(defdata['value'], bool)
and not isinstance(value, bool)):
value = str(value).lower() in ("yes", "y", "1")
elif isinstance(defdata['value'], int):
value = int(value)
except Exception:
raise InvalidSettingValue(value, name)
with State() as data:
if "settings" not in data:
data['settings'] = {}
data['settings'][name] = value
def reset_settings():
with State() as data:
if "settings" in data:
del data['settings']

View File

@ -1,12 +1,22 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os.path import isdir, join
try:
from platformio.util import get_home_dir
except ImportError:
import sys
for _path in sys.path:
if "platformio" in _path:
sys.path.insert(0, _path[:_path.rfind("platformio")-1])
break
from platformio.util import get_home_dir
from SCons.Script import (DefaultEnvironment, Exit, SConscript,
SConscriptChdir, Variables)
from os.path import join
from platformio.util import (get_home_dir, get_pioenvs_dir, get_project_dir,
from SCons.Script import (DefaultEnvironment, SConscript, SConscriptChdir,
Variables)
from platformio.util import (get_lib_dir, get_pioenvs_dir, get_project_dir,
get_source_dir)
# AllowSubstExceptions()
@ -14,8 +24,16 @@ from platformio.util import (get_home_dir, get_pioenvs_dir, get_project_dir,
# allow common variables from INI file
commonvars = Variables(None)
commonvars.AddVariables(
("BUILD_SCRIPT",),
("PIOENV",),
("PLATFORM",),
# package aliases
("PIOPACKAGE_TOOLCHAIN",),
("PIOPACKAGE_UPLOADER",),
("PIOPACKAGE_FRAMEWORK",),
# options
("FRAMEWORK",),
("BUILD_FLAGS",),
("SRCBUILD_FLAGS",),
@ -36,31 +54,27 @@ DefaultEnvironment(
toolpath=[join("$PIOBUILDER_DIR", "tools")],
variables=commonvars,
PIOBUILDER_DIR=join(get_source_dir(), "builder"),
PIOHOME_DIR=get_home_dir(),
PROJECT_DIR=get_project_dir(),
PIOENVS_DIR=get_pioenvs_dir(),
PLATFORMIOHOME_DIR=get_home_dir(),
PLATFORM_DIR=join("$PLATFORMIOHOME_DIR", "$PLATFORM"),
PLATFORMFW_DIR=join("$PLATFORM_DIR", "frameworks", "$FRAMEWORK"),
PLATFORMTOOLS_DIR=join("$PLATFORM_DIR", "tools"),
PIOBUILDER_DIR=join(get_source_dir(), "builder"),
PIOPACKAGES_DIR=join("$PIOHOME_DIR", "packages"),
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_FRAMEWORK"),
BUILD_DIR=join("$PIOENVS_DIR", "$PIOENV"),
LIBSOURCE_DIRS=[
join("$PROJECT_DIR", "lib"),
get_lib_dir(),
join("$PLATFORMFW_DIR", "libraries"),
]
)
env = DefaultEnvironment()
if not isdir(env['PLATFORMIOHOME_DIR']):
Exit("You haven't installed any platforms yet. Please use "
"`platformio install` command")
elif not isdir(env.subst("$PLATFORM_DIR")):
Exit("An '%s' platform hasn't been installed yet. Please use "
"`platformio install %s` command" % (env['PLATFORM'],
env['PLATFORM']))
env.PrependENVPath(
"PATH",
env.subst(join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN", "bin"))
)
SConscriptChdir(0)
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "${PLATFORM}.py")))
SConscript(env.subst("$BUILD_SCRIPT"))

View File

@ -6,11 +6,12 @@
"""
from os.path import join
from time import sleep
from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default,
DefaultEnvironment, Exit)
from platformio.util import reset_serialport
from platformio.util import get_serialports, reset_serialport
env = DefaultEnvironment()
@ -33,10 +34,10 @@ env.Replace(
CCFLAGS=[
"-g", # include debugging info (so errors include line numbers)
"-Os", # optimize for size
"-Wall", # show warnings
# "-Wall", # show warnings
"-ffunction-sections", # place each function in its own section
"-fdata-sections",
"-MMD", # output dependancy info
"-MMD", # output dependency info
"-mmcu=$BOARD_MCU"
],
@ -52,13 +53,13 @@ env.Replace(
"-mmcu=$BOARD_MCU"
],
UPLOADER=join("$PLATFORMTOOLS_DIR", "avrdude", "avrdude"),
UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"),
UPLOADERFLAGS=[
"-V", # do not verify
"-q", # suppress progress output
"-D", # disable auto erase for flash memory
"-p", "$BOARD_MCU",
"-C", join("$PLATFORMTOOLS_DIR", "avrdude", "avrdude.conf"),
"-C", join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude.conf"),
"-c", "$UPLOAD_PROTOCOL",
"-b", "$UPLOAD_SPEED",
"-P", "$UPLOAD_PORT"
@ -99,13 +100,31 @@ env.Append(
)
)
BUILT_LIBS = env.ProcessGeneral()
def reset_device():
def rpi_sysgpio(path, value):
with open(path, "w") as f:
f.write(str(value))
if env.subst("$BOARD") == "raspduino":
rpi_sysgpio("/sys/class/gpio/export", 18)
rpi_sysgpio("/sys/class/gpio/gpio18/direction", "out")
rpi_sysgpio("/sys/class/gpio/gpio18/value", 1)
sleep(0.1)
rpi_sysgpio("/sys/class/gpio/gpio18/value", 0)
rpi_sysgpio("/sys/class/gpio/unexport", 18)
else:
return reset_serialport(env.subst("$UPLOAD_PORT"))
CORELIBS = env.ProcessGeneral()
#
# Target: Build executable and linkable firmware
#
target_elf = env.BuildFirmware(BUILT_LIBS + ["m"])
target_elf = env.BuildFirmware(CORELIBS + ["m"])
#
# Target: Extract EEPROM data (from EEMEM directive) to .eep file
@ -128,8 +147,7 @@ else:
#
upload = env.Alias(["upload", "uploadlazy"], target_hex, [
lambda target, source, env: reset_serialport(env.subst("$UPLOAD_PORT")),
"$UPLOADHEXCMD"])
lambda target, source, env: reset_device(), "$UPLOADHEXCMD"])
AlwaysBuild(upload)
#
@ -137,8 +155,7 @@ AlwaysBuild(upload)
#
uploadeep = env.Alias("uploadeep", target_eep, [
lambda target, source, env: reset_serialport(env.subst("$UPLOAD_PORT")),
"$UPLOADEEPCMD"])
lambda target, source, env: reset_device(), "$UPLOADEEPCMD"])
AlwaysBuild(uploadeep)
#
@ -147,9 +164,19 @@ AlwaysBuild(uploadeep)
is_uptarget = (set(["upload", "uploadlazy", "uploadeep"]) &
set(COMMAND_LINE_TARGETS))
if is_uptarget and not env.subst("$UPLOAD_PORT"):
Exit("Please specify environment 'upload_port' or use global "
"--upload-port option.")
if is_uptarget:
# try autodetect upload port
if "UPLOAD_PORT" not in env:
for item in get_serialports():
if "VID:PID" in item['hwid']:
print "Auto-detected UPLOAD_PORT: %s" % item['port']
env['UPLOAD_PORT'] = item['port']
break
if "UPLOAD_PORT" not in env:
Exit("Please specify environment 'upload_port' or use global "
"--upload-port option.")
#
# Setup default targets

View File

@ -31,18 +31,19 @@ if "build.usb_product" in BOARD_OPTIONS:
# include board variant
env.VariantDir(
join("$BUILD_DIR", "variant"),
join("$BUILD_DIR", "FrameworkArduinoVariant"),
join("$PLATFORMFW_DIR", "variants", BOARD_OPTIONS['build.variant'])
)
env.Append(
CPPDEFINES=[
"ARDUINO_ARCH_AVR", # @TODO Should be dynamic
"ARDUINO=%d" % ARDUINO_VERSION,
"ARDUINO_%s" % BOARD_OPTIONS['build.board']
] + ARDUINO_USBDEFINES,
CPPPATH=[
join("$BUILD_DIR", "core"),
join("$BUILD_DIR", "variant")
join("$BUILD_DIR", "FrameworkArduino"),
join("$BUILD_DIR", "FrameworkArduinoVariant")
]
)
@ -63,7 +64,7 @@ libs = []
#
libs.append(env.BuildLibrary(
join("$BUILD_DIR", "core"),
join("$BUILD_DIR", "FrameworkArduino"),
join("$PLATFORMFW_DIR", "cores", BOARD_OPTIONS['build.core'])
))

Some files were not shown because too many files have changed in this diff Show More