First commit

master
marcel 5 months ago
commit 7d38f2cb37
  1. 15
      CHANGELOG.md
  2. 232
      LICENSE
  3. 79
      README.md
  4. BIN
      datasheet/Arduino-Pro-Mini-schematic.pdf
  5. BIN
      datasheet/DS-15901-Weather_Meter.pdf
  6. BIN
      datasheet/Si7021.pdf
  7. BIN
      datasheet/Weather_Sensor_Assembly_Updated.pdf
  8. BIN
      datasheet/bmp280.pdf
  9. 340
      firmware/I2C-Sensor-Lib_iLib/LICENSE
  10. 25
      firmware/I2C-Sensor-Lib_iLib/README.md
  11. 192
      firmware/I2C-Sensor-Lib_iLib/examples/WS2812B_Clock_90Led/WS2812B_Clock_90Led.ino
  12. 102
      firmware/I2C-Sensor-Lib_iLib/examples/atmel_math_power_and_scale/atmel_math_power_and_scale.ino
  13. 36
      firmware/I2C-Sensor-Lib_iLib/examples/firstrun_ledBlink/firstrun_ledBlink.ino
  14. 59
      firmware/I2C-Sensor-Lib_iLib/examples/i2c_BMP280/i2c_BMP280.ino
  15. 44
      firmware/I2C-Sensor-Lib_iLib/examples/i2c_L3G/i2c_L3G.ino
  16. 53
      firmware/I2C-Sensor-Lib_iLib/examples/i2c_LPS331/i2c_LPS331.ino
  17. 44
      firmware/I2C-Sensor-Lib_iLib/examples/i2c_MAG3110/i2c_MAG3110.ino
  18. 39
      firmware/I2C-Sensor-Lib_iLib/examples/i2c_MAX44009/i2c_MAX44009.ino
  19. 45
      firmware/I2C-Sensor-Lib_iLib/examples/i2c_MMA8451/i2c_MMA8451.ino
  20. 49
      firmware/I2C-Sensor-Lib_iLib/examples/i2c_MPL3115A2/i2c_MPL3115A2.ino
  21. 63
      firmware/I2C-Sensor-Lib_iLib/examples/i2c_MPU9250/i2c_MPU9250.ino
  22. 63
      firmware/I2C-Sensor-Lib_iLib/examples/i2c_PCF2127/i2c_PCF2127.ino
  23. 43
      firmware/I2C-Sensor-Lib_iLib/examples/i2c_SI7021/i2c_SI7021.ino
  24. 53
      firmware/I2C-Sensor-Lib_iLib/examples/i2c_TCS3772/i2c_TCS3772.ino
  25. 37
      firmware/I2C-Sensor-Lib_iLib/examples/i2c_probeBus/i2c_probeBus.ino
  26. 54
      firmware/I2C-Sensor-Lib_iLib/examples/spi_rfm95/spi_rfm95.ino
  27. 189
      firmware/I2C-Sensor-Lib_iLib/keywords.txt
  28. 20
      firmware/I2C-Sensor-Lib_iLib/library.json
  29. 9
      firmware/I2C-Sensor-Lib_iLib/library.properties
  30. 211
      firmware/I2C-Sensor-Lib_iLib/src/WS2812B.h
  31. 147
      firmware/I2C-Sensor-Lib_iLib/src/atmel_eFunction.h
  32. 239
      firmware/I2C-Sensor-Lib_iLib/src/atmel_hdlc.h
  33. 160
      firmware/I2C-Sensor-Lib_iLib/src/atmel_math_power_and_scale.h
  34. 149
      firmware/I2C-Sensor-Lib_iLib/src/atmel_spektrumSerial.h
  35. 44
      firmware/I2C-Sensor-Lib_iLib/src/atmel_vcc.h
  36. 13
      firmware/I2C-Sensor-Lib_iLib/src/i2c.cpp
  37. 173
      firmware/I2C-Sensor-Lib_iLib/src/i2c.h
  38. 343
      firmware/I2C-Sensor-Lib_iLib/src/i2c_BMP280.h
  39. 361
      firmware/I2C-Sensor-Lib_iLib/src/i2c_FAN5421.h
  40. 302
      firmware/I2C-Sensor-Lib_iLib/src/i2c_L3G.h
  41. 287
      firmware/I2C-Sensor-Lib_iLib/src/i2c_LPS331.h
  42. 207
      firmware/I2C-Sensor-Lib_iLib/src/i2c_MAG3110.h
  43. 333
      firmware/I2C-Sensor-Lib_iLib/src/i2c_MAX17047.h
  44. 144
      firmware/I2C-Sensor-Lib_iLib/src/i2c_MAX44009.h
  45. 244
      firmware/I2C-Sensor-Lib_iLib/src/i2c_MMA8451.h
  46. 311
      firmware/I2C-Sensor-Lib_iLib/src/i2c_MPL3115A2.h
  47. 460
      firmware/I2C-Sensor-Lib_iLib/src/i2c_MPU9250.h
  48. 379
      firmware/I2C-Sensor-Lib_iLib/src/i2c_PCF2127.h
  49. 53
      firmware/I2C-Sensor-Lib_iLib/src/i2c_PRESET.h
  50. 213
      firmware/I2C-Sensor-Lib_iLib/src/i2c_SI7021.h
  51. 60
      firmware/I2C-Sensor-Lib_iLib/src/i2c_Sensor.h
  52. 303
      firmware/I2C-Sensor-Lib_iLib/src/i2c_TCS3772.h
  53. 643
      firmware/I2C-Sensor-Lib_iLib/src/spi_rfm95.h
  54. 2738
      firmware/Modbus-Arduino/Doxyfile
  55. 27
      firmware/Modbus-Arduino/LICENSE
  56. 138
      firmware/Modbus-Arduino/README.md
  57. 122
      firmware/Modbus-Arduino/doc/html/ModbusIP_8h_source.html
  58. 122
      firmware/Modbus-Arduino/doc/html/ModbusIP__ENC28J60_8h_source.html
  59. 122
      firmware/Modbus-Arduino/doc/html/ModbusIP__ESP8266AT_8h_source.html
  60. 127
      firmware/Modbus-Arduino/doc/html/ModbusSerial_8h_source.html
  61. 118
      firmware/Modbus-Arduino/doc/html/Modbus_8h_source.html
  62. 133
      firmware/Modbus-Arduino/doc/html/annotated.html
  63. 8
      firmware/Modbus-Arduino/doc/html/annotated_dup.js
  64. BIN
      firmware/Modbus-Arduino/doc/html/arrowdown.png
  65. BIN
      firmware/Modbus-Arduino/doc/html/arrowright.png
  66. BIN
      firmware/Modbus-Arduino/doc/html/bc_s.png
  67. BIN
      firmware/Modbus-Arduino/doc/html/bdwn.png
  68. 140
      firmware/Modbus-Arduino/doc/html/classModbus-members.html
  69. 592
      firmware/Modbus-Arduino/doc/html/classModbus.html
  70. 16
      firmware/Modbus-Arduino/doc/html/classModbus.js
  71. 157
      firmware/Modbus-Arduino/doc/html/classModbusIP-members.html
  72. 801
      firmware/Modbus-Arduino/doc/html/classModbusIP.html
  73. 20
      firmware/Modbus-Arduino/doc/html/classModbusIP.js
  74. 132
      firmware/Modbus-Arduino/doc/html/classModbusIP__ENC28J60.html
  75. 132
      firmware/Modbus-Arduino/doc/html/classModbusIP__ESP8266AT.html
  76. 3
      firmware/Modbus-Arduino/doc/html/classModbusIP__inherit__graph.map
  77. 1
      firmware/Modbus-Arduino/doc/html/classModbusIP__inherit__graph.md5
  78. BIN
      firmware/Modbus-Arduino/doc/html/classModbusIP__inherit__graph.png
  79. 150
      firmware/Modbus-Arduino/doc/html/classModbusSerial-members.html
  80. 515
      firmware/Modbus-Arduino/doc/html/classModbusSerial.html
  81. 13
      firmware/Modbus-Arduino/doc/html/classModbusSerial.js
  82. 3
      firmware/Modbus-Arduino/doc/html/classModbusSerial__inherit__graph.map
  83. 1
      firmware/Modbus-Arduino/doc/html/classModbusSerial__inherit__graph.md5
  84. BIN
      firmware/Modbus-Arduino/doc/html/classModbusSerial__inherit__graph.png
  85. 4
      firmware/Modbus-Arduino/doc/html/classModbus__inherit__graph.map
  86. 1
      firmware/Modbus-Arduino/doc/html/classModbus__inherit__graph.md5
  87. BIN
      firmware/Modbus-Arduino/doc/html/classModbus__inherit__graph.png
  88. 133
      firmware/Modbus-Arduino/doc/html/classes.html
  89. BIN
      firmware/Modbus-Arduino/doc/html/closed.png
  90. 123
      firmware/Modbus-Arduino/doc/html/dir_3f5e39fb36414adb637ec20326caccc2.html
  91. 123
      firmware/Modbus-Arduino/doc/html/dir_51675f879e41ba5281dde78f999c1732.html
  92. 123
      firmware/Modbus-Arduino/doc/html/dir_5ac0cf6acd9f1a97dbbafe5d659a6e56.html
  93. 123
      firmware/Modbus-Arduino/doc/html/dir_b54e0a2b0f0dd993b2c80a66bde8de0f.html
  94. 123
      firmware/Modbus-Arduino/doc/html/dir_b68070abd0927afc37f6892e9bcc19ad.html
  95. 131
      firmware/Modbus-Arduino/doc/html/dir_bc0718b08fb2015b8e59c47b2805f60c.html
  96. BIN
      firmware/Modbus-Arduino/doc/html/doc.png
  97. 1475
      firmware/Modbus-Arduino/doc/html/doxygen.css
  98. BIN
      firmware/Modbus-Arduino/doc/html/doxygen.png
  99. 104
      firmware/Modbus-Arduino/doc/html/dynsections.js
  100. BIN
      firmware/Modbus-Arduino/doc/html/folderclosed.png
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,15 @@
# Changelog
All notable changes to this project will be documented in this file.
Added : for new features.
Changed : for changes in existing functionality.
Deprecated: for soon-to-be removed features.
Removed : for now removed features.
Fixed : for any bug fixes.
Security : in case of vulnerabilities.
## [0.1.0] - 2023-12-29
- First working version. But without pressure sensor. Physical RS485 bus untested, but did test ModBus over TTL serial.

@ -0,0 +1,232 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to version 3 of the GNU General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
7. Additional Terms.
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.

@ -0,0 +1,79 @@
# Weather station with ModBus over RS-485
## Abstract
A weather station build around a SparkFun Weather Meter Kit (SEN-15901). The temperature, humidity and pressure are measured with I2C sensors housed in an RS1 Passive Radiation Shield from Garni. The data can be retrieved via an RS485 ModBus RTU interface. The main processor is an Arduino Pro Mini (ATmega328P 5V@16MHz)
![SparkFun Weather Station](./images/SparkFun-Weather_Meter.jpg "SparkFun Weather Station")
SparkFun SEN-15901 Weather Station
![Garni RS1 Passive Radiation Shield](./images/garni_rs1.jpg "Garni RS1 Passive Radiation Shield")
Garni RS1 Passive Radiation Shield
## Sensors
- SparkFun SEN-15901 Weather Station (wind speed, wind direction and rain fall)
- Silicon Labs Si7021 (humidity and temperature)
- Bosch BMP280 (pressure and temperature)
## Measurements
- Wind direction
- Wind speed (average of last 10 minutes)
- Wind gust (last 10 minutes)
- Rain fall (last hour)
- Rain fall (last 24 hours)
- Temperature
- Humidity
- Atmospheric pressure
## ModBus
- RS485 transceiver
- ModBus address: 14 (fixed in software)
### Input registers
The measurments and order of the measurements are the same as for APRS weather reports. But ofcourse we use SI units.
| Address | Description | Units |
|---------|-------------------------------------|-----------------------|
| 30001 | Wind direction | degrees |
| 30002 | Wind speed (average of 10 minutes) | m/s * 100 |
| 30003 | Wind gust (peak of last 10 minutes) | m/s * 100 |
| 30004 | Temperature | degrees Celcius * 100 |
| 30005 | Rain last hour | l/m2 * 100 |
| 30006 | Rain last 24 hours | l/m2 * 100 |
| 30007 | Rain since midnight | NOT IMPLEMENTED |
| 30008 | Humidity | percent * 100 |
| 30009 | Barometric pressure | hPa * 100 |
The ModBus registers are 16 bit wide. For better precision, some units are scaled by a factor of 100. This way, values with up to two decimal points can be stored as 16 bit integer values. Just divide by 100 to get the floating point values.
## Dependencies
- Arduino IDE
### Arduino libraries
- https://github.com/sparkfun/SparkFun_Weather_Meter_Kit_Arduino_Library
- https://github.com/orgua/iLib
- https://github.com/epsilonrt/modbus-arduino
- https://github.com/epsilonrt/modbus-serial
Libraries are included with the source code of this project
## License
Copyright (C) 2023 M.T. Konstapel
### Software
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
### Hardware and documentation
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

@ -0,0 +1,25 @@
I2C-Sensor-Lib (iLib)
====
Library for I2C sensors and some atmel-specific functions. The following sensors can be used with an uniform interface and come with arduino-examples:
- Austria Microsystems TCS3772: light sensor - RGB and clear
- Silicon Labs SI7021: humidity sensor
- Invensense MPU9250: 9DOF - 3 axis acceleration and gyro PLUS AK8963-IC with magnetic-field sensor
- Freescale MPL3115A2: pressure
- Maxim MAX44009: ambient and lux with incredible wide dynamic
- NXP PCF2127: Realtime-Clock with 2ppm
- Bosch BMP280: pressure
- ST L3G-Series: 3 axis gyro / angular rate
- Freescale MAG3110: 3 axis Compass / Magnetic field
- Freescale MMA8451: 3 axis acceleration
- Fairchild FAN5421: Single-Cell Li-Ion Switching Charger
- STM LPS331: Pressure Sensor
- Maxim MAX17047: Fuel Gauge for various Cells
Additional Features:
- AVR: measure VCC of the power-pin
- AVR: emulate a spektrum-serial control
- fast math fn for e-function, power-of with scaling (interpolation with sampling points)
- HDLC: a protocol for serial communication featuring frames, checksum and auto-escaping of characters
- WS2812B: efficient controller

@ -0,0 +1,192 @@
/**<
this is untidy and not very intuitive BUT it works so far
the code was not refactored once... maybe i have time for this in the future
*/
#include "WS2812B.h"
WS2812B ws2812b;
#define LEDS_SIZE 90 //120
#define LEDS_CHANNELS 3
#define LEDS_DELAY 55
#define LEDS_DIST 30 //(LEDS_SIZE/LEDS_CHANNELS)
#define LEDS_INCR 1 //12 //(255/(LEDS_SIZE/LEDS_CHANNELS))
#define LEDS_MAX LEDS_INCR*LEDS_DIST
struct cRGB led[LEDS_SIZE]; // cGRB
volatile uint8_t selected_led, actual_led, actual_channel, actual_status;
struct time {
uint8_t tv_hour;
uint8_t tv_min;
uint8_t tv_sec;
uint16_t tv_msec;
} clock;
struct timeA {
uint16_t tv_hour;
uint16_t tv_min;
uint16_t tv_sec;
} analog;
#define SCALEMAX 12000
#define SCALEHA (SCALEMAX / 24) // 500
#define SCALEHB (SCALEHA / 60) // 8.33
#define SCALEMA (SCALEMAX / 60)
#define SCALEMB (SCALEMA / 60)
#define SCALESA (SCALEMAX / 60) // 200
#define SCALESB (SCALESA / 1000) // 0.2
#define SCALESBi (1000 / SCALESA) // 5
#define SCALELED (SCALEMAX / LEDS_SIZE)
uint32_t milli_old;
void get_analog() {
uint32_t milli_new = millis();
uint32_t tv_msec = clock.tv_msec + (milli_new - milli_old);
milli_old = milli_new;
uint32_t tv_sec = clock.tv_sec + (tv_msec/1000);
uint32_t tv_min = clock.tv_min + (tv_sec / 60);
uint32_t tv_hour = clock.tv_hour + (tv_min / 60);
/*
uint8_t tv_day = (tv_hour / 24);
clock.tv_hour = tv_hour - tv_day * 24;
clock.tv_min = tv_min - tv_hour* 60;
clock.tv_sec = tv_sec - tv_min * 60;
clock.tv_msec = tv_msec - tv_sec * 1000;
*/
while (tv_hour > 23) tv_hour -= 24;
clock.tv_hour = tv_hour;
while (tv_min > 59) tv_min -= 60;
clock.tv_min = tv_min;
while (tv_sec > 59) tv_sec -= 60;
clock.tv_sec = tv_sec;
while (tv_msec > 999) tv_msec -= 1000;
clock.tv_msec = tv_msec;
// zahlen normiert
analog.tv_hour = (clock.tv_hour*SCALEHA) + (clock.tv_min*SCALEHB);
if (analog.tv_hour >= SCALEMAX) analog.tv_hour -= SCALEMAX;
analog.tv_min = (clock.tv_min*SCALEMA) + (clock.tv_sec*SCALEMB);
if (analog.tv_min >= SCALEMAX) analog.tv_min -= SCALEMAX;
analog.tv_sec = (clock.tv_sec*SCALESA) + (clock.tv_msec/SCALESBi);
if (analog.tv_sec >= SCALEMAX) analog.tv_sec -= SCALEMAX;
}
void setup(void) {
clock.tv_hour = 3;
clock.tv_min = 45;
clock.tv_sec = 50;
clock.tv_msec = 0;
}
void loop(void)
{
uint8_t red, green, blue;
uint8_t ledi;
red = LEDS_MAX;
green = 0;
blue = 0;
while(1)
{
// Farbkreis - Algo
ledi = actual_led;
for (uint8_t x=0; x<LEDS_SIZE; x++) {
if (x < LEDS_DIST) { blue = 0; red = red - LEDS_INCR; green = green + LEDS_INCR; }
else if (x < 2*LEDS_DIST) { red = 0; green = green - LEDS_INCR; blue = blue + LEDS_INCR; }
else { green = 0; blue = blue - LEDS_INCR; red = red + LEDS_INCR; }
#define GROUNDLIGHT 0
#define SHIFTFACTOR 0
led[ledi].r = GROUNDLIGHT + (red>>SHIFTFACTOR);
led[ledi].g = GROUNDLIGHT + (green>>SHIFTFACTOR);
led[ledi].b = GROUNDLIGHT + (blue>>SHIFTFACTOR);
if (++ledi >= LEDS_SIZE) ledi = 0;
}
//if (++actual_led>=LEDS_SIZE) { actual_led = 0; } // Clockwise Color-Ring
if (actual_led--==0) actual_led = LEDS_SIZE - 1; // Reverse Color-Ring
// Uhr einfügen
#define CLOCK_INTENSITY 255
#define CLOCK_WIDTH (1)
uint8_t led_mid, led_sel, led_overflow;
int16_t value;
uint16_t analog_LED;
get_analog();
//if (led[analog.tv_hour/SCALELED].r < CLOCK_INTENSITY) { led[analog.tv_hour/SCALELED].r = CLOCK_INTENSITY; }
//if (led[analog.tv_min/SCALELED].g < CLOCK_INTENSITY) { led[analog.tv_min/SCALELED].g = CLOCK_INTENSITY; }
// HOURS
led_mid = (analog.tv_hour/SCALELED);
led_overflow = 0;
if (led_mid >= CLOCK_WIDTH) { led_sel = led_mid - CLOCK_WIDTH; }
else { led_sel = led_mid + (LEDS_SIZE - CLOCK_WIDTH); analog.tv_hour += SCALEMAX; }
for (uint8_t x=0; x<=2*CLOCK_WIDTH; x++) {
if (led_overflow) { analog_LED = (led_sel + LEDS_SIZE) * SCALELED; }
else { analog_LED = led_sel * SCALELED; }
if (analog_LED > analog.tv_hour) { value = (analog_LED - analog.tv_hour); }
else { value = (analog.tv_hour - analog_LED); }
if (value > CLOCK_INTENSITY) { value = 0; }
else { value = CLOCK_INTENSITY - value; }
if (led[led_sel].r < value) { led[led_sel].r = value; } // intensity normal
if (++led_sel >= LEDS_SIZE) { led_sel -= LEDS_SIZE; led_overflow = 1;}
}
// MINUTES
led_mid = (analog.tv_min/SCALELED);
led_overflow = 0;
if (led_mid >= CLOCK_WIDTH) { led_sel = led_mid - CLOCK_WIDTH; }
else { led_sel = led_mid + (LEDS_SIZE - CLOCK_WIDTH); analog.tv_min += SCALEMAX; }
for (uint8_t x=0; x<=2*CLOCK_WIDTH; x++) {
if (led_overflow) { analog_LED = (led_sel + LEDS_SIZE) * SCALELED; }
else { analog_LED = led_sel * SCALELED; }
if (analog_LED > analog.tv_min) { value = (analog_LED - analog.tv_min); }
else { value = (analog.tv_min - analog_LED); }
if (value > CLOCK_INTENSITY) { value = 0; }
else { value = CLOCK_INTENSITY - value; }
if (led[led_sel].g < value) { led[led_sel].g = value; } // intensity normal
if (++led_sel >= LEDS_SIZE) { led_sel -= LEDS_SIZE; led_overflow = 1;}
}
// SECONDS
led_mid = (analog.tv_sec/SCALELED);
led_overflow = 0;
if (led_mid >= CLOCK_WIDTH) { led_sel = led_mid - CLOCK_WIDTH; }
else { led_sel = led_mid + (LEDS_SIZE - CLOCK_WIDTH); analog.tv_sec += SCALEMAX; }
for (uint8_t x=0; x<=2*CLOCK_WIDTH; x++) {
if (led_overflow) { analog_LED = (led_sel + LEDS_SIZE) * SCALELED; }
else { analog_LED = led_sel * SCALELED; }
if (analog_LED > analog.tv_sec) { value = (analog_LED - analog.tv_sec); }
else { value = (analog.tv_sec - analog_LED); }
if (value > CLOCK_INTENSITY) { value = 0; }
else { value = CLOCK_INTENSITY - value; }
if (led[led_sel].b < value) { led[led_sel].b = value; } // intensity normal
if (++led_sel >= LEDS_SIZE) { led_sel -= LEDS_SIZE; led_overflow = 1;}
}
//led[0].r=255;led[0].g=0;led[0].b=0; // Write red to array
ws2812b.setleds(led,LEDS_SIZE);
_delay_ms(LEDS_DELAY); // wait for 500ms.
}
}

@ -0,0 +1,102 @@
#include <math.h>
//#include <JeeLib.h>
#include <atmel_eFunction.h>
eFunction eFkt;
#define PWR 1.6
#define MAX_X 1024
#define STDVALUE 512
void setup()
{
Serial.begin(115200);
eFkt.init(STDVALUE, MAX_X, MAX_X,PWR);
Serial.println("Test Function PowerOf and Scale: ");
Serial.println(" X, Y_orig, Y_new");
}
void loop()
{
uint32_t time_start, duration_original, duration_new, result_original, result_new, result_error;
float scale, max_y, max_x;
max_x = MAX_X-STDVALUE;
max_y = pow(max_x, PWR); //interval^(1/1.7)
scale = max_x / max_y;
result_error = 0;
for (uint16_t ivar = 0; ivar < 1034; ivar++)
{
if (ivar >= STDVALUE) result_original = pow(ivar - STDVALUE, PWR)*scale + STDVALUE;
else result_original = STDVALUE - pow(STDVALUE - ivar, PWR)*scale;
result_new = eFkt.get(ivar);
if (result_new > result_original) result_error += result_new - result_original;
else result_error += result_original - result_new;
Serial.print(" ");
Serial.print(ivar);
Serial.print(", ");
Serial.print(result_original);
Serial.print(", ");
Serial.print(result_new);
Serial.println("");
}
result_original = 0;
result_new = 0;
time_start = micros();
for (uint16_t ivar = 0; ivar < 1024; ivar++)
{
if (ivar >= STDVALUE) result_original += pow(ivar - STDVALUE, PWR)*scale + STDVALUE;
else result_original += STDVALUE - pow(STDVALUE - ivar, PWR)*scale;
}
duration_original = micros() - time_start;
time_start = micros();
for (uint16_t ivar = 0; ivar < 1024; ivar++)
{
result_new += eFkt.get(ivar);
}
duration_new = micros() - time_start;
Serial.print("Result_sum : ");
Serial.print(result_original);
Serial.print(", ");
Serial.print(result_new);
Serial.println("");
Serial.print("Calculation_time_sum us : ");
Serial.print(duration_original);
Serial.print(", ");
Serial.print(duration_new);
Serial.println("");
Serial.print("Error/Mean : ");
Serial.print(result_error / 1024.0);
Serial.println("");
while(1)
{
;
}
}
/**<
Program size:
A1.0.5:
A1.5.7:
*/

@ -0,0 +1,36 @@
/**<
Program Fuses:
EXT 0xFD
HIGH 0xDF or xDE (bootrst EN)
LOW 0xFF
*/
#define TIMEON 20
#define TIMEOFF (1000-TIMEON)
#define LEDPINA 8
#define LEDPINB 11
void setup() {
pinMode(LEDPINA, OUTPUT);
pinMode(LEDPINB, OUTPUT);
digitalWrite(LEDPINA,LOW);
digitalWrite(LEDPINB,LOW);
}
void loop() {
delay(TIMEOFF);
digitalWrite(LEDPINA,HIGH);
digitalWrite(LEDPINB,HIGH);
delay(TIMEON); // busywaiting
digitalWrite(LEDPINA,LOW);
digitalWrite(LEDPINB,LOW);
}

@ -0,0 +1,59 @@
#include <Wire.h>
#include "i2c.h"
#include "i2c_BMP280.h"
BMP280 bmp280;
void setup()
{
Serial.begin(115200);
Serial.print("Probe BMP280: ");
if (bmp280.initialize()) Serial.println("Sensor found");
else
{
Serial.println("Sensor missing");
while (1) {}
}
// onetime-measure:
bmp280.setEnabled(0);
bmp280.triggerMeasurement();
}
void loop()
{
bmp280.awaitMeasurement();
float temperature;
bmp280.getTemperature(temperature);
float pascal;
bmp280.getPressure(pascal);
static float meters, metersold;
bmp280.getAltitude(meters);
metersold = (metersold * 10 + meters)/11;
bmp280.triggerMeasurement();
Serial.print(" HeightPT1: ");
Serial.print(metersold);
Serial.print(" m; Height: ");
Serial.print(meters);
Serial.print(" Pressure: ");
Serial.print(pascal);
Serial.print(" Pa; T: ");
Serial.print(temperature);
Serial.println(" C");
}
/**<
Program size:
A1.0.5:
A1.5.7: 9680b
A1.6.3: 9664b / 561b
*/

@ -0,0 +1,44 @@
#include <Wire.h>
#include "i2c.h"
#include "i2c_L3G.h"
L3G l3g;
void setup()
{
Serial.begin(115200);
Serial.print("Probe L3G: ");
if (l3g.initialize()) Serial.println("Sensor found!");
else
{
Serial.println("Sensor missing");
while(1) {};
}
}
void loop()
{
float xyz_dps[3];
l3g.getMeasurement(xyz_dps);
Serial.print(" X: ");
Serial.print(xyz_dps[0],2);
Serial.print(" \tY: ");
Serial.print(xyz_dps[1],2);
Serial.print(" \tZ: ");
Serial.print(xyz_dps[2],2);
Serial.println("");
delay(20);
}
/**<
Program size:
A1.0.5:
A1.5.7: 7226b
A1.6.3: 7160b / 483b
*/

@ -0,0 +1,53 @@
#include <Wire.h>
#include "i2c.h"
// Pressure-Sensor
#include "i2c_LPS331.h"
LPS331 lps331;
void setup()
{
Serial.begin(115200);
Serial.print("Probe LPS331: ");
if (lps331.initialize()) Serial.println("Sensor found!");
else
{
Serial.println("Sensor missing");
while(1) {};
}
}
void loop()
{
static float mbar, degC;
Serial.print("Altitude: ");
//static int32_t cm;
//lps331.getAltitude(cm);
//Serial.print(cm);
static float meter;
lps331.getAltitude(meter);
Serial.print(meter);
//lps331.getMeasurement(mbar);
//Serial.print("Pressure: ");
//Serial.print(mbar);
lps331.getTemperature(degC);
Serial.print(" \tTemperature: ");
Serial.print(degC);
Serial.println("");
delay(20);
}
/**<
Program size:
A1.0.5: 7098b
A1.5.7:
A1.6.3: 7184b / 567b
*/

@ -0,0 +1,44 @@
#include <Wire.h>
#include "i2c.h"
#include "i2c_MAG3110.h"
MAG3110 mag3110;
void setup()
{
Serial.begin(115200);
Serial.print("Probe MAG3310: ");
if (mag3110.initialize()) Serial.println("Sensor found!");
else
{
Serial.println("Sensor missing");
while(1) {};
}
}
void loop()
{
float xyz_uT[3];
mag3110.getMeasurement(xyz_uT);
Serial.print(" X: ");
Serial.print(xyz_uT[0],2);
Serial.print(" \tY: ");
Serial.print(xyz_uT[1],2);
Serial.print(" \tZ: ");
Serial.print(xyz_uT[2],2);
Serial.println("");
delay(20);
}
/**<
Program size:
A1.0.5: 7144b
A1.5.7: 6860b
A1.6.3: 6766b / 493b
*/

@ -0,0 +1,39 @@
#include <Wire.h>
#include "i2c.h"
#include "i2c_MAX44009.h"
MAX44009 max44009;
void setup()
{
Serial.begin(115200);
Serial.println("Probe MAX44009: ");
if (max44009.initialize()) Serial.println("Sensor found");
else
{
Serial.println("Sensor missing");
while (1) { };
}
}
void loop()
{
static unsigned long mLux_value;
max44009.getMeasurement(mLux_value);
Serial.print("mLUX: ");
Serial.print(mLux_value);
Serial.println(" ");
delay(40);
}
/**<
Program size:
A1.0.5: 5126b
A1.5.7: 4860b
A1.6.3: 4764b / 463b
*/

@ -0,0 +1,45 @@
#include <Wire.h>
#include "i2c.h"
#include "i2c_MMA8451.h"
MMA8451 mma8451;
void setup()
{
Serial.begin(115200);
Serial.print("Probe MMA8451: ");
if (mma8451.initialize()) Serial.println("Sensor found!");
else
{
Serial.println("Sensor missing");
while(1) {};
}
}
void loop()
{
static float xyz_g[3];
mma8451.getMeasurement(xyz_g);
Serial.print(" X: ");
Serial.print(xyz_g[0],2);
Serial.print(" \tY: ");
Serial.print(xyz_g[1],2);
Serial.print(" \tZ: ");
Serial.print(xyz_g[2],2);
Serial.println("");
delay(20);
}
/**<
Program size:
A1.0.5:
A1.5.7: 6992b
A1.6.3: 6988b / 494b
*/

@ -0,0 +1,49 @@
#include <Wire.h>
#include "i2c.h"
#include "i2c_MPL3115A2.h"
MPL3115A2 mpl3115;
void setup()
{
Serial.begin(115200);
Serial.print("Probe MPL3115A2: ");
if (mpl3115.initialize()) Serial.println("Sensor found");
else
{
Serial.println("Sensor missing");
while (1) {}
}
// onetime-measure:
mpl3115.setEnabled(0);
mpl3115.triggerMeasurement();
}
void loop()
{
mpl3115.awaitMeasurement();
float altitude;
mpl3115.getAltitude(altitude);
float temperature;
mpl3115.getTemperature(temperature);
mpl3115.triggerMeasurement();
Serial.print(" Height: ");
Serial.print(altitude);
Serial.print(" Temp: ");
Serial.print(temperature);
Serial.println("");
}
/**<
Program size:
A1.0.5:
A1.5.7: 6980b
A1.6.3: 6890b / 495b
*/

@ -0,0 +1,63 @@
#include <Wire.h>
#include "i2c.h"
// IMU-Sensor
#include "i2c_MPU9250.h"
MPU9250 mpu9250;
void setup()
{
Serial.begin(115200);
Serial.print("Probe MPU9250: ");
switch (mpu9250.initialize())
{
case 0: Serial.println("MPU-Sensor missing"); while(1) {};
case 1: Serial.println("Found unknown Sensor."); break;
case 2: Serial.println("MPU6500 found."); break;
case 3: Serial.println("MPU9250 found!"); break;
}
Serial.print("Probe AK8963: ");
if (i2c.probe(0x0C)) Serial.println("AK8963 found!");
else Serial.println("AK8963 missing");
}
void loop()
{
static float xyz_GyrAccMag[9];
mpu9250.getMeasurement(xyz_GyrAccMag);
Serial.print("XYZ ACC g[");
Serial.print(xyz_GyrAccMag[0],2);
Serial.print(";");
Serial.print(xyz_GyrAccMag[1],2);
Serial.print(";");
Serial.print(xyz_GyrAccMag[2],2);
Serial.print("]");
Serial.print(" \t GYR dps[");
Serial.print(xyz_GyrAccMag[4],2);
Serial.print(";");
Serial.print(xyz_GyrAccMag[5],2);
Serial.print(";");
Serial.print(xyz_GyrAccMag[6],2);
Serial.print("]");
Serial.print(" \t T: ");
Serial.print(xyz_GyrAccMag[3],2);
Serial.print(" C");
Serial.println("");
delay(20);
}
/**<
Program size:
A1.0.5:
A1.5.7:
A1.6.3: 7752b / 631b
*/

@ -0,0 +1,63 @@
#include <Wire.h>
#include "i2c.h"
// RTC
#include "i2c_PCF2127.h"
PCF2127 pcf2127;
void setup()
{
Serial.begin(115200);
Serial.print("Probe PCF2127: ");
if (pcf2127.initialize()) Serial.println("Module found");
else
{
Serial.println("Module missing");
while (1) {}
}
pcf2127.setTime(2014,9,3,5,4,11,12);
char time = '__TIME__';
}
void loop()
{
uint8_t MM,WW,DD,hh,mm,ss;
uint16_t YY;
pcf2127.readTime();
pcf2127.getYears(YY);
pcf2127.getMonth(MM);
pcf2127.getWeekdays(WW);
pcf2127.getDays(DD);
pcf2127.getHours(hh);
pcf2127.getMinutes(mm);
pcf2127.getSeconds(ss);
Serial.print(YY);
Serial.print("-");
Serial.print(MM);
Serial.print("-");
Serial.print(WW);
Serial.print("-");
Serial.print(DD);
Serial.print(" ");
Serial.print(hh);
Serial.print(":");
Serial.print(mm);
Serial.print(":");
Serial.print(ss);
Serial.println("");
delay(200);
}
/**<
Program size:
A1.0.5: 6754b
A1.5.7: 6454b
A1.6.3: 5016b / 446b
*/

@ -0,0 +1,43 @@
#include <Wire.h>
#include "i2c.h"
#include "i2c_SI7021.h"
SI7021 si7021;
void setup()
{
Serial.begin(115200);
Serial.print("Probe SI7021: ");
if (si7021.initialize()) Serial.println("Sensor found!");
else
{
Serial.println("Sensor missing");
while(1) {};
}
}
void loop()
{
static float humi, temp;
si7021.getHumidity(humi);
si7021.getTemperature(temp);
si7021.triggerMeasurement();
Serial.print("TEMP: ");
Serial.print(temp);
Serial.print(" HUMI: ");
Serial.print(humi);
Serial.println("");
}
/**<
Program size:
A1.0.5: 6896b
A1.5.7: 6590b
A1.6.3: 6484b / 499b
*/

@ -0,0 +1,53 @@
#include <Wire.h>
#include "i2c.h"
#include "i2c_TCS3772.h"
TCS3772 tcs3772;
void setup()
{
Serial.begin(115200);
Serial.print("Probe TCS3772: ");
if (tcs3772.initialize()) Serial.println("Sensor found");
else
{
Serial.println("Sensor missing");
while (1) {}
}
}
void loop()
{
static uint16_t value_crgb[4], scale_factor;
tcs3772.getMeasurement(value_crgb);
scale_factor = tcs3772.autoGain(value_crgb[0]);
if (scale_factor)
{
Serial.print(" R: ");
Serial.print(value_crgb[1]);
Serial.print(" G: ");
Serial.print(value_crgb[2]);
Serial.print(" B: ");
Serial.print(value_crgb[3]);
Serial.print(" C: ");
Serial.print(value_crgb[0]);
Serial.print(" GAIN: ");
Serial.print(scale_factor);
Serial.println("");
}
delay(50);
}
/**<
Program size:
A1.0.5: 6754b
A1.5.7: 6454b
A1.6.3: 6322b / 494b
*/

@ -0,0 +1,37 @@
#include <Wire.h>
#include "i2c.h"
void setup()
{
Serial.begin(115200);
Serial.println("Scan I2C-Bus for responses");
uint8_t address, result;
for(address = 0; address < 128; address++ )
{
result = i2c.probe(address);
if (result)
{
Serial.print("Found: 0x");
if (address < 17) Serial.print("0");
Serial.print(address,HEX);
Serial.println("");
}
delay(20);
}
Serial.println("");
Serial.println("DONE");
}
void loop() { }
/**<
Program size:
A1.0.5:
A1.5.7: 4072b
A1.6.3: 3982b / 435b
*/

@ -0,0 +1,54 @@
#include <SPI.h>
#include "spi_rfm95.h"
RFM95 rfm;
#define TIMEON 20
#define TIMEOFF (1000-TIMEON)
#define LEDPINA 8
void setup()
{
Serial.begin(115200);
Serial.println(rfm.getFrequency());
Serial.print("Probe RFM95W: ");
if (rfm.initialize()) Serial.println("missing");
else
{
Serial.println("found");
while(1) {};
}
Serial.println(rfm.getFrequency());
rfm.receiveDataCont();
//while (1) { rfm.handleIRQ(); };
pinMode(LEDPINA, OUTPUT);
digitalWrite(LEDPINA,HIGH);
}
void loop()
{
rfm.handleIRQ();
delay(TIMEOFF);
if (rfm.canSend())
{
digitalWrite(LEDPINA,HIGH);
rfm.sendData();
};
delay(TIMEON);
digitalWrite(LEDPINA,LOW);
}
/**<
Program size:
A105: b
A157: b
*/

@ -0,0 +1,189 @@
#######################################
# Syntax Coloring Map For iLib
#######################################
#######################################
# Datatypes (KEYWORD1)
#######################################
#######################################
# Methods and Functions (KEYWORD2)
#######################################
spektrum_init KEYWORD2
spektrum_send KEYWORD2
ATMEL KEYWORD1
readVcc KEYWORD2
WirePlus KEYWORD1
probe KEYWORD2
probeAddress KEYWORD2
write KEYWORD2
writeByte KEYWORD2
writeCMD KEYWORD2
read KEYWORD2
readByte KEYWORD2
setRegister KEYWORD2
getRegister KEYWORD2
i2cSensor KEYWORD1
setEnabled KEYWORD2
reset KEYWORD2
initialize KEYWORD2
checkMeasurement KEYWORD2
awaitMeasurement KEYWORD2
manualSensor KEYWORD1
triggerMeasurement KEYWORD2
BMP280 KEYWORD1
getEnabled KEYWORD2
setPressureOversampleRatio KEYWORD2
setTemperatureOversampleRatio KEYWORD2
setFilterRatio KEYWORD2
setStandby KEYWORD2
readTrimming KEYWORD2
getPressure KEYWORD2
getMeasurement KEYWORD2
getAltitude KEYWORD2
getTemperature KEYWORD2
FAN5421 KEYWORD1
set_safety KEYWORD2
poll_timer KEYWORD2
print_status KEYWORD2
print_register KEYWORD2
set_config KEYWORD2
set_current KEYWORD2
increase_current KEYWORD2
decrease_current KEYWORD2
print_info KEYWORD2
get_chargingstatus KEYWORD2
charging_enable KEYWORD2
power_without_battery KEYWORD2
L3G KEYWORD1
setDatarate KEYWORD2
setSensibility KEYWORD2
LPS331 KEYWORD1
setDatarate KEYWORD2
setSensitivity KEYWORD2
getTemperature KEYWORD2
getAltitude KEYWORD2
MAG3110 KEYWORD1
setSensorAutoReset KEYWORD2
setRawMode KEYWORD2
setDataRate KEYWORD2
MAX17047 KEYWORD1
set_capacity_design KEYWORD2
set_full_threshold KEYWORD2
set_termination_charge_current KEYWORD2
set_empty_voltage KEYWORD2
set_alarm_voltage KEYWORD2
backup_data KEYWORD2
restore_data KEYWORD2
set_config KEYWORD2
print_status KEYWORD2
get_cell_voltage KEYWORD2
get_cell_current KEYWORD2
MAX44009 KEYWORD1
MMA8451 KEYWORD1
setSensibility KEYWORD2
setDatarate KEYWORD2
MPL3115A2 KEYWORD1
setAltimeter KEYWORD2
getEnabled KEYWORD2
setOversampleRatio KEYWORD2
setEventFlags KEYWORD2
getAltitude KEYWORD2
getPressure KEYWORD2
getMeasurement KEYWORD2
getTemperature KEYWORD2
MPU9250 KEYWORD1
setGSensitivity KEYWORD2
setASensitivity KEYWORD2
setDatarate KEYWORD2
setBandwidth KEYWORD2
PCF2127 KEYWORD1
clearInterrupt KEYWORD2
setTemperaturePeriod KEYWORD2
setClockOut KEYWORD2
setTime KEYWORD2
readTime KEYWORD2
setSeconds KEYWORD2
getSeconds KEYWORD2
setMinutes KEYWORD2
getMinutes KEYWORD2
setHours KEYWORD2
getHours KEYWORD2
setDays KEYWORD2
getDays KEYWORD2
setWeekdays KEYWORD2
getWeekdays KEYWORD2
setMonth KEYWORD2
getMonth KEYWORD2
setYears KEYWORD2
getYears KEYWORD2
SI7021 KEYWORD1
readValue KEYWORD2
setResolution KEYWORD2
setHeater KEYWORD2
readHumidity KEYWORD2
getHumidity KEYWORD2
readTemperature KEYWORD2
getTemperature KEYWORD2
requestTemperature KEYWORD2
readTemperatureReq KEYWORD2
getTemperatureReq KEYWORD2
TCS3772 KEYWORD1
ATIME_TO_MSEC KEYWORD2
MSEC_TO_ATIME KEYWORD2
FACT_TO_ATIME KEYWORD2
MSEC_TO_ATIMELONG KEYWORD2
setWaitTime KEYWORD2
setATime KEYWORD2
setAGain KEYWORD2
autoGain KEYWORD2
RFM95 KEYWORD1
spiExchange KEYWORD2
WS2812B KEYWORD1
setleds KEYWORD2
setleds_pin KEYWORD2
sendarray KEYWORD2
sendarray_mask KEYWORD2
#######################################
# Instances (KEYWORD2)
#######################################
#######################################
# Constants (LITERAL1)
#######################################

@ -0,0 +1,20 @@
{
"name": "I2C-Sensor-Lib (iLib)",
"frameworks": "Arduino",
"keywords": "TCS3772, light, RGB, SI7021, humidity, MPU9250, 9DOF, acceleration, gyro, magnetic, MPL3115A2, pressure, MAX44009, lux, PCF2127, Realtime-Clock, RTC, BMP280, L3G, MAG3110, Compass, MMA8451, FAN5421, Li-ion, Charger, LPS331, MAX17047, Gauge",
"description": "Library for various sensors and some atmel-specific functions. The sensors can be used with an uniform interface and come with arduino-examples",
"authors":
[
{
"name": "Ingmar Splitt",
"email": "orgua@gmx.de",
"url": "https://github.com/orgua"
"maintainer": true
}
],
"repository":
{
"type": "git",
"url": "https://github.com/orgua/iLib"
}
}

@ -0,0 +1,9 @@
name=I2C-Sensor-Lib iLib
version=0.8.2
author=Ingmar Splitt
maintainer=Ingmar Splitt
sentence=Library for i2c-sensors and some other specific functions (fast eFn, HDLC, SpektrumSerial).
paragraph=The following sensors can be used with an uniform interface: Austria Microsystems TCS3772 light sensor - RGB and clear, Silicon Labs SI7021 humidity sensor, Invensense MPU9250 9DOF - 3 axis acceleration and gyro PLUS AK8963-IC with magnetic-field sensor, Freescale MPL3115A2 pressure, Maxim MAX44009 ambient and lux with incredible wide dynamic, NXP PCF2127 Realtime-Clock with 2ppm, Bosch BMP280 pressure, ST L3G-Series 3 axis gyro / angular rate, Freescale MAG3110 3 axis Compass / Magnetic field, Freescale MMA8451 3 axis acceleration, Fairchild FAN5421 Single-Cell Li-Ion Switching Charger, STM LPS331 Pressure Sensor, Maxim MAX17047 Fuel Gauge for various Cells
category=Sensors
url=https://github.com/orgua/iLib
architectures=*

@ -0,0 +1,211 @@
#ifndef WS2812B_h
#define WS2812B_h
#include "avr/interrupt.h"
#include "avr/io.h"
#include "util/delay.h"
struct cRGB { uint8_t g; uint8_t r; uint8_t b; };
/** ######################################################################
Driver for the WS2812b
Details:
///
######################################################################## */
class WS2812B
{
/** ######### Register-Map ################################################################# */
#define CONCAT(a, b) a ## b
#define CONCAT_EXP(a, b) CONCAT(a, b)
#define ws2812_PORTREG CONCAT_EXP(PORT,ws2812_port)
#define ws2812_DDRREG CONCAT_EXP(DDR,ws2812_port)
#define ws2812_port B // Data port
#define ws2812_pin 1 // Data out pin
/** ######### function definition ################################################################# */
public:
WS2812B(void)
{
#ifdef __AVR_ATtiny10__
CCP=0xD8; // configuration change protection, write signature
CLKPSR=0; // set cpu clock prescaler =1 (8Mhz) (attiny 4/5/9/10)
#else
CLKPR=_BV(CLKPCE);
CLKPR=0; // set clock prescaler to 1 (attiny 25/45/85/24/44/84/13/13A)
#endif
};
void inline setleds(struct cRGB *ledarray, uint16_t leds)
{
setleds_pin(ledarray,leds, _BV(ws2812_pin));
}
void inline setleds_pin(struct cRGB *ledarray, uint16_t leds, uint8_t pinmask)
{
ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR
sendarray_mask((uint8_t*)ledarray,leds+leds+leds,pinmask);
_delay_us(50);
}
void sendarray(uint8_t *data,uint16_t datlen)
{
sendarray_mask(data,datlen,_BV(ws2812_pin));
}
/*
This routine writes an array of bytes with RGB values to the Dataout pin
using the fast 800kHz clockless WS2811/2812 protocol.
*/
// Timing in ns
#define w_zeropulse 350
#define w_onepulse 900
#define w_totalperiod 1250
// Fixed cycles used by the inner loop
#define w_fixedlow 2
#define w_fixedhigh 4
#define w_fixedtotal 8
// Insert NOPs to match the timing, if possible
#define w_zerocycles (((F_CPU/1000)*w_zeropulse )/1000000)
#define w_onecycles (((F_CPU/1000)*w_onepulse +500000)/1000000)
#define w_totalcycles (((F_CPU/1000)*w_totalperiod +500000)/1000000)
// w1 - nops between rising edge and falling edge - low
#define w1 (w_zerocycles-w_fixedlow)
// w2 nops between fe low and fe high
#define w2 (w_onecycles-w_fixedhigh-w1)
// w3 nops to complete loop
#define w3 (w_totalcycles-w_fixedtotal-w1-w2)
#if w1>0
#define w1_nops w1
#else
#define w1_nops 0
#endif
// The only critical timing parameter is the minimum pulse length of the "0"
// Warn or throw error if this timing can not be met with current F_CPU settings.
#define w_lowtime ((w1_nops+w_fixedlow)*1000000)/(F_CPU/1000)
#if w_lowtime>550
#error "Light_ws2812: Sorry, the clock speed is too low. Did you set F_CPU correctly?"
#elif w_lowtime>450
#warning "Light_ws2812: The timing is critical and may only work on WS2812B, not on WS2812(S)."
#warning "Please consider a higher clockspeed, if possible"
#endif
#if w2>0
#define w2_nops w2
#else
#define w2_nops 0
#endif
#if w3>0
#define w3_nops w3
#else
#define w3_nops 0
#endif
#define w_nop1 "nop \n\t"
#define w_nop2 "rjmp .+0 \n\t"
#define w_nop4 w_nop2 w_nop2
#define w_nop8 w_nop4 w_nop4
#define w_nop16 w_nop8 w_nop8
void inline sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi)
{
uint8_t ctr,masklo;
uint8_t sreg_prev;
masklo =~maskhi&ws2812_PORTREG;
maskhi |= ws2812_PORTREG;
sreg_prev=SREG;
cli();
while (datlen--)
{
uint8_t curbyte=*data++;
asm volatile(
" ldi %0,8 \n\t"
"loop%=: \n\t"
" out %2,%3 \n\t" // '1' [01] '0' [01] - re
#if (w1_nops&1)
w_nop1
#endif
#if (w1_nops&2)
w_nop2
#endif
#if (w1_nops&4)
w_nop4
#endif
#if (w1_nops&8)
w_nop8
#endif
#if (w1_nops&16)
w_nop16
#endif
" sbrs %1,7 \n\t" // '1' [03] '0' [02]
" out %2,%4 \n\t" // '1' [--] '0' [03] - fe-low
" lsl %1 \n\t" // '1' [04] '0' [04]
#if (w2_nops&1)
w_nop1
#endif
#if (w2_nops&2)
w_nop2
#endif
#if (w2_nops&4)
w_nop4
#endif
#if (w2_nops&8)
w_nop8
#endif
#if (w2_nops&16)
w_nop16
#endif
" out %2,%4 \n\t" // '1' [+1] '0' [+1] - fe-high
#if (w3_nops&1)
w_nop1
#endif
#if (w3_nops&2)
w_nop2
#endif
#if (w3_nops&4)
w_nop4
#endif
#if (w3_nops&8)
w_nop8
#endif
#if (w3_nops&16)
w_nop16
#endif
" dec %0 \n\t" // '1' [+2] '0' [+2]
" brne loop%=\n\t" // '1' [+3] '0' [+4]
: "=&d" (ctr)
: "r" (curbyte), "I" (_SFR_IO_ADDR(ws2812_PORTREG)), "r" (maskhi), "r" (masklo)
);
}
SREG=sreg_prev;
}
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//PRESET preset = PRESET();
#endif

@ -0,0 +1,147 @@
#ifndef atmel_eFunction_h
#define atmel_eFunction_h
#if ARDUINO >= 100
#include <Arduino.h> // Arduino 1.0
#else
#include <WProgram.h> // Arduino 0022
#endif
#include <stdint.h>
#include <avr/pgmspace.h>
////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// PowerOf-and-Scale-Funktion //////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
// INPUT:
//
#define INTERPOL 4
#define MEANVAL 512 // conflicts with zero_setpoint.... not clean implemented
#define INTERVAL ((MEANVAL<<INTERPOL)-1)
#define OUT_LOW_TH 0
#define OUT_HIGH_TH 1024
// ehemals 255 nun 2^16-1
class eFunction
{
private:
long kf[8], ks[8]; // 8*4*2 = 64b
long xnode[9]; // = {0,INTERVAL/96,INTERVAL/48,INTERVAL/24,INTERVAL/12,INTERVAL/6,INTERVAL/3,INTERVAL/1.5,INTERVAL};
long zero_setpoint;
public:
eFunction(void): zero_setpoint(0)
{
for (uint8_t ivar = 0; ivar < 8; ++ivar)
{
kf[ivar] = 1;
ks[ivar] = 0;
xnode[ivar] = 1;
};
xnode[8] = 1;
};
void init(uint16_t interval, float pwr)
{
float maxi, base; // 2*4=8 (nur temporär)
maxi = pow(interval, 1/pwr); //interval^(1/1.7)
base = maxi / float(interval);
// nicht sehr schön, aber keine andere Lösung um auf aktuelle Stützstellen zu kommen
xnode[0] = long(float(0.0));
xnode[1] = long(float(interval)/96.0);
xnode[2] = long(float(interval)/48.0);
xnode[3] = long(float(interval)/24.0);
xnode[4] = long(float(interval)/12.0);
xnode[5] = long(float(interval)/6.00);
xnode[6] = long(float(interval)/3.00);
xnode[7] = long(float(interval)/1.50);
xnode[8] = long(float(interval)/1.00);
for (uint8_t p = 0; p<8; ++p)
{
float yy, xx; // 2*4=8 (nur temporär)
yy = (float)((pow(base*float(xnode[p+1]),pwr))-(pow(base*float(xnode[p]),pwr)));
xx = (float)(xnode[p+1]-xnode[p]);
// x^pwr = x * kf + ks über Interpolation mit 9 Stützstellen
kf[p] = (long)((yy*128)/xx);
ks[p] = (long)((pow(base*float(xnode[p]),pwr)*128)-float(xnode[p]*kf[p]));
};
zero_setpoint = 0;
};
void set_zeropoint(long new_setpoint)
{
zero_setpoint = new_setpoint;
};
uint16_t get(long value)
{
if (value == zero_setpoint) return (unsigned int)(zero_setpoint);
else if (value >= OUT_HIGH_TH) return (unsigned int)(OUT_HIGH_TH);
else if (value <= OUT_LOW_TH) return (unsigned int)(OUT_LOW_TH);
uint8_t sign, n;
if (value > zero_setpoint) // TODO: not clean, because of not zero based
{
value = value - zero_setpoint;
sign = 0;
}
else
{
value = zero_setpoint - value;
sign = 1;
}
value = value<<INTERPOL;
if (value<xnode[4])
{
if (value<xnode[2])
{
if (value<xnode[1])
{
if (value<=xnode[0]) return (unsigned int) xnode[0];
else n = 0;
}
else n = 1;
}
else
{
if (value<xnode[3]) n = 2;
else n = 3;
};
}
else
{
if (value < xnode[6])
{
if (value < xnode[5]) n = 4;
else n = 5;
}
else
{
if (value < xnode[7]) n = 6;
else
{
if (value < xnode[8]) n = 7;
else return (unsigned int) xnode[8];
};
};
};
value = ((value*kf[n]+ks[n])>>7);// Todo: 7x Rollen umgehen
value = (value>>INTERPOL);
if (value >= INTERVAL) value = 0;
if (sign) return (unsigned int)(zero_setpoint - value);
else return (unsigned int)(zero_setpoint + value);
};
};
//eFunction efkt;
#endif

@ -0,0 +1,239 @@
#ifndef atmel_hdlc_h
#define atmel_hdlc_h
/// HDLC /////////////////////////////////////////////////////////
/* a protocol for serial communication featuring frames, checksum and auto-escaping of characters.
datasheet: http://tools.ietf.org/html/rfc1662
send:
Serial.begin(57600); // open serialport
hdlc.frameOpen(); // framestart
hdlc.frameWrite(byte data); //repeat as often as you want
hdlc.frameClose(); // frame-ending (&checksum) and flush
receive:
uint8_t incoming_msg[80];
if (uint8_t msg_size = hdlc.poll())
{
for (uint8_t ivar=0; ivar < size_msg; ++ivar )
{
incoming_msg[ivar] = hdlc.getMsg(ivar);
};
};
hdlc.clearMsg();
*/
class HDLC
{
private:
static constexpr uint8_t HDLC_FLAG = (0x7e);
static constexpr uint8_t HDLC_ESCAPE = (0x7d);
static constexpr uint8_t HDLC_FLAG_ESC = (0x5e);
static constexpr uint8_t HDLC_ESCAPE_ESC = (0x5d);
static constexpr uint8_t HDLC_ESCAPE_MASK = (0x20);
static constexpr uint16_t HDLC_CRCINIT = (0xffff);
static constexpr uint16_t HDLC_CRCGOOD = (0xf0b8);
static constexpr uint16_t HDLC_MAX_FRAME_LENGTH = (128);
static constexpr uint16_t HDLC_INPUT_BUFFER_SIZE = (HDLC_MAX_FRAME_LENGTH);
static constexpr uint16_t hdlc_fcstab[256] =
{
0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
};
inline uint16_t crcIteration(const uint16_t crc, const uint8_t _b)
{
return (crc >> 8) ^ hdlc_fcstab[(crc ^ _b) & 0xff];
};
uint16_t crc16;
uint8_t msg_now, msg_received, msg[HDLC_INPUT_BUFFER_SIZE];
public:
HDLC(void): crc16(0), msg_now(0), msg_received(0)
{
for (uint8_t loopvar = 0; loopvar < HDLC_INPUT_BUFFER_SIZE; ++loopvar)
{
msg[loopvar] = 0;
};
};
// TODO: not ideal, but ok for now
void frameOpen(void)
{
Serial.write(HDLC_FLAG);
crc16 = HDLC_CRCINIT;
};
void frameWrite(const uint8_t _b)
{
crc16 = crcIteration(crc16,_b);
uint8_t bw;
if (_b == HDLC_FLAG)
{
Serial.write(HDLC_ESCAPE);
bw = HDLC_FLAG_ESC;
}
else if (_b == HDLC_ESCAPE)
{
Serial.write(HDLC_ESCAPE);
bw = HDLC_ESCAPE_ESC;
}
else bw = _b;
Serial.write(bw);
};
uint16_t frameClose(void)
{
uint16_t _crc = ~crc16;
frameWrite((_crc>>0)& 0xFF);
frameWrite((_crc>>8)& 0xFF);
Serial.write(HDLC_FLAG);
Serial.flush();
};
uint8_t poll()
{
if (msg_received < 3) // shortcut, nothing to analyze
{
while (Serial.available())
{
uint8_t _b = uint8_t(Serial.read());
if (msg_received == 0)
{
if (_b==HDLC_FLAG) msg_received = 1;
if (!Serial.available()) delay(1);
continue;
};
if ((msg_received == 2)&&(_b==HDLC_FLAG)) // message complete
{
msg_received = 3;
break;
};
if (msg_received == 1)
{
if (_b==HDLC_FLAG) continue; // startflag found, do nothing
else msg_received = 2; // >1 other character after specialflag found, normal message buffering
};
if (msg_received == 2)
{
if (_b == HDLC_ESCAPE)
{
uint8_t wstop = 0;
while(!Serial.available())
{
//ps.sleep ( 0 );
delay(1);
if (wstop++ > 10) break;
};
_b = uint8_t(Serial.read());
if (_b == HDLC_FLAG_ESC) _b = HDLC_FLAG;
if (_b == HDLC_ESCAPE_ESC) _b = HDLC_ESCAPE;
};
msg[msg_now] = _b;
msg_now ++;
};
if (!Serial.available()) delay(1); //ps.sleep ( 0 );
};
};
if (msg_received == 3)
{
msg_now -= 2; // cut away sync-bytes
uint16_t crcT = HDLC_CRCINIT;
for (uint8_t ivar = 0; ivar < msg_now; ++ivar)
{
crcT = crcIteration(crcT,msg[ivar]);
};
crcT = ~crcT;
uint16_t crcM = msg[msg_now] | (msg[msg_now+1]<<8);
if (crcM != crcT)
{
clearMsg();
return 0;
};
msg_received = 4;
return msg_now;
};
if (msg_received > 2) return msg_now;
else return 0;
};
uint8_t getMsg(const uint8_t position)
{
uint8_t _b;
if (position > (HDLC_INPUT_BUFFER_SIZE - 1)) _b = 0;
else _b = msg[position];
return _b;
};
void clearMsg()
{
msg_received = 0;
msg_now = 0;
};
};
constexpr uint16_t HDLC::hdlc_fcstab[]; // definition - workaround
HDLC hdlc;
#endif

@ -0,0 +1,160 @@
#ifndef atmel_eFunction_h
#define atmel_eFunction_h
#if ARDUINO >= 100
#include <Arduino.h> // Arduino 1.0
#else
#include <WProgram.h> // Arduino 0022
#endif
#include <stdint.h>
#include <avr/pgmspace.h>
////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// PowerOf-and-Scale-Funktion //////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
// INPUT:
//
class eFunction
{
private:
int32_t kf[8], ks[8]; // 8*4*2 = 64b
int32_t xnode[9]; // = {0,INTERVAL/96,INTERVAL/48,INTERVAL/24,INTERVAL/12,INTERVAL/6,INTERVAL/3,INTERVAL/1.5,INTERVAL};
int32_t zero_input = 0, zero_output = 0;
uint8_t interpol = 0;
uint16_t mean_input, mean_output, max_input, max_output;
public:
void init(uint16_t zero_inp, uint16_t max_inp, uint16_t max_out, float pwr)
{
float max_pow, scale_pow, yy, xx; // 4*4=16 (nur temporär)
uint16_t mean_tmp;
zero_input = zero_inp;
mean_tmp = max_inp - zero_input;
if (zero_input >= max_inp) mean_input = max_input;
else if (mean_tmp > zero_input) mean_input = mean_tmp;
else mean_input = zero_input;
//mean_input = max_inp >> 1;
zero_output = (uint16_t)(float(zero_input) * float(max_out) / float(max_inp));
mean_output = zero_output;
if (max_inp > max_out) mean_tmp = mean_input;
else mean_tmp = mean_output;
while (mean_tmp <= 8192)
{
interpol++;
mean_tmp *= 2;
}
if (max_inp >= (mean_input*2))
{
max_input = max_inp << interpol;
max_output = max_out << interpol;
}
else
{
max_input = mean_input << (1 + interpol);
max_output = mean_output << (1 + interpol);
}
max_pow = pow(max_input, 1/pwr); //interval^(1/1.7)
scale_pow = max_pow / float(max_output);
uint16_t interval = max_input - 1;
max_input = max_inp;
max_output = max_out;
// nicht sehr schön, aber keine andere Lösung um auf aktuelle Stützstellen zu kommen
xnode[0] = long(float(0.0));
xnode[1] = long(float(interval)/96.0);
xnode[2] = long(float(interval)/48.0);
xnode[3] = long(float(interval)/24.0);
xnode[4] = long(float(interval)/12.0);
xnode[5] = long(float(interval)/6.00);
xnode[6] = long(float(interval)/3.00);
xnode[7] = long(float(interval)/1.50);
xnode[8] = long(float(interval)/1.00);
for (uint8_t p = 0; p<8; p++)
{
yy = (float)((pow(scale_pow*float(xnode[p+1]),pwr))-(pow(scale_pow*float(xnode[p]),pwr)));
xx = (float)(xnode[p+1]-xnode[p]);
// x^pwr = x * kf + ks über Interpolation mit 9 Stützstellen
kf[p] = (long)((yy*128)/xx);
ks[p] = (long)((pow(scale_pow*float(xnode[p]),pwr)*128)-float(xnode[p]*kf[p]));
}
};
uint16_t get(long value)
{
if (value == zero_input) return (uint16_t)(zero_output);
else if (value >= max_input) return (uint16_t)(max_output);
else if (value <= 0) return (uint16_t)(0);
uint8_t sign, n;
if (value > zero_input) // TODO: not clean, because of not zero scale_powd
{
value = value - zero_input;
sign = 0;
}
else
{
value = zero_input - value;
sign = 1;
}
value = value<<interpol;
if (value<xnode[4])
{
if (value<xnode[2])
{
if (value<xnode[1])
{
if (value<=xnode[0]) return (uint16_t) xnode[0];
else n = 0;
}
else n = 1;
}
else
{
if (value<xnode[3]) n = 2;
else n = 3;
};
}
else
{
if (value < xnode[6])
{
if (value < xnode[5]) n = 4;
else n = 5;
}
else
{
if (value < xnode[7]) n = 6;
else
{
if (value < xnode[8]) n = 7;
else return (uint16_t) xnode[8];
};
};
};
value = ((value*kf[n]+ks[n])>>7);// Todo: 7x Rollen umgehen
value = (value>>interpol);
//if (value >= INTERVAL) value = 0;
if (sign) return (uint16_t)(zero_output - value);
else return (uint16_t)(zero_output + value);
};
};
//eFunction efkt;
#endif

@ -0,0 +1,149 @@
#ifndef atmel_spektrumSerial_h
#define atmel_spectrumSerial_h
////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// Spektrum Serial /////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
// forked from: https://github.com/esden/ppm_to_spektrum_encoder
#include <avr/io.h>
#include <avr/interrupt.h>
/// Choose only one of the two systems
//#define USE_SPEKTRUM2048 // otherwise SPEKTRUM1024 is used
/// IMPORTANT: dont forget to compensate (<<1) if you just want more channels, but no higher resolution
#ifdef USE_SPEKTRUM2048 // 11 bit frames
static const uint16_t SPEKTRUM_VAL_MASK = (0x7FF); // 2047
static const uint8_t SPEKTRUM_CHAN_COUNT = (12);
static const uint8_t SPEKTRUM_CHAN_SHIFT = (3);
static const uint8_t SPEKTRUM_CHAN_MASK = (0x0F);
static const uint8_t SPEKTRUM_CHAN_STATIC = (4); // first # Channels get transmitted every time, the others on change
#else // 10 bit frames
static const uint16_t SPEKTRUM_VAL_MASK = (0x3FF); // 1023
static const uint8_t SPEKTRUM_CHAN_COUNT = (7);
static const uint8_t SPEKTRUM_CHAN_SHIFT = (2);
static const uint8_t SPEKTRUM_CHAN_MASK = (0x07);
#endif // USE_SPEKTRUM2048
static const uint8_t SPEKTRUM_FRAME_SIZE = (16);
volatile uint8_t spectrum_frame[SPEKTRUM_FRAME_SIZE];
volatile uint8_t frame_counter = (0);
volatile uint8_t frame_send = (0);
void spektrum_init(void)
{
/* frame loss count */
spectrum_frame[0] = 0x00; // Let's pretend we are not loosing any frames
/* Receiver identifier */
spectrum_frame[1] = 0x01; // Let's pretend we are DX6i or similar
// Set all initial channel data to 0
for (uint8_t i=0; i<7; i++)
{
spectrum_frame[2+(i*2)] = ((i&SPEKTRUM_CHAN_MASK) << SPEKTRUM_CHAN_SHIFT);
spectrum_frame[2+(i*2)+1] = 0x00;
}
/* Enable USART subsystem */
UCSR0B=(0<<RXCIE0)|(0<<TXCIE0)|(0<<RXEN0)|(1<<TXEN0);
/* Setup baud rate */
const uint32_t UART_BAUD_RATE = 115200; // if you use bad Crystals, adapt this value
const uint32_t UART_BAUD_SELECT = ((F_CPU/UART_BAUD_RATE/16)-1);
UBRR0L=((unsigned char)UART_BAUD_SELECT);
UDR0 = 0xAA;
/* configure second pin to be output for serial out */
DDRD |= (1 << 1); // TX
asm("sei");
};
void spektrum_send(uint16_t *channel_data)
{
#ifdef USE_SPEKTRUM2048
static uint8_t position_newVal = {SPEKTRUM_CHAN_STATIC};
static uint8_t position_sameVal = {SPEKTRUM_CHAN_STATIC};
uint8_t position_start;
static uint16_t old_val[SPEKTRUM_CHAN_COUNT-SPEKTRUM_CHAN_STATIC];
uint16_t bitmap_selected = {0};
// make the position_newVal run through the Channels and until position_start is
if (position_newVal>SPEKTRUM_CHAN_STATIC) position_start = position_newVal - 1;
else position_start = SPEKTRUM_CHAN_COUNT - 1;
#endif // USE_SPEKTRUM2048
for (uint8_t i=0; i<7; i++)
{
uint8_t temp_i;
#ifdef USE_SPEKTRUM2048
if (i < SPEKTRUM_CHAN_STATIC) // handle the channels that get transmitted every time
{
temp_i = i;
}
else
{
temp_i = 0xFF;
while(temp_i == 0xFF)
{
if (position_start != position_newVal) // run through the remaining channels and find changed ones
{
if (old_val[position_newVal-SPEKTRUM_CHAN_STATIC] != (channel_data[position_newVal] & SPEKTRUM_VAL_MASK))
{
old_val[position_newVal-SPEKTRUM_CHAN_STATIC] = (channel_data[position_newVal] & SPEKTRUM_VAL_MASK);
temp_i = position_newVal;
bitSet(bitmap_selected, position_newVal);
}
if (++position_newVal >= SPEKTRUM_CHAN_COUNT) position_newVal = SPEKTRUM_CHAN_STATIC;
}
else // fill the remaining places with unchanged channels
{
if (bitRead(bitmap_selected,position_sameVal) == 0) temp_i = position_sameVal;
if (++position_sameVal >= SPEKTRUM_CHAN_COUNT) position_sameVal = SPEKTRUM_CHAN_STATIC;
}
}
}
#else
temp_i = i;
#endif // USE_SPEKTRUM2048
uint16_t temp_val;
if (channel_data[temp_i] <= 0) temp_val = 0;
else if (channel_data[temp_i] >= SPEKTRUM_VAL_MASK) temp_val = SPEKTRUM_VAL_MASK;
else temp_val = channel_data[temp_i];
spectrum_frame[2+(i*2)] = ((temp_i&SPEKTRUM_CHAN_MASK) << SPEKTRUM_CHAN_SHIFT) | (temp_val>>8);
spectrum_frame[2+(i*2)+1] = temp_val & 0xFF;
}
/* Just enable the serial interrupt the rest will be taken care of */
frame_send = 0;
UCSR0B|=(1<<TXCIE0);
};
ISR(USART_TX_vect)
{
asm("sei");
UDR0 = spectrum_frame[frame_counter];
frame_counter++;
if (frame_counter >= SPEKTRUM_FRAME_SIZE) /* Frame is over, let's disable ourselves */
{
frame_counter = 0; /* reset */
UCSR0B=(0<<RXCIE0)|(0<<TXCIE0)|(0<<RXEN0)|(1<<TXEN0); /* disable */
frame_send = 1;
}
};
#endif

@ -0,0 +1,44 @@
#ifndef atmel_vcc_h
#define atmel_vcc_h
class ATMEL {
public:
ATMEL(void) {};
int32_t readVcc() {
// Read 1.1V reference against AVcc
// set the reference to Vcc and the measurement to the internal 1.1V reference
#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
#elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
ADMUX = _BV(MUX5) | _BV(MUX0);
#elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
ADMUX = _BV(MUX3) | _BV(MUX2);
#else
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
#endif
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Start conversion
while (bit_is_set(ADCSRA,ADSC)); // measuring
uint8_t low = ADCL; // must read ADCL first - it then locks ADCH
uint8_t high = ADCH; // unlocks both
int32_t result = (high<<8) | low;
result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
return result; // Vcc in millivolts
};
/*
volatile bool adcDone;
ISR(ADC_vect)
{
adcDone = true;
}
*/
};
#endif

@ -0,0 +1,13 @@
//#ifdef WirePlus_h
/**<
TODO: ugly BUGFIX!!!
moved content directly to i2c.h ...
to get Scripts without i2c down in filesize
(i2c.cpp is loaded w/o request)
*/
//#endif

@ -0,0 +1,173 @@
#ifndef WirePlus_h
#define WirePlus_h
#include "Wire.h"
#include <Arduino.h> // for uint8_t data type
/** ######### usefull defines ################################################################# */
#define getmax(a,b) ((a)>(b)?(a):(b)) // TODO: implement as static const
#define BITMASK(a) (1<<a)
#define BIT(a) (1<<a)
#ifndef TRUE
#define TRUE (1==1)
#define FALSE (1==2)
#endif
#ifndef HIGH
#define LOW (0)
#define HIGH (1)
#endif
/// are they really usefull?
#define UBLB(a,b) ( ( (a) << 8) | (b) )
#define UBLB19(a,b) ( ( (a) << 16 ) | (b) )
#define UBLB32(a,b,c,d) ((( ((a)<<24) | ((b)<<16) ) | ((c)<<8)) | (d) )
/**< A way to get around Questions with shifting
uint8_t value = 250;
Serial.println(value); // --> 250
Serial.println(int8_t(value)); // --> -6
Serial.println(int8_t(value)<<8); // --> -1536 = -6*256
Serial.println(uint8_t(value)); // --> 250
Serial.println(uint8_t(value)<<8); // --> -1536 = -6*256 !!!!!!!!!!!!!!!!!!!!!!
Serial.println(uint16_t(value<<8)); // --> 64000
*/
class WirePlus
{
public:
WirePlus();
uint8_t probe (const uint8_t);
uint8_t probeAddress(const uint8_t);
void write (const uint8_t, const uint8_t, const uint8_t *, const uint8_t);
void writeByte (const uint8_t, const uint8_t, const uint8_t);
void writeCMD (const uint8_t, const uint8_t);
uint8_t readByte (const uint8_t, const uint8_t);
void read (const uint8_t, const uint8_t, uint8_t *, const uint8_t);
void setRegister (const uint8_t, const uint8_t, const uint8_t, const uint8_t);
uint8_t getRegister (const uint8_t, const uint8_t, const uint8_t);
private:
WirePlus(const WirePlus&); // declaration only for copy constructor
WirePlus& operator=(const WirePlus&); // declaration only for copy assignment --> make it uncopyable
};
/** ######### Implementation ################################################################# */
WirePlus::WirePlus()
{
Wire.begin(); // I2C as Master
bitSet(PORTC, 4); // deactivate internal pull-ups for twi
bitSet(PORTC, 5); // as per note from atmega8 manual pg167
// switch to 400KHz I2C - eheheh
TWBR = ((F_CPU / 400000L) - 16) / 2; // see twi_init in Wire/utility/twi.c
};
/** ######### Public Methods ################################################################# */
uint8_t WirePlus::probe(const uint8_t address)
{
Wire.beginTransmission(address);
if (Wire.endTransmission(true)==0) return 1; // found something
else return 0; // no response
};
uint8_t WirePlus::probeAddress(const uint8_t address)
{
return probe(address);
};
void WirePlus::write(const uint8_t address, const uint8_t register_address, const uint8_t write_value[], const uint8_t length=1)
{
if (!length) return;
Wire.beginTransmission(address);
Wire.write(register_address);
uint8_t counter;
counter = 0;
while (counter < length)
{
Wire.write(write_value[counter]);
counter++;
}
Wire.endTransmission(true);
};
void WirePlus::writeByte(const uint8_t address, const uint8_t register_address, const uint8_t write_value)
{
Wire.beginTransmission(address);
Wire.write(register_address);
Wire.write(write_value);
Wire.endTransmission(true);
};
void WirePlus::writeCMD(const uint8_t address, const uint8_t cmd)
{
Wire.beginTransmission(address);
Wire.write(cmd);
Wire.endTransmission();
};
void WirePlus::read(const uint8_t address, const uint8_t registeraddress, uint8_t buff[], const uint8_t length=1)
{
Wire.beginTransmission(address); // Adress + WRITE (0)
Wire.write(registeraddress);
Wire.endTransmission(false); // No Stop Condition, for repeated Talk
if (!length) return;
Wire.requestFrom(address, length); // Address + READ (1)
uint8_t _i;
_i=0;
while(Wire.available())
{
buff[_i] = Wire.read();
_i++;
}
Wire.endTransmission(true); // Stop Condition
};
uint8_t WirePlus::readByte(const uint8_t address, const uint8_t register_address)
{
uint8_t _readvalue;
read(address, register_address, &_readvalue, 1);
return _readvalue;
};
void WirePlus::setRegister(const uint8_t address, const uint8_t registeraddress, const uint8_t mask, const uint8_t writevalue)
{
uint8_t _setting;
read(address, registeraddress, &_setting, 1 );
_setting &= ~mask;
_setting |= (writevalue&mask);
writeByte(address, registeraddress, _setting);
};
uint8_t WirePlus::getRegister(const uint8_t address, const uint8_t registeraddress, const uint8_t mask)
{
uint8_t _setting;
read(address, registeraddress, &_setting, (uint8_t)1 );
return (_setting & mask);
};
extern WirePlus i2c;
/** ######### Preinstantiate Object ################################################################# */
WirePlus i2c;
//#include "i2c.cpp" // TODO: ugly BUGFIX to get Scripts without i2c down in filesize (i2c.cpp is loaded w/o request)
#endif

@ -0,0 +1,343 @@
#ifndef i2c_bmp280_h
#define i2c_bmp280_h
#include "i2c.h"
#include "i2c_Sensor.h"
/** ######################################################################
Driver for the BMP280-Sensor
CONSUMPTION: standby 0.5 µA, measure 4.2@1Hz, 260-1120µA
ONE-TIME-MEASURE: disable sensor, [start measurement, wait, read ] ...
AUTO-Measure: enable sensor, start measurement, [read, read ] ...
######################################################################## */
class BMP280 : public i2cSensor, public manualSensor
{
private:
/** ######### Register-Map ################################################################# */
static const uint8_t I2C_ADDRESS =(0x76);
// CALIBRATION DATA, 25 Register. 0x88 - 0xA1
static const uint8_t REG_DIG_T1 =(0x88); // watch out - switched MSB/LSB
static const uint8_t REG_DIG_T2 =(0x8A);
static const uint8_t REG_DIG_T3 =(0x8C);
static const uint8_t REG_DIG_P1 =(0x8E);
static const uint8_t REG_DIG_P2 =(0x90);
static const uint8_t REG_DIG_P3 =(0x92);
static const uint8_t REG_DIG_P4 =(0x94);
static const uint8_t REG_DIG_P5 =(0x96);
static const uint8_t REG_DIG_P6 =(0x98);
static const uint8_t REG_DIG_P7 =(0x9A);
static const uint8_t REG_DIG_P8 =(0x9C);
static const uint8_t REG_DIG_P9 =(0x9E);
static const uint8_t REG_ID =(0xD0);
static const uint8_t VAL_ID =(0x58);
static const uint8_t REG_RESET =(0xE0);
static const uint8_t VAL_RESET =(0xB6); // write it to trigger POR
static const uint8_t REG_STATUS =(0xF3);
static const uint8_t MSK_STATUS_MEASURING =(1<<3); // 1 when conversion is running
static const uint8_t MSK_STATUS_IMUPDATE =(1<<0); // 1 when NVM data is copied to image registers
static const uint8_t REG_CTRL_MEAS =(0xF4);
static const uint8_t MSK_CTRL_OSRS_T =(B11100000);
static const uint8_t VAL_CTRL_OSRS_T00 =(B00000000); // skip measurement
static const uint8_t VAL_CTRL_OSRS_T01 =(B00100000); // 1x (no oversampling)
static const uint8_t VAL_CTRL_OSRS_T02 =(B01000000); // 2x --> 17bit, 2m°C
static const uint8_t VAL_CTRL_OSRS_T04 =(B01100000); // 4x (brings no improvement)
static const uint8_t VAL_CTRL_OSRS_T08 =(B10000000); // 8x (brings no improvement)
static const uint8_t VAL_CTRL_OSRS_T16 =(B10100000); // 16x (brings no improvement)
static const uint8_t MSK_CTRL_OSRS_P =(B00011100);
static const uint8_t VAL_CTRL_OSRS_P00 =(B00000000); // skip measurement
static const uint8_t VAL_CTRL_OSRS_P01 =(B00000100); // 1x (no oversampling)
static const uint8_t VAL_CTRL_OSRS_P02 =(B00001000); // 2x
static const uint8_t VAL_CTRL_OSRS_P04 =(B00001100); // 4x
static const uint8_t VAL_CTRL_OSRS_P08 =(B00010000); // 8x
static const uint8_t VAL_CTRL_OSRS_P16 =(B00010100); // 16x --> 20 bit, 0.16 Pa
static const uint8_t MSK_CTRL_MODE =(B00000011);
static const uint8_t VAL_MODE_SLEEP =(B00000000); // low power
static const uint8_t VAL_MODE_FORCED =(B00000001); // manual
static const uint8_t VAL_MODE_NORMAL =(B00000011); // automatic
static const uint8_t REG_CONFIG =(0xF5);
static const uint8_t MSK_CONFIG_T_SB =(B11100000);
static const uint8_t VAL_SB_0000 =(B00000000);
static const uint8_t VAL_SB_0062 =(B00100000);
static const uint8_t VAL_SB_0125 =(B01000000);
static const uint8_t VAL_SB_0250 =(B01100000);
static const uint8_t VAL_SB_0500 =(B10000000);
static const uint8_t VAL_SB_1000 =(B10100000);
static const uint8_t VAL_SB_2000 =(B11000000);
static const uint8_t VAL_SB_4000 =(B11100000);
static const uint8_t MSK_CONFIG_FILTER =(B00011100);
static const uint8_t VAL_FILTER_00 =(B00000000); // full BW
static const uint8_t VAL_FILTER_02 =(B00000100); // 0.223 * ODR
static const uint8_t VAL_FILTER_04 =(B00001000); // 0.092 * ODR
static const uint8_t VAL_FILTER_08 =(B00001100); // 0.042 * ODR
static const uint8_t VAL_FILTER_16 =(B00010000); // 0.021 * ODR
static const uint8_t MSK_CONFIG_SPI3W_EN =(B00000001); // 1 = activate SPI-Mode
static const uint8_t REG_PRESS_MSB =(0xF7);
static const uint8_t REG_PRESS_LSB =(0xF8);
static const uint8_t REG_PRESS_XLSB =(0xF9); // bit 4-7 usable
static const uint8_t REG_TEMP_MSB =(0xFA);
static const uint8_t REG_TEMP_LSB =(0xFB);
static const uint8_t REG_TEMP_XLSB =(0xFC); // bit 4-7 usable
uint16_t dig_T1, dig_P1;
int16_t dig_T2, dig_T3, dig_P2, dig_P3, dig_P4, dig_P5, dig_P6, dig_P7, dig_P8, dig_P9;
int32_t tFine;
/** ######### function definition ################################################################# */
public:
BMP280(void) : dig_T1(0), dig_P1(0), dig_T2(0), dig_T3(0), dig_P2(0), dig_P3(0), dig_P4(0), dig_P5(0), dig_P6(0), dig_P7(0), dig_P8(0), dig_P9(0), tFine(0)
{
};
/**< Enable / Disable the Sensor */
inline void setEnabled(const uint8_t enable = 1)
{
uint8_t _value;
if (enable) _value=VAL_MODE_NORMAL;
else _value=0;
i2c.setRegister(I2C_ADDRESS,REG_CTRL_MEAS, MSK_CTRL_MODE, _value);
};
/**< read Enable / Disable - Status */
inline uint8_t getEnabled(void)
{
return (3 & i2c.readByte(I2C_ADDRESS,REG_CTRL_MEAS));
};
/**< do a software reset */
inline void reset(void)
{
i2c.writeByte(I2C_ADDRESS,REG_RESET, VAL_RESET);
};
/**< */
inline void setPressureOversampleRatio(const uint8_t sampleRatio = 16)
{
uint8_t _value;
if (sampleRatio > 15) _value = VAL_CTRL_OSRS_P16;
else if (sampleRatio > 7) _value = VAL_CTRL_OSRS_P08;
else if (sampleRatio > 3) _value = VAL_CTRL_OSRS_P04;
else if (sampleRatio > 1) _value = VAL_CTRL_OSRS_P02;
else if (sampleRatio > 0) _value = VAL_CTRL_OSRS_P01;
else _value = VAL_CTRL_OSRS_P00; // disable!!!
i2c.setRegister(I2C_ADDRESS,REG_CTRL_MEAS, MSK_CTRL_OSRS_P, _value);
};
inline void setTemperatureOversampleRatio(const uint8_t sampleRatio = 2)
{
uint8_t _value;
if (sampleRatio > 15) _value = VAL_CTRL_OSRS_T16;
else if (sampleRatio > 7) _value = VAL_CTRL_OSRS_T08;
else if (sampleRatio > 3) _value = VAL_CTRL_OSRS_T04; // more isn't better
else if (sampleRatio > 1) _value = VAL_CTRL_OSRS_T02; // 2 should be maximum
else if (sampleRatio > 0) _value = VAL_CTRL_OSRS_T01;
else _value = VAL_CTRL_OSRS_T00; // disable!!!
i2c.setRegister(I2C_ADDRESS,REG_CTRL_MEAS, MSK_CTRL_OSRS_T, _value);
};
inline void setFilterRatio(const uint8_t filterRatio = 0)
{
uint8_t _value;
if (filterRatio > 15) _value = VAL_FILTER_16;
else if (filterRatio > 7) _value = VAL_FILTER_08;
else if (filterRatio > 3) _value = VAL_FILTER_04;
else if (filterRatio > 1) _value = VAL_FILTER_02;
else _value = VAL_FILTER_00; // disable!!!
i2c.setRegister(I2C_ADDRESS,REG_CONFIG, MSK_CONFIG_FILTER, _value);
};
inline void setStandby(const uint16_t ms = 0)
{
uint8_t _value;
if (ms > 3000) _value = VAL_SB_4000;
else if (ms > 1500) _value = VAL_SB_2000;
else if (ms > 750) _value = VAL_SB_1000;
else if (ms > 350) _value = VAL_SB_0500;
else if (ms > 180) _value = VAL_SB_0250;
else if (ms > 90) _value = VAL_SB_0125;
else if (ms > 31) _value = VAL_SB_0062;
else _value = VAL_SB_0000; // disable!!!
i2c.setRegister(I2C_ADDRESS,REG_CONFIG, MSK_CONFIG_T_SB, _value);
}
/**< initialize */
inline uint8_t initialize(void)
{
if (i2c.probe(I2C_ADDRESS)==0) return 0;
reset();
delay(4);
setPressureOversampleRatio(16);
setTemperatureOversampleRatio(2);
setFilterRatio();
setStandby();
i2c.setRegister(I2C_ADDRESS,REG_CONFIG, MSK_CONFIG_SPI3W_EN, 0);
readTrimming();
/*
Serial.println("");
Serial.println(dig_T1);
Serial.println(dig_T2);
Serial.println(dig_T3);
*/
setEnabled(1);
return 1;
};
void readTrimming()
{
uint8_t _value[2];
i2c.read(I2C_ADDRESS, REG_DIG_T1, _value, 2);
dig_T1 = uint16_t((uint16_t(_value[1]<<8)) | _value[0]);
i2c.read(I2C_ADDRESS, REG_DIG_T2, _value, 2);
dig_T2 = int16_t((_value[1]<<8) | _value[0]);
i2c.read(I2C_ADDRESS, REG_DIG_T3, _value, 2);
dig_T3 = int16_t((_value[1]<<8) | _value[0]);
i2c.read(I2C_ADDRESS, REG_DIG_P1, _value, 2);
dig_P1 = uint16_t((uint16_t(_value[1]<<8)) | _value[0]);
i2c.read(I2C_ADDRESS, REG_DIG_P2, _value, 2);
dig_P2 = int16_t((_value[1]<<8) | _value[0]);
i2c.read(I2C_ADDRESS, REG_DIG_P3, _value, 2);
dig_P3 = int16_t((_value[1]<<8) | _value[0]);
i2c.read(I2C_ADDRESS, REG_DIG_P4, _value, 2);
dig_P4 = int16_t((_value[1]<<8) | _value[0]);
i2c.read(I2C_ADDRESS, REG_DIG_P5, _value, 2);
dig_P5 = int16_t((_value[1]<<8) | _value[0]);
i2c.read(I2C_ADDRESS, REG_DIG_P6, _value, 2);
dig_P6 = int16_t((_value[1]<<8) | _value[0]);
i2c.read(I2C_ADDRESS, REG_DIG_P7, _value, 2);
dig_P7 = int16_t((_value[1]<<8) | _value[0]);
i2c.read(I2C_ADDRESS, REG_DIG_P8, _value, 2);
dig_P8 = int16_t((_value[1]<<8) | _value[0]);
i2c.read(I2C_ADDRESS, REG_DIG_P9, _value, 2);
dig_P9 = int16_t((_value[1]<<8) | _value[0]);
};
/**< disables continious Mode! (enable(1)) */
inline void triggerMeasurement(void)
{
i2c.setRegister(I2C_ADDRESS,REG_CTRL_MEAS, MSK_CTRL_MODE, VAL_MODE_FORCED);
};
inline uint8_t checkMeasurement(void)
{
return !(MSK_STATUS_MEASURING & i2c.readByte(I2C_ADDRESS, REG_STATUS));
};
/**< if you started a measurement and want to actively wait for it to finish */
inline uint8_t awaitMeasurement(void)
{
uint8_t _counter = 0;
while(checkMeasurement()==0)
{
if(++_counter > 250) return 0; //Error out after max of 500ms for a read
delay(2);
}
return 1; // Measurement finished
};
/**< gives airpressure in Pascal */
void getPressure(uint32_t& pascal)
{
uint8_t _value[3];
i2c.read(I2C_ADDRESS, REG_PRESS_MSB, _value, 3);
int32_t var1, var2, adc;
adc = (uint32_t( uint16_t(_value[0] << 8) | _value[1])<<4) | (_value[2]>>4);
var1 = (((int32_t)tFine)>>1) - (int32_t)64000;
var2 = (((var1>>2) * (var1>>2)) >> 11 ) * ((int32_t)dig_P6);
var2 = var2 + ((var1*((int32_t)dig_P5))<<1);
var2 = (var2>>2)+(((int32_t)dig_P4)<<16);
var1 = (((dig_P3 * (((var1>>2) * (var1>>2)) >> 13 )) >> 3) + ((((int32_t)dig_P2) * var1)>>1))>>18;
var1 =((((32768+var1))*((int32_t)dig_P1))>>15);
if (var1 == 0) return; // avoid exception caused by division by zero
pascal = (((uint32_t)(((int32_t)1048576)-adc)-(var2>>12)))*3125;
if (pascal < 0x80000000) pascal = (pascal << 1) / ((uint32_t)var1);
else pascal = (pascal / (uint32_t)var1) * 2;
var1 = (((int32_t)dig_P9) * ((int32_t)(((pascal>>3) * (pascal>>3))>>13)))>>12;
var2 = (((int32_t)(pascal>>2)) * ((int32_t)dig_P8))>>13;
pascal = (uint32_t)((int32_t)pascal + ((var1 + var2 + dig_P7) >> 4));
};
void getPressure(float& pascal)
{
uint32_t iPascal;
getPressure(iPascal);
pascal = float(iPascal);
}
/**< gives pressure-values */
void getMeasurement(float& pascal)
{
getPressure(pascal);
};
/**< gives the number of meters above sea level */
void getAltitude(float& meter)
{
uint32_t iPascal;
getPressure(iPascal);
meter = 44330.0*(1-pow(float(iPascal)/101325.0,1.0/5.255));
};
/**< gives temperature in degree celsius */
void getTemperature(int32_t& millicelsius)
{
uint8_t value[3];
i2c.read(I2C_ADDRESS, REG_TEMP_MSB, value, 3);
int32_t var1, var2, adc;
adc = (uint32_t( uint16_t(value[0] << 8) | value[1])<<4) | (value[2]>>4);
var1 = ((((adc>>3) - ((int32_t)dig_T1<<1))) * ((int32_t)dig_T2)) >> 11;
var2 = (((((adc>>4) - ((int32_t)dig_T1)) * ((adc>>4) - ((int32_t)dig_T1))) >> 12) * ((int32_t)dig_T3))>>14;
//var2 = ((adc>>4) - ((int32_t)dig_T1));
//var2 = (((var2 * var2) >> 12) * ((int32_t)dig_T3))>>14;
tFine = var1 + var2;
millicelsius = (tFine * 50 + 1280) >> 8;
};
void getTemperature(float& celsius)
{
int32_t iTemperature;
getTemperature(iTemperature);
celsius = float(iTemperature) / 1000;
};
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//BMP280 bmp280 = BMP280();
#endif

@ -0,0 +1,361 @@
#ifndef i2c_FAN5421_h
#define i2c_FAN5421_h
#include "i2c.h"
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// FAN5421 ///////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
class FAN5421
{
/** ######### Register-Map ################################################################# */
public:
static const uint8_t I2C_ADDRESS =(0x6A);
private:
static const uint8_t FAN5421_REG_CONTROL0 =(0x00);
static const uint8_t FAN5421_MSK_TMR_RST =(1<<7); // has to be written every 30s to enable charging
static const uint8_t FAN5421_MSK_EN_STAT =(1<<6);
static const uint8_t FAN5421_MSK_STAT =(3<<4);
static const uint8_t FAN5421_VAL_STAT_READY =(0<<4);
static const uint8_t FAN5421_VAL_STAT_CHARGE =(1<<4);
static const uint8_t FAN5421_VAL_STAT_FULL =(2<<4);
static const uint8_t FAN5421_VAL_STAT_FAULT =(3<<4);
static const uint8_t FAN5421_MSK_FAULT =(7<<0);
static const uint8_t FAN5421_VAL_FAULT_NORMAL =(0<<0);
static const uint8_t FAN5421_VAL_FAULT_VBUSOVP =(1<<0);
static const uint8_t FAN5421_VAL_FAULT_SLEEP =(2<<0);
static const uint8_t FAN5421_VAL_FAULT_POORSRC =(3<<0);
static const uint8_t FAN5421_VAL_FAULT_BATOVP =(4<<0);
static const uint8_t FAN5421_VAL_FAULT_THSHTDWN =(5<<0);
static const uint8_t FAN5421_VAL_FAULT_TMR =(6<<0);
static const uint8_t FAN5421_VAL_FAULT_NOBAT =(7<<0);
static const uint8_t FAN5421_REG_CONTROL1 =(0x01);
static const uint8_t FAN5421_MSK_V_LOW_V =(3<<4);
static const uint8_t FAN5421_VAL_V_LOW_3V4 =(0<<4);
static const uint8_t FAN5421_VAL_V_LOW_3V5 =(1<<4);
static const uint8_t FAN5421_VAL_V_LOW_3V6 =(2<<4);
static const uint8_t FAN5421_VAL_V_LOW_3V7 =(3<<4);
static const uint8_t FAN5421_MSK_TE =(1<<3); // Current Termination
static const uint8_t FAN5421_MSK_CE_N =(1<<2); // Charge Enabled NOT
static const uint8_t FAN5421_MSK_HZ_MODE =(1<<1); // High impedance mode
static const uint8_t FAN5421_REG_OREG =(0x02);
static const uint8_t FAN5421_MSK_OREG =(0b11111100);
static const uint8_t FAN5421_VAL_OREG_3V80 =(15<<2);
static const uint8_t FAN5421_VAL_OREG_3V90 =(20<<2);
static const uint8_t FAN5421_VAL_OREG_4V00 =(25<<2);
static const uint8_t FAN5421_VAL_OREG_4V10 =(30<<2);
static const uint8_t FAN5421_VAL_OREG_4V20 =(35<<2); // =(4200-3500)/20
static const uint8_t FAN5421_VAL_OREG_4V30 =(40<<2);
static const uint8_t FAN5421_VAL_OREG_4V40 =(45<<2);
static const uint8_t FAN5421_VAL_OREG_4V44 =(62<<2);
static const uint8_t FAN5421_REG_IC_INFO =(0x03);
static const uint8_t FAN5421_MSK_VENDOR =(7<<5);
static const uint8_t FAN5421_VAL_FAIRCHILD =(0b10000000);
static const uint8_t FAN5421_MSK_PN =(3<<3);
static const uint8_t FAN5421_VAL_PN =(0b00000000);
static const uint8_t FAN5421_MSK_REV =(7);
static const uint8_t FAN5421_VAL_REV =(1);
static const uint8_t FAN5421_REG_IBAT =(0x04);
static const uint8_t FAN5421_MSK_RESET =(1<<7);
static const uint8_t FAN5421_MSK_IOCHARGE =(15<<3);
static const uint8_t FAN5421_VAL_IO_1A55 =(10<<3);
static const uint8_t FAN5421_VAL_IO_1A45 =(9<<3);
static const uint8_t FAN5421_VAL_IO_1A35 =(8<<3);
static const uint8_t FAN5421_VAL_IO_1A25 =(7<<3);
static const uint8_t FAN5421_VAL_IO_1A15 =(6<<3);
static const uint8_t FAN5421_VAL_IO_1A05 =(5<<3);
static const uint8_t FAN5421_VAL_IO_0A95 =(4<<3);
static const uint8_t FAN5421_VAL_IO_0A85 =(3<<3);
static const uint8_t FAN5421_VAL_IO_0A75 =(2<<3);
static const uint8_t FAN5421_VAL_IO_0A65 =(1<<3);
static const uint8_t FAN5421_VAL_IO_0A55 =(0<<3);
static const uint8_t FAN5421_MSK_ITERM =(7);
static const uint8_t FAN5421_VAL_ITERM_050MA =(0);
static const uint8_t FAN5421_VAL_ITERM_100MA =(1);
static const uint8_t FAN5421_VAL_ITERM_150MA =(2);
static const uint8_t FAN5421_VAL_ITERM_200MA =(3);
static const uint8_t FAN5421_REG_SP_CHARGER =(0x05);
static const uint8_t FAN5421_MSK_IO_LEVEL =(1<<5);
static const uint8_t FAN5421_MSK_SP =(1<<4); // Special Charger
static const uint8_t FAN5421_MSK_EN_LEVEL =(1<<3); // ReadOnly
static const uint8_t FAN5421_MSK_VSP =(7<<0);
static const uint8_t FAN5421_VAL_VSP_4V20 =(0<<0);
static const uint8_t FAN5421_VAL_VSP_4V44 =(3<<0);
static const uint8_t FAN5421_VAL_VSP_4V60 =(5<<0);
static const uint8_t FAN5421_VAL_VSP_4V76 =(7<<0);
static const uint8_t FAN5421_REG_SAFETY =(0x06); // can only be written before any other register is written =(after vbat > vshort)
static const uint8_t FAN5421_MSK_ISAFE =(15<<4);
static const uint8_t FAN5421_VAL_ISAFE_1A0 =(5<<4);
static const uint8_t FAN5421_VAL_ISAFE_1A5 =(10<<4);
static const uint8_t FAN5421_VAL_ISAFE_2A0 =(15<<4);
static const uint8_t FAN5421_MSK_VSAFE =(15);
static const uint8_t FAN5421_VAL_VSAFE_4V20 =(0);
static const uint8_t FAN5421_VAL_VSAFE_4V30 =(5);
static const uint8_t FAN5421_VAL_VSAFE_4V40 =(10);
static const uint8_t FAN5421_VAL_VSAFE_4V44 =(15);
FAN5421(const FAN5421&); // declaration only for copy constructor
FAN5421& operator=(const FAN5421&); // declaration only for copy assignment --> make it uncopyable
public:
FAN5421(void)
{
};
// reset IC --> dont forget to set safety-registers first after reset
void reset()
{
i2c.setRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_RESET, 255);
i2c.setRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_RESET, 0);
};
// has to be written before any other register is written (locked after)
uint8_t set_safety()
{
uint8_t error = 0;
i2c.writeByte( I2C_ADDRESS, FAN5421_REG_SAFETY, FAN5421_VAL_ISAFE_1A5 | FAN5421_VAL_VSAFE_4V20);
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_SAFETY, FAN5421_MSK_ISAFE) != FAN5421_VAL_ISAFE_1A5) error++;
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_SAFETY, FAN5421_MSK_VSAFE) != FAN5421_VAL_VSAFE_4V20) error++;
return error;
};
// has to be polled at least every 32s during charging (HOST alive)
void poll_timer()
{
i2c.setRegister( I2C_ADDRESS, FAN5421_REG_CONTROL0, FAN5421_MSK_TMR_RST, 255);
};
// feedback for debugging / status
void print_status()
{
Serial.print("FAN5421 is ");
uint8_t status = i2c.getRegister(I2C_ADDRESS, FAN5421_REG_CONTROL0,FAN5421_MSK_STAT);
if (status == FAN5421_VAL_STAT_READY) Serial.print("READY");
if (status == FAN5421_VAL_STAT_CHARGE) Serial.print("CHARGING");
if (status == FAN5421_VAL_STAT_FULL) Serial.print("FULL");
if (status == FAN5421_VAL_STAT_FAULT) Serial.print("FAULTY");
Serial.print(" with ");
uint8_t fault = i2c.getRegister(I2C_ADDRESS, FAN5421_REG_CONTROL0,FAN5421_MSK_FAULT);
if (fault == FAN5421_VAL_FAULT_NORMAL) Serial.print("no fault");
if (fault == FAN5421_VAL_FAULT_VBUSOVP) Serial.print("Vbus OVP");
if (fault == FAN5421_VAL_FAULT_SLEEP) Serial.print("sleep enabled");
if (fault == FAN5421_VAL_FAULT_POORSRC) Serial.print("poor source");
if (fault == FAN5421_VAL_FAULT_BATOVP) Serial.print("battery OVP");
if (fault == FAN5421_VAL_FAULT_THSHTDWN) Serial.print("thermal shutdown");
if (fault == FAN5421_VAL_FAULT_TMR) Serial.print("timer error");
if (fault == FAN5421_VAL_FAULT_NOBAT) Serial.print("no battery");
Serial.print(" (");
Serial.print(3400 + 100*(i2c.getRegister(I2C_ADDRESS, FAN5421_REG_CONTROL1, FAN5421_MSK_V_LOW_V)>>4));
Serial.print("mV,");
Serial.print(550 + 100*(i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_IOCHARGE)>>3));
Serial.print("mA,");
Serial.print(3500.0+20.0*(i2c.getRegister(I2C_ADDRESS, FAN5421_REG_OREG, FAN5421_MSK_OREG)>>2),0);
Serial.print("mV)");
};
// only for debug purpose
void print_register()
{
Serial.print("DEBUG \t ");
for (uint8_t loopvar=0; loopvar < 7; loopvar++)
{
Serial.print(" R");
Serial.print(loopvar);
Serial.print(": ");
Serial.print(i2c.getRegister(I2C_ADDRESS, loopvar, 255), BIN);
Serial.print(" \t ");
}
};
// give a basic and safe set for enable charging
uint8_t set_config(const uint16_t charge_current_mA = 750)
{
uint8_t error = 0;
// TODO: probe IC
//// FAN5421_REG_CONTROL0
i2c.writeByte( I2C_ADDRESS, FAN5421_REG_CONTROL0, FAN5421_MSK_TMR_RST | FAN5421_MSK_EN_STAT);
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_CONTROL0, FAN5421_MSK_EN_STAT) != FAN5421_MSK_EN_STAT) error++;
//// FAN5421_REG_CONTROL1
i2c.writeByte( I2C_ADDRESS, FAN5421_REG_CONTROL1, FAN5421_VAL_V_LOW_3V6 | FAN5421_MSK_TE | 0 | 0);
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_CONTROL1, FAN5421_MSK_V_LOW_V) != FAN5421_VAL_V_LOW_3V6) error++;
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_CONTROL1, FAN5421_MSK_TE) != FAN5421_MSK_TE) error++;
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_CONTROL1, FAN5421_MSK_CE_N) != 0) error++;
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_CONTROL1, FAN5421_MSK_HZ_MODE) != 0) error++;
//// FAN5421_REG_OREG
i2c.writeByte( I2C_ADDRESS, FAN5421_REG_OREG, FAN5421_VAL_OREG_4V20);
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_OREG, FAN5421_MSK_OREG) != FAN5421_VAL_OREG_4V20) error++;
//// FAN5421_REG_IC_INFO
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IC_INFO, FAN5421_MSK_VENDOR) != FAN5421_VAL_FAIRCHILD) error++;
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IC_INFO, FAN5421_MSK_PN) != FAN5421_VAL_PN) error++;
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IC_INFO, FAN5421_MSK_REV) != FAN5421_VAL_REV) error++;
//// FAN5421_REG_IBAT
i2c.writeByte( I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_VAL_IO_0A75 | FAN5421_VAL_ITERM_100MA);
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_IOCHARGE)!= FAN5421_VAL_IO_0A75) error++;
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_ITERM) != FAN5421_VAL_ITERM_100MA) error++;
error += set_current(charge_current_mA);
//// FAN5421_REG_SP_CHARGER
i2c.writeByte( I2C_ADDRESS, FAN5421_REG_SP_CHARGER, 0 | FAN5421_VAL_VSP_4V20);
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_SP_CHARGER, FAN5421_MSK_IO_LEVEL) != 0) error++;
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_SP_CHARGER, FAN5421_MSK_VSP) != FAN5421_VAL_VSP_4V20) error++;
return error;
};
// charging current routine
uint8_t set_current(uint16_t charge_current_mA)
{
uint8_t error = 0, value = 0;
while (charge_current_mA > 550)
{
charge_current_mA -= 100;
value += (1<<3);
}
i2c.writeByte( I2C_ADDRESS, FAN5421_REG_IBAT, (value) | i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_ITERM));
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_IOCHARGE)!= value) error++;
return error;
};
// increase charging-current step by step
uint8_t increase_current()
{
uint8_t error = 0;
uint8_t value = i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_IOCHARGE);
if (value == (15<<3)) return 1; // error - maximum reached
value += (1<<3);
// watch out - dont trigger reset
i2c.writeByte( I2C_ADDRESS, FAN5421_REG_IBAT, (value) | i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_ITERM));
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_IOCHARGE)!= value) error++;
return error;
};
// decrease charging-current step by step
uint8_t decrease_current()
{
uint8_t error = 0;
uint8_t value = i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_IOCHARGE);
if (value == 0) return 1; // error - minimum reached
value -= (1<<3);
// watch out - dont trigger reset
i2c.writeByte( I2C_ADDRESS, FAN5421_REG_IBAT, (value) | i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_ITERM));
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_IOCHARGE)!= value) error++;
return error;
};
// mostly for debugging
void print_info()
{
Serial.print(" SRST: \t ");
Serial.println(i2c.getRegister( I2C_ADDRESS, FAN5421_REG_CONTROL0, FAN5421_MSK_TMR_RST)>>7);
Serial.print(" SP: \t");
Serial.println(i2c.getRegister( I2C_ADDRESS, FAN5421_REG_SP_CHARGER, FAN5421_MSK_IO_LEVEL)>>4);
Serial.print(" DIS: \t");
Serial.println(i2c.getRegister( I2C_ADDRESS, FAN5421_REG_SP_CHARGER, FAN5421_MSK_EN_LEVEL)>>3);
Serial.print(" VE: \t");
Serial.println(i2c.getRegister( I2C_ADDRESS, FAN5421_REG_IC_INFO, FAN5421_MSK_VENDOR)>>5);
Serial.print(" PN: \t");
Serial.println(i2c.getRegister( I2C_ADDRESS, FAN5421_REG_IC_INFO, FAN5421_MSK_PN)>>3);
Serial.print(" REV \t 1.");
Serial.println(i2c.getRegister( I2C_ADDRESS, FAN5421_REG_IC_INFO, FAN5421_MSK_REV));
};
// gives feedback if it charges or not
uint8_t get_chargingstatus()
{
uint8_t status = i2c.getRegister(I2C_ADDRESS, FAN5421_REG_CONTROL0,FAN5421_MSK_STAT);
if (status == FAN5421_VAL_STAT_CHARGE) return 1;
else return 0;
};
// workaround for: chip doesnt charge when already charged and external power still present
// disable charging, wait ~30ms, enable charging --> not working as expected, try chip.reset
uint8_t charging_enable(const uint8_t enable = 1)
{
i2c.setRegister(I2C_ADDRESS, FAN5421_REG_CONTROL1, FAN5421_MSK_CE_N, ~enable);
if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_CONTROL1, FAN5421_MSK_CE_N) == (FAN5421_MSK_CE_N&(~enable))) return 1; // charging-changed
else return 0; // error
};
/// by default the system current is limited to 325mA. increase with following sequence:
// program safety register
// set oreg to the desired value (4...18)
// set iocharge, then reset the iolevel-bit
uint8_t power_without_battery()
{
uint8_t error = 0;
//// FAN5421_REG_OREG
i2c.writeByte( I2C_ADDRESS, FAN5421_REG_OREG, FAN5421_VAL_OREG_4V20);
//if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_OREG, FAN5421_MSK_OREG) != FAN5421_VAL_OREG_4V20) error++;
//// FAN5421_REG_IBAT
i2c.writeByte( I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_VAL_IO_1A45 | FAN5421_VAL_ITERM_100MA);
//if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_IOCHARGE)!= FAN5421_VAL_IO_0A75) error++;
//if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_IBAT, FAN5421_MSK_ITERM) != FAN5421_VAL_ITERM_100MA) error++;
//// FAN5421_REG_SP_CHARGER
//i2c.writeByte( I2C_ADDRESS, FAN5421_REG_SP_CHARGER, FAN5421_MSK_IO_LEVEL);
i2c.writeByte( I2C_ADDRESS, FAN5421_REG_SP_CHARGER, 0 | FAN5421_VAL_VSP_4V20);
//if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_SP_CHARGER, FAN5421_MSK_IO_LEVEL) != 0) error++;
//if (i2c.getRegister(I2C_ADDRESS, FAN5421_REG_SP_CHARGER, FAN5421_MSK_VSP) != FAN5421_VAL_VSP_4V20) error++;
return error;
};
};
#endif

@ -0,0 +1,302 @@
#ifndef i2c_L3G_h
#define i2c_L3G_h
#include "i2c.h"
#include "i2c_Sensor.h"
/** ######################################################################
Driver for the L3G-Sensor
CONSUMPTION: standby X µA, measure X µA
Details:
///
######################################################################## */
class L3G : public i2cSensor
{
private:
/** ######### Register-Map ################################################################# */
static const uint8_t L3G4200D_ADDRESS_SA0_LOW =(0xD0 >> 1);
static const uint8_t L3G4200D_ADDRESS_SA0_HIGH =(0xD2 >> 1);
static const uint8_t L3GD20_ADDRESS_SA0_LOW =(0xD4 >> 1);
static const uint8_t L3GD20_ADDRESS_SA0_HIGH =(0xD6 >> 1);
static const uint8_t I2C_ADDRESS =(L3GD20_ADDRESS_SA0_HIGH);
static const uint8_t WHO_AM_I =(0x0F);
static const uint8_t CTRL_REG1 =(0x20);
static const uint8_t DATA_RATE_MASK =(B11000000);
static const uint8_t DATA_RATE_100HZ =(B00000000);
static const uint8_t DATA_RATE_200HZ =(B01000000);
static const uint8_t DATA_RATE_400HZ =(B10000000);
static const uint8_t DATA_RATE_800HZ =(B11000000);
static const uint8_t BANDWIDTH_MASK =(B00110000);
static const uint8_t BANDWIDTH_MIN =(B00000000);
static const uint8_t BANDWIDTH_LOW =(B00010000);
static const uint8_t BANDWIDTH_MED =(B00100000);
static const uint8_t BANDWIDTH_HIG =(B00110000);
static const uint8_t PWRDWN_DIS_MASK =(B00001000);
static const uint8_t Z_AXIS_EN_MASK =(B00000100);
static const uint8_t Y_AXIS_EN_MASK =(B00000010);
static const uint8_t X_AXIS_EN_MASK =(B00000001);
static const uint8_t CTRL_REG2 =(0x21);
static const uint8_t HIGH_PASS_MODE_MASK =(B00110000);
static const uint8_t HIGH_PASS_MODE_NORR =(B00000000);
static const uint8_t HIGH_PASS_MODE_REFE =(B00010000);
static const uint8_t HIGH_PASS_MODE_NORM =(B00100000);
static const uint8_t HIGH_PASS_MODE_AUTO =(B00110000);
static const uint8_t HIGH_PASS_FREQ_MASK =(B00001111);
static const uint8_t HIGH_PASS_FREQ_STP9 =(B00000000);
static const uint8_t HIGH_PASS_FREQ_STP8 =(B00000001);
static const uint8_t HIGH_PASS_FREQ_STP7 =(B00000010);
static const uint8_t HIGH_PASS_FREQ_STP6 =(B00000011);
static const uint8_t HIGH_PASS_FREQ_STP5 =(B00000100);
static const uint8_t HIGH_PASS_FREQ_STP4 =(B00000101);
static const uint8_t HIGH_PASS_FREQ_STP3 =(B00000110);
static const uint8_t HIGH_PASS_FREQ_STP2 =(B00000111);
static const uint8_t HIGH_PASS_FREQ_STP1 =(B00001000);
static const uint8_t HIGH_PASS_FREQ_STP0 =(B00001001);
static const uint8_t CTRL_REG3 =(0x22);
static const uint8_t INT1_EN_MASK =(B10000000);
static const uint8_t INT1_BOOTSTAT_MASK =(B01000000);
static const uint8_t INT1_LOW_ACT_MASK =(B00100000);
static const uint8_t INT_OPNDRAIN_MASK =(B00010000);
static const uint8_t DRDY_DRDY_MASK =(B00001000);
static const uint8_t DRDY_FIFO_WTM_MASK =(B00000100);
static const uint8_t DRDY_FIFO_ORUN_MASK =(B00000010);
static const uint8_t DRDY_FIFO_EMTY_MASK =(B00000001);
static const uint8_t CTRL_REG4 =(0x23);
static const uint8_t BLOCK_D_UPDATE_MASK =(B10000000);
static const uint8_t MSB_ON_LOWADD_MASK =(B01000000);
static const uint8_t SCALE_MASK =(B00110000);
static const uint8_t SCALE_0250DPS =(B00000000);
static const uint8_t SCALE_0500DPS =(B00010000);
static const uint8_t SCALE_1000DPS =(B00100000);
static const uint8_t SCALE_2000DPS =(B00110000);
static const uint8_t SELFTEST_EN_MASK =(B00000110);
static const uint8_t SELFTEST_DIS =(B00000000);
static const uint8_t SELFTEST_EN0 =(B00000010);
static const uint8_t SELFTEST_EN1 =(B00000110);
static const uint8_t SPI_TO_3WIRE_MASK =(B00000001);
static const uint8_t SPI_TO_3WIRE_DIS =(B00000000);
static const uint8_t SPI_TO_3WIRE_EN =(B00000001);
static const uint8_t CTRL_REG5 =(0x24);
static const uint8_t REBOOT_MEM_MASK =(B10000000);
static const uint8_t FIFO_EN_MASK =(B01000000);
static const uint8_t HIGH_PASS_EN_MASK =(B00010000);
static const uint8_t INTSEL_LPF_EN_MASK =(B00001000);
static const uint8_t INTSEL_HPF_EN_MASK =(B00000100);
static const uint8_t DATA_LPF_EN_MASK =(B00000010);
static const uint8_t DATA_HPF_EN_MASK =(B00000001);
static const uint8_t REFERENCE =(0x25);
static const uint8_t OUT_TEMP =(0x26);
static const uint8_t STATUS_REG =(0x27);
static const uint8_t OUT_X_L =(0x28);
static const uint8_t OUT_X_H =(0x29);
static const uint8_t OUT_Y_L =(0x2A);
static const uint8_t OUT_Y_H =(0x2B);
static const uint8_t OUT_Z_L =(0x2C);
static const uint8_t OUT_Z_H =(0x2D);
static const uint8_t FIFO_CTRL_REG =(0x2E);
static const uint8_t FIFO_SRC_REG =(0x2F);
static const uint8_t INT1_CFG =(0x30);
static const uint8_t INT1_SRC =(0x31);
static const uint8_t INT1_THS_XH =(0x32);
static const uint8_t INT1_THS_XL =(0x33);
static const uint8_t INT1_THS_YH =(0x34);
static const uint8_t INT1_THS_YL =(0x35);
static const uint8_t INT1_THS_ZH =(0x36);
static const uint8_t INT1_THS_ZL =(0x37);
static const uint8_t INT1_DURATION =(0x38);
float sens_factor;
/** ######### function definition ################################################################# */
public:
L3G(void) : sens_factor(1)
{
};
inline void reset(void)
{
i2c.setRegister(I2C_ADDRESS, CTRL_REG5, REBOOT_MEM_MASK, 255);
delay(3);
i2c.setRegister(I2C_ADDRESS, CTRL_REG5, REBOOT_MEM_MASK, 0);
};
inline void setEnabled(const uint8_t enable=1)
{
uint8_t _value;
if (enable) _value = 255;
else _value = 0;
i2c.setRegister(I2C_ADDRESS, CTRL_REG1, PWRDWN_DIS_MASK, _value);
};
inline void setDatarate(const uint16_t hzFreq = 100)
{
uint8_t _value;
if (hzFreq <= 100) _value = DATA_RATE_100HZ; // 95Hz
else if (hzFreq <= 200) _value = DATA_RATE_200HZ; // 190Hz
else if (hzFreq <= 400) _value = DATA_RATE_400HZ; // 380Hz
else _value = DATA_RATE_800HZ; // 760Hz
i2c.setRegister(I2C_ADDRESS, CTRL_REG1, DATA_RATE_MASK, _value); // 100HZ
};
inline void setSensibility(const uint16_t degScaleRange)
{
uint8_t _value;
if (degScaleRange <= 250)
{
_value = SCALE_0250DPS;
sens_factor = 0.00875;
}
else if (degScaleRange <= 500)
{
_value = SCALE_0500DPS;
sens_factor = 0.01750;
}
//else if (degScaleRange <= 400) { value = SCALE_1000DPS; }
else
{
_value = SCALE_2000DPS;
sens_factor = 1/13.98f; // 0.07000;
}
i2c.setRegister(I2C_ADDRESS, CTRL_REG4, SCALE_MASK, _value);
};
inline uint8_t initialize(void)
{
return initialize(100, 250);
}
inline uint8_t initialize(const uint16_t hzFreq, const uint16_t degScaleRange)
{
if (i2c.probe(I2C_ADDRESS)==0) return 0;
reset();
setEnabled(0);
setDatarate(hzFreq);
i2c.setRegister(I2C_ADDRESS, CTRL_REG1, BANDWIDTH_MASK, BANDWIDTH_HIG);
i2c.setRegister(I2C_ADDRESS, CTRL_REG1, Z_AXIS_EN_MASK, Z_AXIS_EN_MASK);
i2c.setRegister(I2C_ADDRESS, CTRL_REG1, Y_AXIS_EN_MASK, Y_AXIS_EN_MASK);
i2c.setRegister(I2C_ADDRESS, CTRL_REG1, X_AXIS_EN_MASK, X_AXIS_EN_MASK);
i2c.setRegister(I2C_ADDRESS, CTRL_REG2, B11000000, 0); // Just for secure operation
i2c.setRegister(I2C_ADDRESS, CTRL_REG2, HIGH_PASS_MODE_MASK, HIGH_PASS_MODE_NORM);
i2c.setRegister(I2C_ADDRESS, CTRL_REG2, HIGH_PASS_FREQ_MASK, HIGH_PASS_FREQ_STP0);
i2c.setRegister(I2C_ADDRESS, CTRL_REG3, INT1_EN_MASK, 0);
i2c.setRegister(I2C_ADDRESS, CTRL_REG3, INT1_BOOTSTAT_MASK, 0);
i2c.setRegister(I2C_ADDRESS, CTRL_REG3, INT1_LOW_ACT_MASK, 0); // 0=HIGH active
i2c.setRegister(I2C_ADDRESS, CTRL_REG3, INT_OPNDRAIN_MASK, 0); // 0=PushPull
i2c.setRegister(I2C_ADDRESS, CTRL_REG3, DRDY_DRDY_MASK, 255);
i2c.setRegister(I2C_ADDRESS, CTRL_REG3, DRDY_FIFO_WTM_MASK, 0);
i2c.setRegister(I2C_ADDRESS, CTRL_REG3, DRDY_FIFO_ORUN_MASK, 0);
i2c.setRegister(I2C_ADDRESS, CTRL_REG3, DRDY_FIFO_EMTY_MASK, 0);
i2c.setRegister(I2C_ADDRESS, CTRL_REG4, BLOCK_D_UPDATE_MASK, 0); // 0=continuos update
i2c.setRegister(I2C_ADDRESS, CTRL_REG4, MSB_ON_LOWADD_MASK, 0);
setSensibility(degScaleRange);
//i2c.setRegister(I2C_ADDRESS, CTRL_REG4, SELFTEST_EN_MASK, SELFTEST_DIS); // should not be changed in gd20
i2c.setRegister(I2C_ADDRESS, CTRL_REG4, SPI_TO_3WIRE_MASK, SPI_TO_3WIRE_DIS);
i2c.setRegister(I2C_ADDRESS, CTRL_REG5, FIFO_EN_MASK, 0);
i2c.setRegister(I2C_ADDRESS, CTRL_REG5, HIGH_PASS_EN_MASK, 0); // Combination - not helpfull, or?
i2c.setRegister(I2C_ADDRESS, CTRL_REG5, INTSEL_LPF_EN_MASK, 0);
i2c.setRegister(I2C_ADDRESS, CTRL_REG5, INTSEL_HPF_EN_MASK, 0);
i2c.setRegister(I2C_ADDRESS, CTRL_REG5, DATA_LPF_EN_MASK, 0); // Combination
i2c.setRegister(I2C_ADDRESS, CTRL_REG5, DATA_HPF_EN_MASK, 0); // Combination
setEnabled(1);
return 1;
};
/**< check for new data, return 1 when Measurement is ready */
inline uint8_t checkMeasurement(void)
{
/**< TODO: Implement */
return 1; // Measurement finished
};
/**< wait for new data*/
inline uint8_t awaitMeasurement(void)
{
/**< TODO: Implement */
return 1; // Measurement finished
};
/**< Reads the 3 gyro channels RAW!!!
Sensitivity for the L3GD20:
250dps --> 8.75 mdps/digit
500dps --> 17.5 mdps/digit
2000dps --> 70.0 mdps/digit
*/
void getMeasurement(int16_t xyz_raw[])
{
byte _byte[6];
i2c.read(I2C_ADDRESS, (OUT_X_L | (1 << 7)), _byte, 6);
// combine high and low bytes
xyz_raw[0] = (int16_t)(_byte[1] << 8 | _byte[0]); // X
xyz_raw[1] = (int16_t)(_byte[3] << 8 | _byte[2]); // Y
xyz_raw[2] = (int16_t)(_byte[5] << 8 | _byte[4]); // Z
};
/**< with sensitivity in dps */
void getMeasurement(float xyz_dps[])
{
byte _byte[6];
i2c.read(I2C_ADDRESS, (OUT_X_L | (1 << 7)), _byte, 6);
// combine high and low bytes
xyz_dps[0] = ((float)(_byte[1] << 8 | _byte[0]))*sens_factor; // X
xyz_dps[1] = ((float)(_byte[3] << 8 | _byte[2]))*sens_factor; // Y
xyz_dps[2] = ((float)(_byte[5] << 8 | _byte[4]))*sens_factor; // Z
};
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//PRESET preset = PRESET();
#endif

@ -0,0 +1,287 @@
#ifndef i2c_LPS331_h
#define i2c_LPS331_h
#include "i2c.h"
#include "i2c_Sensor.h"
/** ######################################################################
Driver for the LPS331-Sensor
CONSUMPTION: standby X µA, measure X µA
Details:
///
######################################################################## */
class LPS331 : public i2cSensor, public manualSensor
{
private:
/** ######### Register-Map ################################################################# */
static const uint8_t LPS331AP_ADDRESS_SA0_LOW =(0b1011100);
static const uint8_t LPS331AP_ADDRESS_SA0_HIGH =(0b1011101);
static const uint8_t I2C_ADDRESS =(LPS331AP_ADDRESS_SA0_HIGH);
static const uint8_t REF_P_XL =(0x08);
static const uint8_t REF_P_L =(0x09);
static const uint8_t REF_P_H =(0x0A);
static const uint8_t WHO_AM_I =(0x0F);
static const uint8_t VAL_WHO_AM_I =(0xBB);
static const uint8_t RES_CONF =(0x10);
static const uint8_t CTRL_REG1 =(0x20);
static const uint8_t CTRL_REG2 =(0x21);
static const uint8_t CTRL_REG3 =(0x22);
static const uint8_t INTERRUPT_CFG =(0x23);
static const uint8_t INT_SOURCE =(0x24);
static const uint8_t THS_P_L =(0x25);
static const uint8_t THS_P_H =(0x26);
static const uint8_t STATUS_REG =(0x27);
static const uint8_t PRESS_OUT_XL =(0x28);
static const uint8_t PRESS_OUT_L =(0x29);
static const uint8_t PRESS_OUT_H =(0x2A);
static const uint8_t TEMP_OUT_L =(0x2B);
static const uint8_t TEMP_OUT_H =(0x2C);
static const uint8_t AMP_CTRL =(0x30);
static const uint8_t DELTA_PRESS_XL =(0x3C);
static const uint8_t DELTA_PRESS_L =(0x3D);
static const uint8_t DELTA_PRESS_H =(0x3E);
/** ######### function definition ################################################################# */
public:
/**< TODO: do i need a constructor? */
LPS331(void)
{
};
inline void setDatarate(const uint8_t freqHz)
{
uint8_t _value;
if (freqHz == 0) _value = 0b00000000; // ONE-SHOT / MANUAL
else if (freqHz == 1) _value = 0b00010000; // Pressure 512 averages, Temp 128 averages
else if (freqHz <= 7) _value = 0b01010000; // 7 Hz
else if (freqHz <= 13) _value = 0b01100000; // 12.5 Hz
else _value = 0b01110000; // 25Hz, Temp 64 averages
i2c.setRegister(I2C_ADDRESS, CTRL_REG1, B01110000, _value); // chip active, 12.5Hz, no INT, continuous update, no delta_pressure, SPI/I2C
};
inline void setSensitivity(const uint8_t sens=0)
{
uint8_t _value;
if (sens) _value = 0x7A;
else _value = 0x6A;
i2c.writeByte(I2C_ADDRESS, RES_CONF, _value); // temp 128samples, pres 512samples per Value
}
inline void setEnabled(const uint8_t enable = 1)
{
uint8_t _value;
if (enable) _value = 255;
else _value = 0;
i2c.setRegister(I2C_ADDRESS, CTRL_REG1, B10000000, _value);
}
inline void reset(void)
{
i2c.setRegister(I2C_ADDRESS, CTRL_REG2, B10000100, B10000100); // Boot and SWRESET
}
/**< sets or detects slave address; returns bool indicating success */
inline uint8_t initialize(void)
{
return initialize(25);
};
uint8_t initialize(const uint8_t hzRate)
{
if (i2c.probe(I2C_ADDRESS)==0) return 0;
i2c.writeByte(I2C_ADDRESS, CTRL_REG1, 0b00000000); // Chip power DOWN
i2c.writeByte(I2C_ADDRESS, CTRL_REG2, 0b00000000); // NO auto_zero, NO one_shot
setDatarate(hzRate);
setSensitivity(0);
setEnabled(1);
return 1;
};
/**< only used when in manual/standby mode */
inline void triggerMeasurement(void)
{
i2c.setRegister(I2C_ADDRESS, CTRL_REG2, 0x01, 0x01);
}
/**< check for new data, return 1 when Measurement is ready */
inline uint8_t checkMeasurement(void)
{
uint8_t _byte;
i2c.read(I2C_ADDRESS,STATUS_REG, &_byte, 1);
if (_byte&0x02) return 1; // Pressure Measurement finished,
else return 0;
};
/**< wait for new data*/
inline uint8_t awaitMeasurement(void)
{
uint8_t _counter = 0;
while (checkMeasurement()==0)
{
if (++_counter > 250) return 0; // check took longer than 250ms
delay(1);
};
return 1; // Measurement finished
};
/**< reads pressure in millibars (mbar)/hectopascals (hPa) */
void getMeasurement(float& mbar)
{
int32_t praw;
getMeasurement(praw);
mbar = (praw/4096.0);
};
/**< reads pressure and returns raw 24-bit sensor output */
void inline getMeasurement(int32_t& pressure_raw)
{
uint8_t _byte[3];
// assert MSB to enable register address auto-increment
i2c.read(I2C_ADDRESS,PRESS_OUT_XL | (1 << 7), _byte, 3);
// combine bytes
// GCC performs an arithmetic right shift for signed negative
// numbers, but this code will not work if you port it to a
// compiler that does a logical right shift instead.
pressure_raw = ((int32_t)_byte[2] << 16) | ((uint16_t)_byte[1] << 8) | (_byte[0]);
};
/**< reads temperature in degrees C */
void getTemperature(float& degC)
{
int16_t _degRaw;
getTemperature(_degRaw);
degC = 42.5 + ((float)_degRaw) / 480.0;
};
/**< reads temperature and returns raw 16-bit sensor output */
void getTemperature(int16_t& degRaw)
{
uint8_t _byte[2];
// assert MSB to enable register address auto-increment
i2c.read(I2C_ADDRESS,TEMP_OUT_L | (1 << 7), _byte, 2);
// combine bytes
// GCC performs an arithmetic right shift for signed negative
// numbers, but this code will not work if you port it to a
// compiler that does a logical right shift instead.
degRaw = ((int16_t)_byte[1] << 8) | (_byte[0]);
};
/**< reads pressure and returns raw 24-bit sensor output */
/*
unsigned long LPS331::readAltitudeMillimeters(void)
{
uint8_t _byte[3];
// assert MSB to enable register address auto-increment
i2c.read(address,PRESS_OUT_XL | (1 << 7), _byte, (byte) 3);
unsigned long x;
x = uint32_t(pow ((int32_t)_byte[2] << 16 | (uint16_t)_byte[1] << 8 | _byte[0] , 0.190263) * 2440790.3);
return (44330800 - x);
}
*/
void inline getAltitude(float& height_m)
{
int32_t _cm;
getAltitude(_cm);
height_m = _cm / 100.0;
}
void inline getAltitude(int32_t& height_cm)
{
static const long xnode[8] = {2867200, 3101257, 3335314, 3569371, 3803429, 4037486, 4271543, 4505600};
static const long yfac[7] = {1088, 1023, 967, 916, 872, 832, 796}; // * -4096
static const long ysum[7] = {1062587, 1013703, 967631, 924033, 882630, 843188, 805511};
unsigned long presraw;
uint8_t _byte[3];
i2c.read(I2C_ADDRESS,PRESS_OUT_XL | (1 << 7), _byte, (byte) 3);
presraw = ((int32_t)_byte[2] << 16 | (uint16_t)_byte[1] << 8 | _byte[0]);
//presraw = readPressureRaw();
byte n;
if (presraw<xnode[4])
{
if (presraw<xnode[2])
{
if (presraw<xnode[1])
{
if (presraw<=xnode[0])
{
n = 0;
presraw = xnode[0];
}
else n = 0;
}
else n = 1;
}
else
{
if (presraw<xnode[3]) n = 2;
else n = 3;
};
}
else
{
if (presraw < xnode[6])
{
if (presraw < xnode[5]) n = 4;
else n = 5;
}
else
{
if (presraw < xnode[7]) n = 6;
else
{
n = 6;
presraw = xnode[7];
};
};
};
presraw /= 4;
presraw *= yfac[n];
presraw /= 256;
presraw /= 4;
height_cm = (ysum[n] - presraw);
//*alti = (ysum[n] - presraw);
};
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//PRESET preset = PRESET();
#endif

@ -0,0 +1,207 @@
#ifndef i2c_h
#define i2c_h
#include "i2c.h"
#include "i2c_Sensor.h"
/** ######################################################################
Driver for the MAG3310-Sensor
CONSUMPTION: standby 2 µA, measure 9-900 µA
Details: up to 80Hz, ±1000 µT, Sensitivity of 0.10 µT
######################################################################## */
class MAG3110 : public i2cSensor, public manualSensor
{
private:
/** ######### Register-Map ################################################################# */
static const uint8_t I2C_ADDRESS =(0x0E);
static const uint8_t REG_DR_STATUS =(0x00);
static const uint8_t REG_OUT_X_MSB =(0x01);
static const uint8_t REG_OUT_X_LSB =(0x02);
static const uint8_t REG_OUT_Y_MSB =(0x03);
static const uint8_t REG_OUT_Y_LSB =(0x04);
static const uint8_t REG_OUT_Z_MSB =(0x05);
static const uint8_t REG_OUT_Z_LSB =(0x06);
static const uint8_t REG_WHO_AM_I =(0x07);
static const uint8_t MAG_VAL_WHO_AM_I =(0xC4);
static const uint8_t REG_SYSMOD =(0x08);
static const uint8_t REG_OFF_X_MSB =(0x09);
static const uint8_t REG_OFF_X_LSB =(0x0A);
static const uint8_t REG_OFF_Y_MSB =(0x0B);
static const uint8_t REG_OFF_Y_LSB =(0x0C);
static const uint8_t REG_OFF_Z_MSB =(0x0D);
static const uint8_t REG_OFF_Z_LSB =(0x0E);
static const uint8_t REG_DIE_TEMP =(0x0F);
static const uint8_t REG_CTRL_REG1 =(0x10);
static const uint8_t MASK_ACTIVE =(0x01); // standby --> active
static const uint8_t MASK_TM =(0x02); // Trigger Measurement
static const uint8_t MASK_FR =(0x04); // Fast read: skip low-registers
static const uint8_t MASK_OSR =(B00011000); // Oversampling
static const uint8_t VAL_OSR_16 =(B00000000);
static const uint8_t VAL_OSR_32 =(B00001000);
static const uint8_t VAL_OSR_64 =(B00010000);
static const uint8_t VAL_OSR_128 =(B00011000);
static const uint8_t MASK_DR =(B11100000); // datarate
static const uint8_t VAL_DR_0 =(B00000000);
static const uint8_t VAL_DR_1 =(B00100000);
static const uint8_t VAL_DR_2 =(B01000000);
static const uint8_t VAL_DR_3 =(B01100000);
static const uint8_t VAL_DR_4 =(B10000000);
static const uint8_t VAL_DR_5 =(B10100000);
static const uint8_t VAL_DR_6 =(B11000000);
static const uint8_t VAL_DR_7 =(B11100000);
static const uint8_t REG_CTRL_REG2 =(0x11);
static const uint8_t MASK_AUTO_MRST =(B10000000); // Magnetic Sensor reset
static const uint8_t MASK_RAW =(B00100000); // read uncorrected RAW values
static const uint8_t MASK_RESET =(B00010000); // Trigger a Reset
static const uint8_t SYSMOD_STANDBY =(0x00);
static const uint8_t SYSMOD_ACTIVE_RAW =(0x01);
static const uint8_t SYSMOD_ACTIVE =(0x02);
/** ######### function definition ################################################################# */
public:
/**< TODO: do i need a constructor? */
MAG3110(void)
{
};
/**< Trigger a software-reset*/
inline void reset(void)
{
i2c.setRegister(I2C_ADDRESS,REG_CTRL_REG2,MASK_RESET, 255);
};
/**< recommended: the resets occur automatically before each data acquisition*/
inline void setSensorAutoReset(const uint8_t enable=1)
{
uint8_t _value;
if (enable) _value = MASK_AUTO_MRST;
else _value = 0;
i2c.setRegister(I2C_ADDRESS,REG_CTRL_REG2,MASK_AUTO_MRST, _value);
};
/**< data values are not corrected by the user offset register values. */
inline void setRawMode(const uint8_t enable=1)
{
uint8_t _value;
if (enable) _value = MASK_RAW;
else _value = 0;
i2c.setRegister(I2C_ADDRESS,REG_CTRL_REG2,MASK_RAW, _value);
};
/**< switch between continious and trigger/manual mode */
inline void setEnabled(const uint8_t enable=1)
{
uint8_t _value;
if (enable) _value = MASK_ACTIVE;
else _value = 0;
i2c.setRegister(I2C_ADDRESS,REG_CTRL_REG1,MASK_ACTIVE, _value);
};
inline void setDataRate(const uint8_t hz=10)
{
uint8_t _value;
// use modes with 1280 Hz ADC Rate
if (hz > 40) _value = 0; // 80 Hz with 16x OS
else if (hz > 20) _value = 1; // 40 Hz with 32x OS
else if (hz > 10) _value = 2; // 20 Hz with 64x OS
else if (hz > 5) _value = 3; // 10 Hz with 128x OS
else if (hz >= 3) _value = 7; // 5 Hz with 128x OS, 640 Hz ADC
else _value = 11; // 2.5Hz with 128x OS, 320 Hz ADC
i2c.setRegister(I2C_ADDRESS, REG_CTRL_REG1, (MASK_DR | MASK_OSR), _value<<3); // set combination of data rate and oversampling
}
inline uint8_t initialize(void)
{
return initialize(100);
};
inline uint8_t initialize(const uint8_t hzFreq)
{
if (i2c.probe(I2C_ADDRESS)==0) return 0;
setEnabled(0);
setSensorAutoReset(1);
setRawMode(1);
setDataRate(hzFreq);
setEnabled(1);
return 1;
};
/**< only used when in manual/standby mode */
inline void triggerMeasurement(void)
{
i2c.setRegister(I2C_ADDRESS, REG_CTRL_REG1, MASK_TM, MASK_TM);
};
/**< check for new data, return 1 when Measurement is ready */
inline uint8_t checkMeasurement(void)
{
uint8_t _val;
i2c.read(I2C_ADDRESS, REG_DR_STATUS, &_val, 1);
if (_val & B00001000) return 1; // Measurement finished
else return 0;
};
/**< wait for new data*/
inline uint8_t awaitMeasurement(void)
{
uint8_t _counter = 0;
while (checkMeasurement()==0)
{
if (++_counter > 250) return 0; // check took longer than 250ms
delay(1);
};
return 1; // Measurement finished
};
/**< get RAW values */
void getMeasurement(int16_t xyz_raw[])
{
uint8_t buf[6];
i2c.read(I2C_ADDRESS, REG_OUT_X_MSB, buf, 6);
xyz_raw[0] = (buf[0]<<8) | buf[1];
xyz_raw[1] = (buf[2]<<8) | buf[3];
xyz_raw[2] = (buf[4]<<8) | buf[5];
};
/**< values scaled to uT */
void getMeasurement(float xyz_uT[])
{
uint8_t buf[6];
i2c.read(I2C_ADDRESS, REG_OUT_X_MSB, buf, 6);
xyz_uT[0] = int16_t((buf[0]<<8) | buf[1])*0.2471f;
xyz_uT[1] = int16_t((buf[2]<<8) | buf[3])*0.2479f;
xyz_uT[2] = int16_t((buf[4]<<8) | buf[5])*0.2480f;
};
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//PRESET preset = PRESET();
#endif

@ -0,0 +1,333 @@
#ifndef i2c_MAX17047_h
#define i2c_MAX17047_h
#include "i2c.h"
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// MAX17047 ///////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
class MAX17047
{
/** ######### Register-Map ################################################################# */
public:
static const uint8_t I2C_ADDRESS =(0x36);
private:
static constexpr float MAX17047_SENSE =(0.01);
static const uint8_t MAX17047_STATUS =(0x00);
static const uint8_t MAX17047_V_ALRT_THRESHOLD =(0x01);
static const uint8_t MAX17047_T_ALRT_THRESHOLD =(0x02);
static const uint8_t MAX17047_SOC_ALRT_THRESHOLD =(0x03);
static const uint8_t MAX17047_AT_RATE =(0x04);
static const uint8_t MAX17047_REM_CAP_REP =(0x05); // Capacity in uVh / filtered -AV
static const uint8_t MAX17047_SOC_REP =(0x06); // State of Charge in % (Highbyte) Filtered -AV
static const uint8_t MAX17047_AGE =(0x07);
static const uint8_t MAX17047_TEMPERATURE =(0x08);
static const uint8_t MAX17047_V_CELL =(0x09);
static const uint8_t MAX17047_CURRENT =(0x0A);
static const uint8_t MAX17047_AVERAGE_CURRENT =(0x0B);
static const uint8_t MAX17047_SOC_MIX =(0x0D); // State of Charge in % (Highbyte)
static const uint8_t MAX17047_SOC_AV =(0x0E); // State of Charge in % (Highbyte) considering all information
static const uint8_t MAX17047_REM_CAP_MIX =(0x0F); // Capacity in uVh (div Senseresistor for mAh)
static const uint8_t MAX17047_FULL_CAP =(0x10); // best case full capacity in uVh
static const uint8_t MAX17047_TTE =(0x11); // Time to Empty 5.625s/LSB
static const uint8_t MAX17047_Q_RESIDUAL_00 =(0x12);
static const uint8_t MAX17047_FULL_SOC_THR =(0x13);
static const uint8_t MAX17047_AVERAGE_TEMP =(0x16);
static const uint8_t MAX17047_CYCLES =(0x17); // accumulate total percent in Change in %
static const uint8_t MAX17047_DESIGN_CAP =(0x18);
static const uint8_t MAX17047_AVERAGE_V_CELL =(0x19);
static const uint8_t MAX17047_MAX_MIN_TEMP =(0x1A);
static const uint8_t MAX17047_MAX_MIN_VOLTAGE =(0x1B);
static const uint8_t MAX17047_MAX_MIN_CURRENT =(0x1C);
static const uint8_t MAX17047_CONFIG =(0x1D);
static const uint8_t MAX17047_I_CHG_TERM =(0x1E);
static const uint8_t MAX17047_REM_CAP_AV =(0x1F);
static const uint8_t MAX17047_VERSION =(0x21);
static const uint8_t MAX17047_Q_RESIDUAL_10 =(0x22);
static const uint8_t MAX17047_FULL_CAP_NOM =(0x23);
static const uint8_t MAX17047_TEMP_NOM =(0x24);
static const uint8_t MAX17047_TEMP_LIM =(0x25);
static const uint8_t MAX17047_AIN =(0x27);
static const uint8_t MAX17047_LEARN_CFG =(0x28);
static const uint8_t MAX17047_FILTER_CFG =(0x29);
static const uint8_t MAX17047_RELAX_CFG =(0x2A);
static const uint8_t MAX17047_MISC_CFG =(0x2B);
static const uint8_t MAX17047_T_GAIN =(0x2C);
static const uint8_t MAX17047_T_OFF =(0x2D);
static const uint8_t MAX17047_C_GAIN =(0x2E);
static const uint8_t MAX17047_C_OFF =(0x2F);
static const uint8_t MAX17047_Q_RESIDUAL_20 =(0x32);
static const uint8_t MAX17047_I_AVG_EMPTY =(0x36);
static const uint8_t MAX17047_F_CTC =(0x37);
static const uint8_t MAX17047_RCOMP_0 =(0x38);
static const uint8_t MAX17047_TEMP_CO =(0x39);
static const uint8_t MAX17047_V_EMPTY =(0x3A); // Empty Voltage
static const uint8_t MAX17047_F_STAT =(0x3D);
static const uint8_t MAX17047_TIMER =(0x3E);
static const uint8_t MAX17047_SHDN_TIMER =(0x3F);
static const uint8_t MAX17047_Q_RESIDUAL_30 =(0x42);
static const uint8_t MAX17047_D_QACC =(0x45);
static const uint8_t MAX17047_D_PACC =(0x46);
static const uint8_t MAX17047_QH =(0x4D);
static const uint8_t MAX17047_V_FOCV =(0xFB);
static const uint8_t MAX17047_SOC_VF =(0xFF); // State of Charge according to voltage fuel gauge
MAX17047(const MAX17047&); // declaration only for copy constructor
MAX17047& operator=(const MAX17047&); // declaration only for copy assignment --> make it uncopyable
public:
MAX17047(void)
{
};
// application specific (only set on POR)
void set_capacity_design(const uint16_t capacity_mA)
{
uint16_t uvalue = capacity_mA * (MAX17047_SENSE * 200); // mAh * R / uVh
uint8_t value[2];
value[0] = uvalue & 0xFF;
value[1] = (uvalue>>8) & 0xFF;
i2c.write(I2C_ADDRESS, MAX17047_DESIGN_CAP, value, 2);
};
// application specific (only set on POR)
void set_full_threshold(const uint8_t percent_soc)
{
uint8_t value[2];
value[0] = 0;
value[1] = (percent_soc) & 0xFF;
i2c.write(I2C_ADDRESS, MAX17047_FULL_SOC_THR, value, 2);
};
// application specific (only set on POR)
void set_termination_charge_current(const uint16_t current_mA)
{
uint8_t value[2];
uint16_t uvalue = current_mA * (MAX17047_SENSE * 640);
value[0] = uvalue & 0xFF;
value[1] = (uvalue>>8) & 0xFF;
i2c.write(I2C_ADDRESS, MAX17047_I_CHG_TERM, value, 2);
};
// application specific (only set on POR)
void set_empty_voltage(const uint16_t empty_mV, const uint16_t recovery_mV)
{
uint8_t value[2];
value[0] = (recovery_mV / 40) & 0b01111111;
value[1] = (empty_mV / 20) & 0xFF;
i2c.write(I2C_ADDRESS, MAX17047_V_EMPTY, value, 2);
};
// alarm turns the alarm-led on
void set_alarm_voltage(const uint16_t lowVolt_mV, const uint16_t highVolt_mV)
{
uint8_t value[2];
value[0] = (lowVolt_mV / 20) & 0xFF; // low Voltage
value[1] = (highVolt_mV / 20) & 0xFF; // high Voltage
i2c.write(I2C_ADDRESS, MAX17047_V_ALRT_THRESHOLD, value, 2);
};
// only set once on POR!!!
uint8_t initialize()
{
// TODO: Probe IC
// Check POR-Status
uint8_t value[2];
i2c.read(I2C_ADDRESS, MAX17047_STATUS, value, 2);
if (value[0] & 2) Serial.println("POR detected - will initialize the IC");
else return 0;
Serial.println("Set ");
Serial.println(CELL_CAPACITY_mA);
Serial.println("mAh Capacity");
set_capacity_design(CELL_CAPACITY_mA); // mA
Serial.println("Set Full Cap at 95%.");
set_full_threshold(95); // %
Serial.println("Set Charge Termination Current to 100mA");
set_termination_charge_current(100); //mA
Serial.println("Set Voltage Thresholds for Empty-Detection (3400,3500mV)");
set_empty_voltage(3400, 3500); // mV
// play back backup if it exists
uint8_t backup[20];
if (eeprom_read(backup)) restore_data(backup);
// clear POR-bit
Serial.println("POR-Status is being reset");
value[0] &= 0b11111101; // POR
i2c.write(I2C_ADDRESS, MAX17047_STATUS, value, 2);
return 1;
};
// do this at end-of-charge or end-of-discharge, gives back 20 byte, INFO about cells
void backup_data(uint8_t registers[])
{
i2c.read(I2C_ADDRESS, MAX17047_FULL_CAP, &registers[0], 2);
i2c.read(I2C_ADDRESS, MAX17047_CYCLES, &registers[2], 2);
i2c.read(I2C_ADDRESS, MAX17047_RCOMP_0, &registers[4], 2);
i2c.read(I2C_ADDRESS, MAX17047_TEMP_CO, &registers[6], 2);
i2c.read(I2C_ADDRESS, MAX17047_Q_RESIDUAL_00, &registers[8], 2);
i2c.read(I2C_ADDRESS, MAX17047_Q_RESIDUAL_10, &registers[10], 2);
i2c.read(I2C_ADDRESS, MAX17047_Q_RESIDUAL_20, &registers[12], 2);
i2c.read(I2C_ADDRESS, MAX17047_Q_RESIDUAL_30, &registers[14], 2);
i2c.read(I2C_ADDRESS, MAX17047_D_QACC, &registers[16], 2);
i2c.read(I2C_ADDRESS, MAX17047_D_PACC, &registers[18], 2);
};
// after POR you have can restore registers and don't have to relearn the cell
uint8_t restore_data(uint8_t registers[])
{
uint8_t value[2];
// read status and wait for POR != 0
i2c.read(I2C_ADDRESS, MAX17047_STATUS, value, 2);
if (value[0] & 2) Serial.println("POR detected - will restore Data-Backup");
else return 0;
// restore app-specific-register
// restore gauge-learned register
i2c.write(I2C_ADDRESS, MAX17047_FULL_CAP, &registers[0], 2);
i2c.write(I2C_ADDRESS, MAX17047_CYCLES, &registers[2], 2);
i2c.write(I2C_ADDRESS, MAX17047_RCOMP_0, &registers[4], 2);
i2c.write(I2C_ADDRESS, MAX17047_TEMP_CO, &registers[6], 2);
i2c.write(I2C_ADDRESS, MAX17047_Q_RESIDUAL_00, &registers[8], 2);
i2c.write(I2C_ADDRESS, MAX17047_Q_RESIDUAL_10, &registers[10], 2);
i2c.write(I2C_ADDRESS, MAX17047_Q_RESIDUAL_20, &registers[12], 2);
i2c.write(I2C_ADDRESS, MAX17047_Q_RESIDUAL_30, &registers[14], 2);
i2c.write(I2C_ADDRESS, MAX17047_D_QACC, &registers[16], 2);
i2c.write(I2C_ADDRESS, MAX17047_D_PACC, &registers[18], 2);
// clear POR-bit
Serial.println("POR-Status is being reset");
value[0] &= 0b11111101; // POR
i2c.write(I2C_ADDRESS, MAX17047_STATUS, value, 2);
return 1;
};
// basic initialization
void set_config()
{
uint8_t uvalue[2];
Serial.println("Programm Alert to SOC_AV");
i2c.read(I2C_ADDRESS, MAX17047_MISC_CFG, uvalue, 2);
uvalue[0] &= 0b11111100;
uvalue[0] |= 0b00000001;
i2c.write(I2C_ADDRESS, MAX17047_MISC_CFG, uvalue, 2);
// MAX17047_CONFIG
i2c.read(I2C_ADDRESS, MAX17047_CONFIG, uvalue, 2);
Serial.println("Enable Alarms");
uvalue[0] |= 0b00000100; // Aen
uvalue[1] &= 0b11110111; // ALRTp
// disable Thermistor
Serial.println("Disable Thermistor-Input");
uvalue[0] &= 0b11101111; // ETHRM
i2c.write(I2C_ADDRESS, MAX17047_CONFIG, uvalue, 2);
};
// feedback and status
void print_status()
{
uint8_t value[2];
float fvalue;
// empty-Status
i2c.read(I2C_ADDRESS, MAX17047_F_STAT, value, 2);
if (value[1] & 1) Serial.print("E");
else Serial.print("N");
i2c.read(I2C_ADDRESS, MAX17047_STATUS, value, 2);
// Voltage Status
if (value[1] & 0b00000001) Serial.print("|E"); // EMPTY
else if (value[1] & 0b00010000) Serial.print("|M"); // FULL exceed maximum
else Serial.print("|N"); // normal
// POR-Status
if (value[0] & 2) Serial.print("|R "); // POR SET
else Serial.print("|N ");
// Voltage of Cells
i2c.read(I2C_ADDRESS, MAX17047_V_CELL, value, 2);
fvalue = float(uint16_t(value[1]<<5) + (value[0]>>3)) / 1.6;
Serial.print(fvalue,0);
Serial.print(" mV :: ");
// State of Charge
i2c.read(I2C_ADDRESS, MAX17047_SOC_AV, value, 2);
fvalue = float(uint16_t(value[1]<<8) + (value[0])) / 256;
Serial.print(fvalue,2);
Serial.print(" %SOC :: ");
// Remaining capacity
i2c.read(I2C_ADDRESS, MAX17047_REM_CAP_AV, value, 2);
fvalue = float(uint16_t(value[1]<<8) + (value[0])) * (0.000005 / MAX17047_SENSE);
Serial.print(fvalue,3);
Serial.print(" of ");
// full capacity
i2c.read(I2C_ADDRESS, MAX17047_FULL_CAP, value, 2);
fvalue = float(uint16_t(value[1]<<8) + (value[0])) * (0.000005 / MAX17047_SENSE);
Serial.print(fvalue,3);
Serial.print(" Ah :: ");
// time to empty
i2c.read(I2C_ADDRESS, MAX17047_TTE, value, 2);
fvalue = float(uint16_t(value[1]<<8) + (value[0])) * (5.625 / 60);
Serial.print(fvalue,0);
Serial.print(" min left at ");
// MAX17047_CURRENT
i2c.read(I2C_ADDRESS, MAX17047_CURRENT, value, 2);
fvalue = float((value[1]<<8) + (value[0])) * (0.001 * (1.5625 / MAX17047_SENSE));
Serial.print(fvalue,2);
Serial.print("|");
i2c.read(I2C_ADDRESS, MAX17047_AVERAGE_CURRENT, value, 2);
fvalue = float((value[1]<<8) + (value[0])) * (0.001 * (1.5625 / MAX17047_SENSE));
Serial.print(fvalue,2);
Serial.print(" mA :: ");
// MAX17047_CYCLES
i2c.read(I2C_ADDRESS, MAX17047_CYCLES, value, 2);
fvalue = float(uint16_t(value[1]<<8) + (value[0]));
Serial.print(fvalue,0);
Serial.print(" %cycled :: ");
// MAX17047_AGE
i2c.read(I2C_ADDRESS, MAX17047_AGE, value, 2);
fvalue = float(uint16_t(value[1]<<8) + (value[0])) * 0.0039;
Serial.print(fvalue,2);
Serial.print(" %age :: ");
};
// return measured cell voltage in mV
uint16_t get_cell_voltage()
{
uint8_t value[2];
i2c.read(I2C_ADDRESS, MAX17047_V_CELL, value, 2);
return uint16_t((uint16_t(value[1]<<5) + (value[0]>>3)) / 1.6); // mV
};
// return measured cell coltage in mA
int16_t get_cell_current()
{
uint8_t value[2];
i2c.read(I2C_ADDRESS, MAX17047_CURRENT, value, 2);
return (((value[1]<<8) + (value[0])) * (0.001 * (1.5625 / MAX17047_SENSE)));
};
};
#endif

@ -0,0 +1,144 @@
#ifndef i2c_MAX44009_h
#define i2c_MAX44009_h
#include "i2c.h"
#include "i2c_Sensor.h"
/** ######################################################################
Driver for the MAX44009-Sensor
CONSUMPTION: sleep ???, measure 0.65 - 1.6µA
MEAS_RANGE: 45 mLux - 180k Lux
######################################################################## */
class MAX44009 : public i2cSensor
{
private:
/** ######### Register-Map ################################################################# */
static const uint8_t I2C_ADDRESS =(0x4B);
static const uint8_t INT_STATUS_REG =(0x00);
static const uint8_t INT_ENABLE_REG =(0x01);
static const uint8_t CONFIGURATION_REG =(0x02);
static const uint8_t CONFIG_CONT_MASK =(bit(7)); // CONTINOUS MODE
static const uint8_t CONFIG_CONT_ON =(1<<7);
static const uint8_t CONFIG_CONT_OFF =(0);
static const uint8_t CONFIG_MANUAL_MASK =(bit(6)); // MANUAL Set CDR and TIME
static const uint8_t CONFIG_MANUAL_ON =(1<<6);
static const uint8_t CONFIG_MANUAL_OFF =(0);
static const uint8_t CONFIG_CDR_MASK =(bit(3)); // Current DIVISION RATIO (When HIGH Brightness --> Current/8
static const uint8_t CONFIG_CDR_1div1 =(0);
static const uint8_t CONFIG_CDR_1div8 =(1<<3);
static const uint8_t CONFIG_TIM_MASK =(bit(2)|bit(1)|bit(0));
static const uint8_t CONFIG_TIM_800MS =(0);
static const uint8_t CONFIG_TIM_400MS =(1);
static const uint8_t CONFIG_TIM_200MS =(2);
static const uint8_t CONFIG_TIM_100MS =(3);
static const uint8_t CONFIG_TIM_50MS =(4);
static const uint8_t CONFIG_TIM_25MS =(5);
static const uint8_t CONFIG_TIM_12MS =(6);
static const uint8_t CONFIG_TIM_6MS =(7);
static const uint8_t LUX_HIGH_REG =(0x03);
static const uint8_t LUX_LOW_REG =(0x04);
static const uint8_t THRESHOLD_UPPER_REG =(0x05);
static const uint8_t THRESHOLD_LOWER_REG =(0x06);
static const uint8_t THRESHOLD_TIMER_REG =(0x07);
/** ######### function definition ################################################################# */
public:
MAX44009(void)
{
};
inline void setEnabled(const uint8_t enable=1)
{
uint8_t _value;
if (enable)
{
_value = CONFIG_CONT_ON;
i2c.setRegister(I2C_ADDRESS, INT_ENABLE_REG, 1, 0);
i2c.setRegister(I2C_ADDRESS, CONFIGURATION_REG, CONFIG_MANUAL_MASK, CONFIG_MANUAL_OFF);
}
else
{
_value = CONFIG_CONT_OFF;
}
i2c.setRegister(I2C_ADDRESS, CONFIGURATION_REG, CONFIG_CONT_MASK, _value);
};
inline void reset()
{
// nothing to do
};
inline uint8_t initialize()
{
if (i2c.probe(I2C_ADDRESS)==0) return 0;
setEnabled(1);
return 1;
};
/**< check for new data, return 1 when Measurement is ready */
inline uint8_t checkMeasurement(void)
{
/**< TODO: Implement */
return 1; // Measurement finished
};
/**< wait for new data*/
inline uint8_t awaitMeasurement(void)
{
/**< TODO: Implement */
return 1; // Measurement finished
};
/**
READING only high-register:
Lux = 2(exponent) x mantissa x 0.72
Exponent = 8xE3 + 4xE2 + 2xE1 + E0
Mantissa = 8xM7 + 4xM6 + 2xM5 + M4
READING combined Registers:
E3E0: Exponent bits of lux reading
M7M0: Mantissa byte of lux reading
Lux = 2(exponent) x mantissa x 0.045
*/
inline void getMeasurement(uint32_t& mLux_value)
{
uint8_t lux[2], lux_exponent;
i2c.read(I2C_ADDRESS, LUX_HIGH_REG, lux, 2);
lux_exponent = ((lux[0] >> 4) & 0x0F);
lux[0] = ((lux[0] << 4) & 0xF0);
lux[1] &= 0x0F;
//lux_value = 0.045 * ( lux_high + lux_low ) * (1<< lux_exponent);
mLux_value = 45L * ( lux[0] | lux[1] ) * (1<< lux_exponent);
};
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//PRESET preset = PRESET();
#endif

@ -0,0 +1,244 @@
#ifndef i2c_MMA8451_h
#define i2c_MMA8451_h
#include "i2c.h"
#include "i2c_Sensor.h"
/** ######################################################################
Driver for the MMA8451-Sensor
CONSUMPTION: standby X µA, measure X µA
Details:
######################################################################## */
class MMA8451 : public i2cSensor
{
private:
/** ######### Register-Map ################################################################# */
static const uint8_t I2C_ADDRESS =(0x1C);
//static const uint8_t I2C_ADDRESS =(0x1D); // another common value
static const uint8_t REG_STATUS =(0x00); //(R) Real time status
static const uint8_t REG_OUT_X_MSB =(0x01); //(R) [7:0] are 8 MSBs of 10-bit sample
static const uint8_t REG_OUT_X_LSB =(0x02); //(R) [7:6] are 2 LSBs of 10-bit sample
static const uint8_t REG_OUT_Y_MSB =(0x03); //(R) [7:0] are 8 MSBs of 10-bit sample
static const uint8_t REG_OUT_Y_LSB =(0x04); //(R) [7:6] are 2 LSBs of 10-bit sample
static const uint8_t REG_OUT_Z_MSB =(0x05); //(R) [7:0] are 8 MSBs of 10-bit sample
static const uint8_t REG_OUT_Z_LSB =(0x06); //(R) [7:6] are 2 LSBs of 10-bit sample
static const uint8_t REG_F_SETUP =(0x09); // FIFO SETUP
static const uint8_t REG_SYSMOD =(0x0b); //(R) Current system mode
static const uint8_t REG_INT_SOURCE =(0x0c); //(R) Interrupt status
static const uint8_t REG_WHO_AM_I =(0x0d); //(R) Device ID (0x3A)
static const uint8_t VAL_WHO_AM_I_A =(0x3A); // MMA8453
static const uint8_t VAL_WHO_AM_I_B =(0x1A); // MMA8451
static const uint8_t REG_XYZ_DATA_CFG =(0x0e); //(R/W) Dynamic range settings
static const uint8_t REG_HP_FILTER_CUTOFF =(0x0f); //(R/W) cut-off frequency is set to 16Hz @ 800Hz
static const uint8_t REG_PL_STATUS =(0x10); //(R) Landscape/Portrait orientation status
static const uint8_t REG_PL_CFG =(0x11); //(R/W) Landscape/Portrait configuration
static const uint8_t REG_PL_COUNT =(0x12); //(R) Landscape/Portrait debounce counter
static const uint8_t REG_PL_BF_ZCOMP =(0x13); //(R) Back-Front, Z-Lock trip threshold
static const uint8_t REG_P_L_THS_REG =(0x14); //(R/W) Portrait to Landscape trip angle is 29 degree
static const uint8_t REG_FF_MT_CFG =(0x15); //(R/W) Freefall/motion functional block configuration
static const uint8_t REG_FF_MT_SRC =(0x16); //(R) Freefall/motion event source register
static const uint8_t REG_FF_MT_THS =(0x17); //(R/W) Freefall/motion threshold register
static const uint8_t REG_FF_MT_COUNT =(0x18); //(R/W) Freefall/motion debounce counter
static const uint8_t REG_TRANSIENT_CFG =(0x1d); //(R/W) Transient functional block configuration
static const uint8_t REG_TRANSIENT_SRC =(0x1e); //(R) Transient event status register
static const uint8_t REG_TRANSIENT_THS =(0x1f); //(R/W) Transient event threshold
static const uint8_t REG_TRANSIENT_COUNT =(0x20); //(R/W) Transient debounce counter
static const uint8_t REG_PULSE_CFG =(0x21); //(R/W) ELE, Double_XYZ or Single_XYZ
static const uint8_t REG_PULSE_SRC =(0x22); //(R) EA, Double_XYZ or Single_XYZ
static const uint8_t REG_PULSE_THSX =(0x23); //(R/W) X pulse threshold
static const uint8_t REG_PULSE_THSY =(0x24); //(R/W) Y pulse threshold
static const uint8_t REG_PULSE_THSZ =(0x25); //(R/W) Z pulse threshold
static const uint8_t REG_PULSE_TMLT =(0x26); //(R/W) Time limit for pulse
static const uint8_t REG_PULSE_LTCY =(0x27); //(R/W) Latency time for 2nd pulse
static const uint8_t REG_PULSE_WIND =(0x28); //(R/W) Window time for 2nd pulse
static const uint8_t REG_ASLP_COUNT =(0x29); //(R/W) Counter setting for auto-sleep
static const uint8_t REG_CTRL_REG1 =(0x2a); //(R/W) ODR = 800 Hz, STANDBY mode
static const uint8_t REG_CTRL_REG2 =(0x2b); //(R/W) Sleep enable, OS Modes, RST, ST
static const uint8_t REG_CTRL_REG3 =(0x2c); //(R/W) Wake from sleep, IPOL, PP_OD
static const uint8_t REG_CTRL_REG4 =(0x2d); //(R/W) Interrupt enable register
static const uint8_t REG_CTRL_REG5 =(0x2e); //(R/W) Interrupt pin (INT1/INT2) map
static const uint8_t REG_OFF_X =(0x2f); //(R/W) X-axis offset adjust
static const uint8_t REG_OFF_Y =(0x30); //(R/W) Y-axis offset adjust
static const uint8_t REG_OFF_Z =(0x31); //(R/W) Z-axis offset adjust
static const uint8_t FULL_SCALE_RANGE_2g =(0x00);
static const uint8_t FULL_SCALE_RANGE_4g =(0x01);
static const uint8_t FULL_SCALE_RANGE_8g =(0x02);
int16_t sensitivity;
/** ######### function definition ################################################################# */
public:
/**< TODO: do i need a constructor? */
MMA8451(void) : sensitivity(4096)
{
};
inline void setEnabled(const uint8_t enable)
{
uint8_t _value;
if (enable) _value = 255;
else _value = 0;
i2c.setRegister(I2C_ADDRESS, REG_CTRL_REG1, 0x01, _value); // deactivate the device
};
inline void setSensibility(const uint8_t gScaleRange=2)
{
uint8_t _value;
// figure out the Range
if ( gScaleRange <= 3)
{
_value = FULL_SCALE_RANGE_2g; //0-3 = 2g
sensitivity = 4096;
}
else if( gScaleRange <= 5)
{
_value = FULL_SCALE_RANGE_4g; //4-5 = 4g
sensitivity = 2048;
}
else
{
_value = FULL_SCALE_RANGE_8g; // 6-8 = 8g till boundary
sensitivity = 1024;
}
i2c.setRegister(I2C_ADDRESS,REG_XYZ_DATA_CFG, 0x03, _value); // set Range
if (sensitivity >= 2048) _value = 255; // Reduced Noise <=4g
else _value = 0;
i2c.setRegister(I2C_ADDRESS, REG_CTRL_REG1, B00000100, _value);
};
inline void setDatarate(const uint16_t hzFreq=100)
{
uint8_t _value;
// figure out Frequency
if ( hzFreq <= 2) _value = 7; // 1.56 Hz
else if( hzFreq <= 6) _value = 6; // 6.25 Hz
else if( hzFreq <= 13) _value = 5; // 12.5 Hz
else if( hzFreq <= 50) _value = 4; // 50 Hz
else if( hzFreq <= 100) _value = 3; // 100 Hz
else if( hzFreq <= 200) _value = 2; // 200 Hz
else if( hzFreq <= 400) _value = 1; // 400 Hz
else _value = 0; // 800 Hz
i2c.setRegister(I2C_ADDRESS, REG_CTRL_REG1, B00111000, _value<<3 ); // set OutputDataRate
};
inline void reset(void)
{
i2c.setRegister(I2C_ADDRESS, REG_CTRL_REG2, B01000000, 255);
};
inline uint8_t initialize()
{
return initialize(100, 8);
};
inline uint8_t initialize(const uint16_t hzFreq, const uint8_t gScaleRange)
{
if (i2c.probe(I2C_ADDRESS)==0) return 0;
setEnabled(0);
setSensibility(gScaleRange);
setDatarate(hzFreq);
/**< TODO: needs some tuning */
i2c.setRegister(I2C_ADDRESS, REG_F_SETUP, B11000000, 0 ); // disable FIFO
i2c.setRegister(I2C_ADDRESS, REG_XYZ_DATA_CFG, B00010000, 0 ); // deactivate HighPassFilter
i2c.setRegister(I2C_ADDRESS, REG_CTRL_REG2, 0x3, 2 ); // HighResolution while awake
//const uint8_t BITRES_14_TO_10
#ifdef BITRES_14_TO_10
i2c.setRegister(I2C_ADDRESS, REG_CTRL_REG1, 0x02, 0x02 ); // enable Fast Read Mode
#else
i2c.setRegister(I2C_ADDRESS, REG_CTRL_REG1, 0x02, 0 ); // disable Fast Read Mode (FullResolution)
#endif
setEnabled(1);
return 1;
};
/**< check for new data, return 1 when Measurement is ready */
uint8_t checkMeasurement(void)
{
uint8_t _value;
i2c.read(I2C_ADDRESS, REG_STATUS, &_value, 1);
if (_value & B00001000) return 1; // Measurement finished
else return 0;
};
/**< wait for new data*/
uint8_t awaitMeasurement(void)
{
uint8_t _counter = 0;
while (checkMeasurement()==0)
{
if (++_counter > 250) return 0; // check took longer than 250ms
delay(1);
};
return 1; // Measurement finished
};
/*************************************************************
*
* xyz
*
* Get accelerometer readings (x, y, z)
* by default, standard 10 bits mode is used.
*
* This function also convers 2's complement number to
* signed integer result.
*
* If accelerometer is initialized to use low res mode,
* isHighRes must be passed in as false.
*
*************************************************************/
void inline getMeasurement(int16_t raw_xyz[])
{
uint8_t _buf[6];
i2c.read(I2C_ADDRESS, REG_OUT_X_MSB, _buf, 6);
#ifdef BITRES_14_TO_10
raw_xyz[0] = (_buf[0] << 2) | ((_buf[1] >> 6) & 0x3); // Only 10 bit of 14 used
raw_xyz[1] = (_buf[2] << 2) | ((_buf[3] >> 6) & 0x3);
raw_xyz[2] = (_buf[4] << 2) | ((_buf[5] >> 6) & 0x3);
if (raw_xyz[0] > 511) raw_xyz[0] -= 1024;
if (raw_xyz[1] > 511) raw_xyz[1] -= 1024;
if (raw_xyz[2] > 511) raw_xyz[2] -= 1024;
#else
raw_xyz[0] = (_buf[0] << 6) | ((_buf[1] >> 2) & 0x63); // use all 14 bits
raw_xyz[1] = (_buf[2] << 6) | ((_buf[3] >> 2) & 0x63);
raw_xyz[2] = (_buf[4] << 6) | ((_buf[5] >> 2) & 0x63);
if (raw_xyz[0] > 8191) raw_xyz[0] -= 16384;
if (raw_xyz[1] > 8191) raw_xyz[1] -= 16384;
if (raw_xyz[2] > 8191) raw_xyz[2] -= 16384;
#endif
};
void inline getMeasurement(float acc_xyz[])
{
int16_t _raw_xyz[3];
getMeasurement(_raw_xyz);
acc_xyz[0] = float(_raw_xyz[0]) / float(sensitivity);
acc_xyz[1] = float(_raw_xyz[1]) / float(sensitivity);
acc_xyz[2] = float(_raw_xyz[2]) / float(sensitivity);
};
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//PRESET preset = PRESET();
#endif

@ -0,0 +1,311 @@
#ifndef i2c_mpl3115a2_h
#define i2c_mpl3115a2_h
#include "i2c.h"
#include "i2c_Sensor.h"
/** ######################################################################
Driver for the MPL3115A2-Sensor
CONSUMPTION: standby 2µA, measure 260-2000µA
ONE-TIME-MEASURE: disable sensor, [start measurement, wait, read ] ...
AUTO-Measure: enable sensor, start measurement, [read, read ] ...
######################################################################## */
class MPL3115A2 : public i2cSensor, public manualSensor
{
private:
/** ######### Register-Map ################################################################# */
static const uint8_t I2C_ADDRESS =(0x60);
static const uint8_t REG_STATUS =(0x00); // data ready, previous data unread and overwritten
static const uint8_t REG_OUT_P_MSB =(0x01);
static const uint8_t REG_OUT_P_CSB =(0x02);
static const uint8_t REG_OUT_P_LSB =(0x03);
static const uint8_t REG_OUT_T_MSB =(0x04);
static const uint8_t REG_OUT_T_LSB =(0x05);
static const uint8_t REG_DR_STATUS =(0x06);
static const uint8_t REG_OUT_P_DELTA_MSB =(0x07);
static const uint8_t REG_OUT_P_DELTA_CSB =(0x08);
static const uint8_t REG_OUT_P_DELTA_LSB =(0x09);
static const uint8_t REG_OUT_T_DELTA_MSB =(0x0A);
static const uint8_t REG_OUT_T_DELTA_LSB =(0x0B);
static const uint8_t REG_WHO_AM_I =(0x0C);
static const uint8_t VAL_WHO_AM_I =(0xC4);
static const uint8_t REG_FIFO_STATUS =(0x0D);
static const uint8_t REG_FIFO_DATA =(0x0E);
static const uint8_t REG_FIFO_SETUP =(0x0F);
static const uint8_t REG_TIME_DLY =(0x10);
static const uint8_t REG_SYSMOD =(0x11);
static const uint8_t VAL_SYS_ACTIVE =(0x01);
static const uint8_t VAL_SYS_STANDBY =(0x00);
static const uint8_t REG_INT_SOURCE =(0x12);
static const uint8_t REG_PT_DATA_CFG =(0x13);
static const uint8_t MSK_DATA_READY =(0x04);
static const uint8_t MSK_PRES_READY =(0x02);
static const uint8_t MSK_TEMP_READY =(0x01);
static const uint8_t REG_BAR_IN_MSB =(0x14);
static const uint8_t REG_BAR_IN_LSB =(0x15);
static const uint8_t REG_P_TGT_MSB =(0x16); // target int16 in meters OR uint16 in 2Pa
static const uint8_t REG_P_TGT_LSB =(0x17);
static const uint8_t REG_T_TGT =(0x18);
static const uint8_t REG_P_WND_MSB =(0x19);
static const uint8_t REG_P_WND_LSB =(0x1A);
static const uint8_t REG_T_WND =(0x1B);
static const uint8_t REG_P_MIN_MSB =(0x1C);
static const uint8_t REG_P_MIN_CSB =(0x1D);
static const uint8_t REG_P_MIN_LSB =(0x1E);
static const uint8_t REG_T_MIN_MSB =(0x1F);
static const uint8_t REG_T_MIN_LSB =(0x20);
static const uint8_t REG_P_MAX_MSB =(0x21);
static const uint8_t REG_P_MAX_CSB =(0x22);
static const uint8_t REG_P_MAX_LSB =(0x23);
static const uint8_t REG_T_MAX_MSB =(0x24);
static const uint8_t REG_T_MAX_LSB =(0x25);
static const uint8_t REG_CTRL1 =(0x26); //
static const uint8_t MSK_SBYB =(0x01);
static const uint8_t MSK_OST =(0x02); // triggers measurement even when standby (onetime)!!!
static const uint8_t MSK_RST =(0x04);
static const uint8_t MSK_OS =(B00111000);
static const uint8_t MSK_RAW =(B01000000);
static const uint8_t MSK_ALT =(B10000000);
static const uint8_t REG_CTRL2 =(0x27); // can only be modified in standby
static const uint8_t REG_CTRL3 =(0x28); // can only be modified in standby
static const uint8_t REG_CTRL4 =(0x29); // can only be modified in standby
static const uint8_t REG_CTRL5 =(0x2A); // can only be modified in standby
static const uint8_t REG_OFF_P =(0x2B); // registers not preserved in standby
static const uint8_t REG_OFF_T =(0x2C); // registers not preserved in standby
static const uint8_t REG_OFF_H =(0x2D); // registers not preserved in standby
/** ######### function definition ################################################################# */
public:
MPL3115A2(void)
{
};
/**< Enable Altimeter / Barometer MODE */
inline void setAltimeter(const uint8_t enable = 1)
{
uint8_t _value;
if (enable) _value=MSK_ALT;
else _value=0;
i2c.setRegister(I2C_ADDRESS,REG_CTRL1, MSK_ALT, _value);
};
/**< Enable / Disable the Sensor */
inline void setEnabled(const uint8_t enable = 1)
{
uint8_t _value;
if (enable) _value=1;
else _value=0;
i2c.setRegister(I2C_ADDRESS,REG_CTRL1, MSK_SBYB, _value);
};
/**< read Enable / Disable - Status */
inline uint8_t getEnabled()
{
return (1 & i2c.readByte(I2C_ADDRESS,REG_SYSMOD));
};
/**< do a software reset */
inline void reset()
{
i2c.writeByte(I2C_ADDRESS,REG_CTRL1, MSK_RST);
};
/**< */
inline uint8_t setOversampleRatio(const uint8_t sampleRatio = 128)
{
uint8_t ratio, sample;
if (sampleRatio > 127)
{
sample = 7; // takes 512ms
ratio = 128;
}
else if (sampleRatio > 63)
{
sample = 6; // takes 258ms
ratio = 64;
}
else if (sampleRatio > 31)
{
sample = 5; // takes 130ms
ratio = 32;
}
else if (sampleRatio > 15)
{
sample = 4; // takes 66ms
ratio = 16;
}
else if (sampleRatio > 7)
{
sample = 3; // takes 34ms
ratio = 8;
}
else if (sampleRatio > 3)
{
sample = 2; // takes 18ms
ratio = 4;
}
else if (sampleRatio > 1)
{
sample = 1; // takes 10ms
ratio = 2;
}
else
{
sample = 0; // takes 6ms
ratio = 1;
}
sample <<= 3; //Align it for the CTRL_REG1 register
i2c.setRegister(I2C_ADDRESS,REG_CTRL1, MSK_OS, sample); //Read current settings
return ratio;
};
/**< Enables the measurement event flags */
/**< This is recommended in datasheet during setup. */
inline void setEventFlags(const uint8_t flags = (MSK_DATA_READY | MSK_PRES_READY | MSK_TEMP_READY))
{
i2c.writeByte(I2C_ADDRESS,REG_PT_DATA_CFG, (flags & 0x07)); // Enable all three pressure and temp event flags
};
/**< initialize */
inline uint8_t initialize(void)
{
if (i2c.probe(I2C_ADDRESS)==0) return 0;
reset();
delay(2);
setEnabled(0);
setEventFlags();
setOversampleRatio(128);
setAltimeter(1);
setEnabled(1);
return 1;
};
/**< Clears and sets the OST bit --> immediately take another reading */
/**< Needed to sample faster than 1Hz */
void triggerMeasurement(void)
{
uint8_t setting = i2c.readByte(I2C_ADDRESS,REG_CTRL1); //Read current settings
if (setting&2)
{
setting &= ~(1<<1); //Clear OST bit
i2c.writeByte(I2C_ADDRESS,REG_CTRL1, setting);
setting = i2c.readByte(I2C_ADDRESS,REG_CTRL1); //Read current settings to be safe
}
setting |= (1<<1); //Set OST bit
i2c.writeByte(I2C_ADDRESS,REG_CTRL1, setting);
};
uint8_t checkMeasurement(void)
{
uint8_t _val;
//Wait for PDR bit, indicates we have new pressure data
i2c.read(I2C_ADDRESS, REG_STATUS, &_val, 1);
if (_val & B00000010) return 1; // Measurement finished
else return 0;
};
/**< if you started a measurement and want to actively wait for it to finish */
uint8_t awaitMeasurement(void)
{
uint8_t _counter = 0;
while(checkMeasurement()==0)
{
if(++_counter > 250) return 0; //Error out after max of 500ms for a read
delay(2);
}
return 1; // Measurement finished
};
/**< gives the number of meters above sea level */
inline void getAltitude(float& meter)
{
uint8_t value[3];
i2c.read(I2C_ADDRESS, REG_OUT_P_MSB, value, 3); // meter in Q16.4 signed in 3x8bit left
float tempcsb = (float(value[2]>>4))/16.0;
meter = (float)( int16_t(value[0] << 8) | int16_t(value[1])) + tempcsb;
};
/**< gives airpressure in Pascal */
inline void getPressure(float& pascal)
{
// Read pressure registers
uint8_t value[3];
i2c.read(I2C_ADDRESS, REG_OUT_P_MSB, value, 3); // pascal in Q18.2 unsigned in 3x8bit left
float tempcsb = (float(value[2]>>4))/4.0;
pascal = (float( uint16_t(value[0] << 8) | value[1]))*4 + tempcsb;
};
/**< not so much precision (2bit), mut much faster (26 instructions) */
inline void getPressure(uint32_t& pascal)
{
// Read pressure registers
uint8_t value[3];
i2c.read(I2C_ADDRESS, REG_OUT_P_MSB, value, 3); // pascal in Q18.2 unsigned in 3x8bit left
pascal = uint32_t(( (uint32_t(value[0]<<8) | uint32_t(value[1]))<<2) + (value[2]>>6) );
};
/**< gives pressure-values */
inline void getMeasurement(float& pascal)
{
getPressure(pascal);
};
/**< gives temperature in degree celsius */
inline void getTemperature(float& celsius)
{
// Read temperature registers
byte value[2];
i2c.read(I2C_ADDRESS, REG_OUT_T_MSB, value, 2); // °C in Q8.4 signed in 2x
uint16_t foo;
bool negSign = false;
if(value[0] > 0x7F) //Check for 2s compliment
{
foo = ~((value[0] << 8) + value[1]) + 1;
negSign = true;
}
else
{
foo = ((value[0] << 8) + value[1]);
}
celsius = ((float)(foo))/256.0;
if (negSign) celsius = 0 - celsius;
};
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//MPL3115 mpl3115 = MPL3115();
#endif

@ -0,0 +1,460 @@
#ifndef i2c_MPU9250_h
#define i2c_MPU9250_h
#include "i2c.h"
#include "i2c_Sensor.h"
/** ######################################################################
Driver for the MPU9250-Sensor
9D-IMU 3.7mA, 8µA sleep
GYRO XYZ: [3.9 .. 8000 Hz], ±250, ±500, ±1000, and ±2000°/sec and integrated 16-bit ADCs
8µA, 3.2mA active
ACCE XYZ: ±2g, ±4g, ±8g and ±16g and integrated 16-bit ADCs
8µA, 450µA
MAGN XYZ: ±4800μT, 14 bit (0.6μT/LSB) or 16 bit (15μT/LSB)
?µA, 280μA @8Hz
DMP: Digital Motion Processing
///
######################################################################## */
class MPU9250 : public i2cSensor
{
private:
/** ######### Register-Map ################################################################# */
static const uint8_t I2C_ADDRESS =(0x69);
//MPU9250 Register map
static const uint8_t REG_SELF_TEST_X_GYRO =(0x00);
static const uint8_t REG_SELF_TEST_Y_GYRO =(0x01);
static const uint8_t REG_SELF_TEST_Z_GYRO =(0x02);
static const uint8_t REG_SELF_TEST_X_ACCEL =(0x0D);
static const uint8_t REG_SELF_TEST_Y_ACCEL =(0x0E);
static const uint8_t REG_SELF_TEST_Z_ACCEL =(0x0F);
static const uint8_t REG_XG_OFFSET_H =(0x13);
static const uint8_t REG_XG_OFFSET_L =(0x14);
static const uint8_t REG_YG_OFFSET_H =(0x15);
static const uint8_t REG_YG_OFFSET_L =(0x16);
static const uint8_t REG_ZG_OFFSET_H =(0x17);
static const uint8_t REG_ZG_OFFSET_L =(0x18);
static const uint8_t REG_SMPLRT_DIV =(0x19);
inline const uint8_t HZ_TO_DIV(const uint16_t hz)
{
return ((1000/hz) - 1);
};
static const uint8_t REG_CONFIG =(0x1A);
static const uint8_t MSK_FIFO_MODE =(0x40);
static const uint8_t MSK_EXT_SYNC_SET =(0x38);
static const uint8_t MSK_DLPF_CFG =(0x07);
static const uint8_t REG_GYRO_CONFIG =(0x1B);
static const uint8_t MSK_XGYRO_CTEN =(0x80);
static const uint8_t MSK_YGYRO_CTEN =(0x40);
static const uint8_t MSK_ZGYRO_CTEN =(0x20);
static const uint8_t MSK_GYRO_FS_SEL =(0x18);
static const uint8_t VAL_GYRO_FS_0250 =(0x00);
static const uint8_t VAL_GYRO_FS_0500 =(0x01);
static const uint8_t VAL_GYRO_FS_1000 =(0x02);
static const uint8_t VAL_GYRO_FS_2000 =(0x03);
static const uint8_t MSK_FCHOICE_B =(0x03);
static const uint8_t REG_ACCEL_CONFIG =(0x1C);
static const uint8_t MSK_AX_ST_EN =(0x80);
static const uint8_t MSK_AY_ST_EN =(0x40);
static const uint8_t MSK_AZ_ST_EN =(0x20);
static const uint8_t MSK_ACCEL_FS_SEL =(0x18);
static const uint8_t VAL_ACCEL_FS_02 =(0x00);
static const uint8_t VAL_ACCEL_FS_04 =(0x01);
static const uint8_t VAL_ACCEL_FS_08 =(0x02);
static const uint8_t VAL_ACCEL_FS_16 =(0x03);
static const uint8_t REG_ACCEL_CONFIG2 =(0x1D);
static const uint8_t MSK_ACCEL_FCHOICE_B =(0xC0);
static const uint8_t MSK_A_DLPF_CFG =(0x03);
static const uint8_t REG_LP_ACCEL_ODR =(0x1E);
static const uint8_t MSK_LPOSC_CLKSEL =(0x0F);
static const uint8_t REG_WOM_THR =(0x1F);
static const uint8_t REG_FIFO_EN =(0x23);
static const uint8_t MSK_TEMP_FIFO_EN =(0x80);
static const uint8_t MSK_GYRO_XOUT =(0x40);
static const uint8_t MSK_GYRO_YOUT =(0x20);
static const uint8_t MSK_GYRO_ZOUT =(0x10);
static const uint8_t MSK_ACCEL =(0x08);
static const uint8_t MSK_SLV2 =(0x04);
static const uint8_t MSK_SLV1 =(0x02);
static const uint8_t MSK_SLV0 =(0x01);
static const uint8_t REG_I2C_MST_CTRL =(0x24);
static const uint8_t MSK_MULT_MST_EN =(0x80);
static const uint8_t MSK_WAIT_FOR_ES =(0x40);
static const uint8_t MSK_SLV_3_FIFO_EN =(0x20);
static const uint8_t MSK_I2C_MST_P_NSR =(0x10);
static const uint8_t MSK_I2C_MST_CLK =(0x0F);
static const uint8_t REG_I2C_SLV0_ADDR =(0x25);
static const uint8_t MSK_I2C_SLV0_RNW =(0x80);
static const uint8_t MSK_I2C_ID_0 =(0x7F);
static const uint8_t REG_I2C_SLV0_REG =(0x26);
static const uint8_t REG_I2C_SLV0_CTRL =(0x27);
static const uint8_t MSK_I2C_SLV0_EN =(0x80);
static const uint8_t MSK_I2C_SLV0_BYTE_SW =(0x40);
static const uint8_t MSK_I2C_SLV0_REG_DIS =(0x20);
static const uint8_t MSK_I2C_SLV0_GRP =(0x10);
static const uint8_t MSK_I2C_SLV0_LENG =(0x0F);
// [without SLV0 to SLV4]
static const uint8_t REG_I2C_MST_STATUS =(0x36);
static const uint8_t MSK_PASS_THROUGH =(0x80);
static const uint8_t MSK_I2C_SLV4_DONE =(0x40);
static const uint8_t MSK_I2C_LOST_ARB =(0x20);
static const uint8_t MSK_I2C_SLV4_NACK =(0x10);
static const uint8_t MSK_I2C_SLV3_NACK =(0x08);
static const uint8_t MSK_I2C_SLV2_NACK =(0x04);
static const uint8_t MSK_I2C_SLV1_NACK =(0x02);
static const uint8_t MSK_I2C_SLV0_NACK =(0x01);
static const uint8_t REG_INT_PIN_CFG =(0x37);
static const uint8_t MSK_ACTL =(0x80);
static const uint8_t MSK_OPEN =(0x40);
static const uint8_t MSK_LATCH_INT_EN =(0x20);
static const uint8_t MSK_INT_ANYRD_2CLEAR =(0x10);
static const uint8_t MSK_ACTL_FSYNC =(0x08);
static const uint8_t MSK_FSYNC_INT_MODE_EN =(0x04);
static const uint8_t MSK_BYPASS_EN =(0x02);
static const uint8_t REG_INT_ENABLE =(0x38);
static const uint8_t MSK_WOM_EN =(0x40);
static const uint8_t MSK_FIFO_OFLOW_EN =(0x10);
static const uint8_t MSK_FSYNC_INT_EN =(0x08);
static const uint8_t MSK_RAW_RDY_EN =(0x01);
static const uint8_t REG_INT_STATUS =(0x3A);
static const uint8_t MSK_WOM_INT =(0x40);
static const uint8_t MSK_FIFO_OFLOW_INT =(0x10);
static const uint8_t MSK_FSYNC_INT =(0x08);
static const uint8_t MSK_RAW_DATA_RDY_INT =(0x01);
static const uint8_t REG_ACCEL_XOUT_H =(0x3B);
static const uint8_t REG_ACCEL_XOUT_L =(0x3C);
static const uint8_t REG_ACCEL_YOUT_H =(0x3D);
static const uint8_t REG_ACCEL_YOUT_L =(0x3E);
static const uint8_t REG_ACCEL_ZOUT_H =(0x3F);
static const uint8_t REG_ACCEL_ZOUT_L =(0x40);
static const uint8_t REG_TEMP_OUT_H =(0x41);
static const uint8_t REG_TEMP_OUT_L =(0x42);
static const uint8_t REG_GYRO_XOUT_H =(0x43);
static const uint8_t REG_GYRO_XOUT_L =(0x44);
static const uint8_t REG_GYRO_YOUT_H =(0x45);
static const uint8_t REG_GYRO_YOUT_L =(0x46);
static const uint8_t REG_GYRO_ZOUT_H =(0x47);
static const uint8_t REG_GYRO_ZOUT_L =(0x48);
static const uint8_t REG_EXT_SENS_DATA_00 =(0x49);
static const uint8_t REG_EXT_SENS_DATA_01 =(0x4A);
static const uint8_t REG_EXT_SENS_DATA_02 =(0x4B);
static const uint8_t REG_EXT_SENS_DATA_03 =(0x4C);
static const uint8_t REG_EXT_SENS_DATA_04 =(0x4D);
static const uint8_t REG_EXT_SENS_DATA_05 =(0x4E);
static const uint8_t REG_EXT_SENS_DATA_06 =(0x4F);
static const uint8_t REG_EXT_SENS_DATA_07 =(0x50);
static const uint8_t REG_EXT_SENS_DATA_08 =(0x51);
static const uint8_t REG_EXT_SENS_DATA_09 =(0x52);
static const uint8_t REG_EXT_SENS_DATA_10 =(0x53);
static const uint8_t REG_EXT_SENS_DATA_11 =(0x54);
static const uint8_t REG_EXT_SENS_DATA_12 =(0x55);
static const uint8_t REG_EXT_SENS_DATA_13 =(0x56);
static const uint8_t REG_EXT_SENS_DATA_14 =(0x57);
static const uint8_t REG_EXT_SENS_DATA_15 =(0x58);
static const uint8_t REG_EXT_SENS_DATA_16 =(0x59);
static const uint8_t REG_EXT_SENS_DATA_17 =(0x5A);
static const uint8_t REG_EXT_SENS_DATA_18 =(0x5B);
static const uint8_t REG_EXT_SENS_DATA_19 =(0x5C);
static const uint8_t REG_EXT_SENS_DATA_20 =(0x5D);
static const uint8_t REG_EXT_SENS_DATA_21 =(0x5E);
static const uint8_t REG_EXT_SENS_DATA_22 =(0x5F);
static const uint8_t REG_EXT_SENS_DATA_23 =(0x60);
static const uint8_t REG_I2C_SLV0_DO =(0x63);
static const uint8_t REG_I2C_SLV1_DO =(0x64);
static const uint8_t REG_I2C_SLV2_DO =(0x65);
static const uint8_t REG_I2C_SLV3_DO =(0x66);
static const uint8_t REG_I2C_MST_DELAY_CTRL =(0x67);
static const uint8_t MSK_DELAY_ES_SHADOW =(0x80);
static const uint8_t MSK_I2C_SLV4_DLY_EN =(0x10);
static const uint8_t MSK_I2C_SLV3_DLY_EN =(0x08);
static const uint8_t MSK_I2C_SLV2_DLY_EN =(0x04);
static const uint8_t MSK_I2C_SLV1_DLY_EN =(0x02);
static const uint8_t MSK_I2C_SLV0_DLY_EN =(0x01);
static const uint8_t REG_SIGNAL_PATH_RESET =(0x68);
static const uint8_t MSK_GYRO_RST =(0x04);
static const uint8_t MSK_ACCEL_RST =(0x02);
static const uint8_t MSK_TEMP_RST =(0x01);
static const uint8_t REG_MOT_DETECT_CTRL =(0x69);
static const uint8_t MSK_ACCEL_INTEL_EN =(0x80);
static const uint8_t MSK_ACCEL_INTEL_MODE =(0x40);
static const uint8_t REG_USER_CTRL =(0x6A);
static const uint8_t MSK_FIFO_EN =(0x40);
static const uint8_t MSK_I2C_MST_EN =(0x20);
static const uint8_t MSK_I2C_IF_DIS =(0x10);
static const uint8_t MSK_FIFO_RST =(0x04);
static const uint8_t MSK_I2C_MST_RST =(0x02);
static const uint8_t MSK_SIG_COND_RST =(0x01);
static const uint8_t REG_PWR_MGMT_1 =(0x6B);
static const uint8_t MSK_H_RESET =(0x80);
static const uint8_t MSK_SLEEP =(0x40);
static const uint8_t MSK_CYCLE =(0x20);
static const uint8_t MSK_GYRO_STANDBY_CYCLE =(0x10);
static const uint8_t MSK_PD_PTAT =(0x08);
static const uint8_t MSK_CLKSEL =(0x07);
static const uint8_t REG_PWR_MGMT_2 =(0x6C);
static const uint8_t MSK_DISABLE_XA =(0x20);
static const uint8_t MSK_DISABLE_YA =(0x10);
static const uint8_t MSK_DISABLE_ZA =(0x08);
static const uint8_t MSK_DISABLE_XG =(0x04);
static const uint8_t MSK_DISABLE_YG =(0x02);
static const uint8_t MSK_DISABLE_ZG =(0x01);
static const uint8_t MSK_DISABLE_XYZA =(0x38);
static const uint8_t MSK_DISABLE_XYZG =(0x07);
static const uint8_t REG_FIFO_COUNTH =(0x72);
static const uint8_t REG_FIFO_COUNTL =(0x73);
static const uint8_t REG_FIFO_R_W =(0x74);
static const uint8_t REG_WHO_AM_I =(0x75);
static const uint8_t VAL_WHOAMI_6500 =(0x70);
static const uint8_t VAL_WHOAMI_9250 =(0x71);
static const uint8_t REG_XA_OFFSET_H =(0x77);
static const uint8_t REG_XA_OFFSET_L =(0x78);
static const uint8_t REG_YA_OFFSET_H =(0x7A);
static const uint8_t REG_YA_OFFSET_L =(0x7B);
static const uint8_t REG_ZA_OFFSET_H =(0x7D);
static const uint8_t REG_ZA_OFFSET_L =(0x7E);
//reset values
static const uint8_t WHOAMI_RESET_VAL =(0x71);
static const uint8_t POWER_MANAGMENT_1_RESET_VAL =(0x01);
static const uint8_t DEFAULT_RESET_VALUE =(0x00);
static const uint8_t WHOAMI_DEFAULT_VAL =(0x68);
/**< TODO: Switch to separate lib for the AK8963 */
//Magnetometer register maps
static const uint8_t REG_MAG_WIA =(0x00);
static const uint8_t REG_MAG_INFO =(0x01);
static const uint8_t REG_MAG_ST1 =(0x02);
static const uint8_t REG_MAG_XOUT_L =(0x03);
static const uint8_t REG_MAG_XOUT_H =(0x04);
static const uint8_t REG_MAG_YOUT_L =(0x05);
static const uint8_t REG_MAG_YOUT_H =(0x06);
static const uint8_t REG_MAG_ZOUT_L =(0x07);
static const uint8_t REG_MAG_ZOUT_H =(0x08);
static const uint8_t REG_MAG_ST2 =(0x09);
static const uint8_t REG_MAG_CNTL =(0x0A);
static const uint8_t REG_MAG_RSV =(0x0B); //reserved mystery meat
static const uint8_t REG_MAG_ASTC =(0x0C);
static const uint8_t REG_MAG_TS1 =(0x0D);
static const uint8_t REG_MAG_TS2 =(0x0E);
static const uint8_t REG_MAG_I2CDIS =(0x0F);
static const uint8_t REG_MAG_ASAX =(0x10);
static const uint8_t REG_MAG_ASAY =(0x11);
static const uint8_t REG_MAG_ASAZ =(0x12);
//Magnetometer register masks
static const uint8_t MPU9250_WIA =(0x48);
static const uint8_t MPU9250_ =(0x00);
float gSensitivity, aSensitivity;
/** ######### function definition ################################################################# */
public:
/**< TODO: do i need a constructor? */
MPU9250(void): gSensitivity(1), aSensitivity(1)
{
};
void setEnabled(const uint8_t enable = 1)
{
uint8_t _value;
if (enable) _value = 0;
else _value = 255;
i2c.setRegister(I2C_ADDRESS, REG_PWR_MGMT_1, MSK_SLEEP, _value);
i2c.setRegister(I2C_ADDRESS, REG_PWR_MGMT_2, B00111111, _value); // enable XYZ of Gyr & Acc
};
/**< takes 0..3 for 250, 500, 1000, 2000 dps */
inline void setGSensitivity(const uint8_t gScaleRange = VAL_GYRO_FS_0500)
{
if (gScaleRange<4) i2c.setRegister(I2C_ADDRESS, REG_GYRO_CONFIG, MSK_GYRO_FS_SEL, gScaleRange<<3);
if (gScaleRange==VAL_GYRO_FS_0250) gSensitivity=131.0;
else if (gScaleRange==VAL_GYRO_FS_0500) gSensitivity=65.5;
else if (gScaleRange==VAL_GYRO_FS_1000) gSensitivity=32.8;
else if (gScaleRange==VAL_GYRO_FS_2000) gSensitivity=16.4;
};
/**< takes 0..3 for 2, 4, 8 and 16g */
inline void setASensitivity(const uint8_t aScaleRange = VAL_ACCEL_FS_04)
{
if (aScaleRange<4) i2c.setRegister(I2C_ADDRESS, REG_ACCEL_CONFIG, MSK_ACCEL_FS_SEL, aScaleRange<<3);
if (aScaleRange==VAL_ACCEL_FS_02) aSensitivity=16384;
else if (aScaleRange==VAL_ACCEL_FS_04) aSensitivity= 8192;
else if (aScaleRange==VAL_ACCEL_FS_08) aSensitivity= 4096;
else if (aScaleRange==VAL_ACCEL_FS_16) aSensitivity= 2048;
};
/**< round numbers are: 1 kHz, 500 Hz, 200, 125, 100, 50, 25, 20, 10 ... */
inline void setDatarate(const uint16_t hzFreq=100)
{
/**< with clockratedivider for samplerate 1kHz (Configure FChoice) */
i2c.writeByte(I2C_ADDRESS, REG_SMPLRT_DIV, (uint8_t) HZ_TO_DIV(hzFreq));
};
inline void setBandwidth(const uint16_t hzFreq=100)
{
uint8_t dlpf;
if (hzFreq>184) dlpf = 0; // 460 Hz Acc, FS= 1 kHz // 250 Hz Gyro, 4000 Hz Temp, FS=8kHz
else if (hzFreq>92) dlpf = 1; // 184 Hz Gyro/Acc, 4000 Hz Temp, FS=1kHz
else if (hzFreq>41) dlpf = 2; // 92 Hz Gyro/Acc, 4000 Hz Temp, FS=1kHz
else if (hzFreq>20) dlpf = 3; // 41 Hz Gyro/Acc, 42 Hz Temp, FS=1kHz
else if (hzFreq>10) dlpf = 4; // 20 Hz Gyro/Acc, 20 Hz Temp, FS=1kHz
else if (hzFreq>5) dlpf = 5; // 10 Hz Gyro/Acc, 10 Hz Temp, FS=1kHz
else dlpf = 6; // 5 Hz Gyro/Acc, 5 Hz Temp, FS=1kHz
/**< Rework, page 15 - FS=1kHz --> Bandbreite einstellen */
i2c.setRegister(I2C_ADDRESS, REG_CONFIG, MSK_DLPF_CFG, dlpf); // 0x1A DLPF p13
i2c.setRegister(I2C_ADDRESS, REG_GYRO_CONFIG, MSK_FCHOICE_B, 0); // 0x1B gFChoice
i2c.setRegister(I2C_ADDRESS, REG_ACCEL_CONFIG2, MSK_A_DLPF_CFG, dlpf);
i2c.setRegister(I2C_ADDRESS, REG_ACCEL_CONFIG2, MSK_ACCEL_FCHOICE_B, 0); // aFChoice
};
inline void reset(void)
{
uint8_t rVector;
rVector = MSK_GYRO_RST | MSK_ACCEL_RST | MSK_TEMP_RST;
i2c.setRegister(I2C_ADDRESS, REG_SIGNAL_PATH_RESET, rVector, rVector); // Registers of Sensors
i2c.setRegister(I2C_ADDRESS, REG_USER_CTRL, MSK_SIG_COND_RST, MSK_SIG_COND_RST); // Signal paths of Sensors
i2c.setRegister(I2C_ADDRESS, REG_PWR_MGMT_1, MSK_H_RESET, MSK_H_RESET); // internal Registers
};
inline uint8_t initialize(void)
{
if (i2c.probe(I2C_ADDRESS) == 0) return 0;
// 0x19 Sample Rate Divider - standard = 0 (+1)
reset();
delay(20);
//setEnabled(0);
setBandwidth(20);
setDatarate(100);
setGSensitivity(VAL_GYRO_FS_0500);
setASensitivity(VAL_ACCEL_FS_04);
// Clocksource
i2c.setRegister(I2C_ADDRESS, REG_PWR_MGMT_1, MSK_CLKSEL, 1); // should be VAL_CLOCK_PLL_XGYRO, is it?
// PWR MGMT
i2c.setRegister(I2C_ADDRESS, REG_PWR_MGMT_1, MSK_CYCLE | MSK_GYRO_STANDBY_CYCLE | MSK_PD_PTAT, 0); // Normal operation
// INTs
i2c.setRegister(I2C_ADDRESS, REG_INT_PIN_CFG, MSK_INT_ANYRD_2CLEAR,MSK_INT_ANYRD_2CLEAR); // Clear INT at read
i2c.setRegister(I2C_ADDRESS, REG_INT_ENABLE , MSK_RAW_RDY_EN, MSK_RAW_RDY_EN); // INT: Raw Data Ready to read
// I2C-Master
i2c.setRegister(I2C_ADDRESS, REG_USER_CTRL , MSK_I2C_MST_EN, 0); // disable I2C-Master
i2c.setRegister(I2C_ADDRESS, REG_INT_PIN_CFG , MSK_BYPASS_EN, MSK_BYPASS_EN); // enable Bypass mode!
setEnabled(1);
uint8_t who = i2c.readByte(I2C_ADDRESS, REG_WHO_AM_I);
if (who == VAL_WHOAMI_6500) return 2;
else if (who == VAL_WHOAMI_9250) return 3;
else return 1;
};
/**< check for new data, return 1 when Measurement is ready */
inline uint8_t checkMeasurement(void)
{
if (i2c.readByte(I2C_ADDRESS,REG_INT_STATUS)&MSK_RAW_DATA_RDY_INT) return 1;
else return 0;
};
/**< if you started a measurement and want to actively wait for it to finish */
inline uint8_t awaitMeasurement(void)
{
uint8_t _counter = 0;
while(checkMeasurement()==0)
{
if(++_counter > 250) return 0; //Error out after max of 250ms for a read
delay(1);
}
return 1; // Measurement finished
};
/**< TODO: separate RAW and Scaled GET */
void getMeasurement(float xyz_AccTemGyr[])
{
uint8_t _data[14];
i2c.read(I2C_ADDRESS,REG_ACCEL_XOUT_H, _data, 14);
// RAW
xyz_AccTemGyr[0] = int16_t(_data[0]<<8 | _data[1]); // ACC
xyz_AccTemGyr[1] = int16_t(_data[2]<<8 | _data[3]);
xyz_AccTemGyr[2] = int16_t(_data[4]<<8 | _data[5]);
xyz_AccTemGyr[3] = int16_t(_data[6]<<8 | _data[7]); // TEMP
xyz_AccTemGyr[4] = int16_t(_data[8]<<8 | _data[9]); // GYR
xyz_AccTemGyr[5] = int16_t(_data[10]<<8| _data[11]);
xyz_AccTemGyr[6] = int16_t(_data[12]<<8| _data[13]);
// Scale
xyz_AccTemGyr[3] = xyz_AccTemGyr[3] / 333.87 + 21; // TEMP_degC = ((TEMP_OUT – RoomTemp_Offset)/Temp_Sensitivity) + 21degC
xyz_AccTemGyr[0] /= aSensitivity; // ACC
xyz_AccTemGyr[1] /= aSensitivity;
xyz_AccTemGyr[2] /= aSensitivity;
xyz_AccTemGyr[4] /= gSensitivity; // GYR
xyz_AccTemGyr[5] /= gSensitivity;
xyz_AccTemGyr[6] /= gSensitivity;
};
/** ######### Digital Motion Processor ################################################################# */
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//PRESET preset = PRESET();
#endif

@ -0,0 +1,379 @@
#ifndef i2c_pcf2127_h
#define i2c_pcf2127_h
#include "i2c.h"
/** ######################################################################
Driver for the PCF2127T RTC
CONSUMPTION: standby X µA, measure X µA
Details:
######################################################################## */
class PCF2127
{
private:
/** ######### Register-Map ################################################################# */
static const uint8_t I2C_ADDRESS =(0x51);
static const uint8_t REG_CONTROL1 =(0x00);
static const uint8_t MSK_CONTROL1_EXTTST =(B10000000); // test mode? NO
static const uint8_t MSK_CONTROL1_T =(B01000000); // unused
static const uint8_t MSK_CONTROL1_STOP =(B00100000);
static const uint8_t MSK_CONTROL1_TSF1 =(B00010000);
static const uint8_t MSK_CONTROL1_POROVRD =(B00001000);
static const uint8_t MSK_CONTROL1_12_24 =(B00000100);
static const uint8_t MSK_CONTROL1_MI =(B00000010);
static const uint8_t MSK_CONTROL1_SI =(B00000001);
static const uint8_t REG_CONTROL2 =(0x01);
static const uint8_t MSK_CONTROL2_MSF =(B10000000);
static const uint8_t MSK_CONTROL2_WDTF =(B01000000);
static const uint8_t MSK_CONTROL2_TSF2 =(B00100000);
static const uint8_t MSK_CONTROL2_AF =(B00010000);
static const uint8_t MSK_CONTROL2_CDTF =(B00001000);
static const uint8_t MSK_CONTROL2_TSIE =(B00000100);
static const uint8_t MSK_CONTROL2_AIE =(B00000010);
static const uint8_t MSK_CONTROL2_CDTIE =(B00000001);
static const uint8_t REG_CONTROL3 =(0x02);
static const uint8_t MSK_CONTROL3_PWRMNG =(B11100000);
static const uint8_t MSK_CONTROL3_BTSE =(B00010000);
static const uint8_t MSK_CONTROL3_BF =(B00001000);
static const uint8_t MSK_CONTROL3_BLF =(B00000100);
static const uint8_t MSK_CONTROL3_BIE =(B00000010);
static const uint8_t MSK_CONTROL3_BLIE =(B00000001);
static const uint8_t REG_SECONDS =(0x03); // 7bit
static const uint8_t REG_MINUTES =(0x04); // 7bit
static const uint8_t REG_HOURS =(0x05); // 6bit
static const uint8_t REG_DAYS =(0x06); // 6bit
static const uint8_t REG_WEEKDAYS =(0x07); // 3bit
static const uint8_t REG_MONTH =(0x08); // 5bit
static const uint8_t REG_YEARS =(0x09); // 8bit
static const uint16_t VAL_YEAR_OFFSET =(2000);
static const uint8_t REG_SECOND_ALARM =(0x0A);
static const uint8_t REG_MINUTE_ALARM =(0x0B);
static const uint8_t REG_HOUR_ALARM =(0x0C);
static const uint8_t REG_DAY_ALARM =(0x0D);
static const uint8_t REG_WEEKDAY_ALARM =(0x0E);
static const uint8_t VAL_ENABLE_ALARM =(B10000000); // highest bit always for Enable!
static const uint8_t REG_CLOCKOUT_CTL =(0x0F);
static const uint8_t MSK_CLOCKOUT_TCR =(B11000000);
static const uint8_t MSK_CLOCKOUT_COF =(B00000111);
static const uint8_t REG_WATCHDOG_TIM_CTL =(0x10);
static const uint8_t MSK_WATCHDOG_WDCD =(B11000000);
static const uint8_t MSK_WATCHDOG_TITP =(B00100000);
static const uint8_t MSK_WATCHDOG_TF =(B00000011);
static const uint8_t REG_WATCHDOG_TIM_VAL =(0x11);
static const uint8_t REG_TIMESTP_CTL =(0x12);
static const uint8_t MSK_TIMESTP_TSM =(B10000000);
static const uint8_t MSK_TIMESTP_TSOFF =(B01000000);
static const uint8_t MSK_TIMESTP_1O16 =(B00011111);
static const uint8_t REG_SEC_TIMESTP =(0x13);
static const uint8_t REG_MIN_TIMESTP =(0x14);
static const uint8_t REG_HOUR_TIMESTP =(0x15);
static const uint8_t REG_DAY_TIMESTP =(0x16);
static const uint8_t REG_MON_TIMESTP =(0x17);
static const uint8_t REG_YEAR_TIMESTP =(0x18);
static const uint8_t REG_AGING_OFFSET =(0x19); // 4bit
static const uint8_t REG_RAM_ADDR_MSB =(0x1A); // 1bit / last
static const uint8_t REG_RAM_ADDR_LSB =(0x1B);
static const uint8_t REG_RAM_WRT_CMD =(0x1C);
static const uint8_t REG_RAM_RD_CMD =(0x1D);
uint8_t datetime[7];
/** ######### function definition ################################################################# */
public:
/**< TODO: do i need a constructor? */
PCF2127(void) : datetime({0,0,0,0,0,0})
{
};
inline uint8_t initialize()
{
if (i2c.probe(I2C_ADDRESS)==0) return 0;
uint8_t regPCF;
regPCF = 0;
regPCF &= !MSK_CONTROL1_EXTTST;
regPCF &= !MSK_CONTROL1_STOP;
regPCF &= !MSK_CONTROL1_TSF1;
regPCF &= !MSK_CONTROL1_POROVRD;
regPCF &= !MSK_CONTROL1_12_24;
regPCF &= !MSK_CONTROL1_MI;
regPCF &= !MSK_CONTROL1_SI;
i2c.writeByte(I2C_ADDRESS, REG_CONTROL1, regPCF);
regPCF = 0;
regPCF &= !MSK_CONTROL2_TSIE;
regPCF &= !MSK_CONTROL2_AIE;
regPCF &= !MSK_CONTROL2_CDTIE;
i2c.writeByte(I2C_ADDRESS, REG_CONTROL2, regPCF);
regPCF = 0;
regPCF |= MSK_CONTROL3_PWRMNG & B10100000; // direct switching and no low power detection
regPCF &= !MSK_CONTROL3_BTSE;
regPCF &= !MSK_CONTROL3_BIE;
regPCF &= !MSK_CONTROL3_BLIE;
i2c.writeByte(I2C_ADDRESS, REG_CONTROL3, regPCF);
setTemperaturePeriod(240);
return 1;
};
inline void clearInterrupt()
{
i2c.setRegister(I2C_ADDRESS, REG_CONTROL1, MSK_CONTROL1_TSF1, 0);
};
inline void setTemperaturePeriod(const uint8_t seconds=240)
{
uint8_t _value;
if (seconds > 160) _value = B00000000; // 240s
else if (seconds > 90) _value = B01000000; // 120s
else if (seconds > 45) _value = B10000000; // 60s
else _value = B11000000; // 30s
i2c.setRegister(I2C_ADDRESS, REG_CLOCKOUT_CTL, MSK_CLOCKOUT_TCR, _value);
};
void setClockOut(const uint16_t clock = 1)
{
uint8_t _value;
if (clock > 30000) _value = 000; // 32768
else if (clock > 16000) _value = 001; // 16384
else if (clock > 8000) _value = 010; // 8192
else if (clock > 4000) _value = 011; // 4096
else if (clock > 2000) _value = 100; // 2048
else if (clock > 1000) _value = 101; // 1024
else if (clock > 0) _value = 110; // PPS
else _value = 111; // disable
i2c.setRegister(I2C_ADDRESS, REG_CLOCKOUT_CTL, MSK_CLOCKOUT_COF, _value);
};
inline void setTime(const uint16_t YYYY, const uint8_t MM, const uint8_t W, const uint8_t DD, const uint8_t hh, const uint8_t mm, const uint8_t ss)
{
uint8_t decimal = 0, _value;
/// YEAR
uint16_t _ivalue = YYYY;
if (YYYY >= VAL_YEAR_OFFSET) _ivalue -= VAL_YEAR_OFFSET;
if (_ivalue > 99) return;
decimal = 0;
while (_ivalue > 9)
{
_ivalue -= 10;
decimal += 1;
}
datetime[6] = _ivalue | ((decimal)<<4);
/// MONTH
if (MM > 12) return;
_value = MM;
decimal = 0;
while (_value > 9)
{
_value -= 10;
decimal++;
}
datetime[5] = _value | (decimal)<<4;
/// WEEKDAYS
if (W > 6) return;
datetime[4] = W;
/// DAY
if (DD > 32) return;
_value = DD;
decimal = 0;
while (_value > 9)
{
_value -= 10;
decimal++;
}
datetime[3] = _value | (decimal)<<4;
/// HOURS
if (hh > 24) return;
_value = hh;
decimal = 0;
while (_value > 9)
{
_value -= 10;
decimal++;
}
datetime[2] = _value | (decimal)<<4;
/// MINUTES
if (mm > 60) return;
_value = mm;
decimal = 0;
while (_value > 9)
{
_value -= 10;
decimal++;
}
datetime[1] = _value | (decimal)<<4;
/// SECONDS
if (ss > 60) return;
_value = ss;
decimal = 0;
while (_value > 9)
{
_value -= 10;
decimal++;
}
datetime[0] = _value | (decimal)<<4;
i2c.setRegister(I2C_ADDRESS, REG_CONTROL1, MSK_CONTROL1_STOP, MSK_CONTROL1_STOP);
i2c.write(I2C_ADDRESS, REG_SECONDS, datetime, 7);
i2c.setRegister(I2C_ADDRESS, REG_CONTROL1, MSK_CONTROL1_STOP, 0);
};
inline void readTime()
{
i2c.read(I2C_ADDRESS, REG_SECONDS, datetime, 7);
//uint8_t counter;
//counter = 0;
// while (counter<7)
for (uint8_t counter = 0; counter<7; counter++)
{
datetime[counter] = uint8_t(((datetime[counter]>>4) * 10) + (datetime[counter] & B00001111));
//counter++;
}
};
inline void setSeconds(const uint8_t unit = 0)
{
// TODO:
};
inline void getSeconds(uint8_t& unit)
{
unit = datetime[0];
};
inline void setMinutes(const uint8_t unit = 0)
{
// TODO:
};
inline void getMinutes(uint8_t& unit)
{
unit = datetime[1];
};
inline void setHours(const uint8_t unit = 0)
{
// TODO
};
inline void getHours(uint8_t& unit)
{
unit = datetime[2];
};
inline void setDays(const uint8_t unit = 0)
{
// TODO
};
inline void getDays(uint8_t& unit)
{
unit = datetime[3];
}
inline void setWeekdays(const uint8_t unit = 0)
{
};
inline void getWeekdays(uint8_t& unit)
{
unit = datetime[4];
};
inline void setMonth(const uint8_t unit = 0)
{
// TODO:
};
inline void getMonth(uint8_t& unit)
{
unit = datetime[5];
};
inline void setYears(const uint8_t unit = 0)
{
// TODO
};
inline void getYears(uint16_t& unit)
{
unit = VAL_YEAR_OFFSET + uint16_t(datetime[6]);
};
/*
TODO:
static const uint8_t REG_SECONDS 0x03 // 7bit
static const uint8_t REG_MINUTES 0x04 // 7bit
static const uint8_t REG_HOURS 0x05 // 6bit
static const uint8_t REG_DAYS 0x06 // 6bit
static const uint8_t REG_WEEKDAYS 0x07 // 3bit
static const uint8_t REG_MONTH 0x08 // 5bit
static const uint8_t REG_YEARS 0x09 // 8bit
static const uint8_t REG_SECOND_ALARM 0x0A
static const uint8_t REG_MINUTE_ALARM 0x0B
static const uint8_t REG_HOUR_ALARM 0x0C
static const uint8_t REG_DAY_ALARM 0x0D
static const uint8_t REG_WEEKDAY_ALARM 0x0E
static const uint8_t VAL_ENABLE_ALARM (B10000000) // highest bit always for Enable!
static const uint8_t REG_WATCHDOG_TIM_CTL 0x10
static const uint8_t MSK_WATCHDOG_WDCD (B11000000)
static const uint8_t MSK_WATCHDOG_TITP (B00100000)
static const uint8_t MSK_WATCHDOG_TF (B00000011)
static const uint8_t REG_WATCHDOG_TIM_VAL 0x11
static const uint8_t REG_AGING_OFFSET 0x19 // 4bit
static const uint8_t REG_RAM_ADDR_MSB 0x1A // 1bit / last
static const uint8_t REG_RAM_ADDR_LSB 0x1B
static const uint8_t REG_RAM_WRT_CMD 0x1C
static const uint8_t REG_RAM_RD_CMD 0x1D
*/
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//PCF2127 pcf2127 = PCF2127();
#endif

@ -0,0 +1,53 @@
#ifndef i2c_preset_h
#define i2c_preset_h
#include "i2c.h"
#include "i2c_Sensor.h"
/** ######################################################################
Driver for the preset-Sensor
CONSUMPTION: standby X µA, measure X µA
Details:
######################################################################## */
class PRESET : public i2cSensor
{
private:
/** ######### Register-Map ################################################################# */
static const uint8_t I2C_ADDRESS =(0x60);
/** ######### function definition ################################################################# */
public:
/**< TODO: do i need a constructor? */
PRESET(void)
{
//_address = I2C_ADDRESS;
};
/**< gives values */
void getMeasurement(uint8_t buffer[])
{
};
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//PRESET preset = PRESET();
#endif

@ -0,0 +1,213 @@
#ifndef i2c_SI7021_h
#define i2c_SI7021_h
#include "i2c.h"
#include "i2c_Sensor.h"
/** ######################################################################
Driver for the SI7021-Sensor
CONSUMPTION: sleep 0.6µA, measure 120-180µA, 3.1mA Heater
MEASUREMENT: 12ms for 12bit RH, 11ms for 14bit Temp --> measurement time is combination of these two
ACCURACY in Main Range 0.4°C, 3% RH
With every humiditymeasurement there is an automatical temperaturmeasurement (just read it afterwards)
You have to trigger the Measurement yourself --> requestHumidity,
######################################################################## */
class SI7021 : public i2cSensor, public manualSensor
{
private:
/** ######### Register-Map ################################################################# */
static const uint8_t I2C_ADDRESS =(0x40);
static const uint8_t CMD_MEASURE_HUMIDITY_HOLD =(0xE5); // Hold: clock stretching
static const uint8_t CMD_MEASURE_HUMIDITY_NO_HOLD =(0xF5); // No Hold: Not Acknowledging read requests
static const uint8_t CMD_MEASURE_TEMPERATURE_HOLD =(0xE3); // performs an extra measurement
static const uint8_t CMD_MEASURE_TEMPERATURE_NO_HOLD =(0xF3);
static const uint8_t CMD_READ_PREVIOUS_TEMPERATURE =(0xE0); // performs NO extra measurement,
static const uint8_t CMD_RESET =(0xFE);
static const uint8_t CMD_WRITE_REG1 =(0xE6);
static const uint8_t CMD_READ_REG1 =(0xE7);
static const uint8_t MASK_RESOLUTION =(B10000001);
static const uint8_t VAL_RESOLUTION_H12_T14 =(0x00); // takes 10 -12 ms
static const uint8_t VAL_RESOLUTION_H11_T11 =(0x01); // takes 5.8- 7 ms
static const uint8_t VAL_RESOLUTION_H10_T13 =(0x80); // takes 3.7-4.5 ms
static const uint8_t VAL_RESOLUTION_H08_T12 =(0x81); // takes 2.6-3.1 ms
static const uint8_t MASK_LOW_VOLTAGE =(0x40); // just for reading/checking
static const uint8_t MASK_ENABLE_HEATER =(0x04); // for dew-point-measurement
/** ######### function definition ################################################################# */
protected: // TODO: why protected and not private?
/**< helperfunction */
uint16_t readValue(const uint8_t registerAdd)
{
uint16_t _ret;
Wire.beginTransmission(I2C_ADDRESS);
Wire.write(registerAdd);
Wire.endTransmission(); // difference to normal read
Wire.beginTransmission(I2C_ADDRESS); // difference to normal read
Wire.requestFrom(I2C_ADDRESS, (uint8_t) 2);
_ret = (Wire.read() << 8 );
_ret |= Wire.read();
Wire.endTransmission();
return _ret;
};
public:
SI7021(void)
{
};
/**< resolutions for temp and humidity is combined, influences the duration */
inline void setResolution(const uint8_t stepH=4)
{
uint8_t _value;
if (stepH == 1) _value = VAL_RESOLUTION_H08_T12;
else if (stepH == 2) _value = VAL_RESOLUTION_H10_T13;
else if (stepH == 3) _value = VAL_RESOLUTION_H11_T11;
else _value = VAL_RESOLUTION_H12_T14; // takes about 12ms
i2c.setRegister(I2C_ADDRESS, CMD_WRITE_REG1, MASK_RESOLUTION, _value);
};
/**< for dew-point measurements, takes 3.1mA */
inline void setHeater(const uint8_t enable=1)
{
uint8_t _value;
if (enable) _value = 255;
else _value = 0;
i2c.setRegister(I2C_ADDRESS, CMD_WRITE_REG1, MASK_ENABLE_HEATER, _value);
};
/**< no function */
inline void setEnabled(const uint8_t enable=1)
{
};
/**< softwarereset */
inline void reset(void)
{
i2c.writeCMD(I2C_ADDRESS, CMD_RESET);
};
/**< set standardvalues */
inline uint8_t initialize()
{
if (i2c.probe(I2C_ADDRESS)==0) return 0;
setHeater(0);
setResolution(4);
triggerMeasurement(); // Manual Mode: Request and Read
return 1;
};
/**< there is also a temperaturemeasurement taken */
void triggerMeasurement()
{
i2c.writeCMD(I2C_ADDRESS, CMD_MEASURE_HUMIDITY_HOLD);
};
/**< check for new data, return 1 when Measurement is ready */
inline uint8_t checkMeasurement(void)
{
/**< TODO: Implement */
return 1; // Measurement finished
};
/**< wait for new data*/
inline uint8_t awaitMeasurement(void)
{
/**< TODO: Implement */
return 1; // Measurement finished
};
/**< inefficient way to get a value */
float readHumidity(void)
{
float _rh;
int32_t _rawHumi;
_rawHumi = readValue(CMD_MEASURE_HUMIDITY_HOLD);
_rh = (_rawHumi*125.0/65536) - 6;
return _rh;
};
inline void getHumidity(float& rh) // pass a reference
{
int32_t _rawHumi;
_rawHumi = readValue(CMD_MEASURE_HUMIDITY_HOLD);
rh = (_rawHumi*125.0/65536) - 6;
};
/**< standardcall */
inline void getMeasurement(float& rh)
{
getHumidity(rh);
}
/**< inefficient way to get a value */
float readTemperature(void)
{
float _celsius;
int32_t _rawTemp;
_rawTemp = readValue(CMD_READ_PREVIOUS_TEMPERATURE);
_celsius = (_rawTemp*175.72/65536) - 46.85;
return _celsius;
};
/**< there is an extra measurement triggered */
void getTemperature(float& celsius) // pass a reference
{
int32_t _rawTemp;
_rawTemp = readValue(CMD_READ_PREVIOUS_TEMPERATURE);
celsius = (_rawTemp*175.72/65536) - 46.85;
};
/**< not very usefull */
void requestTemperature()
{
i2c.writeCMD(I2C_ADDRESS, CMD_MEASURE_TEMPERATURE_HOLD);
};
/**< inefficient way to get a value */
float readTemperatureReq(void)
{
float _celsius;
int32_t _rawTemp;
_rawTemp = readValue(CMD_MEASURE_TEMPERATURE_HOLD);
_celsius = (_rawTemp*175.72/65536) - 46.85;
return _celsius;
};
/**< there is an extra measurement triggered */
void getTemperatureReq(float& celsius) // pass a reference
{
int32_t _rawTemp;
_rawTemp = readValue(CMD_MEASURE_TEMPERATURE_HOLD);
celsius = (_rawTemp*175.72/65536) - 46.85;
};
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//PRESET preset = PRESET();
#endif

@ -0,0 +1,60 @@
#ifndef i2c_interface_h
#define i2c_interface_h
/**< Abstract Class as Interface for sensor-libs */
/**< with basic functions that have to be implemented */
class i2cSensor
{
public:
/**< TODO: make virtual functions private? how to inherit of this? */
/**< TODO: constructur is not usefull? */
/**< TODO: Try const functions */
/**< TODO: new functions: wait for value, check for new value */
/**< declaring prototypes */
virtual void setEnabled(const uint8_t enable=1) = 0; // Enable Sensor or set it to Standby (1 or 0)
virtual void reset(void) = 0; // trigger a software-reboot of the sensor
virtual uint8_t initialize(void) = 0; // set up the sensor for basic operation, IF found at address
//uint8_t init(void) {initialize();}; // short form of the function above
/**< check for new data, return 1 when Measurement is ready */
virtual uint8_t checkMeasurement(void) = 0;
/**< wait (and check) for new data in a busy-loop, TODO: give functionpointer to sleepfunction */
virtual uint8_t awaitMeasurement(void) = 0;
/**< new getValue */
//virtual void getMeasurement(int16_t xyz_raw[])
/**< TODO: solveable with anonymous (void) pointers or similar reference */
//virtual void getValue(uint8_t buffer[]) = 0; // get the main values the sensor was made for (barometer gives pressure)
protected:
i2cSensor() {};
//~i2cSensor() {}; // makes code larger and is never used in the typical case
// instance gets control over
//uint8_t _address;
private:
// instance has no control over these
i2cSensor(const i2cSensor&); // declaration only for copy constructor
i2cSensor& operator=(const i2cSensor&); // declaration only for copy assignment --> make it uncopyable
};
class manualSensor
{
public:
/**< only used when in manual/standby mode */
virtual void triggerMeasurement(void) = 0;
};
#endif

@ -0,0 +1,303 @@
#ifndef i2c_TCS3772_h
#define i2c_TCS3772_h
#include "i2c.h"
#include "i2c_Sensor.h"
/** ######################################################################
Driver for the TCS3772-Sensor
CONSUMPTION: sleep 4.5µA, wait 65µA, measure 230-330µA
possible gains: 4 (3.8 .. 4.2), 16 (15 .. 16.8), 60 (58 .. 63)
######################################################################## */
class TCS3772 : private i2cSensor
{
private:
/** ######### Register-Map ################################################################# */
static const uint8_t I2C_ADDRESS =(0x29);
// Keept Out: Proximity Feature, Interrupts,
static const uint8_t CMD_REPEAT =(B10000000);
static const uint8_t CMD_INCREMENT =(B10100000);
static const uint8_t CMD_SPECIAL =(B11100000);
static const uint8_t REG_ENABLE =(0x00);
static const uint8_t MASK_PON =(bit(0)); // POWER ON
static const uint8_t VAL_PWR_ON =(0x01);
static const uint8_t VAL_PWR_OFF =(0x00);
static const uint8_t MASK_AEN =(bit(1)); // RGBC-Sensor Enable
static const uint8_t MASK_WEN =(bit(3)); // WAIT Enable
static const uint8_t REG_ATIME =(0x01); // Integration time in 2.4ms Steps
static const uint8_t VAL_MIN =(0xFF); // 2.4ms
static const uint8_t VAL_MAX =(0x00); // 614ms
static const uint8_t REG_WTIME =(0x03); // WLONG=0 2.4ms Steps, WLONG=1 28.8ms Steps
//// INTERRUPT THRESHOLD, ....
static const uint8_t REG_CONFIG =(0x0D);
static const uint8_t MASK_WLONG =(bit(1)); // Factor 12x for WTIME
static const uint8_t REG_CONTROL =(0x0F);
static const uint8_t MASK_AGAIN =(0x03);
static const uint8_t VAL_AGAIN_01 =(0x00);
static const uint8_t VAL_AGAIN_04 =(0x01);
static const uint8_t VAL_AGAIN_16 =(0x02);
static const uint8_t VAL_AGAIN_60 =(0x03);
static const uint8_t REG_ID =(0x12);
static const uint8_t VAL_DEVICE_ID_A =(0x48); // TCS37721 & TCS37725
static const uint8_t VAL_DEVICE_ID_B =(0x49); // TCS37723 & TCS37727
static const uint8_t REG_STATUS =(0x13);
static const uint8_t MASK_AVALID =(bit(0)); // cylce completed since AEN=1
static const uint8_t REG_CLEAR_DATAL =(0x14);
static const uint8_t REG_CLEAR_DATAH =(0x15);
static const uint8_t REG_RED_DATAL =(0x16);
static const uint8_t REG_RED_DATAH =(0x17);
static const uint8_t REG_GREEN_DATAL =(0x18);
static const uint8_t REG_GREEN_DATAH =(0x19);
static const uint8_t REG_BLUE_DATAL =(0x1A);
static const uint8_t REG_BLUE_DATAH =(0x1B);
/** ######### function definition ################################################################# */
inline uint16_t static const ATIME_TO_MSEC(const uint8_t atime)
{
return (2.4*(256-atime));
}; // TODO: WB
inline uint8_t static const MSEC_TO_ATIME(const uint16_t msec)
{
return (256 - (msec/2.4));
};
inline uint8_t static const FACT_TO_ATIME(const uint8_t factor)
{
return (256 - factor);
}; // TODO: WB
inline uint8_t MSEC_TO_ATIMELONG(const uint16_t msec)
{
return (256 - (msec/28.8));
}; // TODO: WB
public:
TCS3772(void) // TODO: WB
{
};
inline void setEnabled(const uint8_t enable = 1)
{
uint8_t _value;
if (enable) _value = VAL_PWR_ON | MASK_AEN;
else _value = 0;
i2c.setRegister(I2C_ADDRESS, REG_ENABLE | CMD_INCREMENT, MASK_AEN | MASK_PON, _value);
};
inline void reset() {};
inline void setWaitTime(const uint16_t wait = 0)
{
uint8_t _valueA, _valueB, _valueC;
if (wait > 7372)
{
_valueA = 255;
_valueB = 255;
_valueC = VAL_MAX;
}
else if (wait > 614)
{
_valueA = 255;
_valueB = 255;
_valueC = MSEC_TO_ATIMELONG(wait);
}
else if (wait < 4)
{
_valueA = 0;
_valueB = 0;
_valueC = VAL_MIN;
}
else
{
_valueA = 255;
_valueB = 0;
_valueC = MSEC_TO_ATIME(wait);
}
i2c.setRegister(I2C_ADDRESS, REG_ENABLE | CMD_INCREMENT, MASK_WEN, _valueA);
i2c.setRegister(I2C_ADDRESS, REG_CONFIG | CMD_INCREMENT, MASK_WLONG, _valueB);
i2c.writeByte( I2C_ADDRESS, REG_WTIME | CMD_INCREMENT, _valueC);
};
inline void setATime(const uint16_t integrationtime_ms)
{
uint8_t _value;
if (integrationtime_ms > 614) _value = VAL_MAX;
else if (integrationtime_ms < 4) _value = VAL_MIN;
else _value = (uint8_t) MSEC_TO_ATIME(integrationtime_ms);
i2c.writeByte( I2C_ADDRESS, REG_ATIME | CMD_INCREMENT, _value);
};
uint8_t setAGain(const uint8_t gain)
{
uint8_t _valueA, _valueB;
/**< TODO: rewrite with local Vars and only 1 writeCall at the end */
if (gain < 4)
{
_valueA = VAL_AGAIN_01;
_valueB = 1;
}
else if (gain < 16)
{
_valueA = VAL_AGAIN_04;
_valueB = 4;
}
else if (gain < 60)
{
_valueA = VAL_AGAIN_16;
_valueB = 16;
}
else
{
_valueA = VAL_AGAIN_60;
_valueB = 60;
}
i2c.setRegister(I2C_ADDRESS, REG_CONTROL | CMD_INCREMENT, MASK_AGAIN, _valueA);
return _valueB;
};
/**< gives back the total gain when values are in good range, otherwise return 0! */
uint8_t autoGain(const uint16_t val_clear)
{
/**< TODO: something is wrong here! switching integrationtime shows no faster measurement?!? */
static uint16_t val_last;
// val_clear between 0 .. 65k
static const uint16_t MARGIN_LOW =(5000);
static const uint16_t MARGIN_HIGH =(0xFFFF - MARGIN_LOW);
// val_gain: 0=G1, 1=G4, 2=G16, 3=G60
// val_time: 0=i64, 1=i128, 2=i256
if ((val_clear != val_last) || (val_clear == 0xFFFF))
{
static uint8_t val_gain, val_time, gain;
val_last = val_clear;
if (val_clear < MARGIN_LOW)
{
if (val_gain<3) // first try to raise gain, before raising integrationtime
{
val_gain++;
gain = 1<<(2*val_gain);
gain = setAGain(gain);
return 0;
}
else if (val_time<2)
{
val_time++;
uint16_t time;
time = 1<<(val_time);
setATime(2.4*64*time);
return 0;
}
}
else if (val_clear > MARGIN_HIGH)
{
if (val_time>0)
{
val_time--;
uint16_t time;
time = 1<<(val_time);
setATime(2.4*64*time);
return 0;
}
else if (val_gain>0)
{
val_gain--;
gain = 1<<(2*val_gain);
gain = setAGain(gain);
return 0;
};
}
return (gain*(1<<val_time));
}
return 0;
/* OLD CODE - doesnt wait for good measurement-range
if (val_clear < MARGIN_LOW) { if (val_gain<3) { val_gain++; } else if ( val_time < 2) { val_time++; }}
else if (val_clear > MARGIN_HIGH) { if (val_time>0) { val_time--; } else if ( val_gain > 0) { val_gain--; }}
}
uint16_t time;
time = 1<<(6+val_time);
tcs_setATime(2.4*time);
gain = 1<<(2*val_gain);
gain = tcs_setAGain(gain);
return (gain*(1<<val_time));
*/
};
inline uint8_t initialize()
{
if (i2c.probe(I2C_ADDRESS)==0) return 0;
byte _sensor_id;
_sensor_id = i2c.readByte(I2C_ADDRESS, REG_ID | CMD_INCREMENT);
setEnabled(1);
setATime(2.4*64);
setAGain(1);
setWaitTime(0);
if (_sensor_id == VAL_DEVICE_ID_A) return 1;
else if (_sensor_id == VAL_DEVICE_ID_B) return 1;
else return 0;
}
/**< check for new data, return 1 when Measurement is ready */
inline uint8_t checkMeasurement(void)
{
/**< TODO: Implement */
return 1; // Measurement finished
};
/**< wait for new data*/
inline uint8_t awaitMeasurement(void)
{
/**< TODO: Implement */
return 1; // Measurement finished
};
void getMeasurement(uint16_t value_crgb[])
{
uint8_t _content[8];
i2c.read(I2C_ADDRESS, REG_CLEAR_DATAL | CMD_INCREMENT, _content, 8);
value_crgb[0] = (_content[1]<<8) + _content[0];
value_crgb[1] = (_content[3]<<8) + _content[2];
value_crgb[2] = (_content[5]<<8) + _content[4];
value_crgb[3] = (_content[7]<<8) + _content[6];
}
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//PRESET preset = PRESET();
#endif

@ -0,0 +1,643 @@
#ifndef spi_rfm95_h
#define spi_rfm95_h
#include <SPI.h>
/** ######################################################################
Driver for the RFM95W LongRange Tranceiver (Samtech sx1276)
CONSUMPTION:
sleep 0.2-1 µA
idle 1.5 µA
standby 1.8 µA
RX 12 mA
TX 20 (7dBm) - 120mA (20dBm)
Details:
TODO:
- uses digitalWrite-Stuff
-
######################################################################## */
class RFM95
{
#define RFM_FIFO_SIZE 256
#define RFM_PACKET_SIZE_MAX 128
#define RFM_FOSC 32000000.0
#define RFM_FSTEP (RFM_FOSC / 524288)
#define RFM_FINV (524288.0 / RFM_FOSC)
#define RFM_CS 10 // PIN
#define SPI_WRITE(a) (a|0x80)
#define SPI_READ(a) (a&0x7F)
/** ######### Register-Map ################################################################# */
#define REG_FIFO 0x00 // cleared when in SleepMode
#define REG_OPMODE 0x01
#define MSK_OPMODE_LORA (B10000000) // settable only in sleep mode
#define MSK_OPMODE_ACCSHARED (B01000000)
#define MSK_OPMODE_LOFREQ (B00001000)
#define MSK_OPMODE_MODE (B00000111)
#define VAL_MODE_SLEEP 0x00 // only mode to allow switching FSK/OOK/LORA
#define VAL_MODE_STANDBY 0x01
#define VAL_MODE_FSTX 0x02
#define VAL_MODE_TX 0x03
#define VAL_MODE_FSRX 0x04
#define VAL_MODE_RX_CONT 0x05
#define VAL_MODE_RX_SINGLE 0x06
#define VAL_MODE_CAD 0x07
#define REG_REGFRFMSB 0x06 // RF Carrier Freq --> access in sleep/stdby
#define REG_REGFRFMID 0x07
#define REG_REGFRFLSB 0x08
#define REG_PA_CONFIG 0x09 // PA selection, output power control
#define MSK_PA_SELECT (B10000000) // 0:RFO, 1:BOOST
#define MSK_PA_MAX_POWER (B01110000) // pmax = 10.8+0.6*REG dBm
#define MSK_PA_OUT_POWER (B00001111) // pout = pmax - (15-REG) OR (boost) pout = 2 + REG
#define REG_PA_RAMP 0x0A // low phase noise
#define MSK_PA_RAMP (B00001111)
#define REG_OCP 0x0B // Over current Protection
#define MSK_OCP_ON (B00100000)
#define MSK_OCP_TRIM (B00011111) // max 240mA, default: 100mA
#define REG_LNA 0x0C // LNA settings
#define MSK_LNA_GAIN (B11100000) // possible: 1-6 from 0 to -48dB
#define MSK_LNA_BOOST_LF (B00011000) // do not change
#define MSK_LNA_BOOST_HF (B00000011)
#define VAL_LNA_BOOST_HF_ON (B00000011) // boost 150%
#define VAL_LNA_BOOST_HF_DE (B00000000)
#define REG_FIFO_ADDR_PTR 0x0D // write position to read/write (autoinc)
#define REG_FIFO_TX_BASE_AD 0x0E // startup: 0x80
#define REG_FIFO_RX_BASE_AD 0x0F // startup: 0x00
#define REG_FIFO_RX_CURRENT_ADDR 0x10 // start of last packet received
#define REG_IRQ_FLAGS_MASK 0x11
#define REG_IRQ_FLAGS 0x12
#define MSK_IRQ_RX_TIMEOUT (B10000000)
#define MSK_IRQ_RX_DONE (B01000000)
#define MSK_IRQ_PAYLOAD_CRC_ERR (B00100000)
#define MSK_IRQ_VALID_HEADER (B00010000)
#define MSK_IRQ_TX_DONE (B00001000)
#define MSK_IRQ_CAD_DONE (B00000100)
#define MSK_IRQ_FHSS_CHANGE (B00000010)
#define MSK_IRQ_CAD_DETECTED (B00000001)
#define REG_RX_NB_BYTES 0x13 // successful receive will write this bytecount
#define REG_RX_HEADER_CNT_MSB 0x14
#define REG_RX_HEADER_CNT_LSB 0x15
#define REG_RX_PACKET_CNT_MSB 0x16
#define REG_RX_PACKET_CNT_LSB 0x17
#define REG_MODEM_STAT 0x18
#define MSK_MODEM_RX_CODINGRATE (B11100000)
#define MSK_MODEM_STATUS (B00011111)
#define MSK_MODEM_STATUS_CLEAR (B00010000)
#define MSK_MODEM_STATUS_HDRVAL (B00001000)
#define MSK_MODEM_STATUS_RXON (B00000100)
#define MSK_MODEM_STATUS_SYNC (B00000010)
#define MSK_MODEM_STATUS_SIGDET (B00000001)
#define REG_PKT_SNR_VALUE 0x19 // last Packets SNR dB = int8_REG/4
#define REG_PKT_RSSI_VALUE 0x1A // last Packets RSSI dBm = REG - 127
#define REG_RSSI_VALUE 0x1B // current RSSI dBm = REG - 127
#define REG_HOP_CHANNEL 0x1C
#define MSK_HOP_PLL_TIMEOUT (B10000000)
#define MSK_HOP_RX_CRCON (B01000000)
#define MSK_HOP_FHSS_CHANNEL (B00111111)
#define REG_MODEM_CONFIG1 0x1D ///
#define MSK_MODEM_BW (B11110000)
#define VAL_MODEM_BW008 (B00000000) // in kHz
#define VAL_MODEM_BW010 (B00010000) // in kHz
#define VAL_MODEM_BW016 (B00100000) // in kHz
#define VAL_MODEM_BW021 (B00110000) // in kHz
#define VAL_MODEM_BW031 (B01000000) // in kHz
#define VAL_MODEM_BW042 (B01010000) // in kHz
#define VAL_MODEM_BW063 (B01100000) // in kHz
#define VAL_MODEM_BW125 (B01110000) // in kHz
#define VAL_MODEM_BW250 (B10000000) // in kHz
#define VAL_MODEM_BW500 (B10010000) // in kHz
#define MSK_MODEM_CR (B00001110)
#define VAL_MODEM_CR1 (B00000010) // Coding Rate 4/5
#define VAL_MODEM_CR2 (B00000100) // Coding Rate 4/6
#define VAL_MODEM_CR3 (B00000110) // Coding Rate 4/7
#define VAL_MODEM_CR4 (B00001000) // Coding Rate 4/8
#define MSK_MODEM_IMPLICITHDR (B00000001) // implicit header stores length
#define REG_MODEM_CONFIG2 0x1E
#define MSK_MODEM_SF (B11110000)
#define VAL_MODEM_SF06 (B01100000) // 64 chips/symbol --> SNR -5 dB
#define VAL_MODEM_SF07 (B01110000) // 128 chips/symbol --> SNR -7.5 dB
#define VAL_MODEM_SF08 (B10000000) // 256 chips/symbol --> SNR -10 dB
#define VAL_MODEM_SF09 (B10010000) // 512 chips/symbol --> SNR -12.5 dB
#define VAL_MODEM_SF10 (B10100000) // 1024 chips/symbol --> SNR -15 dB
#define VAL_MODEM_SF11 (B10110000) // 2048 chips/symbol --> SNR -17.5 dB
#define VAL_MODEM_SF12 (B11000000) // 4096 chips/symbol --> SNR -20 dB
#define MSK_TX_CONTINOUOS (B00001000)
#define MSK_RX_PAYLOAD_CRC_ON (B00000100)
#define MSK_SYMB_TIMEOUTMSB (B00000011)
#define REG_SYMB_TIMEOUTLSB 0x1F // number of symbols; timeout = REG * Ts
#define REG_PREAMBLE_MSB 0x20 // Length = REG + 4.25 Symbols
#define REG_PREAMBLE_LSB 0x21
#define REG_PAYLOAD_LENGTH 0x22 // size of bytes to be transmitted
#define REG_MAX_PAYLOAD_LENGTH 0x23
#define REG_HOP_PERIOD 0x24 // 0: disable
#define REG_FIFO_RX_BYTE_ADDR 0x25 // Addr of last byte written
#define REG_MODEM_CONFIG3 0x26
#define MSK_LOW_DATARATE_OPTI (B00001000) // Mandatory when symbollength > 16ms
#define MSK_AGC_AUTO_ON (B00000100)
/// 0x27 - 3F not for LoRa
#define REG_DIO_MAPPING_1 0x40
#define MSK_DIO0_MAPPING (B11000000)
#define MSK_DIO1_MAPPING (B00110000)
#define MSK_DIO2_MAPPING (B00001100)
#define MSK_DIO3_MAPPING (B00000011)
#define REG_DIO_MAPPING_2 0x41
#define MSK_DIO4_MAPPING (B11000000)
#define MSK_DIO5_MAPPING (B00110000)
#define MSK_DIO_MAP_PREAMB_DET (B00000001)
#define REG_VERSION 0x42
#define VAL_V1B 0x12 // has errors --> extra document (errata)
#define REG_TCXO 0x4B // TCXO or XTAL input
#define MSK_TCXO_ON (B00010000)
#define REG_PA_DAC 0x4D // Power setting of PA
#define MSK_PA_DAC (B00000111)
#define VAL_PA_DAC_DEFAULT 0x04
#define VAL_PA_DAC_20DBM 0x07 // when outputpower = 111
#define REG_FORMER_TEMP 0x5B // -1°C per LSB
#define REG_AGC_REF 0x61
#define MSK_AGC_REF_LEVEL (B00111111) // def=0x19
#define REG_AGC_THRESH1 0x62
#define MSK_AGC_STEP1 0x0F
#define REG_AGC_THRESH2 0x63
#define MSK_AGC_STEP2 0xF0
#define MSK_AGC_STEP3 0x0F
#define REG_AGC_THRESH3 0x64
#define MSK_AGC_STEP4 0xF0
#define MSK_AGC_STEP5 0x0F
#define REG_PLL 0x70
#define MSK_PLL_BW (B11000000)
#define VAL_PLL_BW075KHZ (B00000000)
#define VAL_PLL_BW150KHZ (B01000000)
#define VAL_PLL_BW225KHZ (B10000000)
#define VAL_PLL_BW300KHZ (B11000000)
/// static configuration:
// CRCon
// Variable packet: preamble B, SyncWord/NW-ID 1B, length 1B, addr 1B, Data , CRC 2B
// AGC: automatic gain control
private:
uint8_t _filterBadCRC;
uint8_t _mode;
uint8_t _idleState, _receiveContinouos, _awaitAck;
public:
/** ######### SPI ################################################################# */
void spiExchange(uint8_t regExchange, uint8_t buffer[], uint8_t length=1) // uint8_t CS,
{
if (!length) return;
digitalWrite(RFM_CS, LOW);
SPI.transfer(regExchange);
for (uint8_t counter=0; counter < length; counter++)
{
buffer[counter] = SPI.transfer(buffer[counter]);
};
// todo: better while (length--) *buffer++ = SPI.transfer(*buffer);
digitalWrite(RFM_CS, HIGH);
};
uint8_t spiRead(uint8_t regValue)
{
digitalWrite(RFM_CS, LOW);
SPI.transfer(SPI_READ(regValue));
uint8_t _value = SPI.transfer(0);
digitalWrite(RFM_CS, HIGH);
return _value;
};
void spiWrite(uint8_t regValue, uint8_t value = 0)
{
digitalWrite(RFM_CS, LOW);
SPI.transfer(SPI_WRITE(regValue));
SPI.transfer(value);
digitalWrite(RFM_CS, HIGH);
};
void setRegister(uint8_t regValue, uint8_t mask, uint8_t value = 0)
{
uint8_t _toWrite = spiRead(regValue);
_toWrite = (_toWrite & (!mask)) | value;
spiWrite(regValue, _toWrite);
};
/** ######### function definition ################################################################# */
RFM95(void): _filterBadCRC(0), _mode (0), _idleState(0), _receiveContinouos(0), _awaitAck(0)
{
pinMode(RFM_CS, OUTPUT);
SPI.begin();
SPI.setClockDivider(SPI_CLOCK_DIV8); // RFM95W can handle 10MHz
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);
};
uint8_t initialize()
{
if (spiRead(REG_VERSION) != VAL_V1B) return 1; // FAIL
/// activate sleep and lora
setEnabled(1);
delay(20);
setRegister(REG_OPMODE, MSK_OPMODE_LORA, 255); // setLoRaMode()
setIdleState(VAL_MODE_RX_CONT);
/// config FIFO
spiWrite(REG_FIFO_TX_BASE_AD, 0x00);
spiWrite(REG_FIFO_RX_BASE_AD, 0x00);
spiWrite(REG_FIFO_ADDR_PTR, 0x00);
spiWrite(REG_MAX_PAYLOAD_LENGTH, RFM_PACKET_SIZE_MAX); // longer packets trigger CRC-Error
/// config IRQs
// TODO
spiWrite(REG_IRQ_FLAGS_MASK, 255); // All ON
/// configure Message / Tranceiver
setFrequency(868000);
setPreambleLength(8);
setPMax(10);
setIMax(100);
setLNA();
filterCRC(0);
setBandwidth(100);
setRegister(REG_MODEM_CONFIG1, MSK_MODEM_CR, VAL_MODEM_CR1); // set CodingRate
setRegister(REG_MODEM_CONFIG1, MSK_MODEM_IMPLICITHDR, 0); // Explicit
setRegister(REG_MODEM_CONFIG2, MSK_MODEM_SF, VAL_MODEM_SF06); // set SpreadingFactor
// setRegister(REG_MODEM_CONFIG3, MSK_LOW_DATARATE_OPTI, 255); // Mandatory when symbollength > 16ms
setRegister(REG_MODEM_CONFIG2, MSK_TX_CONTINOUOS, 0); // single Packet sending
setRegister(REG_MODEM_CONFIG2, MSK_RX_PAYLOAD_CRC_ON,MSK_RX_PAYLOAD_CRC_ON); // CRC on
spiWrite(REG_HOP_PERIOD, 0); // 0: disable
setRegister(REG_TCXO, MSK_TCXO_ON, 0);
///
return 0; // all OK
};
/**< Go into powersaving standby */
void setEnabled(uint8_t enabled = 1)
{
if (enabled) _mode = VAL_MODE_SLEEP;
else _mode = VAL_MODE_STANDBY;
setRegister(REG_OPMODE, MSK_OPMODE_MODE, _mode);
};
void setPreambleLength(uint16_t length = 8)
{
spiWrite(REG_PREAMBLE_MSB, (length >> 8)&0xFF);
spiWrite(REG_PREAMBLE_LSB, (length&0xFF));
};
void setFrequency(uint32_t kHz = 868000)
{
kHz = uint32_t(RFM_FINV * float(kHz) * 1000.0);
spiWrite(REG_REGFRFLSB, kHz & 0xFF);
kHz = kHz >> 8;
spiWrite(REG_REGFRFMID, kHz & 0xFF);
kHz = kHz >> 8;
spiWrite(REG_REGFRFMSB, kHz & 0xFF);
};
uint32_t getFrequency()
{
uint32_t frf;
frf = spiRead(REG_REGFRFMSB);
frf = (frf<<8) | spiRead(REG_REGFRFMID);
frf = (frf<<8) | spiRead(REG_REGFRFLSB);
frf = uint32_t(RFM_FSTEP * float(frf) / 1000.0);
return frf;
};
void setIMax(uint8_t mA = 50) /// zero turns current protection off
{
if (mA > 120) mA = ((mA - 45) / 5);
else if (mA) mA = ((mA + 30) / 10);
else
{
setRegister(REG_OCP, MSK_OCP_ON, 0);
return;
}
setRegister(REG_OCP, MSK_OCP_ON, 255);
setRegister(REG_OCP, MSK_OCP_TRIM,mA);
};
void setPMax(uint8_t dBm = 10)
{
if (dBm > 20) dBm = 20;
uint8_t paBoost = 0;
uint8_t paMax = 0;
if (dBm > 14)
{
paBoost = 255;
paMax = 255;
dBm -= 5;
}
else if (dBm > 11) paMax = 255;
else dBm += 4;
setRegister(REG_PA_CONFIG,MSK_PA_SELECT, paBoost);
setRegister(REG_PA_CONFIG,MSK_PA_MAX_POWER,paMax);
setRegister(REG_PA_CONFIG,MSK_PA_OUT_POWER, dBm&MSK_PA_OUT_POWER);
if (dBm == 15) dBm = VAL_PA_DAC_20DBM; /// when outputpower = 111
else dBm = VAL_PA_DAC_DEFAULT;
setRegister(REG_PA_DAC, MSK_PA_DAC, dBm);
};
void setLNA()
{
setRegister(REG_LNA, MSK_LNA_GAIN, B00100000);
setRegister(REG_LNA, MSK_LNA_BOOST_HF, VAL_LNA_BOOST_HF_ON);
setRegister(REG_MODEM_CONFIG3, MSK_AGC_AUTO_ON, MSK_AGC_AUTO_ON);
};
void setBandwidth(uint16_t kHz = 500)
{
if (kHz > 300) kHz = VAL_MODEM_BW500;
else if (kHz > 200) kHz = VAL_MODEM_BW250;
else if (kHz > 100) kHz = VAL_MODEM_BW125;
else if (kHz > 50) kHz = VAL_MODEM_BW063;
else if (kHz > 35) kHz = VAL_MODEM_BW042;
else if (kHz > 25) kHz = VAL_MODEM_BW031;
else if (kHz > 18) kHz = VAL_MODEM_BW021;
else if (kHz > 13) kHz = VAL_MODEM_BW016;
else if (kHz > 9) kHz = VAL_MODEM_BW010;
else kHz = VAL_MODEM_BW008;
setRegister(REG_MODEM_CONFIG1, MSK_MODEM_BW, kHz);
};
void handleIRQ()
{
uint8_t flags = spiRead(REG_IRQ_FLAGS);
if (flags & MSK_IRQ_RX_TIMEOUT)
{
flags &= !MSK_IRQ_RX_TIMEOUT;
Serial.println(" RX_Timeout");
}
if (flags & MSK_IRQ_RX_DONE)
{
flags &= !MSK_IRQ_RX_DONE; /// valid header CRC --> set the RxDone interrupt
Serial.println(" RX_Done");
startIdleState();
}
if (flags & MSK_IRQ_PAYLOAD_CRC_ERR) ///
{
flags &= !MSK_IRQ_PAYLOAD_CRC_ERR;
Serial.println(" CRC_Error");
startIdleState();
}
if (flags & MSK_IRQ_VALID_HEADER)
{
flags &= !MSK_IRQ_VALID_HEADER;
Serial.println(" Valid HDR");
}
if (flags & MSK_IRQ_TX_DONE) /// Packet is out
{
flags &= !MSK_IRQ_TX_DONE;
Serial.println(" TX Done");
_mode = VAL_MODE_SLEEP;
startIdleState();
}
if (flags & MSK_IRQ_CAD_DONE)
{
flags &= !MSK_IRQ_CAD_DONE;
Serial.println(" CAD Done");
}
if (flags & MSK_IRQ_FHSS_CHANGE)
{
flags &= !MSK_IRQ_FHSS_CHANGE;
Serial.println(" FHSS Change");
}
if (flags & MSK_IRQ_CAD_DETECTED)
{
flags &= !MSK_IRQ_CAD_DETECTED;
Serial.println(" CAD Detected");
}
spiWrite(REG_IRQ_FLAGS, flags);
};
void setIdleState(uint8_t state = VAL_MODE_SLEEP)
{
_idleState = state;
};
void startIdleState()
{
if (_idleState == VAL_MODE_STANDBY) setEnabled(0);
else if (_idleState == VAL_MODE_SLEEP) setEnabled(1);
else if (_idleState == VAL_MODE_RX_SINGLE) receiveDataSingle();
else if (_idleState == VAL_MODE_RX_CONT) receiveDataCont();
};
// setMode()
// setRXTimeout()
uint8_t canSend()
{
if (_mode == VAL_MODE_TX) return 0;
else return 1;
};
void sendData()
{
if (_mode == VAL_MODE_TX) return; /// early bailout
setEnabled(0); // goto Standby
spiWrite(REG_FIFO_ADDR_PTR, 0); // Set FifoPtrAddr to FifoTxPtrBase.
spiWrite(REG_FIFO_TX_BASE_AD, 0x00); // ToDo: only here to test
Serial.println("Enter Send-Mode");
/// TODO
uint8_t length = 10;
spiWrite(REG_PAYLOAD_LENGTH, length); // Write PayloadLength bytes to the FIFO (RegFifo)
while (length)
{
spiWrite(REG_FIFO, length--); //put content TODO
}
setRegister(REG_DIO_MAPPING_1, MSK_DIO0_MAPPING, 0x00); // Packet Sent IRQ
/// TODO: activate IRQ
setRegister(REG_OPMODE, MSK_OPMODE_MODE, VAL_MODE_TX);
_mode = VAL_MODE_TX;
};
void filterCRC(uint8_t enable)
{
_filterBadCRC = enable && 1;
}; /// TODO: do something with it
void receiveDataSingle()
{
if ((_mode == VAL_MODE_RX_CONT) || (_mode == VAL_MODE_RX_SINGLE)) return;
setEnabled(0);
Serial.println("Enter Rec-Mode"); /// TODO: only test
spiWrite(REG_FIFO_ADDR_PTR, 0); // Set FifoAddrPtr to FifoRxBaseAddr.
//2 Static configuration register device can be written in either Sleep mode, Stand-by mode or FSRX mode.
//3 A single packet receive operation is initiated by selecting the operating mode RXSINGLE.
//4 The receiver will then await the reception of a valid preamble. Once received, the gain of the receive chain is set. Following the ensuing reception of a valid header, indicated by the ValidHeader interrupt in explicit mode. The packet reception process commences. Once the reception process is complete the RxDone interrupt is set. The radio then returns automatically to Stand-by mode to reduce power consumption.
//5 The receiver status register PayloadCrcError should be checked for packet payload integrity.
//6 If a valid packet payload has been received then the FIFO should be read (See Payload Data Extraction below). Should a subsequent single packet reception need to be triggered, then the RXSINGLE operating mode must be re-selected to launch the receive process again - taking care to reset the SPI pointer (FifoAddrPtr) to the base location in memory (FifoRxBaseAddr).
if (_filterBadCRC) setRegister(REG_DIO_MAPPING_1, MSK_DIO0_MAPPING, B01000000); // CRC OK
else setRegister(REG_DIO_MAPPING_1, MSK_DIO0_MAPPING, B00000000); // Payload Ready
setRegister(REG_OPMODE, MSK_OPMODE_MODE, VAL_MODE_RX_SINGLE);
_mode = VAL_MODE_RX_CONT;
};
void receiveDataCont()
{
if ((_mode == VAL_MODE_RX_CONT) || (_mode == VAL_MODE_RX_SINGLE)) return;
Serial.println("Enter Rec-Mode"); /// TODO: only test
setEnabled(0);
spiWrite(REG_FIFO_RX_BASE_AD, 0x00);
spiWrite(REG_FIFO_ADDR_PTR, 0x00);
if (_filterBadCRC) setRegister(REG_DIO_MAPPING_1, MSK_DIO0_MAPPING, B01000000); // CRC OK
else setRegister(REG_DIO_MAPPING_1, MSK_DIO0_MAPPING, B00000000); // Payload Ready
/// activate IRQ
setRegister(REG_OPMODE, MSK_OPMODE_MODE, VAL_MODE_RX_CONT);
_mode = VAL_MODE_RX_CONT;
};
void extractFifo()
{
// ValidHeader, PayloadCrcError, RxDone and RxTimeout should not be set
// RegRxNbBytes Indicates the number of bytes that have been received thus far.
// RegFifoAddrPtr is a dynamic pointer that indicates precisely where the Lora modem received data has been written up
// to.
// Set RegFifoAddrPtr to RegFifoRxCurrentAddr. This sets the FIFO pointer to the location of the last packet received in
// the FIFO. The payload can then be extracted by reading the register RegFifo, RegRxNbBytes times.
// Alternatively, it is possible to manually point to the location of the last packet received, from the start of the current
// packet, by setting RegFifoAddrPtr to RegFifoRxByteAddr minus RegRxNbBytes. The payload bytes can then be read
// from the FIFO by reading the RegFifo address RegRxNbBytes times.
};
/*
#define REG_FIFO 0x00 // cleared when in SleepMode
#define REG_FIFO_RX_CURRENT_ADDR 0x10 // start of last packet received
#define REG_IRQ_FLAGS_MASK 0x11
#define REG_IRQ_FLAGS 0x12
#define MSK_IRQ_RX_TIMEOUT (B10000000)
#define MSK_IRQ_RX_DONE (B01000000)
#define MSK_IRQ_PAYLOAD_CRC_ERR (B00100000)
#define MSK_IRQ_VALID_HEADER (B00010000)
#define MSK_IRQ_TX_DONE (B00001000)
#define MSK_IRQ_CAD_DONE (B00000100)
#define MSK_IRQ_FHSS_CHANGE (B00000010)
#define MSK_IRQ_CAT_DETECTED (B00000001)
#define REG_RX_NB_BYTES 0x13 // successful receive will write this bytecount
#define REG_RX_HEADER_CNT_MSB 0x14
#define REG_RX_HEADER_CNT_LSB 0x15
#define REG_RX_PACKET_CNT_MSB 0x16
#define REG_RX_PACKET_CNT_LSB 0x17
#define REG_MODEM_STAT 0x18
#define MSK_MODEM_RX_CODINGRATE (B11100000)
#define MSK_MODEM_STATUS (B00011111)
#define MSK_MODEM_STATUS_CLEAR (B00010000)
#define MSK_MODEM_STATUS_HDRVAL (B00001000)
#define MSK_MODEM_STATUS_RXON (B00000100)
#define MSK_MODEM_STATUS_SYNC (B00000010)
#define MSK_MODEM_STATUS_SIGDET (B00000001)
#define REG_PKT_SNR_VALUE 0x19 // last Packets SNR dB = int8_REG/4
#define REG_PKT_RSSI_VALUE 0x1A // last Packets RSSI dBm = REG - 127
#define REG_RSSI_VALUE 0x1B // current RSSI dBm = REG - 127
#define REG_HOP_CHANNEL 0x1C
#define MSK_HOP_PLL_TIMEOUT (B10000000)
#define MSK_HOP_RX_CRCON (B01000000)
#define MSK_HOP_FHSS_CHANNEL (B00111111)
#define REG_SYMB_TIMEOUTLSB 0x1F // number of symbols; timeout = REG * Ts
#define REG_FIFO_RX_BYTE_ADDR 0x25 // Addr of last byte written
/// 0x27 - 3F not for LoRa
#define REG_DIO_MAPPING_1 0x40
#define MSK_DIO0_MAPPING (B11000000)
#define MSK_DIO1_MAPPING (B00110000)
#define MSK_DIO2_MAPPING (B00001100)
#define MSK_DIO3_MAPPING (B00000011)
#define REG_DIO_MAPPING_2 0x41
#define MSK_DIO4_MAPPING (B11000000)
#define MSK_DIO5_MAPPING (B00110000)
#define MSK_DIO_MAP_PREAMB_DET (B00000001)
#define REG_VERSION 0x42
#define VAL_V1B 0x12 // has errors --> extra document (errata)
#define REG_FORMER_TEMP 0x5B // -1°C per LSB
#define REG_AGC_REF 0x61
#define MSK_AGC_REF_LEVEL (B00111111) // def=0x19
#define REG_AGC_THRESH1 0x62
#define MSK_AGC_STEP1 0x0F
#define REG_AGC_THRESH2 0x63
#define MSK_AGC_STEP2 0xF0
#define MSK_AGC_STEP3 0x0F
#define REG_AGC_THRESH3 0x64
#define MSK_AGC_STEP4 0xF0
#define MSK_AGC_STEP5 0x0F
#define REG_PLL 0x70
#define MSK_PLL_BW (B11000000)
#define VAL_PLL_BW075KHZ (B00000000)
#define VAL_PLL_BW150KHZ (B01000000)
#define VAL_PLL_BW225KHZ (B10000000)
#define VAL_PLL_BW300KHZ (B11000000)
*/
};
/** ######### Preinstantiate Object ################################################################# */
/** < it's better when this is done by the user */
//PRESET preset = PRESET();
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,27 @@
Copyright (c) 2015, André Sarmento Barbosa
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.
3. Neither the name of the copyright holder 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 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.

@ -0,0 +1,138 @@
# Modbus Library for Arduino
Allows your Arduino to communicate via Modbus protocol
[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/epsilonrt/modbus-arduino?include_prereleases)](https://github.com/epsilonrt/modbus-arduino/releases)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/epsilonrt/library/modbus-arduino.svg)](https://registry.platformio.org/libraries/epsilonrt/modbus-arduino)
[![Arduino Registry](https://www.ardu-badge.com/badge/Modbus-Arduino.svg)](https://www.arduinolibraries.info/libraries/modbus-arduino)
[![Framework](https://img.shields.io/badge/Framework-Arduino-blue)](https://www.arduino.cc/)
[![Platform ATMELAVR](https://img.shields.io/badge/Platform-AtmelAVR-blue)](#)
[![Platform ATMELSAM](https://img.shields.io/badge/Platform-AtmelSAM-blue)](#)
[![Platform Teensy](https://img.shields.io/badge/Platform-Teensy-green)](#)
[![Platform ESP8266](https://img.shields.io/badge/Platform-Espressif8266-orange)](#)
[![Platform ESP32](https://img.shields.io/badge/Platform-Espressif32-orange)](#)
---
<a href="https://modbus.org/">
<img src="https://github.com/epsilonrt/modbus-arduino/raw/master/extras/modbus.png" alt="Modbus Logo" align="right" valign="top">
</a>
The Modbus is a master-slave protocol used in industrial automation and can be used in other areas, such as home automation.
The Modbus generally uses serial RS-232 or RS-485 as physical layer (then called Modbus Serial) and
TCP/IP via Ethernet or WiFi (Modbus TCP). But it is also possible to associate the Modbus application protocol on any other physical layer, such as the radio for example (with [MobdusRadio](https://github.com/epsilonrt/modbus-radio) for example).
![Modbus Stack](https://github.com/epsilonrt/modbus-arduino/raw/master/extras/modbus-stack.png)
In the current version the library allows the Arduino operate **as a slave**, supporting Modbus Serial and
Modbus over IP. For more information about Modbus see:
* [Wikipedia article](https://en.wikipedia.org/wiki/Modbus)
* [MODBUS Application Protocol Specification](http://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b.pdf)
* [MODBUS Messaging on TCP/IP Implementation Guide](http://www.modbus.org/docs/Modbus_Messaging_Implementation_Guide_V1_0b.pdf)
* [MODBUS over serial line specification and implementation guide ](http://www.modbus.org/docs/Modbus_over_serial_line_V1_02.pdf)
## Features
* Operates as a slave (master mode in development)
* Supports Modbus over Serial line (RS-232 or RS485) and Modbus TCP
* Reply exception messages for all supported functions
* Modbus functions supported:
* 0x01 - Read Coils
* 0x02 - Read Input Status (Read Discrete Inputs)
* 0x03 - Read Holding Registers
* 0x04 - Read Input Registers
* 0x05 - Write Single Coil
* 0x06 - Write Single Register
* 0x0F - Write Multiple Coils
* 0x10 - Write Multiple Registers
* 0x11 - Report Server ID
A set of examples is available for each of the Modbus-derived classes, for example:
* [Lamp](https://github.com/epsilonrt/modbus-serial/blob/master/examples/Lamp/Lamp.ino): Use a coil to turn on and off a LED (0x05 and 0x01 functions)
* [LampDimmer](https://github.com/epsilonrt/modbus-serial/blob/master/examples/LampDimmer/LampDimmer.ino): Use a holding register to control the brightness of a LED (0x06 and 0x03 functions)
* [Switch](https://github.com/epsilonrt/modbus-serial/blob/master/examples/Switch/Switch.ino): Use a discrete input to read the state of a switch (0x02 function)
* [TempSensor](https://github.com/epsilonrt/modbus-serial/blob/master/examples/TempSensor/TempSensor.ino): Use a input register to read the temperature from a sensor (0x04 function)
* [Servo](https://github.com/epsilonrt/modbus-radio/blob/master/examples/Servo/Servo.ino): Use a holding register to control the position of a servo motor (0x06 an 0x03 function). Show how to define boundaries for the register.
* [LampEncrypted](https://github.com/epsilonrt/modbus-radio/blob/master/examples/LampEncrypted/LampEncrypted.ino): Use a coil to turn on and off a LED (0x05 and 0x01 functions) with encrypted communication.
All examples show the use of 0x11 function to report the slave ID.
**Notes:**
1. The offsets for registers are 0-based. So be careful when setting your supervisory system or your testing software. If offsets are 1-based, so a register configured as 100 in library should be 101 in this software.
2. Early in the library Modbus.h file there is an option to limit the operation
to the functions of Holding Registers, saving space in the program memory.
Just comment out the following line:
#define USE_HOLDING_REGISTERS_ONLY
Thus, only the following functions are supported:
* 0x03 - Read Holding Registers
* 0x06 - Write Single Register
* 0x10 - Write Multiple Registers
You may test the library using the [MbPoll](https://github.com/epsilonrt/mbpoll) software. For example, to turn on the led in the Lamp example, just do:
$ mbpoll -m rtu -b38400 -a10 -t0 /dev/tnt1 1
mbpoll 1.5-2 - ModBus(R) Master Simulator
Copyright (c) 2015-2023 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.
Protocol configuration: ModBus RTU
Slave configuration...: address = [10]
start reference = 1, count = 1
Communication.........: /dev/tnt1, 38400-8E1
t/o 1.00 s, poll rate 1000 ms
Data type.............: discrete output (coil)
Written 1 references.
## How to
There are five classes corresponding to six headers that may be used:
* Modbus-Arduino - Base Library (this repository)
* [Modbus-Serial](https://github.com/epsilonrt/modbus-serial) - Modbus Serial RTU Library
* [Modbus-Ethernet](https://github.com/epsilonrt/modbus-ethernet) - Modbus TCP Library (standard Ethernet Shield)
* [Modbus-EtherCard](https://github.com/epsilonrt/modbus-ethercard) - Modbus TCP Library (for ENC28J60 chip)
* [Modbus-Esp8266AT](https://github.com/epsilonrt/modbus-esp8266at) - Modbus IP Library (for ESP8266 chip with AT firmware)
* [Modbus-Radio](https://github.com/epsilonrt/modbus-radio) - Modbus Radio Library (RadioHead compatible chips)
By opting for Modbus Serial, TCP or Radio you must include in your sketch the corresponding header :
#include <ModbusSerial.h>
## Modbus Jargon
In this library was decided to use the terms used in Modbus to the methods names, then is important clarify the names of
register types:
| Register type | Use as | Access | Library methods |
| -------------------- | ------------------ | ----------------- | ----------------------------- |
| Coil | Digital Output | Read/Write | addCoil(), coil(), setCoil() |
| Holding Register | Analog Output | Read/Write | addHreg(), hreg(), setHreg() |
| Input Status | Digital Input | Read Only | addIsts(), ists(), setIsts() |
| Input Register | Analog Input | Read Only | addIreg(), ireg(), setIreg() |
**Notes:**
1. _Input Status_ is sometimes called _Discrete Input_.
2. _Holding Register_ or just _Register_ is also used to store values in the slave.
3. Examples of use: A _Coil_ can be used to drive a lamp or LED. A _Holding Register_ to
store a counter or drive a Servo Motor. A _Input Status_ can be used with a reed switch
in a door sensor and a _Input Register_ with a temperature sensor.
License
=======
The code in this repo is licensed under the BSD New License. See LICENSE for more info.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,122 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: ModbusIP_ESP8266AT.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('ModbusIP__ESP8266AT_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">ModbusIP_ESP8266AT.h</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"> ModbusIP_ESP8266AT.h - Header for Modbus IP ESP8266 AT Library</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> Copyright (C) 2015 André Sarmento Barbosa</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment">*/</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="preprocessor">#include &lt;Arduino.h&gt;</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="preprocessor">#include &lt;Modbus.h&gt;</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="preprocessor">#include &lt;ESP8266.h&gt;</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="preprocessor">#ifndef MODBUSIP_ESP8266AT_H</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="preprocessor">#define MODBUSIP_ESP8266AT_H</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;</div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="preprocessor">#define MODBUSIP_PORT 502 </span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="preprocessor">#define MODBUSIP_MAXFRAME 200 </span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="preprocessor">#define MODBUSIP_TIMEOUT 10 </span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="preprocessor"></span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="keyword">class </span><a class="code" href="classModbusIP.html">ModbusIP</a> : <span class="keyword">public</span> <a class="code" href="classModbus.html">Modbus</a> {</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#ifndef __DOXYGEN__</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160; <span class="keyword">private</span>:</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; byte _MBAP[7];</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; ESP8266* _wifi;</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; <span class="keywordtype">bool</span> prev_conn;</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; <span class="keyword">public</span>:</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; <a class="code" href="classModbusIP.html#a482a2b149889751991af5b9829467cbc">ModbusIP</a>();</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; <span class="keywordtype">void</span> <a class="code" href="classModbusIP.html#a52de8c5a563b3e697d15f026d3f63b9b">config</a>(ESP8266 &amp;wifi, String ssid, String password);</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="keywordtype">void</span> <a class="code" href="classModbusIP.html#a1f1f4e6f27d8bae60fc9174205c50542">task</a>();</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;};</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="preprocessor">#endif //MODBUSIP_ESP8266AT_H</span></div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;</div><div class="ttc" id="classModbusIP_html"><div class="ttname"><a href="classModbusIP.html">ModbusIP</a></div><div class="ttdoc">Modbus over TCP/IP network Class for Arduino Ethernet shield. </div><div class="ttdef"><b>Definition:</b> <a href="ModbusIP_8h_source.html#l00022">ModbusIP.h:22</a></div></div>
<div class="ttc" id="classModbusIP_html_a482a2b149889751991af5b9829467cbc"><div class="ttname"><a href="classModbusIP.html#a482a2b149889751991af5b9829467cbc">ModbusIP::ModbusIP</a></div><div class="ttdeci">ModbusIP()</div><div class="ttdoc">Default constructor. </div></div>
<div class="ttc" id="classModbusIP_html_a52de8c5a563b3e697d15f026d3f63b9b"><div class="ttname"><a href="classModbusIP.html#a52de8c5a563b3e697d15f026d3f63b9b">ModbusIP::config</a></div><div class="ttdeci">void config(uint8_t *mac)</div><div class="ttdoc">Connect a ModbusIP object to a network. </div></div>
<div class="ttc" id="classModbusIP_html_a1f1f4e6f27d8bae60fc9174205c50542"><div class="ttname"><a href="classModbusIP.html#a1f1f4e6f27d8bae60fc9174205c50542">ModbusIP::task</a></div><div class="ttdeci">void task()</div><div class="ttdoc">Task that performs all operations on MODBUS. </div></div>
<div class="ttc" id="classModbus_html"><div class="ttname"><a href="classModbus.html">Modbus</a></div><div class="ttdoc">Modbus base class. </div><div class="ttdef"><b>Definition:</b> <a href="Modbus_8h_source.html#l00053">Modbus.h:53</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_bc0718b08fb2015b8e59c47b2805f60c.html">libraries</a></li><li class="navelem"><a class="el" href="dir_3f5e39fb36414adb637ec20326caccc2.html">ModbusIP_ESP8266AT</a></li><li class="navelem"><b>ModbusIP_ESP8266AT.h</b></li>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,133 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: Class List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li class="current"><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('annotated.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Class List</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock">Here are the classes, structs, unions and interfaces with brief descriptions:</div><div class="directory">
<table class="directory">
<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classModbus.html" target="_self">Modbus</a></td><td class="desc"><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> base class </td></tr>
<tr id="row_1_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classModbusIP.html" target="_self">ModbusIP</a></td><td class="desc"><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> over TCP/IP network Class for Arduino Ethernet shield </td></tr>
<tr id="row_2_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classModbusIP__ENC28J60.html" target="_self">ModbusIP_ENC28J60</a></td><td class="desc"><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> over TCP/IP network Class for ENC28J60 controller </td></tr>
<tr id="row_3_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classModbusIP__ESP8266AT.html" target="_self">ModbusIP_ESP8266AT</a></td><td class="desc"><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> over TCP/IP network Class for Wi-Fi ESP8266 AT controller </td></tr>
<tr id="row_4_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classModbusSerial.html" target="_self">ModbusSerial</a></td><td class="desc"><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> over serial line Class </td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,8 @@
var annotated_dup =
[
[ "Modbus", "classModbus.html", "classModbus" ],
[ "ModbusIP", "classModbusIP.html", "classModbusIP" ],
[ "ModbusIP_ENC28J60", "classModbusIP__ENC28J60.html", null ],
[ "ModbusIP_ESP8266AT", "classModbusIP__ESP8266AT.html", null ],
[ "ModbusSerial", "classModbusSerial.html", "classModbusSerial" ]
];

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

@ -0,0 +1,140 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classModbus.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Modbus Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="classModbus.html">Modbus</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#af10a81e46f971daa4ce429d39776378b">addCoil</a>(word offset, bool value=false)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#a73797fbd9af758aedc198ccd8f4585fb">addHreg</a>(word offset, word value=0)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#ab052ca5452b76bdb85235e898623cedc">addIreg</a>(word offset, word value=0)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#abead971752bc7b2a54cb508ad8a8a2c4">addIsts</a>(word offset, bool value=false)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#a6b5ed2b967d4c43b578d21f562abc007">Coil</a>(word offset, bool value)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#a208bb15086e008f05f2fa72398551d04">Coil</a>(word offset)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#af13802f39b91279bd55538749bb76409">Hreg</a>(word offset, word value)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#aa6b32867beace3ce557ea61183497607">Hreg</a>(word offset)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#ac9be098d4bff9081105b6202922b1134">Ireg</a>(word offset, word value)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#abef420732eca033c08c131df73623521">Ireg</a>(word offset)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#a493b0fc75ea3ba076f7c9a25e491bcbe">Ists</a>(word offset, bool value)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#a833a76980e46be4995d2ca4ce5d2e51b">Ists</a>(word offset)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#a101809cdd4734537bab58dc315a840b4">Modbus</a>()</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,592 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: Modbus Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classModbus.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classModbus-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">Modbus Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> base class.
<a href="classModbus.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="Modbus_8h_source.html">Modbus.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for Modbus:</div>
<div class="dyncontent">
<div class="center"><img src="classModbus__inherit__graph.png" border="0" usemap="#Modbus_inherit__map" alt="Inheritance graph"/></div>
<map name="Modbus_inherit__map" id="Modbus_inherit__map">
<area shape="rect" id="node2" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. " alt="" coords="5,307,104,531"/>
<area shape="rect" id="node3" href="classModbusSerial.html" title="Modbus over serial line Class. " alt="" coords="129,314,250,523"/>
</map>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:af10a81e46f971daa4ce429d39776378b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#af10a81e46f971daa4ce429d39776378b">addCoil</a> (word offset, bool value=false)</td></tr>
<tr class="memdesc:af10a81e46f971daa4ce429d39776378b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a coil. <a href="#af10a81e46f971daa4ce429d39776378b">More...</a><br /></td></tr>
<tr class="separator:af10a81e46f971daa4ce429d39776378b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a73797fbd9af758aedc198ccd8f4585fb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a73797fbd9af758aedc198ccd8f4585fb">addHreg</a> (word offset, word value=0)</td></tr>
<tr class="memdesc:a73797fbd9af758aedc198ccd8f4585fb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a holding register to the list. <a href="#a73797fbd9af758aedc198ccd8f4585fb">More...</a><br /></td></tr>
<tr class="separator:a73797fbd9af758aedc198ccd8f4585fb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab052ca5452b76bdb85235e898623cedc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#ab052ca5452b76bdb85235e898623cedc">addIreg</a> (word offset, word value=0)</td></tr>
<tr class="memdesc:ab052ca5452b76bdb85235e898623cedc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a input register. <a href="#ab052ca5452b76bdb85235e898623cedc">More...</a><br /></td></tr>
<tr class="separator:ab052ca5452b76bdb85235e898623cedc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abead971752bc7b2a54cb508ad8a8a2c4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#abead971752bc7b2a54cb508ad8a8a2c4">addIsts</a> (word offset, bool value=false)</td></tr>
<tr class="memdesc:abead971752bc7b2a54cb508ad8a8a2c4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a discrete input. <a href="#abead971752bc7b2a54cb508ad8a8a2c4">More...</a><br /></td></tr>
<tr class="separator:abead971752bc7b2a54cb508ad8a8a2c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b5ed2b967d4c43b578d21f562abc007"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a6b5ed2b967d4c43b578d21f562abc007">Coil</a> (word offset, bool value)</td></tr>
<tr class="memdesc:a6b5ed2b967d4c43b578d21f562abc007"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of a coil This value will be returned when bus read, the master can also modify it. <a href="#a6b5ed2b967d4c43b578d21f562abc007">More...</a><br /></td></tr>
<tr class="separator:a6b5ed2b967d4c43b578d21f562abc007"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a208bb15086e008f05f2fa72398551d04"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a208bb15086e008f05f2fa72398551d04">Coil</a> (word offset)</td></tr>
<tr class="memdesc:a208bb15086e008f05f2fa72398551d04"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the value of a coil. <a href="#a208bb15086e008f05f2fa72398551d04">More...</a><br /></td></tr>
<tr class="separator:a208bb15086e008f05f2fa72398551d04"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af13802f39b91279bd55538749bb76409"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#af13802f39b91279bd55538749bb76409">Hreg</a> (word offset, word value)</td></tr>
<tr class="memdesc:af13802f39b91279bd55538749bb76409"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of a holding register This value will be returned when bus read, the master can also modify it. <a href="#af13802f39b91279bd55538749bb76409">More...</a><br /></td></tr>
<tr class="separator:af13802f39b91279bd55538749bb76409"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa6b32867beace3ce557ea61183497607"><td class="memItemLeft" align="right" valign="top">word&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#aa6b32867beace3ce557ea61183497607">Hreg</a> (word offset)</td></tr>
<tr class="memdesc:aa6b32867beace3ce557ea61183497607"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the value of a holding register. <a href="#aa6b32867beace3ce557ea61183497607">More...</a><br /></td></tr>
<tr class="separator:aa6b32867beace3ce557ea61183497607"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac9be098d4bff9081105b6202922b1134"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#ac9be098d4bff9081105b6202922b1134">Ireg</a> (word offset, word value)</td></tr>
<tr class="memdesc:ac9be098d4bff9081105b6202922b1134"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of an input register This value will be returned when bus read. <a href="#ac9be098d4bff9081105b6202922b1134">More...</a><br /></td></tr>
<tr class="separator:ac9be098d4bff9081105b6202922b1134"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abef420732eca033c08c131df73623521"><td class="memItemLeft" align="right" valign="top">word&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#abef420732eca033c08c131df73623521">Ireg</a> (word offset)</td></tr>
<tr class="memdesc:abef420732eca033c08c131df73623521"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the value of an input register. <a href="#abef420732eca033c08c131df73623521">More...</a><br /></td></tr>
<tr class="separator:abef420732eca033c08c131df73623521"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a493b0fc75ea3ba076f7c9a25e491bcbe"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a493b0fc75ea3ba076f7c9a25e491bcbe">Ists</a> (word offset, bool value)</td></tr>
<tr class="memdesc:a493b0fc75ea3ba076f7c9a25e491bcbe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of a discrete input This value will be returned when bus read,. <a href="#a493b0fc75ea3ba076f7c9a25e491bcbe">More...</a><br /></td></tr>
<tr class="separator:a493b0fc75ea3ba076f7c9a25e491bcbe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a833a76980e46be4995d2ca4ce5d2e51b"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a833a76980e46be4995d2ca4ce5d2e51b">Ists</a> (word offset)</td></tr>
<tr class="memdesc:a833a76980e46be4995d2ca4ce5d2e51b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the value of a discrete input. <a href="#a833a76980e46be4995d2ca4ce5d2e51b">More...</a><br /></td></tr>
<tr class="separator:a833a76980e46be4995d2ca4ce5d2e51b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a101809cdd4734537bab58dc315a840b4"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a101809cdd4734537bab58dc315a840b4">Modbus</a> ()</td></tr>
<tr class="memdesc:a101809cdd4734537bab58dc315a840b4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor. <a href="#a101809cdd4734537bab58dc315a840b4">More...</a><br /></td></tr>
<tr class="separator:a101809cdd4734537bab58dc315a840b4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> base class. </p>
<p>Definition at line <a class="el" href="Modbus_8h_source.html#l00053">53</a> of file <a class="el" href="Modbus_8h_source.html">Modbus.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a101809cdd4734537bab58dc315a840b4"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Modbus::Modbus </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Default constructor. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="af10a81e46f971daa4ce429d39776378b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Modbus::addCoil </td>
<td>(</td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>value</em> = <code>false</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Add a coil. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>coil offset (PDU addressing: 0-9999) </td></tr>
<tr><td class="paramname">value</td><td>default value </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a73797fbd9af758aedc198ccd8f4585fb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Modbus::addHreg </td>
<td>(</td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>value</em> = <code>0</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Add a holding register to the list. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>register offset (PDU addressing: 0-9999) </td></tr>
<tr><td class="paramname">value</td><td>default value </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ab052ca5452b76bdb85235e898623cedc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Modbus::addIreg </td>
<td>(</td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>value</em> = <code>0</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Add a input register. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>register offset (PDU addressing: 0-9999) </td></tr>
<tr><td class="paramname">value</td><td>default value </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="abead971752bc7b2a54cb508ad8a8a2c4"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Modbus::addIsts </td>
<td>(</td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>value</em> = <code>false</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Add a discrete input. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>input offset (PDU addressing: 0-9999) </td></tr>
<tr><td class="paramname">value</td><td>default value </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a6b5ed2b967d4c43b578d21f562abc007"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Modbus::Coil </td>
<td>(</td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>value</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Change the value of a coil This value will be returned when bus read, the master can also modify it. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>register offset (PDU addressing: 0-9999) </td></tr>
<tr><td class="paramname">value</td><td>new value </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true, false if coil not found. </dd></dl>
</div>
</div>
<a class="anchor" id="a208bb15086e008f05f2fa72398551d04"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Modbus::Coil </td>
<td>(</td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>offset</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return the value of a coil. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>register offset (PDU addressing: 0-9999) </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>coil value </dd></dl>
</div>
</div>
<a class="anchor" id="af13802f39b91279bd55538749bb76409"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Modbus::Hreg </td>
<td>(</td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>value</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Change the value of a holding register This value will be returned when bus read, the master can also modify it. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>register offset (PDU addressing: 0-9999) </td></tr>
<tr><td class="paramname">value</td><td>new value </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true, false if register not found. </dd></dl>
</div>
</div>
<a class="anchor" id="aa6b32867beace3ce557ea61183497607"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">word Modbus::Hreg </td>
<td>(</td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>offset</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return the value of a holding register. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>register offset (PDU addressing: 0-9999) </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>register value </dd></dl>
</div>
</div>
<a class="anchor" id="ac9be098d4bff9081105b6202922b1134"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Modbus::Ireg </td>
<td>(</td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>value</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Change the value of an input register This value will be returned when bus read. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>register offset (PDU addressing: 0-9999) </td></tr>
<tr><td class="paramname">value</td><td>new value </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true, false if register not found. </dd></dl>
</div>
</div>
<a class="anchor" id="abef420732eca033c08c131df73623521"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">word Modbus::Ireg </td>
<td>(</td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>offset</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return the value of an input register. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>register offset (PDU addressing: 0-9999) </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>register value </dd></dl>
</div>
</div>
<a class="anchor" id="a493b0fc75ea3ba076f7c9a25e491bcbe"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Modbus::Ists </td>
<td>(</td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>value</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Change the value of a discrete input This value will be returned when bus read,. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>input offset (PDU addressing: 0-9999) </td></tr>
<tr><td class="paramname">value</td><td>new value </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true, false if input not found. </dd></dl>
</div>
</div>
<a class="anchor" id="a833a76980e46be4995d2ca4ce5d2e51b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Modbus::Ists </td>
<td>(</td>
<td class="paramtype">word&#160;</td>
<td class="paramname"><em>offset</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return the value of a discrete input. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>input offset (PDU addressing: 0-9999) </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>input value </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="classModbus.html">Modbus</a></li>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,16 @@
var classModbus =
[
[ "Modbus", "classModbus.html#a101809cdd4734537bab58dc315a840b4", null ],
[ "addCoil", "classModbus.html#af10a81e46f971daa4ce429d39776378b", null ],
[ "addHreg", "classModbus.html#a73797fbd9af758aedc198ccd8f4585fb", null ],
[ "addIreg", "classModbus.html#ab052ca5452b76bdb85235e898623cedc", null ],
[ "addIsts", "classModbus.html#abead971752bc7b2a54cb508ad8a8a2c4", null ],
[ "Coil", "classModbus.html#a6b5ed2b967d4c43b578d21f562abc007", null ],
[ "Coil", "classModbus.html#a208bb15086e008f05f2fa72398551d04", null ],
[ "Hreg", "classModbus.html#af13802f39b91279bd55538749bb76409", null ],
[ "Hreg", "classModbus.html#aa6b32867beace3ce557ea61183497607", null ],
[ "Ireg", "classModbus.html#ac9be098d4bff9081105b6202922b1134", null ],
[ "Ireg", "classModbus.html#abef420732eca033c08c131df73623521", null ],
[ "Ists", "classModbus.html#a493b0fc75ea3ba076f7c9a25e491bcbe", null ],
[ "Ists", "classModbus.html#a833a76980e46be4995d2ca4ce5d2e51b", null ]
];

@ -0,0 +1,157 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classModbusIP.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">ModbusIP Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="classModbusIP.html">ModbusIP</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#af10a81e46f971daa4ce429d39776378b">addCoil</a>(word offset, bool value=false)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#a73797fbd9af758aedc198ccd8f4585fb">addHreg</a>(word offset, word value=0)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#ab052ca5452b76bdb85235e898623cedc">addIreg</a>(word offset, word value=0)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#abead971752bc7b2a54cb508ad8a8a2c4">addIsts</a>(word offset, bool value=false)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#a6b5ed2b967d4c43b578d21f562abc007">Coil</a>(word offset, bool value)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#a208bb15086e008f05f2fa72398551d04">Coil</a>(word offset)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusIP.html#a52de8c5a563b3e697d15f026d3f63b9b">config</a>(uint8_t *mac)</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbusIP.html#a0f7282286635622b6a856f2e7f415a1d">config</a>(uint8_t *mac, IPAddress ip)</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusIP.html#a972948c55f294d6a6228098f2c5cc19b">config</a>(uint8_t *mac, IPAddress ip, IPAddress dns)</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbusIP.html#a9986c3cb0ad88c3266efcfdbbc8f1cde">config</a>(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway)</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusIP.html#a9ec792b22e7bf30a222405af29b188ac">config</a>(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet)</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbusIP.html#a52de8c5a563b3e697d15f026d3f63b9b">config</a>(uint8_t *mac)</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusIP.html#a0f7282286635622b6a856f2e7f415a1d">config</a>(uint8_t *mac, IPAddress ip)</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbusIP.html#a972948c55f294d6a6228098f2c5cc19b">config</a>(uint8_t *mac, IPAddress ip, IPAddress dns)</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusIP.html#a9986c3cb0ad88c3266efcfdbbc8f1cde">config</a>(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway)</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbusIP.html#a9ec792b22e7bf30a222405af29b188ac">config</a>(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet)</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusIP.html#a8e3482b6d9499e188dd088d5ce3925ed">config</a>(ESP8266 &amp;wifi, String ssid, String password)</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#af13802f39b91279bd55538749bb76409">Hreg</a>(word offset, word value)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#aa6b32867beace3ce557ea61183497607">Hreg</a>(word offset)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#ac9be098d4bff9081105b6202922b1134">Ireg</a>(word offset, word value)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#abef420732eca033c08c131df73623521">Ireg</a>(word offset)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#a493b0fc75ea3ba076f7c9a25e491bcbe">Ists</a>(word offset, bool value)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#a833a76980e46be4995d2ca4ce5d2e51b">Ists</a>(word offset)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#a101809cdd4734537bab58dc315a840b4">Modbus</a>()</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusIP.html#a482a2b149889751991af5b9829467cbc">ModbusIP</a>()</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbusIP.html#a482a2b149889751991af5b9829467cbc">ModbusIP</a>()</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusIP.html#a482a2b149889751991af5b9829467cbc">ModbusIP</a>()</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbusIP.html#a1f1f4e6f27d8bae60fc9174205c50542">task</a>()</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusIP.html#a1f1f4e6f27d8bae60fc9174205c50542">task</a>()</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbusIP.html#a1f1f4e6f27d8bae60fc9174205c50542">task</a>()</td><td class="entry"><a class="el" href="classModbusIP.html">ModbusIP</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,801 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: ModbusIP Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classModbusIP.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classModbusIP-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">ModbusIP Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> over TCP/IP network Class for Arduino Ethernet shield.
<a href="classModbusIP.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="ModbusIP_8h_source.html">ModbusIP.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for ModbusIP:</div>
<div class="dyncontent">
<div class="center"><img src="classModbusIP__inherit__graph.png" border="0" usemap="#ModbusIP_inherit__map" alt="Inheritance graph"/></div>
<map name="ModbusIP_inherit__map" id="ModbusIP_inherit__map">
<area shape="rect" id="node2" href="classModbus.html" title="Modbus base class. " alt="" coords="9,5,100,259"/>
</map>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a52de8c5a563b3e697d15f026d3f63b9b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a52de8c5a563b3e697d15f026d3f63b9b">config</a> (uint8_t *mac)</td></tr>
<tr class="memdesc:a52de8c5a563b3e697d15f026d3f63b9b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. <a href="#a52de8c5a563b3e697d15f026d3f63b9b">More...</a><br /></td></tr>
<tr class="separator:a52de8c5a563b3e697d15f026d3f63b9b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8e3482b6d9499e188dd088d5ce3925ed"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a8e3482b6d9499e188dd088d5ce3925ed">config</a> (ESP8266 &amp;wifi, String ssid, String password)</td></tr>
<tr class="memdesc:a8e3482b6d9499e188dd088d5ce3925ed"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. <a href="#a8e3482b6d9499e188dd088d5ce3925ed">More...</a><br /></td></tr>
<tr class="separator:a8e3482b6d9499e188dd088d5ce3925ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a52de8c5a563b3e697d15f026d3f63b9b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a52de8c5a563b3e697d15f026d3f63b9b">config</a> (uint8_t *mac)</td></tr>
<tr class="memdesc:a52de8c5a563b3e697d15f026d3f63b9b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. <a href="#a52de8c5a563b3e697d15f026d3f63b9b">More...</a><br /></td></tr>
<tr class="separator:a52de8c5a563b3e697d15f026d3f63b9b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0f7282286635622b6a856f2e7f415a1d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a0f7282286635622b6a856f2e7f415a1d">config</a> (uint8_t *mac, IPAddress ip)</td></tr>
<tr class="memdesc:a0f7282286635622b6a856f2e7f415a1d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. <a href="#a0f7282286635622b6a856f2e7f415a1d">More...</a><br /></td></tr>
<tr class="separator:a0f7282286635622b6a856f2e7f415a1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0f7282286635622b6a856f2e7f415a1d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a0f7282286635622b6a856f2e7f415a1d">config</a> (uint8_t *mac, IPAddress ip)</td></tr>
<tr class="memdesc:a0f7282286635622b6a856f2e7f415a1d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. <a href="#a0f7282286635622b6a856f2e7f415a1d">More...</a><br /></td></tr>
<tr class="separator:a0f7282286635622b6a856f2e7f415a1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a972948c55f294d6a6228098f2c5cc19b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a972948c55f294d6a6228098f2c5cc19b">config</a> (uint8_t *mac, IPAddress ip, IPAddress dns)</td></tr>
<tr class="memdesc:a972948c55f294d6a6228098f2c5cc19b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. <a href="#a972948c55f294d6a6228098f2c5cc19b">More...</a><br /></td></tr>
<tr class="separator:a972948c55f294d6a6228098f2c5cc19b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a972948c55f294d6a6228098f2c5cc19b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a972948c55f294d6a6228098f2c5cc19b">config</a> (uint8_t *mac, IPAddress ip, IPAddress dns)</td></tr>
<tr class="memdesc:a972948c55f294d6a6228098f2c5cc19b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. <a href="#a972948c55f294d6a6228098f2c5cc19b">More...</a><br /></td></tr>
<tr class="separator:a972948c55f294d6a6228098f2c5cc19b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9986c3cb0ad88c3266efcfdbbc8f1cde"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a9986c3cb0ad88c3266efcfdbbc8f1cde">config</a> (uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway)</td></tr>
<tr class="memdesc:a9986c3cb0ad88c3266efcfdbbc8f1cde"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. <a href="#a9986c3cb0ad88c3266efcfdbbc8f1cde">More...</a><br /></td></tr>
<tr class="separator:a9986c3cb0ad88c3266efcfdbbc8f1cde"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9986c3cb0ad88c3266efcfdbbc8f1cde"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a9986c3cb0ad88c3266efcfdbbc8f1cde">config</a> (uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway)</td></tr>
<tr class="memdesc:a9986c3cb0ad88c3266efcfdbbc8f1cde"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. <a href="#a9986c3cb0ad88c3266efcfdbbc8f1cde">More...</a><br /></td></tr>
<tr class="separator:a9986c3cb0ad88c3266efcfdbbc8f1cde"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9ec792b22e7bf30a222405af29b188ac"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a9ec792b22e7bf30a222405af29b188ac">config</a> (uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet)</td></tr>
<tr class="memdesc:a9ec792b22e7bf30a222405af29b188ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. <a href="#a9ec792b22e7bf30a222405af29b188ac">More...</a><br /></td></tr>
<tr class="separator:a9ec792b22e7bf30a222405af29b188ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9ec792b22e7bf30a222405af29b188ac"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a9ec792b22e7bf30a222405af29b188ac">config</a> (uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet)</td></tr>
<tr class="memdesc:a9ec792b22e7bf30a222405af29b188ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. <a href="#a9ec792b22e7bf30a222405af29b188ac">More...</a><br /></td></tr>
<tr class="separator:a9ec792b22e7bf30a222405af29b188ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a482a2b149889751991af5b9829467cbc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a482a2b149889751991af5b9829467cbc">ModbusIP</a> ()</td></tr>
<tr class="memdesc:a482a2b149889751991af5b9829467cbc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor. <a href="#a482a2b149889751991af5b9829467cbc">More...</a><br /></td></tr>
<tr class="separator:a482a2b149889751991af5b9829467cbc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a482a2b149889751991af5b9829467cbc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a482a2b149889751991af5b9829467cbc">ModbusIP</a> ()</td></tr>
<tr class="memdesc:a482a2b149889751991af5b9829467cbc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor. <a href="#a482a2b149889751991af5b9829467cbc">More...</a><br /></td></tr>
<tr class="separator:a482a2b149889751991af5b9829467cbc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a482a2b149889751991af5b9829467cbc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a482a2b149889751991af5b9829467cbc">ModbusIP</a> ()</td></tr>
<tr class="memdesc:a482a2b149889751991af5b9829467cbc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor. <a href="#a482a2b149889751991af5b9829467cbc">More...</a><br /></td></tr>
<tr class="separator:a482a2b149889751991af5b9829467cbc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1f1f4e6f27d8bae60fc9174205c50542"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a1f1f4e6f27d8bae60fc9174205c50542">task</a> ()</td></tr>
<tr class="memdesc:a1f1f4e6f27d8bae60fc9174205c50542"><td class="mdescLeft">&#160;</td><td class="mdescRight">Task that performs all operations on MODBUS. <a href="#a1f1f4e6f27d8bae60fc9174205c50542">More...</a><br /></td></tr>
<tr class="separator:a1f1f4e6f27d8bae60fc9174205c50542"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1f1f4e6f27d8bae60fc9174205c50542"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a1f1f4e6f27d8bae60fc9174205c50542">task</a> ()</td></tr>
<tr class="memdesc:a1f1f4e6f27d8bae60fc9174205c50542"><td class="mdescLeft">&#160;</td><td class="mdescRight">Task that performs all operations on MODBUS. <a href="#a1f1f4e6f27d8bae60fc9174205c50542">More...</a><br /></td></tr>
<tr class="separator:a1f1f4e6f27d8bae60fc9174205c50542"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1f1f4e6f27d8bae60fc9174205c50542"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusIP.html#a1f1f4e6f27d8bae60fc9174205c50542">task</a> ()</td></tr>
<tr class="memdesc:a1f1f4e6f27d8bae60fc9174205c50542"><td class="mdescLeft">&#160;</td><td class="mdescRight">Task that performs all operations on MODBUS. <a href="#a1f1f4e6f27d8bae60fc9174205c50542">More...</a><br /></td></tr>
<tr class="separator:a1f1f4e6f27d8bae60fc9174205c50542"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classModbus"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classModbus')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classModbus.html">Modbus</a></td></tr>
<tr class="memitem:af10a81e46f971daa4ce429d39776378b inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#af10a81e46f971daa4ce429d39776378b">addCoil</a> (word offset, bool value=false)</td></tr>
<tr class="memdesc:af10a81e46f971daa4ce429d39776378b inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a coil. <a href="#af10a81e46f971daa4ce429d39776378b">More...</a><br /></td></tr>
<tr class="separator:af10a81e46f971daa4ce429d39776378b inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a73797fbd9af758aedc198ccd8f4585fb inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a73797fbd9af758aedc198ccd8f4585fb">addHreg</a> (word offset, word value=0)</td></tr>
<tr class="memdesc:a73797fbd9af758aedc198ccd8f4585fb inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a holding register to the list. <a href="#a73797fbd9af758aedc198ccd8f4585fb">More...</a><br /></td></tr>
<tr class="separator:a73797fbd9af758aedc198ccd8f4585fb inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab052ca5452b76bdb85235e898623cedc inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#ab052ca5452b76bdb85235e898623cedc">addIreg</a> (word offset, word value=0)</td></tr>
<tr class="memdesc:ab052ca5452b76bdb85235e898623cedc inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a input register. <a href="#ab052ca5452b76bdb85235e898623cedc">More...</a><br /></td></tr>
<tr class="separator:ab052ca5452b76bdb85235e898623cedc inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abead971752bc7b2a54cb508ad8a8a2c4 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#abead971752bc7b2a54cb508ad8a8a2c4">addIsts</a> (word offset, bool value=false)</td></tr>
<tr class="memdesc:abead971752bc7b2a54cb508ad8a8a2c4 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a discrete input. <a href="#abead971752bc7b2a54cb508ad8a8a2c4">More...</a><br /></td></tr>
<tr class="separator:abead971752bc7b2a54cb508ad8a8a2c4 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b5ed2b967d4c43b578d21f562abc007 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a6b5ed2b967d4c43b578d21f562abc007">Coil</a> (word offset, bool value)</td></tr>
<tr class="memdesc:a6b5ed2b967d4c43b578d21f562abc007 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of a coil This value will be returned when bus read, the master can also modify it. <a href="#a6b5ed2b967d4c43b578d21f562abc007">More...</a><br /></td></tr>
<tr class="separator:a6b5ed2b967d4c43b578d21f562abc007 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a208bb15086e008f05f2fa72398551d04 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a208bb15086e008f05f2fa72398551d04">Coil</a> (word offset)</td></tr>
<tr class="memdesc:a208bb15086e008f05f2fa72398551d04 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the value of a coil. <a href="#a208bb15086e008f05f2fa72398551d04">More...</a><br /></td></tr>
<tr class="separator:a208bb15086e008f05f2fa72398551d04 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af13802f39b91279bd55538749bb76409 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#af13802f39b91279bd55538749bb76409">Hreg</a> (word offset, word value)</td></tr>
<tr class="memdesc:af13802f39b91279bd55538749bb76409 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of a holding register This value will be returned when bus read, the master can also modify it. <a href="#af13802f39b91279bd55538749bb76409">More...</a><br /></td></tr>
<tr class="separator:af13802f39b91279bd55538749bb76409 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa6b32867beace3ce557ea61183497607 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">word&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#aa6b32867beace3ce557ea61183497607">Hreg</a> (word offset)</td></tr>
<tr class="memdesc:aa6b32867beace3ce557ea61183497607 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the value of a holding register. <a href="#aa6b32867beace3ce557ea61183497607">More...</a><br /></td></tr>
<tr class="separator:aa6b32867beace3ce557ea61183497607 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac9be098d4bff9081105b6202922b1134 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#ac9be098d4bff9081105b6202922b1134">Ireg</a> (word offset, word value)</td></tr>
<tr class="memdesc:ac9be098d4bff9081105b6202922b1134 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of an input register This value will be returned when bus read. <a href="#ac9be098d4bff9081105b6202922b1134">More...</a><br /></td></tr>
<tr class="separator:ac9be098d4bff9081105b6202922b1134 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abef420732eca033c08c131df73623521 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">word&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#abef420732eca033c08c131df73623521">Ireg</a> (word offset)</td></tr>
<tr class="memdesc:abef420732eca033c08c131df73623521 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the value of an input register. <a href="#abef420732eca033c08c131df73623521">More...</a><br /></td></tr>
<tr class="separator:abef420732eca033c08c131df73623521 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a493b0fc75ea3ba076f7c9a25e491bcbe inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a493b0fc75ea3ba076f7c9a25e491bcbe">Ists</a> (word offset, bool value)</td></tr>
<tr class="memdesc:a493b0fc75ea3ba076f7c9a25e491bcbe inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of a discrete input This value will be returned when bus read,. <a href="#a493b0fc75ea3ba076f7c9a25e491bcbe">More...</a><br /></td></tr>
<tr class="separator:a493b0fc75ea3ba076f7c9a25e491bcbe inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a833a76980e46be4995d2ca4ce5d2e51b inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a833a76980e46be4995d2ca4ce5d2e51b">Ists</a> (word offset)</td></tr>
<tr class="memdesc:a833a76980e46be4995d2ca4ce5d2e51b inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the value of a discrete input. <a href="#a833a76980e46be4995d2ca4ce5d2e51b">More...</a><br /></td></tr>
<tr class="separator:a833a76980e46be4995d2ca4ce5d2e51b inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a101809cdd4734537bab58dc315a840b4 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a101809cdd4734537bab58dc315a840b4">Modbus</a> ()</td></tr>
<tr class="memdesc:a101809cdd4734537bab58dc315a840b4 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor. <a href="#a101809cdd4734537bab58dc315a840b4">More...</a><br /></td></tr>
<tr class="separator:a101809cdd4734537bab58dc315a840b4 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> over TCP/IP network Class for Arduino Ethernet shield. </p>
<p>Definition at line <a class="el" href="ModbusIP_8h_source.html#l00022">22</a> of file <a class="el" href="ModbusIP_8h_source.html">ModbusIP.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a482a2b149889751991af5b9829467cbc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ModbusIP::ModbusIP </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Default constructor. </p>
</div>
</div>
<a class="anchor" id="a482a2b149889751991af5b9829467cbc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ModbusIP::ModbusIP </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Default constructor. </p>
</div>
</div>
<a class="anchor" id="a482a2b149889751991af5b9829467cbc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ModbusIP::ModbusIP </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Default constructor. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a52de8c5a563b3e697d15f026d3f63b9b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::config </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>mac</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">mac</td><td>the MAC (Media access control) address for the device (array of 6 bytes). this is the Ethernet hardware address of your shield. Newer Arduino Ethernet Shields include a sticker with the device's MAC address. For older shields, choose your own. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a8e3482b6d9499e188dd088d5ce3925ed"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::config </td>
<td>(</td>
<td class="paramtype">ESP8266 &amp;&#160;</td>
<td class="paramname"><em>wifi</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">String&#160;</td>
<td class="paramname"><em>ssid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">String&#160;</td>
<td class="paramname"><em>password</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">wifi</td><td>ESP8266 NIC object </td></tr>
<tr><td class="paramname">ssid</td><td>SSID of AP to join in </td></tr>
<tr><td class="paramname">password</td><td>Password of AP to join in </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a52de8c5a563b3e697d15f026d3f63b9b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::config </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>mac</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">mac</td><td>the MAC (Media access control) address for the device (array of 6 bytes). this is the Ethernet hardware address of your shield. Newer Arduino Ethernet Shields include a sticker with the device's MAC address. For older shields, choose your own. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a0f7282286635622b6a856f2e7f415a1d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::config </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>mac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>ip</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">mac</td><td>the MAC (Media access control) address for the device (array of 6 bytes). this is the Ethernet hardware address of your shield. Newer Arduino Ethernet Shields include a sticker with the device's MAC address. For older shields, choose your own. </td></tr>
<tr><td class="paramname">ip</td><td>the IP address of the device (array of 4 bytes) </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a0f7282286635622b6a856f2e7f415a1d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::config </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>mac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>ip</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">mac</td><td>the MAC (Media access control) address for the device (array of 6 bytes). this is the Ethernet hardware address of your shield. Newer Arduino Ethernet Shields include a sticker with the device's MAC address. For older shields, choose your own. </td></tr>
<tr><td class="paramname">ip</td><td>the IP address of the device (array of 4 bytes) </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a972948c55f294d6a6228098f2c5cc19b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::config </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>mac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>ip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>dns</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">mac</td><td>the MAC (Media access control) address for the device (array of 6 bytes). this is the Ethernet hardware address of your shield. Newer Arduino Ethernet Shields include a sticker with the device's MAC address. For older shields, choose your own. </td></tr>
<tr><td class="paramname">ip</td><td>the IP address of the device (array of 4 bytes) </td></tr>
<tr><td class="paramname">dns</td><td>the IP address of the DNS server (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1 </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a972948c55f294d6a6228098f2c5cc19b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::config </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>mac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>ip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>dns</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">mac</td><td>the MAC (Media access control) address for the device (array of 6 bytes). this is the Ethernet hardware address of your shield. Newer Arduino Ethernet Shields include a sticker with the device's MAC address. For older shields, choose your own. </td></tr>
<tr><td class="paramname">ip</td><td>the IP address of the device (array of 4 bytes) </td></tr>
<tr><td class="paramname">dns</td><td>the IP address of the DNS server (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1 </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a9986c3cb0ad88c3266efcfdbbc8f1cde"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::config </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>mac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>ip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>dns</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>gateway</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">mac</td><td>the MAC (Media access control) address for the device (array of 6 bytes). this is the Ethernet hardware address of your shield. Newer Arduino Ethernet Shields include a sticker with the device's MAC address. For older shields, choose your own. </td></tr>
<tr><td class="paramname">ip</td><td>the IP address of the device (array of 4 bytes) </td></tr>
<tr><td class="paramname">dns</td><td>the IP address of the DNS server (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1 </td></tr>
<tr><td class="paramname">gateway</td><td>the IP address of the network gateway (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1 </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a9986c3cb0ad88c3266efcfdbbc8f1cde"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::config </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>mac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>ip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>dns</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>gateway</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">mac</td><td>the MAC (Media access control) address for the device (array of 6 bytes). this is the Ethernet hardware address of your shield. Newer Arduino Ethernet Shields include a sticker with the device's MAC address. For older shields, choose your own. </td></tr>
<tr><td class="paramname">ip</td><td>the IP address of the device (array of 4 bytes) </td></tr>
<tr><td class="paramname">dns</td><td>the IP address of the DNS server (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1 </td></tr>
<tr><td class="paramname">gateway</td><td>the IP address of the network gateway (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1 </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a9ec792b22e7bf30a222405af29b188ac"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::config </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>mac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>ip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>dns</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>gateway</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>subnet</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">mac</td><td>the MAC (Media access control) address for the device (array of 6 bytes). this is the Ethernet hardware address of your shield. Newer Arduino Ethernet Shields include a sticker with the device's MAC address. For older shields, choose your own. </td></tr>
<tr><td class="paramname">ip</td><td>the IP address of the device (array of 4 bytes) </td></tr>
<tr><td class="paramname">dns</td><td>the IP address of the DNS server (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1 </td></tr>
<tr><td class="paramname">gateway</td><td>the IP address of the network gateway (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1 </td></tr>
<tr><td class="paramname">subnet</td><td>the subnet mask of the network (array of 4 bytes). optional: defaults to 255.255.255.0 </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a9ec792b22e7bf30a222405af29b188ac"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::config </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>mac</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>ip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>dns</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>gateway</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">IPAddress&#160;</td>
<td class="paramname"><em>subnet</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect a <a class="el" href="classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. ">ModbusIP</a> object to a network. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">mac</td><td>the MAC (Media access control) address for the device (array of 6 bytes). this is the Ethernet hardware address of your shield. Newer Arduino Ethernet Shields include a sticker with the device's MAC address. For older shields, choose your own. </td></tr>
<tr><td class="paramname">ip</td><td>the IP address of the device (array of 4 bytes) </td></tr>
<tr><td class="paramname">dns</td><td>the IP address of the DNS server (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1 </td></tr>
<tr><td class="paramname">gateway</td><td>the IP address of the network gateway (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1 </td></tr>
<tr><td class="paramname">subnet</td><td>the subnet mask of the network (array of 4 bytes). optional: defaults to 255.255.255.0 </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a1f1f4e6f27d8bae60fc9174205c50542"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::task </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Task that performs all operations on MODBUS. </p>
<p>Call once inside loop(), all magic here ! </p>
</div>
</div>
<a class="anchor" id="a1f1f4e6f27d8bae60fc9174205c50542"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::task </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Task that performs all operations on MODBUS. </p>
<p>Call once inside loop(), all magic here ! </p>
</div>
</div>
<a class="anchor" id="a1f1f4e6f27d8bae60fc9174205c50542"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusIP::task </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Task that performs all operations on MODBUS. </p>
<p>Call once inside loop(), all magic here ! </p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="classModbusIP.html">ModbusIP</a></li>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,20 @@
var classModbusIP =
[
[ "ModbusIP", "classModbusIP.html#a482a2b149889751991af5b9829467cbc", null ],
[ "ModbusIP", "classModbusIP.html#a482a2b149889751991af5b9829467cbc", null ],
[ "ModbusIP", "classModbusIP.html#a482a2b149889751991af5b9829467cbc", null ],
[ "config", "classModbusIP.html#a52de8c5a563b3e697d15f026d3f63b9b", null ],
[ "config", "classModbusIP.html#a8e3482b6d9499e188dd088d5ce3925ed", null ],
[ "config", "classModbusIP.html#a52de8c5a563b3e697d15f026d3f63b9b", null ],
[ "config", "classModbusIP.html#a0f7282286635622b6a856f2e7f415a1d", null ],
[ "config", "classModbusIP.html#a0f7282286635622b6a856f2e7f415a1d", null ],
[ "config", "classModbusIP.html#a972948c55f294d6a6228098f2c5cc19b", null ],
[ "config", "classModbusIP.html#a972948c55f294d6a6228098f2c5cc19b", null ],
[ "config", "classModbusIP.html#a9986c3cb0ad88c3266efcfdbbc8f1cde", null ],
[ "config", "classModbusIP.html#a9986c3cb0ad88c3266efcfdbbc8f1cde", null ],
[ "config", "classModbusIP.html#a9ec792b22e7bf30a222405af29b188ac", null ],
[ "config", "classModbusIP.html#a9ec792b22e7bf30a222405af29b188ac", null ],
[ "task", "classModbusIP.html#a1f1f4e6f27d8bae60fc9174205c50542", null ],
[ "task", "classModbusIP.html#a1f1f4e6f27d8bae60fc9174205c50542", null ],
[ "task", "classModbusIP.html#a1f1f4e6f27d8bae60fc9174205c50542", null ]
];

@ -0,0 +1,132 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: ModbusIP_ENC28J60 Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classModbusIP__ENC28J60.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">ModbusIP_ENC28J60 Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> over TCP/IP network Class for ENC28J60 controller.
<a href="classModbusIP__ENC28J60.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="ModbusIP__ENC28J60_8h_source.html">ModbusIP_ENC28J60.h</a>&gt;</code></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> over TCP/IP network Class for ENC28J60 controller. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="classModbusIP__ENC28J60.html">ModbusIP_ENC28J60</a></li>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,132 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: ModbusIP_ESP8266AT Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classModbusIP__ESP8266AT.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">ModbusIP_ESP8266AT Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> over TCP/IP network Class for Wi-Fi ESP8266 AT controller.
<a href="classModbusIP__ESP8266AT.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="ModbusIP__ESP8266AT_8h_source.html">ModbusIP_ESP8266AT.h</a>&gt;</code></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> over TCP/IP network Class for Wi-Fi ESP8266 AT controller. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="classModbusIP__ESP8266AT.html">ModbusIP_ESP8266AT</a></li>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,3 @@
<map id="ModbusIP" name="ModbusIP">
<area shape="rect" id="node2" href="$classModbus.html" title="Modbus base class. " alt="" coords="9,5,100,259"/>
</map>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

@ -0,0 +1,150 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classModbusSerial.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">ModbusSerial Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="classModbusSerial.html">ModbusSerial</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#af10a81e46f971daa4ce429d39776378b">addCoil</a>(word offset, bool value=false)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#a73797fbd9af758aedc198ccd8f4585fb">addHreg</a>(word offset, word value=0)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#ab052ca5452b76bdb85235e898623cedc">addIreg</a>(word offset, word value=0)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#abead971752bc7b2a54cb508ad8a8a2c4">addIsts</a>(word offset, bool value=false)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#a6b5ed2b967d4c43b578d21f562abc007">Coil</a>(word offset, bool value)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#a208bb15086e008f05f2fa72398551d04">Coil</a>(word offset)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusSerial.html#aefa9a7f9a910a311bfcd5110a6a8ab71">config</a>(HardwareSerial *port, long baud, byte parity=MB_PARITY_EVEN, int txenPin=-1)</td><td class="entry"><a class="el" href="classModbusSerial.html">ModbusSerial</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbusSerial.html#abbe69850e5deb5c35c6a2075a372350c">config</a>(SoftwareSerial *port, long baud, int txenPin=-1)</td><td class="entry"><a class="el" href="classModbusSerial.html">ModbusSerial</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusSerial.html#a82286ed2d9415c624d9b557fe871d8a0">config</a>(Serial_ *port, long baud, byte parity=MB_PARITY_EVEN, int txenPin=-1)</td><td class="entry"><a class="el" href="classModbusSerial.html">ModbusSerial</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbusSerial.html#adefaff8d3e8f4cfc1d90c9b52d880262">getSlaveId</a>()</td><td class="entry"><a class="el" href="classModbusSerial.html">ModbusSerial</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#af13802f39b91279bd55538749bb76409">Hreg</a>(word offset, word value)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#aa6b32867beace3ce557ea61183497607">Hreg</a>(word offset)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#ac9be098d4bff9081105b6202922b1134">Ireg</a>(word offset, word value)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#abef420732eca033c08c131df73623521">Ireg</a>(word offset)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#a493b0fc75ea3ba076f7c9a25e491bcbe">Ists</a>(word offset, bool value)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbus.html#a833a76980e46be4995d2ca4ce5d2e51b">Ists</a>(word offset)</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbus.html#a101809cdd4734537bab58dc315a840b4">Modbus</a>()</td><td class="entry"><a class="el" href="classModbus.html">Modbus</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classModbusSerial.html#add48c6a2b436e600865e0cf63ed0aafc">ModbusSerial</a>()</td><td class="entry"><a class="el" href="classModbusSerial.html">ModbusSerial</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusSerial.html#a3fb991a7b8d0d9766889e2cad7fca115">receive</a>(byte *frame)</td><td class="entry"><a class="el" href="classModbusSerial.html">ModbusSerial</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="classModbusSerial.html#ae7b2f3574d102b26a1de084cb345b6cc">send</a>(byte *frame)</td><td class="entry"><a class="el" href="classModbusSerial.html">ModbusSerial</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusSerial.html#a69850777f84662664dd17e137250e3b0">sendPDU</a>(byte *pduframe)</td><td class="entry"><a class="el" href="classModbusSerial.html">ModbusSerial</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="classModbusSerial.html#a2b727d4d516177e698db6e49729624d8">setSlaveId</a>(byte slaveId)</td><td class="entry"><a class="el" href="classModbusSerial.html">ModbusSerial</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classModbusSerial.html#ad47e2b6a70d42a106a1a55a515e2f33a">task</a>()</td><td class="entry"><a class="el" href="classModbusSerial.html">ModbusSerial</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,515 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: ModbusSerial Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classModbusSerial.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="classModbusSerial-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">ModbusSerial Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> over serial line Class.
<a href="classModbusSerial.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="ModbusSerial_8h_source.html">ModbusSerial.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for ModbusSerial:</div>
<div class="dyncontent">
<div class="center"><img src="classModbusSerial__inherit__graph.png" border="0" usemap="#ModbusSerial_inherit__map" alt="Inheritance graph"/></div>
<map name="ModbusSerial_inherit__map" id="ModbusSerial_inherit__map">
<area shape="rect" id="node2" href="classModbus.html" title="Modbus base class. " alt="" coords="21,5,111,259"/>
</map>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aefa9a7f9a910a311bfcd5110a6a8ab71"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusSerial.html#aefa9a7f9a910a311bfcd5110a6a8ab71">config</a> (HardwareSerial *port, long baud, byte parity=MB_PARITY_EVEN, int txenPin=-1)</td></tr>
<tr class="memdesc:aefa9a7f9a910a311bfcd5110a6a8ab71"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect an <a class="el" href="classModbusSerial.html" title="Modbus over serial line Class. ">ModbusSerial</a> object to a hardware serial port. <a href="#aefa9a7f9a910a311bfcd5110a6a8ab71">More...</a><br /></td></tr>
<tr class="separator:aefa9a7f9a910a311bfcd5110a6a8ab71"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abbe69850e5deb5c35c6a2075a372350c"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusSerial.html#abbe69850e5deb5c35c6a2075a372350c">config</a> (SoftwareSerial *port, long baud, int txenPin=-1)</td></tr>
<tr class="memdesc:abbe69850e5deb5c35c6a2075a372350c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect an <a class="el" href="classModbusSerial.html" title="Modbus over serial line Class. ">ModbusSerial</a> object to a software serial port. <a href="#abbe69850e5deb5c35c6a2075a372350c">More...</a><br /></td></tr>
<tr class="separator:abbe69850e5deb5c35c6a2075a372350c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a82286ed2d9415c624d9b557fe871d8a0"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusSerial.html#a82286ed2d9415c624d9b557fe871d8a0">config</a> (Serial_ *port, long baud, byte parity=MB_PARITY_EVEN, int txenPin=-1)</td></tr>
<tr class="memdesc:a82286ed2d9415c624d9b557fe871d8a0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect an <a class="el" href="classModbusSerial.html" title="Modbus over serial line Class. ">ModbusSerial</a> object to a hardware serial port Variant in the case of an ATMEGA32U4 (Leonardo). <a href="#a82286ed2d9415c624d9b557fe871d8a0">More...</a><br /></td></tr>
<tr class="separator:a82286ed2d9415c624d9b557fe871d8a0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adefaff8d3e8f4cfc1d90c9b52d880262"><td class="memItemLeft" align="right" valign="top">byte&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusSerial.html#adefaff8d3e8f4cfc1d90c9b52d880262">getSlaveId</a> ()</td></tr>
<tr class="memdesc:adefaff8d3e8f4cfc1d90c9b52d880262"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return slave identifier. <a href="#adefaff8d3e8f4cfc1d90c9b52d880262">More...</a><br /></td></tr>
<tr class="separator:adefaff8d3e8f4cfc1d90c9b52d880262"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:add48c6a2b436e600865e0cf63ed0aafc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusSerial.html#add48c6a2b436e600865e0cf63ed0aafc">ModbusSerial</a> ()</td></tr>
<tr class="memdesc:add48c6a2b436e600865e0cf63ed0aafc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor. <a href="#add48c6a2b436e600865e0cf63ed0aafc">More...</a><br /></td></tr>
<tr class="separator:add48c6a2b436e600865e0cf63ed0aafc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2b727d4d516177e698db6e49729624d8"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusSerial.html#a2b727d4d516177e698db6e49729624d8">setSlaveId</a> (byte slaveId)</td></tr>
<tr class="memdesc:a2b727d4d516177e698db6e49729624d8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of slave identifier. <a href="#a2b727d4d516177e698db6e49729624d8">More...</a><br /></td></tr>
<tr class="separator:a2b727d4d516177e698db6e49729624d8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad47e2b6a70d42a106a1a55a515e2f33a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusSerial.html#ad47e2b6a70d42a106a1a55a515e2f33a">task</a> ()</td></tr>
<tr class="memdesc:ad47e2b6a70d42a106a1a55a515e2f33a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Task that performs all operations on MODBUS. <a href="#ad47e2b6a70d42a106a1a55a515e2f33a">More...</a><br /></td></tr>
<tr class="separator:ad47e2b6a70d42a106a1a55a515e2f33a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classModbus"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classModbus')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classModbus.html">Modbus</a></td></tr>
<tr class="memitem:af10a81e46f971daa4ce429d39776378b inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#af10a81e46f971daa4ce429d39776378b">addCoil</a> (word offset, bool value=false)</td></tr>
<tr class="memdesc:af10a81e46f971daa4ce429d39776378b inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a coil. <a href="#af10a81e46f971daa4ce429d39776378b">More...</a><br /></td></tr>
<tr class="separator:af10a81e46f971daa4ce429d39776378b inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a73797fbd9af758aedc198ccd8f4585fb inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a73797fbd9af758aedc198ccd8f4585fb">addHreg</a> (word offset, word value=0)</td></tr>
<tr class="memdesc:a73797fbd9af758aedc198ccd8f4585fb inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a holding register to the list. <a href="#a73797fbd9af758aedc198ccd8f4585fb">More...</a><br /></td></tr>
<tr class="separator:a73797fbd9af758aedc198ccd8f4585fb inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab052ca5452b76bdb85235e898623cedc inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#ab052ca5452b76bdb85235e898623cedc">addIreg</a> (word offset, word value=0)</td></tr>
<tr class="memdesc:ab052ca5452b76bdb85235e898623cedc inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a input register. <a href="#ab052ca5452b76bdb85235e898623cedc">More...</a><br /></td></tr>
<tr class="separator:ab052ca5452b76bdb85235e898623cedc inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abead971752bc7b2a54cb508ad8a8a2c4 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#abead971752bc7b2a54cb508ad8a8a2c4">addIsts</a> (word offset, bool value=false)</td></tr>
<tr class="memdesc:abead971752bc7b2a54cb508ad8a8a2c4 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a discrete input. <a href="#abead971752bc7b2a54cb508ad8a8a2c4">More...</a><br /></td></tr>
<tr class="separator:abead971752bc7b2a54cb508ad8a8a2c4 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b5ed2b967d4c43b578d21f562abc007 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a6b5ed2b967d4c43b578d21f562abc007">Coil</a> (word offset, bool value)</td></tr>
<tr class="memdesc:a6b5ed2b967d4c43b578d21f562abc007 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of a coil This value will be returned when bus read, the master can also modify it. <a href="#a6b5ed2b967d4c43b578d21f562abc007">More...</a><br /></td></tr>
<tr class="separator:a6b5ed2b967d4c43b578d21f562abc007 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a208bb15086e008f05f2fa72398551d04 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a208bb15086e008f05f2fa72398551d04">Coil</a> (word offset)</td></tr>
<tr class="memdesc:a208bb15086e008f05f2fa72398551d04 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the value of a coil. <a href="#a208bb15086e008f05f2fa72398551d04">More...</a><br /></td></tr>
<tr class="separator:a208bb15086e008f05f2fa72398551d04 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af13802f39b91279bd55538749bb76409 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#af13802f39b91279bd55538749bb76409">Hreg</a> (word offset, word value)</td></tr>
<tr class="memdesc:af13802f39b91279bd55538749bb76409 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of a holding register This value will be returned when bus read, the master can also modify it. <a href="#af13802f39b91279bd55538749bb76409">More...</a><br /></td></tr>
<tr class="separator:af13802f39b91279bd55538749bb76409 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa6b32867beace3ce557ea61183497607 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">word&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#aa6b32867beace3ce557ea61183497607">Hreg</a> (word offset)</td></tr>
<tr class="memdesc:aa6b32867beace3ce557ea61183497607 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the value of a holding register. <a href="#aa6b32867beace3ce557ea61183497607">More...</a><br /></td></tr>
<tr class="separator:aa6b32867beace3ce557ea61183497607 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac9be098d4bff9081105b6202922b1134 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#ac9be098d4bff9081105b6202922b1134">Ireg</a> (word offset, word value)</td></tr>
<tr class="memdesc:ac9be098d4bff9081105b6202922b1134 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of an input register This value will be returned when bus read. <a href="#ac9be098d4bff9081105b6202922b1134">More...</a><br /></td></tr>
<tr class="separator:ac9be098d4bff9081105b6202922b1134 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abef420732eca033c08c131df73623521 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">word&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#abef420732eca033c08c131df73623521">Ireg</a> (word offset)</td></tr>
<tr class="memdesc:abef420732eca033c08c131df73623521 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the value of an input register. <a href="#abef420732eca033c08c131df73623521">More...</a><br /></td></tr>
<tr class="separator:abef420732eca033c08c131df73623521 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a493b0fc75ea3ba076f7c9a25e491bcbe inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a493b0fc75ea3ba076f7c9a25e491bcbe">Ists</a> (word offset, bool value)</td></tr>
<tr class="memdesc:a493b0fc75ea3ba076f7c9a25e491bcbe inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the value of a discrete input This value will be returned when bus read,. <a href="#a493b0fc75ea3ba076f7c9a25e491bcbe">More...</a><br /></td></tr>
<tr class="separator:a493b0fc75ea3ba076f7c9a25e491bcbe inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a833a76980e46be4995d2ca4ce5d2e51b inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a833a76980e46be4995d2ca4ce5d2e51b">Ists</a> (word offset)</td></tr>
<tr class="memdesc:a833a76980e46be4995d2ca4ce5d2e51b inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the value of a discrete input. <a href="#a833a76980e46be4995d2ca4ce5d2e51b">More...</a><br /></td></tr>
<tr class="separator:a833a76980e46be4995d2ca4ce5d2e51b inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a101809cdd4734537bab58dc315a840b4 inherit pub_methods_classModbus"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbus.html#a101809cdd4734537bab58dc315a840b4">Modbus</a> ()</td></tr>
<tr class="memdesc:a101809cdd4734537bab58dc315a840b4 inherit pub_methods_classModbus"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor. <a href="#a101809cdd4734537bab58dc315a840b4">More...</a><br /></td></tr>
<tr class="separator:a101809cdd4734537bab58dc315a840b4 inherit pub_methods_classModbus"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a3fb991a7b8d0d9766889e2cad7fca115"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusSerial.html#a3fb991a7b8d0d9766889e2cad7fca115">receive</a> (byte *frame)</td></tr>
<tr class="separator:a3fb991a7b8d0d9766889e2cad7fca115"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae7b2f3574d102b26a1de084cb345b6cc"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusSerial.html#ae7b2f3574d102b26a1de084cb345b6cc">send</a> (byte *frame)</td></tr>
<tr class="separator:ae7b2f3574d102b26a1de084cb345b6cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a69850777f84662664dd17e137250e3b0"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classModbusSerial.html#a69850777f84662664dd17e137250e3b0">sendPDU</a> (byte *pduframe)</td></tr>
<tr class="separator:a69850777f84662664dd17e137250e3b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classModbus.html" title="Modbus base class. ">Modbus</a> over serial line Class. </p>
<p>Definition at line <a class="el" href="ModbusSerial_8h_source.html#l00054">54</a> of file <a class="el" href="ModbusSerial_8h_source.html">ModbusSerial.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="add48c6a2b436e600865e0cf63ed0aafc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ModbusSerial::ModbusSerial </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Default constructor. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="aefa9a7f9a910a311bfcd5110a6a8ab71"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool ModbusSerial::config </td>
<td>(</td>
<td class="paramtype">HardwareSerial *&#160;</td>
<td class="paramname"><em>port</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long&#160;</td>
<td class="paramname"><em>baud</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">byte&#160;</td>
<td class="paramname"><em>parity</em> = <code>MB_PARITY_EVEN</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>txenPin</em> = <code>-1</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect an <a class="el" href="classModbusSerial.html" title="Modbus over serial line Class. ">ModbusSerial</a> object to a hardware serial port. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">port</td><td>pointer on serial port to use, &amp;Serial most of the time, or &amp;Serial1, &amp;Serial2 ... if available </td></tr>
<tr><td class="paramname">baud</td><td>baudrate </td></tr>
<tr><td class="paramname">parity</td><td>parity </td></tr>
<tr><td class="paramname">txenPin</td><td>if an RS485 circuit is used, this corresponds to the pin number connected to the transmit enable (DE) and receive disable (/RE) pin. -1 if not used. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true, false if error occured </dd></dl>
</div>
</div>
<a class="anchor" id="abbe69850e5deb5c35c6a2075a372350c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool ModbusSerial::config </td>
<td>(</td>
<td class="paramtype">SoftwareSerial *&#160;</td>
<td class="paramname"><em>port</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long&#160;</td>
<td class="paramname"><em>baud</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>txenPin</em> = <code>-1</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect an <a class="el" href="classModbusSerial.html" title="Modbus over serial line Class. ">ModbusSerial</a> object to a software serial port. </p>
<dl class="section warning"><dt>Warning</dt><dd>The SoftwareSerial use 8N1 format, this does not respect the MODBUS RTU specifications (2 stop bits if no parity)... </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">port</td><td>pointer on serial port to use </td></tr>
<tr><td class="paramname">baud</td><td>baudrate </td></tr>
<tr><td class="paramname">txenPin</td><td>if an RS485 circuit is used, this corresponds to the pin number connected to the transmit enable (DE) and receive disable (/RE) pin. -1 if not used. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true, false if error occured </dd></dl>
</div>
</div>
<a class="anchor" id="a82286ed2d9415c624d9b557fe871d8a0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool ModbusSerial::config </td>
<td>(</td>
<td class="paramtype">Serial_ *&#160;</td>
<td class="paramname"><em>port</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long&#160;</td>
<td class="paramname"><em>baud</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">byte&#160;</td>
<td class="paramname"><em>parity</em> = <code>MB_PARITY_EVEN</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>txenPin</em> = <code>-1</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Connect an <a class="el" href="classModbusSerial.html" title="Modbus over serial line Class. ">ModbusSerial</a> object to a hardware serial port Variant in the case of an ATMEGA32U4 (Leonardo). </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">port</td><td>pointer on serial port to use, &amp;Serial most of the time, or &amp;Serial1, &amp;Serial2 ... if available </td></tr>
<tr><td class="paramname">baud</td><td>baudrate </td></tr>
<tr><td class="paramname">parity</td><td>parity </td></tr>
<tr><td class="paramname">txenPin</td><td>if an RS485 circuit is used, this corresponds to the pin number connected to the transmit enable (DE) and receive disable (/RE) pin. -1 if not used. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true, false if error occured </dd></dl>
</div>
</div>
<a class="anchor" id="adefaff8d3e8f4cfc1d90c9b52d880262"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">byte ModbusSerial::getSlaveId </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return slave identifier. </p>
</div>
</div>
<a class="anchor" id="a3fb991a7b8d0d9766889e2cad7fca115"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool ModbusSerial::receive </td>
<td>(</td>
<td class="paramtype">byte *&#160;</td>
<td class="paramname"><em>frame</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="ae7b2f3574d102b26a1de084cb345b6cc"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool ModbusSerial::send </td>
<td>(</td>
<td class="paramtype">byte *&#160;</td>
<td class="paramname"><em>frame</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a69850777f84662664dd17e137250e3b0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool ModbusSerial::sendPDU </td>
<td>(</td>
<td class="paramtype">byte *&#160;</td>
<td class="paramname"><em>pduframe</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a2b727d4d516177e698db6e49729624d8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool ModbusSerial::setSlaveId </td>
<td>(</td>
<td class="paramtype">byte&#160;</td>
<td class="paramname"><em>slaveId</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Change the value of slave identifier. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">slaveId</td><td>identifier 1-247 </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true, false if error occured </dd></dl>
</div>
</div>
<a class="anchor" id="ad47e2b6a70d42a106a1a55a515e2f33a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ModbusSerial::task </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Task that performs all operations on MODBUS. </p>
<p>Call once inside loop(), all magic here ! </p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="classModbusSerial.html">ModbusSerial</a></li>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,13 @@
var classModbusSerial =
[
[ "ModbusSerial", "classModbusSerial.html#add48c6a2b436e600865e0cf63ed0aafc", null ],
[ "config", "classModbusSerial.html#aefa9a7f9a910a311bfcd5110a6a8ab71", null ],
[ "config", "classModbusSerial.html#abbe69850e5deb5c35c6a2075a372350c", null ],
[ "config", "classModbusSerial.html#a82286ed2d9415c624d9b557fe871d8a0", null ],
[ "getSlaveId", "classModbusSerial.html#adefaff8d3e8f4cfc1d90c9b52d880262", null ],
[ "receive", "classModbusSerial.html#a3fb991a7b8d0d9766889e2cad7fca115", null ],
[ "send", "classModbusSerial.html#ae7b2f3574d102b26a1de084cb345b6cc", null ],
[ "sendPDU", "classModbusSerial.html#a69850777f84662664dd17e137250e3b0", null ],
[ "setSlaveId", "classModbusSerial.html#a2b727d4d516177e698db6e49729624d8", null ],
[ "task", "classModbusSerial.html#ad47e2b6a70d42a106a1a55a515e2f33a", null ]
];

@ -0,0 +1,3 @@
<map id="ModbusSerial" name="ModbusSerial">
<area shape="rect" id="node2" href="$classModbus.html" title="Modbus base class. " alt="" coords="21,5,111,259"/>
</map>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -0,0 +1,4 @@
<map id="Modbus" name="Modbus">
<area shape="rect" id="node2" href="$classModbusIP.html" title="Modbus over TCP/IP network Class for Arduino Ethernet shield. " alt="" coords="5,307,104,531"/>
<area shape="rect" id="node3" href="$classModbusSerial.html" title="Modbus over serial line Class. " alt="" coords="129,314,250,523"/>
</map>

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@ -0,0 +1,133 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: Class Index</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li class="current"><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classes.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Class Index</div> </div>
</div><!--header-->
<div class="contents">
<div class="qindex"><a class="qindex" href="#letter_M">M</a></div>
<table class="classindex">
<tr><td rowspan="2" valign="bottom"><a name="letter_M"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;M&#160;&#160;</div></td></tr></table>
</td><td valign="top"><a class="el" href="classModbusIP.html">ModbusIP</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classModbusIP__ESP8266AT.html">ModbusIP_ESP8266AT</a>&#160;&#160;&#160;</td><td></td></tr>
<tr><td valign="top"><a class="el" href="classModbusIP__ENC28J60.html">ModbusIP_ENC28J60</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classModbusSerial.html">ModbusSerial</a>&#160;&#160;&#160;</td><td></td></tr>
<tr><td valign="top"><a class="el" href="classModbus.html">Modbus</a>&#160;&#160;&#160;</td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td></tr>
</table>
<div class="qindex"><a class="qindex" href="#letter_M">M</a></div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

@ -0,0 +1,123 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: ModbusIP_ESP8266AT Directory Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('dir_3f5e39fb36414adb637ec20326caccc2.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">ModbusIP_ESP8266AT Directory Reference</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a>
Files</h2></td></tr>
<tr class="memitem:ModbusIP__ESP8266AT_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>ModbusIP_ESP8266AT.h</b> <a href="ModbusIP__ESP8266AT_8h_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_bc0718b08fb2015b8e59c47b2805f60c.html">libraries</a></li><li class="navelem"><a class="el" href="dir_3f5e39fb36414adb637ec20326caccc2.html">ModbusIP_ESP8266AT</a></li>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,123 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: ModbusIP Directory Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('dir_51675f879e41ba5281dde78f999c1732.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">ModbusIP Directory Reference</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a>
Files</h2></td></tr>
<tr class="memitem:ModbusIP_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>ModbusIP.h</b> <a href="ModbusIP_8h_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_bc0718b08fb2015b8e59c47b2805f60c.html">libraries</a></li><li class="navelem"><a class="el" href="dir_51675f879e41ba5281dde78f999c1732.html">ModbusIP</a></li>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,123 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: ModbusIP_ENC28J60 Directory Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('dir_5ac0cf6acd9f1a97dbbafe5d659a6e56.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">ModbusIP_ENC28J60 Directory Reference</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a>
Files</h2></td></tr>
<tr class="memitem:ModbusIP__ENC28J60_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>ModbusIP_ENC28J60.h</b> <a href="ModbusIP__ENC28J60_8h_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_bc0718b08fb2015b8e59c47b2805f60c.html">libraries</a></li><li class="navelem"><a class="el" href="dir_5ac0cf6acd9f1a97dbbafe5d659a6e56.html">ModbusIP_ENC28J60</a></li>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,123 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: ModbusSerial Directory Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('dir_b54e0a2b0f0dd993b2c80a66bde8de0f.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">ModbusSerial Directory Reference</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a>
Files</h2></td></tr>
<tr class="memitem:ModbusSerial_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>ModbusSerial.h</b> <a href="ModbusSerial_8h_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_bc0718b08fb2015b8e59c47b2805f60c.html">libraries</a></li><li class="navelem"><a class="el" href="dir_b54e0a2b0f0dd993b2c80a66bde8de0f.html">ModbusSerial</a></li>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,123 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: Modbus Directory Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('dir_b68070abd0927afc37f6892e9bcc19ad.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Modbus Directory Reference</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a>
Files</h2></td></tr>
<tr class="memitem:Modbus_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>Modbus.h</b> <a href="Modbus_8h_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_bc0718b08fb2015b8e59c47b2805f60c.html">libraries</a></li><li class="navelem"><a class="el" href="dir_b68070abd0927afc37f6892e9bcc19ad.html">Modbus</a></li>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

@ -0,0 +1,131 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>modbus-arduino: libraries Directory Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="modbus.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">modbus-arduino
&#160;<span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Modbus library for Arduino</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('dir_bc0718b08fb2015b8e59c47b2805f60c.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">libraries Directory Reference</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="subdirs"></a>
Directories</h2></td></tr>
<tr class="memitem:dir_b68070abd0927afc37f6892e9bcc19ad"><td class="memItemLeft" align="right" valign="top">directory &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dir_b68070abd0927afc37f6892e9bcc19ad.html">Modbus</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:dir_51675f879e41ba5281dde78f999c1732"><td class="memItemLeft" align="right" valign="top">directory &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dir_51675f879e41ba5281dde78f999c1732.html">ModbusIP</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:dir_5ac0cf6acd9f1a97dbbafe5d659a6e56"><td class="memItemLeft" align="right" valign="top">directory &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dir_5ac0cf6acd9f1a97dbbafe5d659a6e56.html">ModbusIP_ENC28J60</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:dir_3f5e39fb36414adb637ec20326caccc2"><td class="memItemLeft" align="right" valign="top">directory &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dir_3f5e39fb36414adb637ec20326caccc2.html">ModbusIP_ESP8266AT</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:dir_b54e0a2b0f0dd993b2c80a66bde8de0f"><td class="memItemLeft" align="right" valign="top">directory &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dir_b54e0a2b0f0dd993b2c80a66bde8de0f.html">ModbusSerial</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_bc0718b08fb2015b8e59c47b2805f60c.html">libraries</a></li>
<li class="footer">Generated on Fri Jan 19 2018 01:17:49 for modbus-arduino by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

@ -0,0 +1,104 @@
function toggleVisibility(linkObj)
{
var base = $(linkObj).attr('id');
var summary = $('#'+base+'-summary');
var content = $('#'+base+'-content');
var trigger = $('#'+base+'-trigger');
var src=$(trigger).attr('src');
if (content.is(':visible')===true) {
content.hide();
summary.show();
$(linkObj).addClass('closed').removeClass('opened');
$(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
} else {
content.show();
summary.hide();
$(linkObj).removeClass('closed').addClass('opened');
$(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
}
return false;
}
function updateStripes()
{
$('table.directory tr').
removeClass('even').filter(':visible:even').addClass('even');
}
function toggleLevel(level)
{
$('table.directory tr').each(function() {
var l = this.id.split('_').length-1;
var i = $('#img'+this.id.substring(3));
var a = $('#arr'+this.id.substring(3));
if (l<level+1) {
i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
a.html('&#9660;');
$(this).show();
} else if (l==level+1) {
i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
a.html('&#9658;');
$(this).show();
} else {
$(this).hide();
}
});
updateStripes();
}
function toggleFolder(id)
{
// the clicked row
var currentRow = $('#row_'+id);
// all rows after the clicked row
var rows = currentRow.nextAll("tr");
var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
// only match elements AFTER this one (can't hide elements before)
var childRows = rows.filter(function() { return this.id.match(re); });
// first row is visible we are HIDING
if (childRows.filter(':first').is(':visible')===true) {
// replace down arrow by right arrow for current row
var currentRowSpans = currentRow.find("span");
currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
currentRowSpans.filter(".arrow").html('&#9658;');
rows.filter("[id^=row_"+id+"]").hide(); // hide all children
} else { // we are SHOWING
// replace right arrow by down arrow for current row
var currentRowSpans = currentRow.find("span");
currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
currentRowSpans.filter(".arrow").html('&#9660;');
// replace down arrows by right arrows for child rows
var childRowsSpans = childRows.find("span");
childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
childRowsSpans.filter(".arrow").html('&#9658;');
childRows.show(); //show all children
}
updateStripes();
}
function toggleInherit(id)
{
var rows = $('tr.inherit.'+id);
var img = $('tr.inherit_header.'+id+' img');
var src = $(img).attr('src');
if (rows.filter(':first').is(':visible')===true) {
rows.css('display','none');
$(img).attr('src',src.substring(0,src.length-8)+'closed.png');
} else {
rows.css('display','table-row'); // using show() causes jump in firefox
$(img).attr('src',src.substring(0,src.length-10)+'open.png');
}
}
$(document).ready(function() {
$('.code,.codeRef').each(function() {
$(this).data('powertip',$('#'+$(this).attr('href').replace(/.*\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html());
$(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true });
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

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

Loading…
Cancel
Save