SDI12.h file
This file contains the main class for the SDI-12 implementation.
========================== Arduino SDI-12 ==================================
An Arduino library for SDI-12 communication with a wide variety of environmental sensors. This library provides a general software solution, without requiring any additional hardware.
======================== Attribution & License =============================
Copyright (C) 2013 Stroud Water Research Center Available at https:/
Authored initially in August 2013 by: Kevin M. Smith (http:/
Modified 2017 by Manuel Jimenez Buendia to work with ARM based processors (Arduino Zero)
Maintenance and merging 2017 by Sara Damiano
based on the SoftwareSerial library (formerly NewSoftSerial), authored by: ladyada (http:/
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Classes
- class SDI12
- The main class for SDI 12 instances.
Enums
- enum LookaheadMode { SKIP_ALL, SKIP_NONE, SKIP_WHITESPACE }
- This enumeration provides the lookahead options for parseInt(), parseFloat().
- enum SDI12BinaryDataType_e: uint8_t { kInvalidDataType = 0, kInt8DataType = 1, kUint8DataType = 2, kInt16DataType = 3, kUint16DataType = 4, kInt32DataType = 5, kUint32DataType = 6, kInt64DataType = 7, kUint64DataType = 8, kFloatDataType = 9, kDoubleDataType = 10 }
- Enumerated type to reference the type of supported binary data types for binary measurements.
Typedefs
- using FlashString = const __FlashStringHelper*
- Helper for strings stored in flash.
-
using SDI12BinaryDataType_e = enum SDI12BinaryDataType_
e - Enumerated type to reference the type of supported binary data types for binary measurements.
Defines
-
#define SDI12_BIT_WIDTH_MICROS = static_cast
(833) - The size of a bit in microseconds.
- #define WAITING_FOR_START_BIT = 0xFF
- A mask for the rxState while waiting for a start bit; 0b11111111.
- #define NO_IGNORE_CHAR = '\x01'
- a char not found in a valid ASCII numeric field
- #define SDI12_CRC_POLY = 0xa001
- The polynomial to match the CRC-16 with; set in the SDI-12 specifications.
- #define NEED_LOOKAHEAD_ENUM
- This macro is defined if lookahead options are needed.
Enum documentation
enum LookaheadMode
This enumeration provides the lookahead options for parseInt(), parseFloat().
The rules set out here are used until either the first valid character is found or a time out occurs due to lack of input.
This enum is part of the Stream parent class, but is missing from the ESP8266 core and ESP32 cores prior to 3.0 (IDF prior to 5.1).
| Enumerators | |
|---|---|
| SKIP_ALL |
All invalid characters are ignored. |
| SKIP_NONE |
Nothing is skipped, and the stream is not touched unless the first waiting character is valid. |
| SKIP_WHITESPACE |
Only tabs, spaces, line feeds & carriage returns are skipped. |
enum SDI12BinaryDataType_e: uint8_t
Enumerated type to reference the type of supported binary data types for binary measurements.
The least significant byte is transferred first for multi-byte binary numbers.
| Enumerators | |
|---|---|
| kInvalidDataType |
Invalid data or Empty data type. |
| kInt8DataType |
Signed 8-bit integer. |
| kUint8DataType |
Unsigned 8-bit integer. |
| kInt16DataType |
Signed 16-bit integer. |
| kUint16DataType |
Unsigned 16-bit integer. |
| kInt32DataType |
Signed 32-bit integer. |
| kUint32DataType |
Unsigned 32-bit integer. |
| kInt64DataType |
Signed 64-bit integer. |
| kUint64DataType |
Unsigned 64-bit integer. |
| kFloatDataType |
IEEE 32-bit floating point single precision. |
| kDoubleDataType |
IEEE 64-bit floating point double precision. |
Typedef documentation
typedef enum SDI12BinaryDataType_ e SDI12BinaryDataType_e
Enumerated type to reference the type of supported binary data types for binary measurements.
The least significant byte is transferred first for multi-byte binary numbers.
Define documentation
#define SDI12_BIT_WIDTH_MICROS = static_cast(833)
The size of a bit in microseconds.
1200 baud = 1200 bits/second ~ 833.333 µs/bit