├── .gitignore ├── Boards.h ├── Firmata.cpp ├── Firmata.h ├── FirmataConstants.h ├── FirmataDefines.h ├── FirmataMarshaller.cpp ├── FirmataMarshaller.h ├── FirmataParser.cpp ├── FirmataParser.h ├── LICENSE.txt ├── docs ├── .nojekyll ├── Doxyfile ├── html │ ├── _boards_8h_source.html │ ├── _firmata_8h_source.html │ ├── _firmata_constants_8h_source.html │ ├── _firmata_defines_8h_source.html │ ├── _firmata_marshaller_8h_source.html │ ├── _firmata_parser_8h_source.html │ ├── annotated.html │ ├── bc_s.png │ ├── bdwn.png │ ├── classes.html │ ├── classfirmata_1_1_firmata_class-members.html │ ├── classfirmata_1_1_firmata_class.html │ ├── classfirmata_1_1_firmata_marshaller-members.html │ ├── classfirmata_1_1_firmata_marshaller.html │ ├── classfirmata_1_1_firmata_parser-members.html │ ├── classfirmata_1_1_firmata_parser.html │ ├── closed.png │ ├── doc.png │ ├── doxygen.css │ ├── doxygen.png │ ├── dynsections.js │ ├── files.html │ ├── folderclosed.png │ ├── folderopen.png │ ├── functions.html │ ├── functions_func.html │ ├── index.html │ ├── jquery.js │ ├── md_readme.html │ ├── menu.js │ ├── menudata.js │ ├── nav_f.png │ ├── nav_g.png │ ├── nav_h.png │ ├── open.png │ ├── pages.html │ ├── search │ │ ├── all_0.html │ │ ├── all_0.js │ │ ├── all_1.html │ │ ├── all_1.js │ │ ├── all_2.html │ │ ├── all_2.js │ │ ├── all_3.html │ │ ├── all_3.js │ │ ├── all_4.html │ │ ├── all_4.js │ │ ├── all_5.html │ │ ├── all_5.js │ │ ├── all_6.html │ │ ├── all_6.js │ │ ├── all_7.html │ │ ├── all_7.js │ │ ├── all_8.html │ │ ├── all_8.js │ │ ├── all_9.html │ │ ├── all_9.js │ │ ├── all_a.html │ │ ├── all_a.js │ │ ├── all_b.html │ │ ├── all_b.js │ │ ├── classes_0.html │ │ ├── classes_0.js │ │ ├── close.png │ │ ├── functions_0.html │ │ ├── functions_0.js │ │ ├── functions_1.html │ │ ├── functions_1.js │ │ ├── functions_2.html │ │ ├── functions_2.js │ │ ├── functions_3.html │ │ ├── functions_3.js │ │ ├── functions_4.html │ │ ├── functions_4.js │ │ ├── functions_5.html │ │ ├── functions_5.js │ │ ├── functions_6.html │ │ ├── functions_6.js │ │ ├── functions_7.html │ │ ├── functions_7.js │ │ ├── functions_8.html │ │ ├── functions_8.js │ │ ├── functions_9.html │ │ ├── functions_9.js │ │ ├── functions_a.html │ │ ├── functions_a.js │ │ ├── functions_b.html │ │ ├── functions_b.js │ │ ├── mag_sel.png │ │ ├── nomatches.html │ │ ├── pages_0.html │ │ ├── pages_0.js │ │ ├── search.css │ │ ├── search.js │ │ ├── search_l.png │ │ ├── search_m.png │ │ ├── search_r.png │ │ └── searchdata.js │ ├── splitbar.png │ ├── sync_off.png │ ├── sync_on.png │ ├── tab_a.png │ ├── tab_b.png │ ├── tab_h.png │ ├── tab_s.png │ └── tabs.css └── index.html ├── examples ├── AllInputsFirmata │ └── AllInputsFirmata.ino ├── AnalogFirmata │ └── AnalogFirmata.ino ├── EchoString │ └── EchoString.ino ├── OldStandardFirmata │ ├── LICENSE.txt │ └── OldStandardFirmata.ino ├── ServoFirmata │ └── ServoFirmata.ino ├── SimpleAnalogFirmata │ └── SimpleAnalogFirmata.ino ├── SimpleDigitalFirmata │ └── SimpleDigitalFirmata.ino ├── StandardFirmata │ ├── LICENSE.txt │ └── StandardFirmata.ino ├── StandardFirmataBLE │ ├── LICENSE.txt │ ├── StandardFirmataBLE.ino │ └── bleConfig.h ├── StandardFirmataChipKIT │ ├── LICENSE.txt │ └── StandardFirmataChipKIT.ino ├── StandardFirmataEthernet │ ├── LICENSE.txt │ ├── StandardFirmataEthernet.ino │ └── ethernetConfig.h ├── StandardFirmataPlus │ ├── LICENSE.txt │ └── StandardFirmataPlus.ino └── StandardFirmataWiFi │ ├── LICENSE.txt │ ├── StandardFirmataWiFi.ino │ └── wifiConfig.h ├── extras └── revisions.txt ├── keywords.txt ├── library.properties ├── readme.md ├── release.sh └── utility ├── ArduinoBLE_UART_Stream.cpp ├── ArduinoBLE_UART_Stream.h ├── BLEStream.cpp ├── BLEStream.h ├── BluefruitLE_SPI_Stream.cpp ├── BluefruitLE_SPI_Stream.h ├── EthernetClientStream.cpp ├── EthernetClientStream.h ├── EthernetServerStream.cpp ├── EthernetServerStream.h ├── FirmataFeature.h ├── SerialFirmata.cpp ├── SerialFirmata.h ├── WiFiClientStream.h ├── WiFiServerStream.h ├── WiFiStream.cpp ├── WiFiStream.h └── firmataDebug.h /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /Firmata.h: -------------------------------------------------------------------------------- 1 | /* 2 | Firmata.h - Firmata library v2.5.8 - 2018-04-15 3 | Copyright (c) 2006-2008 Hans-Christoph Steiner. All rights reserved. 4 | Copyright (C) 2009-2017 Jeff Hoefs. All rights reserved. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | See file LICENSE.txt for further informations on licensing terms. 12 | */ 13 | 14 | #ifndef Firmata_h 15 | #define Firmata_h 16 | 17 | #include "Boards.h" /* Hardware Abstraction Layer + Wiring/Arduino */ 18 | #include "FirmataDefines.h" 19 | #include "FirmataMarshaller.h" 20 | #include "FirmataParser.h" 21 | 22 | /* DEPRECATED as of Firmata v2.5.1. As of 2.5.1 there are separate version numbers for 23 | * the protocol version and the firmware version. 24 | */ 25 | #define FIRMATA_MAJOR_VERSION 2 // same as FIRMATA_PROTOCOL_MAJOR_VERSION 26 | #define FIRMATA_MINOR_VERSION 5 // same as FIRMATA_PROTOCOL_MINOR_VERSION 27 | #define FIRMATA_BUGFIX_VERSION 1 // same as FIRMATA_PROTOCOL_BUGFIX_VERSION 28 | 29 | // extended command set using sysex (0-127/0x00-0x7F) 30 | /* 0x00-0x0F reserved for user-defined commands */ 31 | // these are DEPRECATED to make the naming more consistent 32 | #define FIRMATA_STRING 0x71 // same as STRING_DATA 33 | #define SYSEX_I2C_REQUEST 0x76 // same as I2C_REQUEST 34 | #define SYSEX_I2C_REPLY 0x77 // same as I2C_REPLY 35 | #define SYSEX_SAMPLING_INTERVAL 0x7A // same as SAMPLING_INTERVAL 36 | 37 | // pin modes 38 | //#define INPUT 0x00 // defined in Arduino.h 39 | //#define OUTPUT 0x01 // defined in Arduino.h 40 | // DEPRECATED as of Firmata v2.5 41 | #define ANALOG 0x02 // same as PIN_MODE_ANALOG 42 | #define PWM 0x03 // same as PIN_MODE_PWM 43 | #define SERVO 0x04 // same as PIN_MODE_SERVO 44 | #define SHIFT 0x05 // same as PIN_MODE_SHIFT 45 | #define I2C 0x06 // same as PIN_MODE_I2C 46 | #define ONEWIRE 0x07 // same as PIN_MODE_ONEWIRE 47 | #define STEPPER 0x08 // same as PIN_MODE_STEPPER 48 | #define ENCODER 0x09 // same as PIN_MODE_ENCODER 49 | #define IGNORE 0x7F // same as PIN_MODE_IGNORE 50 | 51 | namespace firmata { 52 | 53 | // TODO make it a subclass of a generic Serial/Stream base class 54 | class FirmataClass 55 | { 56 | public: 57 | typedef void (*callbackFunction)(uint8_t, int); 58 | typedef void (*systemCallbackFunction)(void); 59 | typedef void (*stringCallbackFunction)(char *); 60 | typedef void (*sysexCallbackFunction)(uint8_t command, uint8_t argc, uint8_t *argv); 61 | 62 | FirmataClass(); 63 | 64 | /* Arduino constructors */ 65 | void begin(); 66 | void begin(long); 67 | void begin(Stream &s); 68 | 69 | /* querying functions */ 70 | void printVersion(void); 71 | void blinkVersion(void); 72 | void printFirmwareVersion(void); 73 | 74 | //void setFirmwareVersion(byte major, byte minor); // see macro below 75 | void setFirmwareNameAndVersion(const char *name, byte major, byte minor); 76 | void disableBlinkVersion(); 77 | 78 | /* serial receive handling */ 79 | int available(void); 80 | void processInput(void); 81 | void parse(unsigned char value); 82 | boolean isParsingMessage(void); 83 | 84 | /* serial send handling */ 85 | void sendAnalog(byte pin, int value); 86 | void sendDigital(byte pin, int value); // TODO implement this 87 | void sendDigitalPort(byte portNumber, int portData); 88 | void sendString(const char *string); 89 | void sendString(byte command, const char *string); 90 | void sendSysex(byte command, byte bytec, byte *bytev); 91 | void write(byte c); 92 | 93 | /* attach & detach callback functions to messages */ 94 | void attach(uint8_t command, callbackFunction newFunction); 95 | void attach(uint8_t command, systemCallbackFunction newFunction); 96 | void attach(uint8_t command, stringCallbackFunction newFunction); 97 | void attach(uint8_t command, sysexCallbackFunction newFunction); 98 | void detach(uint8_t command); 99 | 100 | /* access pin state and config */ 101 | byte getPinMode(byte pin); 102 | void setPinMode(byte pin, byte config); 103 | 104 | /* access pin state */ 105 | int getPinState(byte pin); 106 | void setPinState(byte pin, int state); 107 | 108 | /* utility methods */ 109 | void sendValueAsTwo7bitBytes(int value); 110 | void startSysex(void); 111 | void endSysex(void); 112 | 113 | private: 114 | uint8_t parserBuffer[MAX_DATA_BYTES]; 115 | FirmataMarshaller marshaller; 116 | FirmataParser parser; 117 | Stream *FirmataStream; 118 | 119 | /* firmware name and version */ 120 | byte firmwareVersionCount; 121 | byte *firmwareVersionVector; 122 | 123 | /* pin configuration */ 124 | byte pinConfig[TOTAL_PINS]; 125 | int pinState[TOTAL_PINS]; 126 | 127 | boolean blinkVersionDisabled; 128 | 129 | /* private methods ------------------------------ */ 130 | void strobeBlinkPin(byte pin, int count, int onInterval, int offInterval); 131 | friend void FirmataMarshaller::encodeByteStream (size_t bytec, uint8_t * bytev, size_t max_bytes) const; 132 | 133 | /* callback functions */ 134 | static callbackFunction currentAnalogCallback; 135 | static callbackFunction currentDigitalCallback; 136 | static callbackFunction currentPinModeCallback; 137 | static callbackFunction currentPinValueCallback; 138 | static callbackFunction currentReportAnalogCallback; 139 | static callbackFunction currentReportDigitalCallback; 140 | static stringCallbackFunction currentStringCallback; 141 | static sysexCallbackFunction currentSysexCallback; 142 | static systemCallbackFunction currentSystemResetCallback; 143 | 144 | /* static callbacks */ 145 | inline static void staticAnalogCallback (void *, uint8_t command, uint16_t value) { if ( currentAnalogCallback ) { currentAnalogCallback(command,(int)value); } } 146 | inline static void staticDigitalCallback (void *, uint8_t command, uint16_t value) { if ( currentDigitalCallback ) { currentDigitalCallback(command, (int)value); } } 147 | inline static void staticPinModeCallback (void *, uint8_t command, uint16_t value) { if ( currentPinModeCallback ) { currentPinModeCallback(command, (int)value); } } 148 | inline static void staticPinValueCallback (void *, uint8_t command, uint16_t value) { if ( currentPinValueCallback ) { currentPinValueCallback(command, (int)value); } } 149 | inline static void staticReportAnalogCallback (void *, uint8_t command, uint16_t value) { if ( currentReportAnalogCallback ) { currentReportAnalogCallback(command, (int)value); } } 150 | inline static void staticReportDigitalCallback (void *, uint8_t command, uint16_t value) { if ( currentReportDigitalCallback ) { currentReportDigitalCallback(command, (int)value); } } 151 | inline static void staticStringCallback (void *, const char * c_str) { if ( currentStringCallback ) { currentStringCallback((char *)c_str); } } 152 | inline static void staticSysexCallback (void *, uint8_t command, size_t argc, uint8_t *argv) { if ( currentSysexCallback ) { currentSysexCallback(command, (uint8_t)argc, argv); } } 153 | inline static void staticReportFirmwareCallback (void * context, size_t, size_t, const char *) { if ( context ) { ((FirmataClass *)context)->printFirmwareVersion(); } } 154 | inline static void staticReportVersionCallback (void * context) { if ( context ) { ((FirmataClass *)context)->printVersion(); } } 155 | inline static void staticSystemResetCallback (void *) { if ( currentSystemResetCallback ) { currentSystemResetCallback(); } } 156 | }; 157 | 158 | } // namespace firmata 159 | 160 | extern "C" { 161 | // callback function types 162 | typedef firmata::FirmataClass::callbackFunction callbackFunction; 163 | typedef firmata::FirmataClass::systemCallbackFunction systemCallbackFunction; 164 | typedef firmata::FirmataClass::stringCallbackFunction stringCallbackFunction; 165 | typedef firmata::FirmataClass::sysexCallbackFunction sysexCallbackFunction; 166 | } 167 | 168 | extern firmata::FirmataClass Firmata; 169 | 170 | /*============================================================================== 171 | * MACROS 172 | *============================================================================*/ 173 | 174 | /* shortcut for setFirmwareNameAndVersion() that uses __FILE__ to set the 175 | * firmware name. It needs to be a macro so that __FILE__ is included in the 176 | * firmware source file rather than the library source file. 177 | */ 178 | #define setFirmwareVersion(x, y) setFirmwareNameAndVersion(__FILE__, x, y) 179 | 180 | #endif /* Firmata_h */ 181 | -------------------------------------------------------------------------------- /FirmataConstants.h: -------------------------------------------------------------------------------- 1 | /* 2 | FirmataConstants.h 3 | Copyright (c) 2006-2008 Hans-Christoph Steiner. All rights reserved. 4 | Copyright (C) 2009-2017 Jeff Hoefs. All rights reserved. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | See file LICENSE.txt for further informations on licensing terms. 12 | */ 13 | 14 | #ifndef FirmataConstants_h 15 | #define FirmataConstants_h 16 | 17 | namespace firmata { 18 | /* Version numbers for the Firmata library. 19 | * The firmware version will not always equal the protocol version going forward. 20 | * Query using the REPORT_FIRMWARE message. 21 | */ 22 | static const int FIRMWARE_MAJOR_VERSION = 2; 23 | static const int FIRMWARE_MINOR_VERSION = 5; 24 | static const int FIRMWARE_BUGFIX_VERSION = 7; 25 | 26 | /* Version numbers for the protocol. The protocol is still changing, so these 27 | * version numbers are important. 28 | * Query using the REPORT_VERSION message. 29 | */ 30 | static const int PROTOCOL_MAJOR_VERSION = 2; // for non-compatible changes 31 | static const int PROTOCOL_MINOR_VERSION = 5; // for backwards compatible changes 32 | static const int PROTOCOL_BUGFIX_VERSION = 1; // for bugfix releases 33 | 34 | static const int MAX_DATA_BYTES = 64; // max number of data bytes in incoming messages 35 | 36 | // message command bytes (128-255/0x80-0xFF) 37 | 38 | static const int DIGITAL_MESSAGE = 0x90; // send data for a digital port (collection of 8 pins) 39 | static const int ANALOG_MESSAGE = 0xE0; // send data for an analog pin (or PWM) 40 | static const int REPORT_ANALOG = 0xC0; // enable analog input by pin # 41 | static const int REPORT_DIGITAL = 0xD0; // enable digital input by port pair 42 | // 43 | static const int SET_PIN_MODE = 0xF4; // set a pin to INPUT/OUTPUT/PWM/etc 44 | static const int SET_DIGITAL_PIN_VALUE = 0xF5; // set value of an individual digital pin 45 | // 46 | static const int REPORT_VERSION = 0xF9; // report protocol version 47 | static const int SYSTEM_RESET = 0xFF; // reset from MIDI 48 | // 49 | static const int START_SYSEX = 0xF0; // start a MIDI Sysex message 50 | static const int END_SYSEX = 0xF7; // end a MIDI Sysex message 51 | 52 | // extended command set using sysex (0-127/0x00-0x7F) 53 | /* 0x00-0x0F reserved for user-defined commands */ 54 | 55 | static const int SERIAL_DATA = 0x60; // communicate with serial devices, including other boards 56 | static const int ENCODER_DATA = 0x61; // reply with encoders current positions 57 | static const int SERVO_CONFIG = 0x70; // set max angle, minPulse, maxPulse, freq 58 | static const int STRING_DATA = 0x71; // a string message with 14-bits per char 59 | static const int STEPPER_DATA = 0x72; // control a stepper motor 60 | static const int ONEWIRE_DATA = 0x73; // send an OneWire read/write/reset/select/skip/search request 61 | static const int SHIFT_DATA = 0x75; // a bitstream to/from a shift register 62 | static const int I2C_REQUEST = 0x76; // send an I2C read/write request 63 | static const int I2C_REPLY = 0x77; // a reply to an I2C read request 64 | static const int I2C_CONFIG = 0x78; // config I2C settings such as delay times and power pins 65 | static const int REPORT_FIRMWARE = 0x79; // report name and version of the firmware 66 | static const int EXTENDED_ANALOG = 0x6F; // analog write (PWM, Servo, etc) to any pin 67 | static const int PIN_STATE_QUERY = 0x6D; // ask for a pin's current mode and value 68 | static const int PIN_STATE_RESPONSE = 0x6E; // reply with pin's current mode and value 69 | static const int CAPABILITY_QUERY = 0x6B; // ask for supported modes and resolution of all pins 70 | static const int CAPABILITY_RESPONSE = 0x6C; // reply with supported modes and resolution 71 | static const int ANALOG_MAPPING_QUERY = 0x69; // ask for mapping of analog to pin numbers 72 | static const int ANALOG_MAPPING_RESPONSE = 0x6A; // reply with mapping info 73 | static const int SAMPLING_INTERVAL = 0x7A; // set the poll rate of the main loop 74 | static const int SCHEDULER_DATA = 0x7B; // send a createtask/deletetask/addtotask/schedule/querytasks/querytask request to the scheduler 75 | static const int SYSEX_NON_REALTIME = 0x7E; // MIDI Reserved for non-realtime messages 76 | static const int SYSEX_REALTIME = 0x7F; // MIDI Reserved for realtime messages 77 | 78 | // pin modes 79 | static const int PIN_MODE_INPUT = 0x00; // same as INPUT defined in Arduino.h 80 | static const int PIN_MODE_OUTPUT = 0x01; // same as OUTPUT defined in Arduino.h 81 | static const int PIN_MODE_ANALOG = 0x02; // analog pin in analogInput mode 82 | static const int PIN_MODE_PWM = 0x03; // digital pin in PWM output mode 83 | static const int PIN_MODE_SERVO = 0x04; // digital pin in Servo output mode 84 | static const int PIN_MODE_SHIFT = 0x05; // shiftIn/shiftOut mode 85 | static const int PIN_MODE_I2C = 0x06; // pin included in I2C setup 86 | static const int PIN_MODE_ONEWIRE = 0x07; // pin configured for 1-wire 87 | static const int PIN_MODE_STEPPER = 0x08; // pin configured for stepper motor 88 | static const int PIN_MODE_ENCODER = 0x09; // pin configured for rotary encoders 89 | static const int PIN_MODE_SERIAL = 0x0A; // pin configured for serial communication 90 | static const int PIN_MODE_PULLUP = 0x0B; // enable internal pull-up resistor for pin 91 | static const int PIN_MODE_IGNORE = 0x7F; // pin configured to be ignored by digitalWrite and capabilityResponse 92 | 93 | static const int TOTAL_PIN_MODES = 13; 94 | 95 | } // namespace firmata 96 | 97 | #endif // FirmataConstants_h 98 | -------------------------------------------------------------------------------- /FirmataMarshaller.h: -------------------------------------------------------------------------------- 1 | /* 2 | FirmataMarshaller.h 3 | Copyright (c) 2006-2008 Hans-Christoph Steiner. All rights reserved. 4 | Copyright (C) 2009-2016 Jeff Hoefs. All rights reserved. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | See file LICENSE.txt for further informations on licensing terms. 12 | */ 13 | 14 | #ifndef FirmataMarshaller_h 15 | #define FirmataMarshaller_h 16 | 17 | #if defined(__cplusplus) && !defined(ARDUINO) 18 | #include 19 | #include 20 | #else 21 | #include 22 | #include 23 | #endif 24 | 25 | #include 26 | 27 | namespace firmata { 28 | 29 | class FirmataMarshaller 30 | { 31 | friend class FirmataClass; 32 | 33 | public: 34 | /* constructors */ 35 | FirmataMarshaller(); 36 | 37 | /* public methods */ 38 | void begin(Stream &s); 39 | void end(); 40 | 41 | /* serial send handling */ 42 | void queryFirmwareVersion(void) const; 43 | void queryVersion(void) const; 44 | void reportAnalogDisable(uint8_t pin) const; 45 | void reportAnalogEnable(uint8_t pin) const; 46 | void reportDigitalPortDisable(uint8_t portNumber) const; 47 | void reportDigitalPortEnable(uint8_t portNumber) const; 48 | void sendAnalog(uint8_t pin, uint16_t value) const; 49 | void sendAnalogMappingQuery(void) const; 50 | void sendCapabilityQuery(void) const; 51 | void sendDigital(uint8_t pin, uint8_t value) const; 52 | void sendDigitalPort(uint8_t portNumber, uint16_t portData) const; 53 | void sendFirmwareVersion(uint8_t major, uint8_t minor, size_t bytec, uint8_t *bytev) const; 54 | void sendVersion(uint8_t major, uint8_t minor) const; 55 | void sendPinMode(uint8_t pin, uint8_t config) const; 56 | void sendPinStateQuery(uint8_t pin) const; 57 | void sendString(const char *string) const; 58 | void sendSysex(uint8_t command, size_t bytec, uint8_t *bytev) const; 59 | void setSamplingInterval(uint16_t interval_ms) const; 60 | void systemReset(void) const; 61 | 62 | private: 63 | /* utility methods */ 64 | void reportAnalog(uint8_t pin, bool stream_enable) const; 65 | void reportDigitalPort(uint8_t portNumber, bool stream_enable) const; 66 | void sendExtendedAnalog(uint8_t pin, size_t bytec, uint8_t * bytev) const; 67 | void encodeByteStream (size_t bytec, uint8_t * bytev, size_t max_bytes = 0) const; 68 | 69 | Stream * FirmataStream; 70 | }; 71 | 72 | } // namespace firmata 73 | 74 | #endif /* FirmataMarshaller_h */ 75 | 76 | -------------------------------------------------------------------------------- /FirmataParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | FirmataParser.h 3 | Copyright (c) 2006-2008 Hans-Christoph Steiner. All rights reserved. 4 | Copyright (C) 2009-2016 Jeff Hoefs. All rights reserved. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | See file LICENSE.txt for further informations on licensing terms. 12 | */ 13 | 14 | #ifndef FirmataParser_h 15 | #define FirmataParser_h 16 | 17 | #if defined(__cplusplus) && !defined(ARDUINO) 18 | #include 19 | #include 20 | #else 21 | #include 22 | #include 23 | #endif 24 | 25 | namespace firmata { 26 | 27 | class FirmataParser 28 | { 29 | public: 30 | /* callback function types */ 31 | typedef void (*callbackFunction)(void * context, uint8_t command, uint16_t value); 32 | typedef void (*dataBufferOverflowCallbackFunction)(void * context); 33 | typedef void (*stringCallbackFunction)(void * context, const char * c_str); 34 | typedef void (*sysexCallbackFunction)(void * context, uint8_t command, size_t argc, uint8_t * argv); 35 | typedef void (*systemCallbackFunction)(void * context); 36 | typedef void (*versionCallbackFunction)(void * context, size_t sv_major, size_t sv_minor, const char * firmware); 37 | 38 | FirmataParser(uint8_t * dataBuffer = (uint8_t *)NULL, size_t dataBufferSize = 0); 39 | 40 | /* serial receive handling */ 41 | void parse(uint8_t value); 42 | bool isParsingMessage(void) const; 43 | int setDataBufferOfSize(uint8_t * dataBuffer, size_t dataBufferSize); 44 | 45 | /* attach & detach callback functions to messages */ 46 | void attach(uint8_t command, callbackFunction newFunction, void * context = NULL); 47 | void attach(dataBufferOverflowCallbackFunction newFunction, void * context = NULL); 48 | void attach(uint8_t command, stringCallbackFunction newFunction, void * context = NULL); 49 | void attach(uint8_t command, sysexCallbackFunction newFunction, void * context = NULL); 50 | void attach(uint8_t command, systemCallbackFunction newFunction, void * context = NULL); 51 | void attach(uint8_t command, versionCallbackFunction newFunction, void * context = NULL); 52 | void detach(uint8_t command); 53 | void detach(dataBufferOverflowCallbackFunction); 54 | 55 | private: 56 | /* input message handling */ 57 | bool allowBufferUpdate; 58 | uint8_t * dataBuffer; // multi-byte data 59 | size_t dataBufferSize; 60 | uint8_t executeMultiByteCommand; // execute this after getting multi-byte data 61 | uint8_t multiByteChannel; // channel data for multiByteCommands 62 | size_t waitForData; // this flag says the next serial input will be data 63 | 64 | /* sysex */ 65 | bool parsingSysex; 66 | size_t sysexBytesRead; 67 | 68 | /* callback context */ 69 | void * currentAnalogCallbackContext; 70 | void * currentDigitalCallbackContext; 71 | void * currentReportAnalogCallbackContext; 72 | void * currentReportDigitalCallbackContext; 73 | void * currentPinModeCallbackContext; 74 | void * currentPinValueCallbackContext; 75 | void * currentReportFirmwareCallbackContext; 76 | void * currentReportVersionCallbackContext; 77 | void * currentDataBufferOverflowCallbackContext; 78 | void * currentStringCallbackContext; 79 | void * currentSysexCallbackContext; 80 | void * currentSystemResetCallbackContext; 81 | 82 | /* callback functions */ 83 | callbackFunction currentAnalogCallback; 84 | callbackFunction currentDigitalCallback; 85 | callbackFunction currentReportAnalogCallback; 86 | callbackFunction currentReportDigitalCallback; 87 | callbackFunction currentPinModeCallback; 88 | callbackFunction currentPinValueCallback; 89 | dataBufferOverflowCallbackFunction currentDataBufferOverflowCallback; 90 | stringCallbackFunction currentStringCallback; 91 | sysexCallbackFunction currentSysexCallback; 92 | versionCallbackFunction currentReportFirmwareCallback; 93 | systemCallbackFunction currentReportVersionCallback; 94 | systemCallbackFunction currentSystemResetCallback; 95 | 96 | /* private methods ------------------------------ */ 97 | bool bufferDataAtPosition(const uint8_t data, const size_t pos); 98 | size_t decodeByteStream(size_t bytec, uint8_t * bytev); 99 | void processSysexMessage(void); 100 | void systemReset(void); 101 | }; 102 | 103 | } // firmata 104 | 105 | #endif /* FirmataParser_h */ 106 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/.nojekyll -------------------------------------------------------------------------------- /docs/html/annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Firmata firmware for Arduino: Class List 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 28 | 29 | 30 |
24 |
Firmata firmware for Arduino 25 |
26 |
Firmata is a protocol for communicating with microcontrollers from software on a host computer
27 |
31 |
32 | 33 | 34 | 39 | 40 | 41 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 | 62 |
63 | 64 |
65 |
66 |
Class List
67 |
68 |
69 |
Here are the classes, structs, unions and interfaces with brief descriptions:
70 |
[detail level 12]
71 | 72 | 73 | 74 | 75 |
 Nfirmata
 CFirmataClass
 CFirmataMarshaller
 CFirmataParser
76 |
77 |
78 | 79 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /docs/html/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/bc_s.png -------------------------------------------------------------------------------- /docs/html/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/bdwn.png -------------------------------------------------------------------------------- /docs/html/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Firmata firmware for Arduino: Class Index 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 28 | 29 | 30 |
24 |
Firmata firmware for Arduino 25 |
26 |
Firmata is a protocol for communicating with microcontrollers from software on a host computer
27 |
31 |
32 | 33 | 34 | 39 | 40 | 41 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 | 62 |
63 | 64 |
65 |
66 |
Class Index
67 |
68 |
69 | 70 | 71 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 |
  f  
72 |
FirmataMarshaller (firmata)   FirmataParser (firmata)   
FirmataClass (firmata)   
81 | 82 |
83 | 84 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /docs/html/classfirmata_1_1_firmata_parser-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Firmata firmware for Arduino: Member List 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 28 | 29 | 30 |
24 |
Firmata firmware for Arduino 25 |
26 |
Firmata is a protocol for communicating with microcontrollers from software on a host computer
27 |
31 |
32 | 33 | 34 | 39 | 40 | 41 | 48 | 49 | 50 |
54 |
55 | 56 | 57 |
58 | 61 |
62 | 63 | 67 |
68 |
69 |
70 |
firmata::FirmataParser Member List
71 |
72 |
73 | 74 |

This is the complete list of members for firmata::FirmataParser, including all inherited members.

75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 |
attach(uint8_t command, callbackFunction newFunction, void *context=NULL)firmata::FirmataParser
attach(dataBufferOverflowCallbackFunction newFunction, void *context=NULL)firmata::FirmataParser
attach(uint8_t command, stringCallbackFunction newFunction, void *context=NULL)firmata::FirmataParser
attach(uint8_t command, sysexCallbackFunction newFunction, void *context=NULL)firmata::FirmataParser
attach(uint8_t command, systemCallbackFunction newFunction, void *context=NULL)firmata::FirmataParser
attach(uint8_t command, versionCallbackFunction newFunction, void *context=NULL)firmata::FirmataParser
callbackFunction typedef (defined in firmata::FirmataParser)firmata::FirmataParser
dataBufferOverflowCallbackFunction typedef (defined in firmata::FirmataParser)firmata::FirmataParser
detach(uint8_t command)firmata::FirmataParser
detach(dataBufferOverflowCallbackFunction)firmata::FirmataParser
FirmataParser(uint8_t *dataBuffer=(uint8_t *) NULL, size_t dataBufferSize=0)firmata::FirmataParser
isParsingMessage(void) constfirmata::FirmataParser
parse(uint8_t value)firmata::FirmataParser
setDataBufferOfSize(uint8_t *dataBuffer, size_t dataBufferSize)firmata::FirmataParser
stringCallbackFunction typedef (defined in firmata::FirmataParser)firmata::FirmataParser
sysexCallbackFunction typedef (defined in firmata::FirmataParser)firmata::FirmataParser
systemCallbackFunction typedef (defined in firmata::FirmataParser)firmata::FirmataParser
versionCallbackFunction typedef (defined in firmata::FirmataParser)firmata::FirmataParser
95 | 96 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /docs/html/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/closed.png -------------------------------------------------------------------------------- /docs/html/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/doc.png -------------------------------------------------------------------------------- /docs/html/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/doxygen.png -------------------------------------------------------------------------------- /docs/html/dynsections.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the 3 | JavaScript code in this file. 4 | 5 | Copyright (C) 1997-2017 by Dimitri van Heesch 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License along 18 | with this program; if not, write to the Free Software Foundation, Inc., 19 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | 21 | @licend The above is the entire license notice 22 | for the JavaScript code in this file 23 | */ 24 | function toggleVisibility(linkObj) 25 | { 26 | var base = $(linkObj).attr('id'); 27 | var summary = $('#'+base+'-summary'); 28 | var content = $('#'+base+'-content'); 29 | var trigger = $('#'+base+'-trigger'); 30 | var src=$(trigger).attr('src'); 31 | if (content.is(':visible')===true) { 32 | content.hide(); 33 | summary.show(); 34 | $(linkObj).addClass('closed').removeClass('opened'); 35 | $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); 36 | } else { 37 | content.show(); 38 | summary.hide(); 39 | $(linkObj).removeClass('closed').addClass('opened'); 40 | $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); 41 | } 42 | return false; 43 | } 44 | 45 | function updateStripes() 46 | { 47 | $('table.directory tr'). 48 | removeClass('even').filter(':visible:even').addClass('even'); 49 | } 50 | 51 | function toggleLevel(level) 52 | { 53 | $('table.directory tr').each(function() { 54 | var l = this.id.split('_').length-1; 55 | var i = $('#img'+this.id.substring(3)); 56 | var a = $('#arr'+this.id.substring(3)); 57 | if (l 2 | 3 | 4 | 5 | 6 | 7 | 8 | Firmata firmware for Arduino: File List 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 28 | 29 | 30 |
24 |
Firmata firmware for Arduino 25 |
26 |
Firmata is a protocol for communicating with microcontrollers from software on a host computer
27 |
31 |
32 | 33 | 34 | 39 | 40 | 41 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 | 62 |
63 | 64 |
65 |
66 |
File List
67 |
68 |
69 |
Here is a list of all documented files with brief descriptions:
70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 |
 Boards.h
 Firmata.h
 FirmataConstants.h
 FirmataDefines.h
 FirmataMarshaller.h
 FirmataParser.h
78 |
79 |
80 | 81 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /docs/html/folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/folderclosed.png -------------------------------------------------------------------------------- /docs/html/folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/folderopen.png -------------------------------------------------------------------------------- /docs/html/menu.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the 3 | JavaScript code in this file. 4 | 5 | Copyright (C) 1997-2017 by Dimitri van Heesch 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License along 18 | with this program; if not, write to the Free Software Foundation, Inc., 19 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | 21 | @licend The above is the entire license notice 22 | for the JavaScript code in this file 23 | */ 24 | function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { 25 | function makeTree(data,relPath) { 26 | var result=''; 27 | if ('children' in data) { 28 | result+=''; 35 | } 36 | return result; 37 | } 38 | 39 | $('#main-nav').append(makeTree(menudata,relPath)); 40 | $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); 41 | if (searchEnabled) { 42 | if (serverSide) { 43 | $('#main-menu').append('
  • '); 44 | } else { 45 | $('#main-menu').append('
  • '); 46 | } 47 | } 48 | $('#main-menu').smartmenus(); 49 | } 50 | /* @license-end */ 51 | -------------------------------------------------------------------------------- /docs/html/menudata.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the 3 | JavaScript code in this file. 4 | 5 | Copyright (C) 1997-2019 by Dimitri van Heesch 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of version 2 of the GNU General Public License as published by 9 | the Free Software Foundation 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | 20 | @licend The above is the entire license notice 21 | for the JavaScript code in this file 22 | */ 23 | var menudata={children:[ 24 | {text:"Main Page",url:"index.html"}, 25 | {text:"Classes",url:"annotated.html",children:[ 26 | {text:"Class List",url:"annotated.html"}, 27 | {text:"Class Index",url:"classes.html"}, 28 | {text:"Class Members",url:"functions.html",children:[ 29 | {text:"All",url:"functions.html",children:[ 30 | {text:"a",url:"functions.html#index_a"}, 31 | {text:"b",url:"functions.html#index_b"}, 32 | {text:"d",url:"functions.html#index_d"}, 33 | {text:"e",url:"functions.html#index_e"}, 34 | {text:"f",url:"functions.html#index_f"}, 35 | {text:"g",url:"functions.html#index_g"}, 36 | {text:"i",url:"functions.html#index_i"}, 37 | {text:"p",url:"functions.html#index_p"}, 38 | {text:"q",url:"functions.html#index_q"}, 39 | {text:"r",url:"functions.html#index_r"}, 40 | {text:"s",url:"functions.html#index_s"}, 41 | {text:"w",url:"functions.html#index_w"}]}, 42 | {text:"Functions",url:"functions_func.html",children:[ 43 | {text:"a",url:"functions_func.html#index_a"}, 44 | {text:"b",url:"functions_func.html#index_b"}, 45 | {text:"d",url:"functions_func.html#index_d"}, 46 | {text:"e",url:"functions_func.html#index_e"}, 47 | {text:"f",url:"functions_func.html#index_f"}, 48 | {text:"g",url:"functions_func.html#index_g"}, 49 | {text:"i",url:"functions_func.html#index_i"}, 50 | {text:"p",url:"functions_func.html#index_p"}, 51 | {text:"q",url:"functions_func.html#index_q"}, 52 | {text:"r",url:"functions_func.html#index_r"}, 53 | {text:"s",url:"functions_func.html#index_s"}, 54 | {text:"w",url:"functions_func.html#index_w"}]}]}]}, 55 | {text:"Files",url:"files.html",children:[ 56 | {text:"File List",url:"files.html"}]}]} 57 | -------------------------------------------------------------------------------- /docs/html/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/nav_f.png -------------------------------------------------------------------------------- /docs/html/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/nav_g.png -------------------------------------------------------------------------------- /docs/html/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/nav_h.png -------------------------------------------------------------------------------- /docs/html/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/open.png -------------------------------------------------------------------------------- /docs/html/pages.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Firmata firmware for Arduino: Related Pages 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
    19 |
    20 | 21 | 22 | 23 | 28 | 29 | 30 |
    24 |
    Firmata firmware for Arduino 25 |
    26 |
    Firmata is a protocol for communicating with microcontrollers from software on a host computer
    27 |
    31 |
    32 | 33 | 34 | 39 | 40 | 41 | 48 | 49 |
    50 | 51 |
    55 |
    56 | 57 | 58 |
    59 | 62 |
    63 | 64 |
    65 |
    66 |
    Related Pages
    67 |
    68 |
    69 |
    Here is a list of all related documentation pages:
    70 | 71 | 72 |
     Firmata
    73 |
    74 |
    75 | 76 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /docs/html/search/all_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/all_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['attach_0',['attach',['../classfirmata_1_1_firmata_class.html#adc3db897058f33e902097ce89bb01bb3',1,'firmata::FirmataClass::attach(uint8_t command, systemCallbackFunction newFunction)'],['../classfirmata_1_1_firmata_class.html#a074887a70f9aca0c0aae7e9bdc103f77',1,'firmata::FirmataClass::attach(uint8_t command, stringCallbackFunction newFunction)'],['../classfirmata_1_1_firmata_class.html#a78e360c0c8d70cffeb9c935fdec23f77',1,'firmata::FirmataClass::attach(uint8_t command, sysexCallbackFunction newFunction)'],['../classfirmata_1_1_firmata_parser.html#a2a472a925ed7e626ed36dee94ceae45e',1,'firmata::FirmataParser::attach(uint8_t command, callbackFunction newFunction, void *context=NULL)'],['../classfirmata_1_1_firmata_parser.html#ae176414892a2d240b921c2b8037a8ade',1,'firmata::FirmataParser::attach(dataBufferOverflowCallbackFunction newFunction, void *context=NULL)'],['../classfirmata_1_1_firmata_parser.html#a239b37e09dea042d229fc2171d3a1979',1,'firmata::FirmataParser::attach(uint8_t command, stringCallbackFunction newFunction, void *context=NULL)'],['../classfirmata_1_1_firmata_parser.html#aaa1d755b20b21e528bfa62d6a7c2dc0f',1,'firmata::FirmataParser::attach(uint8_t command, sysexCallbackFunction newFunction, void *context=NULL)'],['../classfirmata_1_1_firmata_parser.html#affc821e7742d889965e61b248c204842',1,'firmata::FirmataParser::attach(uint8_t command, systemCallbackFunction newFunction, void *context=NULL)'],['../classfirmata_1_1_firmata_parser.html#a876105f2203f5e8f1fb06c8236a96933',1,'firmata::FirmataParser::attach(uint8_t command, versionCallbackFunction newFunction, void *context=NULL)']]], 4 | ['available_1',['available',['../classfirmata_1_1_firmata_class.html#a119734b867186567c1cd011e52e59d2d',1,'firmata::FirmataClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/all_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/all_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['begin_2',['begin',['../classfirmata_1_1_firmata_class.html#a2fddcc643892bec2f4aa7aef6dba70eb',1,'firmata::FirmataClass::begin()'],['../classfirmata_1_1_firmata_class.html#ab0b7b837d2c32b4ce79e62895ced2731',1,'firmata::FirmataClass::begin(long)'],['../classfirmata_1_1_firmata_class.html#a0c7b0e10168e3c5dc6442d77c65a156e',1,'firmata::FirmataClass::begin(Stream &s)'],['../classfirmata_1_1_firmata_marshaller.html#a5be18ca3658875dbe5580c2254071c76',1,'firmata::FirmataMarshaller::begin()']]], 4 | ['blinkversion_3',['blinkVersion',['../classfirmata_1_1_firmata_class.html#a9421550f2501fc1df60fd174b154e606',1,'firmata::FirmataClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/all_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/all_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['detach_4',['detach',['../classfirmata_1_1_firmata_class.html#a5db0faee74b9291d1b783d2dde0929d1',1,'firmata::FirmataClass::detach()'],['../classfirmata_1_1_firmata_parser.html#a7cd707386c0807bee733a3e27d161c7d',1,'firmata::FirmataParser::detach(uint8_t command)'],['../classfirmata_1_1_firmata_parser.html#a280ac17e428f8374afd30bce75e9a861',1,'firmata::FirmataParser::detach(dataBufferOverflowCallbackFunction)']]], 4 | ['disableblinkversion_5',['disableBlinkVersion',['../classfirmata_1_1_firmata_class.html#a5ddba465c3772f841828ef82c79d4307',1,'firmata::FirmataClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/all_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/all_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['end_6',['end',['../classfirmata_1_1_firmata_marshaller.html#ab856434fc577b1e069cba51c39daf1de',1,'firmata::FirmataMarshaller']]], 4 | ['endsysex_7',['endSysex',['../classfirmata_1_1_firmata_class.html#a9bb68afbb1d37a7990f59a1d419e64c9',1,'firmata::FirmataClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/all_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/all_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['firmataclass_8',['FirmataClass',['../classfirmata_1_1_firmata_class.html',1,'firmata::FirmataClass'],['../classfirmata_1_1_firmata_class.html#a75b035ab8d96d87d28deeb87badfe11a',1,'firmata::FirmataClass::FirmataClass()']]], 4 | ['firmatamarshaller_9',['FirmataMarshaller',['../classfirmata_1_1_firmata_marshaller.html',1,'firmata::FirmataMarshaller'],['../classfirmata_1_1_firmata_marshaller.html#ad1a42532bdf77088c47c1a62f5a03829',1,'firmata::FirmataMarshaller::FirmataMarshaller()']]], 5 | ['firmataparser_10',['FirmataParser',['../classfirmata_1_1_firmata_parser.html',1,'firmata::FirmataParser'],['../classfirmata_1_1_firmata_parser.html#ac8c388b593a00e88856646712beae68b',1,'firmata::FirmataParser::FirmataParser()']]], 6 | ['firmata_11',['Firmata',['../index.html',1,'']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /docs/html/search/all_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/all_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['getpinmode_12',['getPinMode',['../classfirmata_1_1_firmata_class.html#a0c434227456ce2ba97b3b1142c329f96',1,'firmata::FirmataClass']]], 4 | ['getpinstate_13',['getPinState',['../classfirmata_1_1_firmata_class.html#acf5d4f460b9a2298653d4a71de918dfe',1,'firmata::FirmataClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/all_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/all_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['isparsingmessage_14',['isParsingMessage',['../classfirmata_1_1_firmata_class.html#a58e9d787957c3085f22d33b59b1f6ea6',1,'firmata::FirmataClass::isParsingMessage()'],['../classfirmata_1_1_firmata_parser.html#a67902b70695eaf0cf8f7b06175ca3902',1,'firmata::FirmataParser::isParsingMessage()']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/all_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/all_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['parse_15',['parse',['../classfirmata_1_1_firmata_class.html#aaeaac8b1f8facf070615b0035120c432',1,'firmata::FirmataClass::parse()'],['../classfirmata_1_1_firmata_parser.html#a754c97b890b7fd66c8d953a3e615acbf',1,'firmata::FirmataParser::parse()']]], 4 | ['printfirmwareversion_16',['printFirmwareVersion',['../classfirmata_1_1_firmata_class.html#abe49261eab0bd4892a09fa8b8980b11a',1,'firmata::FirmataClass']]], 5 | ['printversion_17',['printVersion',['../classfirmata_1_1_firmata_class.html#abd8a0370db6d9e923e7e3d5836e78d7a',1,'firmata::FirmataClass']]], 6 | ['processinput_18',['processInput',['../classfirmata_1_1_firmata_class.html#aa698f5f5a234173d5eebb54831350676',1,'firmata::FirmataClass']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /docs/html/search/all_8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/all_8.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['queryfirmwareversion_19',['queryFirmwareVersion',['../classfirmata_1_1_firmata_marshaller.html#af954bcf09b77458b3c4f032897d14697',1,'firmata::FirmataMarshaller']]], 4 | ['queryversion_20',['queryVersion',['../classfirmata_1_1_firmata_marshaller.html#a488fbbd372c894ec78ebb99e0faf5167',1,'firmata::FirmataMarshaller']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/all_9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/all_9.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['reportanalogdisable_21',['reportAnalogDisable',['../classfirmata_1_1_firmata_marshaller.html#a2668d1332704bbf9938f386e247a8f30',1,'firmata::FirmataMarshaller']]], 4 | ['reportanalogenable_22',['reportAnalogEnable',['../classfirmata_1_1_firmata_marshaller.html#a67b3db7232143acf63bd48b765fcc4db',1,'firmata::FirmataMarshaller']]], 5 | ['reportdigitalportdisable_23',['reportDigitalPortDisable',['../classfirmata_1_1_firmata_marshaller.html#aa00582e6e014605a65a8953f8275a5ad',1,'firmata::FirmataMarshaller']]], 6 | ['reportdigitalportenable_24',['reportDigitalPortEnable',['../classfirmata_1_1_firmata_marshaller.html#a608c28cdc966c33d0cc2239d9465ef7c',1,'firmata::FirmataMarshaller']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /docs/html/search/all_a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/all_a.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['sendanalog_25',['sendAnalog',['../classfirmata_1_1_firmata_class.html#ae14e1d8d9bd72068f6e8ca07721e8dda',1,'firmata::FirmataClass::sendAnalog()'],['../classfirmata_1_1_firmata_marshaller.html#a4d9f2d3bb058237404dfe433cfe7571a',1,'firmata::FirmataMarshaller::sendAnalog()']]], 4 | ['sendanalogmappingquery_26',['sendAnalogMappingQuery',['../classfirmata_1_1_firmata_marshaller.html#a1c987a534cc8dd197eb2f2a728bdacb3',1,'firmata::FirmataMarshaller']]], 5 | ['sendcapabilityquery_27',['sendCapabilityQuery',['../classfirmata_1_1_firmata_marshaller.html#a1f1c5ce29ba4488306c9a1e3f158b781',1,'firmata::FirmataMarshaller']]], 6 | ['senddigital_28',['sendDigital',['../classfirmata_1_1_firmata_marshaller.html#a2d90627f0543b6298be71f7d903399b3',1,'firmata::FirmataMarshaller']]], 7 | ['senddigitalport_29',['sendDigitalPort',['../classfirmata_1_1_firmata_class.html#a799b91e5a888dd21b066a2020d8e2b68',1,'firmata::FirmataClass::sendDigitalPort()'],['../classfirmata_1_1_firmata_marshaller.html#a346dcb4487a51efaa95de42d292ad951',1,'firmata::FirmataMarshaller::sendDigitalPort()']]], 8 | ['sendfirmwareversion_30',['sendFirmwareVersion',['../classfirmata_1_1_firmata_marshaller.html#aed71d62cc41f2e0bf3f161894b91be7c',1,'firmata::FirmataMarshaller']]], 9 | ['sendpinmode_31',['sendPinMode',['../classfirmata_1_1_firmata_marshaller.html#a36b6cc103609d900cce36149a239f221',1,'firmata::FirmataMarshaller']]], 10 | ['sendpinstatequery_32',['sendPinStateQuery',['../classfirmata_1_1_firmata_marshaller.html#afc378ab4a39c843d4419acdee944972b',1,'firmata::FirmataMarshaller']]], 11 | ['sendstring_33',['sendString',['../classfirmata_1_1_firmata_class.html#abe11f621154afd308926129de349fc6e',1,'firmata::FirmataClass::sendString(const char *string)'],['../classfirmata_1_1_firmata_class.html#ab139c0d784e69003c88eb5be8807dcdf',1,'firmata::FirmataClass::sendString(byte command, const char *string)'],['../classfirmata_1_1_firmata_marshaller.html#a483ac2dea885ab3472dc38b99bfdec2f',1,'firmata::FirmataMarshaller::sendString()']]], 12 | ['sendsysex_34',['sendSysex',['../classfirmata_1_1_firmata_class.html#a81e2de5b37eb2372c8a3d9a43d5eb0cc',1,'firmata::FirmataClass::sendSysex()'],['../classfirmata_1_1_firmata_marshaller.html#ade4f4592877ec0b9f8d6c74e909bad8e',1,'firmata::FirmataMarshaller::sendSysex()']]], 13 | ['sendvalueastwo7bitbytes_35',['sendValueAsTwo7bitBytes',['../classfirmata_1_1_firmata_class.html#a770e43f26f18204e43acebf9202a6d39',1,'firmata::FirmataClass']]], 14 | ['sendversion_36',['sendVersion',['../classfirmata_1_1_firmata_marshaller.html#a95d58949e32ad285088705dbe5680b29',1,'firmata::FirmataMarshaller']]], 15 | ['setdatabufferofsize_37',['setDataBufferOfSize',['../classfirmata_1_1_firmata_parser.html#a8fbe143ddb428a97c00a15993c31a516',1,'firmata::FirmataParser']]], 16 | ['setfirmwarenameandversion_38',['setFirmwareNameAndVersion',['../classfirmata_1_1_firmata_class.html#ab7aa66b528027566c15b7d64c8cd0f89',1,'firmata::FirmataClass']]], 17 | ['setpinmode_39',['setPinMode',['../classfirmata_1_1_firmata_class.html#a32c41dd94c1d23aa0e6d3d1dbe5c0c04',1,'firmata::FirmataClass']]], 18 | ['setpinstate_40',['setPinState',['../classfirmata_1_1_firmata_class.html#aa9f98ba5069823b4c1d08db9f8999ba8',1,'firmata::FirmataClass']]], 19 | ['setsamplinginterval_41',['setSamplingInterval',['../classfirmata_1_1_firmata_marshaller.html#abb8f4c79dd8a0dbee3f5e04c587ae20c',1,'firmata::FirmataMarshaller']]], 20 | ['startsysex_42',['startSysex',['../classfirmata_1_1_firmata_class.html#a3cc7ea1af348bca3ea0bd570314cada3',1,'firmata::FirmataClass']]], 21 | ['systemreset_43',['systemReset',['../classfirmata_1_1_firmata_marshaller.html#a3a585937f94b1f9e51797e5950a33206',1,'firmata::FirmataMarshaller']]] 22 | ]; 23 | -------------------------------------------------------------------------------- /docs/html/search/all_b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/all_b.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['write_44',['write',['../classfirmata_1_1_firmata_class.html#ae8f29a829e17379602fcb9fd6a497807',1,'firmata::FirmataClass']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/classes_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/classes_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['firmataclass_45',['FirmataClass',['../classfirmata_1_1_firmata_class.html',1,'firmata']]], 4 | ['firmatamarshaller_46',['FirmataMarshaller',['../classfirmata_1_1_firmata_marshaller.html',1,'firmata']]], 5 | ['firmataparser_47',['FirmataParser',['../classfirmata_1_1_firmata_parser.html',1,'firmata']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /docs/html/search/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/search/close.png -------------------------------------------------------------------------------- /docs/html/search/functions_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/functions_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['attach_48',['attach',['../classfirmata_1_1_firmata_class.html#adc3db897058f33e902097ce89bb01bb3',1,'firmata::FirmataClass::attach(uint8_t command, systemCallbackFunction newFunction)'],['../classfirmata_1_1_firmata_class.html#a074887a70f9aca0c0aae7e9bdc103f77',1,'firmata::FirmataClass::attach(uint8_t command, stringCallbackFunction newFunction)'],['../classfirmata_1_1_firmata_class.html#a78e360c0c8d70cffeb9c935fdec23f77',1,'firmata::FirmataClass::attach(uint8_t command, sysexCallbackFunction newFunction)'],['../classfirmata_1_1_firmata_parser.html#a2a472a925ed7e626ed36dee94ceae45e',1,'firmata::FirmataParser::attach(uint8_t command, callbackFunction newFunction, void *context=NULL)'],['../classfirmata_1_1_firmata_parser.html#ae176414892a2d240b921c2b8037a8ade',1,'firmata::FirmataParser::attach(dataBufferOverflowCallbackFunction newFunction, void *context=NULL)'],['../classfirmata_1_1_firmata_parser.html#a239b37e09dea042d229fc2171d3a1979',1,'firmata::FirmataParser::attach(uint8_t command, stringCallbackFunction newFunction, void *context=NULL)'],['../classfirmata_1_1_firmata_parser.html#aaa1d755b20b21e528bfa62d6a7c2dc0f',1,'firmata::FirmataParser::attach(uint8_t command, sysexCallbackFunction newFunction, void *context=NULL)'],['../classfirmata_1_1_firmata_parser.html#affc821e7742d889965e61b248c204842',1,'firmata::FirmataParser::attach(uint8_t command, systemCallbackFunction newFunction, void *context=NULL)'],['../classfirmata_1_1_firmata_parser.html#a876105f2203f5e8f1fb06c8236a96933',1,'firmata::FirmataParser::attach(uint8_t command, versionCallbackFunction newFunction, void *context=NULL)']]], 4 | ['available_49',['available',['../classfirmata_1_1_firmata_class.html#a119734b867186567c1cd011e52e59d2d',1,'firmata::FirmataClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/functions_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/functions_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['begin_50',['begin',['../classfirmata_1_1_firmata_class.html#a2fddcc643892bec2f4aa7aef6dba70eb',1,'firmata::FirmataClass::begin()'],['../classfirmata_1_1_firmata_class.html#ab0b7b837d2c32b4ce79e62895ced2731',1,'firmata::FirmataClass::begin(long)'],['../classfirmata_1_1_firmata_class.html#a0c7b0e10168e3c5dc6442d77c65a156e',1,'firmata::FirmataClass::begin(Stream &s)'],['../classfirmata_1_1_firmata_marshaller.html#a5be18ca3658875dbe5580c2254071c76',1,'firmata::FirmataMarshaller::begin()']]], 4 | ['blinkversion_51',['blinkVersion',['../classfirmata_1_1_firmata_class.html#a9421550f2501fc1df60fd174b154e606',1,'firmata::FirmataClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/functions_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/functions_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['detach_52',['detach',['../classfirmata_1_1_firmata_class.html#a5db0faee74b9291d1b783d2dde0929d1',1,'firmata::FirmataClass::detach()'],['../classfirmata_1_1_firmata_parser.html#a7cd707386c0807bee733a3e27d161c7d',1,'firmata::FirmataParser::detach(uint8_t command)'],['../classfirmata_1_1_firmata_parser.html#a280ac17e428f8374afd30bce75e9a861',1,'firmata::FirmataParser::detach(dataBufferOverflowCallbackFunction)']]], 4 | ['disableblinkversion_53',['disableBlinkVersion',['../classfirmata_1_1_firmata_class.html#a5ddba465c3772f841828ef82c79d4307',1,'firmata::FirmataClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/functions_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/functions_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['end_54',['end',['../classfirmata_1_1_firmata_marshaller.html#ab856434fc577b1e069cba51c39daf1de',1,'firmata::FirmataMarshaller']]], 4 | ['endsysex_55',['endSysex',['../classfirmata_1_1_firmata_class.html#a9bb68afbb1d37a7990f59a1d419e64c9',1,'firmata::FirmataClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/functions_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/functions_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['firmataclass_56',['FirmataClass',['../classfirmata_1_1_firmata_class.html#a75b035ab8d96d87d28deeb87badfe11a',1,'firmata::FirmataClass']]], 4 | ['firmatamarshaller_57',['FirmataMarshaller',['../classfirmata_1_1_firmata_marshaller.html#ad1a42532bdf77088c47c1a62f5a03829',1,'firmata::FirmataMarshaller']]], 5 | ['firmataparser_58',['FirmataParser',['../classfirmata_1_1_firmata_parser.html#ac8c388b593a00e88856646712beae68b',1,'firmata::FirmataParser']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /docs/html/search/functions_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/functions_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['getpinmode_59',['getPinMode',['../classfirmata_1_1_firmata_class.html#a0c434227456ce2ba97b3b1142c329f96',1,'firmata::FirmataClass']]], 4 | ['getpinstate_60',['getPinState',['../classfirmata_1_1_firmata_class.html#acf5d4f460b9a2298653d4a71de918dfe',1,'firmata::FirmataClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/functions_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/functions_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['isparsingmessage_61',['isParsingMessage',['../classfirmata_1_1_firmata_class.html#a58e9d787957c3085f22d33b59b1f6ea6',1,'firmata::FirmataClass::isParsingMessage()'],['../classfirmata_1_1_firmata_parser.html#a67902b70695eaf0cf8f7b06175ca3902',1,'firmata::FirmataParser::isParsingMessage()']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/functions_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/functions_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['parse_62',['parse',['../classfirmata_1_1_firmata_class.html#aaeaac8b1f8facf070615b0035120c432',1,'firmata::FirmataClass::parse()'],['../classfirmata_1_1_firmata_parser.html#a754c97b890b7fd66c8d953a3e615acbf',1,'firmata::FirmataParser::parse()']]], 4 | ['printfirmwareversion_63',['printFirmwareVersion',['../classfirmata_1_1_firmata_class.html#abe49261eab0bd4892a09fa8b8980b11a',1,'firmata::FirmataClass']]], 5 | ['printversion_64',['printVersion',['../classfirmata_1_1_firmata_class.html#abd8a0370db6d9e923e7e3d5836e78d7a',1,'firmata::FirmataClass']]], 6 | ['processinput_65',['processInput',['../classfirmata_1_1_firmata_class.html#aa698f5f5a234173d5eebb54831350676',1,'firmata::FirmataClass']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /docs/html/search/functions_8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/functions_8.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['queryfirmwareversion_66',['queryFirmwareVersion',['../classfirmata_1_1_firmata_marshaller.html#af954bcf09b77458b3c4f032897d14697',1,'firmata::FirmataMarshaller']]], 4 | ['queryversion_67',['queryVersion',['../classfirmata_1_1_firmata_marshaller.html#a488fbbd372c894ec78ebb99e0faf5167',1,'firmata::FirmataMarshaller']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/functions_9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/functions_9.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['reportanalogdisable_68',['reportAnalogDisable',['../classfirmata_1_1_firmata_marshaller.html#a2668d1332704bbf9938f386e247a8f30',1,'firmata::FirmataMarshaller']]], 4 | ['reportanalogenable_69',['reportAnalogEnable',['../classfirmata_1_1_firmata_marshaller.html#a67b3db7232143acf63bd48b765fcc4db',1,'firmata::FirmataMarshaller']]], 5 | ['reportdigitalportdisable_70',['reportDigitalPortDisable',['../classfirmata_1_1_firmata_marshaller.html#aa00582e6e014605a65a8953f8275a5ad',1,'firmata::FirmataMarshaller']]], 6 | ['reportdigitalportenable_71',['reportDigitalPortEnable',['../classfirmata_1_1_firmata_marshaller.html#a608c28cdc966c33d0cc2239d9465ef7c',1,'firmata::FirmataMarshaller']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /docs/html/search/functions_a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/functions_a.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['sendanalog_72',['sendAnalog',['../classfirmata_1_1_firmata_class.html#ae14e1d8d9bd72068f6e8ca07721e8dda',1,'firmata::FirmataClass::sendAnalog()'],['../classfirmata_1_1_firmata_marshaller.html#a4d9f2d3bb058237404dfe433cfe7571a',1,'firmata::FirmataMarshaller::sendAnalog()']]], 4 | ['sendanalogmappingquery_73',['sendAnalogMappingQuery',['../classfirmata_1_1_firmata_marshaller.html#a1c987a534cc8dd197eb2f2a728bdacb3',1,'firmata::FirmataMarshaller']]], 5 | ['sendcapabilityquery_74',['sendCapabilityQuery',['../classfirmata_1_1_firmata_marshaller.html#a1f1c5ce29ba4488306c9a1e3f158b781',1,'firmata::FirmataMarshaller']]], 6 | ['senddigital_75',['sendDigital',['../classfirmata_1_1_firmata_marshaller.html#a2d90627f0543b6298be71f7d903399b3',1,'firmata::FirmataMarshaller']]], 7 | ['senddigitalport_76',['sendDigitalPort',['../classfirmata_1_1_firmata_class.html#a799b91e5a888dd21b066a2020d8e2b68',1,'firmata::FirmataClass::sendDigitalPort()'],['../classfirmata_1_1_firmata_marshaller.html#a346dcb4487a51efaa95de42d292ad951',1,'firmata::FirmataMarshaller::sendDigitalPort()']]], 8 | ['sendfirmwareversion_77',['sendFirmwareVersion',['../classfirmata_1_1_firmata_marshaller.html#aed71d62cc41f2e0bf3f161894b91be7c',1,'firmata::FirmataMarshaller']]], 9 | ['sendpinmode_78',['sendPinMode',['../classfirmata_1_1_firmata_marshaller.html#a36b6cc103609d900cce36149a239f221',1,'firmata::FirmataMarshaller']]], 10 | ['sendpinstatequery_79',['sendPinStateQuery',['../classfirmata_1_1_firmata_marshaller.html#afc378ab4a39c843d4419acdee944972b',1,'firmata::FirmataMarshaller']]], 11 | ['sendstring_80',['sendString',['../classfirmata_1_1_firmata_class.html#abe11f621154afd308926129de349fc6e',1,'firmata::FirmataClass::sendString(const char *string)'],['../classfirmata_1_1_firmata_class.html#ab139c0d784e69003c88eb5be8807dcdf',1,'firmata::FirmataClass::sendString(byte command, const char *string)'],['../classfirmata_1_1_firmata_marshaller.html#a483ac2dea885ab3472dc38b99bfdec2f',1,'firmata::FirmataMarshaller::sendString()']]], 12 | ['sendsysex_81',['sendSysex',['../classfirmata_1_1_firmata_class.html#a81e2de5b37eb2372c8a3d9a43d5eb0cc',1,'firmata::FirmataClass::sendSysex()'],['../classfirmata_1_1_firmata_marshaller.html#ade4f4592877ec0b9f8d6c74e909bad8e',1,'firmata::FirmataMarshaller::sendSysex()']]], 13 | ['sendvalueastwo7bitbytes_82',['sendValueAsTwo7bitBytes',['../classfirmata_1_1_firmata_class.html#a770e43f26f18204e43acebf9202a6d39',1,'firmata::FirmataClass']]], 14 | ['sendversion_83',['sendVersion',['../classfirmata_1_1_firmata_marshaller.html#a95d58949e32ad285088705dbe5680b29',1,'firmata::FirmataMarshaller']]], 15 | ['setdatabufferofsize_84',['setDataBufferOfSize',['../classfirmata_1_1_firmata_parser.html#a8fbe143ddb428a97c00a15993c31a516',1,'firmata::FirmataParser']]], 16 | ['setfirmwarenameandversion_85',['setFirmwareNameAndVersion',['../classfirmata_1_1_firmata_class.html#ab7aa66b528027566c15b7d64c8cd0f89',1,'firmata::FirmataClass']]], 17 | ['setpinmode_86',['setPinMode',['../classfirmata_1_1_firmata_class.html#a32c41dd94c1d23aa0e6d3d1dbe5c0c04',1,'firmata::FirmataClass']]], 18 | ['setpinstate_87',['setPinState',['../classfirmata_1_1_firmata_class.html#aa9f98ba5069823b4c1d08db9f8999ba8',1,'firmata::FirmataClass']]], 19 | ['setsamplinginterval_88',['setSamplingInterval',['../classfirmata_1_1_firmata_marshaller.html#abb8f4c79dd8a0dbee3f5e04c587ae20c',1,'firmata::FirmataMarshaller']]], 20 | ['startsysex_89',['startSysex',['../classfirmata_1_1_firmata_class.html#a3cc7ea1af348bca3ea0bd570314cada3',1,'firmata::FirmataClass']]], 21 | ['systemreset_90',['systemReset',['../classfirmata_1_1_firmata_marshaller.html#a3a585937f94b1f9e51797e5950a33206',1,'firmata::FirmataMarshaller']]] 22 | ]; 23 | -------------------------------------------------------------------------------- /docs/html/search/functions_b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/functions_b.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['write_91',['write',['../classfirmata_1_1_firmata_class.html#ae8f29a829e17379602fcb9fd6a497807',1,'firmata::FirmataClass']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/mag_sel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/search/mag_sel.png -------------------------------------------------------------------------------- /docs/html/search/nomatches.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
    9 |
    No Matches
    10 |
    11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/html/search/pages_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/html/search/pages_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['firmata_92',['Firmata',['../index.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/search.css: -------------------------------------------------------------------------------- 1 | /*---------------- Search Box */ 2 | 3 | #FSearchBox { 4 | float: left; 5 | } 6 | 7 | #MSearchBox { 8 | white-space : nowrap; 9 | float: none; 10 | margin-top: 8px; 11 | right: 0px; 12 | width: 170px; 13 | height: 24px; 14 | z-index: 102; 15 | } 16 | 17 | #MSearchBox .left 18 | { 19 | display:block; 20 | position:absolute; 21 | left:10px; 22 | width:20px; 23 | height:19px; 24 | background:url('search_l.png') no-repeat; 25 | background-position:right; 26 | } 27 | 28 | #MSearchSelect { 29 | display:block; 30 | position:absolute; 31 | width:20px; 32 | height:19px; 33 | } 34 | 35 | .left #MSearchSelect { 36 | left:4px; 37 | } 38 | 39 | .right #MSearchSelect { 40 | right:5px; 41 | } 42 | 43 | #MSearchField { 44 | display:block; 45 | position:absolute; 46 | height:19px; 47 | background:url('search_m.png') repeat-x; 48 | border:none; 49 | width:115px; 50 | margin-left:20px; 51 | padding-left:4px; 52 | color: #909090; 53 | outline: none; 54 | font: 9pt Arial, Verdana, sans-serif; 55 | -webkit-border-radius: 0px; 56 | } 57 | 58 | #FSearchBox #MSearchField { 59 | margin-left:15px; 60 | } 61 | 62 | #MSearchBox .right { 63 | display:block; 64 | position:absolute; 65 | right:10px; 66 | top:8px; 67 | width:20px; 68 | height:19px; 69 | background:url('search_r.png') no-repeat; 70 | background-position:left; 71 | } 72 | 73 | #MSearchClose { 74 | display: none; 75 | position: absolute; 76 | top: 4px; 77 | background : none; 78 | border: none; 79 | margin: 0px 4px 0px 0px; 80 | padding: 0px 0px; 81 | outline: none; 82 | } 83 | 84 | .left #MSearchClose { 85 | left: 6px; 86 | } 87 | 88 | .right #MSearchClose { 89 | right: 2px; 90 | } 91 | 92 | .MSearchBoxActive #MSearchField { 93 | color: #000000; 94 | } 95 | 96 | /*---------------- Search filter selection */ 97 | 98 | #MSearchSelectWindow { 99 | display: none; 100 | position: absolute; 101 | left: 0; top: 0; 102 | border: 1px solid #90A5CE; 103 | background-color: #F9FAFC; 104 | z-index: 10001; 105 | padding-top: 4px; 106 | padding-bottom: 4px; 107 | -moz-border-radius: 4px; 108 | -webkit-border-top-left-radius: 4px; 109 | -webkit-border-top-right-radius: 4px; 110 | -webkit-border-bottom-left-radius: 4px; 111 | -webkit-border-bottom-right-radius: 4px; 112 | -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); 113 | } 114 | 115 | .SelectItem { 116 | font: 8pt Arial, Verdana, sans-serif; 117 | padding-left: 2px; 118 | padding-right: 12px; 119 | border: 0px; 120 | } 121 | 122 | span.SelectionMark { 123 | margin-right: 4px; 124 | font-family: monospace; 125 | outline-style: none; 126 | text-decoration: none; 127 | } 128 | 129 | a.SelectItem { 130 | display: block; 131 | outline-style: none; 132 | color: #000000; 133 | text-decoration: none; 134 | padding-left: 6px; 135 | padding-right: 12px; 136 | } 137 | 138 | a.SelectItem:focus, 139 | a.SelectItem:active { 140 | color: #000000; 141 | outline-style: none; 142 | text-decoration: none; 143 | } 144 | 145 | a.SelectItem:hover { 146 | color: #FFFFFF; 147 | background-color: #3D578C; 148 | outline-style: none; 149 | text-decoration: none; 150 | cursor: pointer; 151 | display: block; 152 | } 153 | 154 | /*---------------- Search results window */ 155 | 156 | iframe#MSearchResults { 157 | width: 60ex; 158 | height: 15em; 159 | } 160 | 161 | #MSearchResultsWindow { 162 | display: none; 163 | position: absolute; 164 | left: 0; top: 0; 165 | border: 1px solid #000; 166 | background-color: #EEF1F7; 167 | z-index:10000; 168 | } 169 | 170 | /* ----------------------------------- */ 171 | 172 | 173 | #SRIndex { 174 | clear:both; 175 | padding-bottom: 15px; 176 | } 177 | 178 | .SREntry { 179 | font-size: 10pt; 180 | padding-left: 1ex; 181 | } 182 | 183 | .SRPage .SREntry { 184 | font-size: 8pt; 185 | padding: 1px 5px; 186 | } 187 | 188 | body.SRPage { 189 | margin: 5px 2px; 190 | } 191 | 192 | .SRChildren { 193 | padding-left: 3ex; padding-bottom: .5em 194 | } 195 | 196 | .SRPage .SRChildren { 197 | display: none; 198 | } 199 | 200 | .SRSymbol { 201 | font-weight: bold; 202 | color: #425E97; 203 | font-family: Arial, Verdana, sans-serif; 204 | text-decoration: none; 205 | outline: none; 206 | } 207 | 208 | a.SRScope { 209 | display: block; 210 | color: #425E97; 211 | font-family: Arial, Verdana, sans-serif; 212 | text-decoration: none; 213 | outline: none; 214 | } 215 | 216 | a.SRSymbol:focus, a.SRSymbol:active, 217 | a.SRScope:focus, a.SRScope:active { 218 | text-decoration: underline; 219 | } 220 | 221 | span.SRScope { 222 | padding-left: 4px; 223 | } 224 | 225 | .SRPage .SRStatus { 226 | padding: 2px 5px; 227 | font-size: 8pt; 228 | font-style: italic; 229 | } 230 | 231 | .SRResult { 232 | display: none; 233 | } 234 | 235 | DIV.searchresults { 236 | margin-left: 10px; 237 | margin-right: 10px; 238 | } 239 | 240 | /*---------------- External search page results */ 241 | 242 | .searchresult { 243 | background-color: #F0F3F8; 244 | } 245 | 246 | .pages b { 247 | color: white; 248 | padding: 5px 5px 3px 5px; 249 | background-image: url("../tab_a.png"); 250 | background-repeat: repeat-x; 251 | text-shadow: 0 1px 1px #000000; 252 | } 253 | 254 | .pages { 255 | line-height: 17px; 256 | margin-left: 4px; 257 | text-decoration: none; 258 | } 259 | 260 | .hl { 261 | font-weight: bold; 262 | } 263 | 264 | #searchresults { 265 | margin-bottom: 20px; 266 | } 267 | 268 | .searchpages { 269 | margin-top: 10px; 270 | } 271 | 272 | -------------------------------------------------------------------------------- /docs/html/search/search_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/search/search_l.png -------------------------------------------------------------------------------- /docs/html/search/search_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/search/search_m.png -------------------------------------------------------------------------------- /docs/html/search/search_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/search/search_r.png -------------------------------------------------------------------------------- /docs/html/search/searchdata.js: -------------------------------------------------------------------------------- 1 | var indexSectionsWithContent = 2 | { 3 | 0: "abdefgipqrsw", 4 | 1: "f", 5 | 2: "abdefgipqrsw", 6 | 3: "f" 7 | }; 8 | 9 | var indexSectionNames = 10 | { 11 | 0: "all", 12 | 1: "classes", 13 | 2: "functions", 14 | 3: "pages" 15 | }; 16 | 17 | var indexSectionLabels = 18 | { 19 | 0: "All", 20 | 1: "Classes", 21 | 2: "Functions", 22 | 3: "Pages" 23 | }; 24 | 25 | -------------------------------------------------------------------------------- /docs/html/splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/splitbar.png -------------------------------------------------------------------------------- /docs/html/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/sync_off.png -------------------------------------------------------------------------------- /docs/html/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/sync_on.png -------------------------------------------------------------------------------- /docs/html/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/tab_a.png -------------------------------------------------------------------------------- /docs/html/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/tab_b.png -------------------------------------------------------------------------------- /docs/html/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/tab_h.png -------------------------------------------------------------------------------- /docs/html/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firmata/arduino/ebd19be71b3673ba16f884c00b0a2e940ef86157/docs/html/tab_s.png -------------------------------------------------------------------------------- /docs/html/tabs.css: -------------------------------------------------------------------------------- 1 | .sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0 1px 1px rgba(255,255,255,0.9);color:#283a5d;outline:0}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace!important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283a5d transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;-moz-border-radius:0!important;-webkit-border-radius:0;border-radius:0!important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a:hover span.sub-arrow{border-color:white transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;-moz-border-radius:5px!important;-webkit-border-radius:5px;border-radius:5px!important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0!important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent white}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px!important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}} -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /examples/AllInputsFirmata/AllInputsFirmata.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Firmata is a generic protocol for communicating with microcontrollers 3 | * from software on a host computer. It is intended to work with 4 | * any host computer software package. 5 | * 6 | * To download a host software package, please click on the following link 7 | * to open the list of Firmata client libraries in your default browser. 8 | * 9 | * https://github.com/firmata/arduino#firmata-client-libraries 10 | */ 11 | 12 | /* 13 | * This firmware reads all inputs and sends them as fast as it can. It was 14 | * inspired by the ease-of-use of the Arduino2Max program. 15 | * 16 | * This example code is in the public domain. 17 | */ 18 | #include 19 | 20 | byte pin; 21 | 22 | int analogValue; 23 | int previousAnalogValues[TOTAL_ANALOG_PINS]; 24 | 25 | byte portStatus[TOTAL_PORTS]; // each bit: 1=pin is digital input, 0=other/ignore 26 | byte previousPINs[TOTAL_PORTS]; 27 | 28 | /* timer variables */ 29 | unsigned long currentMillis; // store the current value from millis() 30 | unsigned long previousMillis; // for comparison with currentMillis 31 | /* make sure that the FTDI buffer doesn't go over 60 bytes, otherwise you 32 | get long, random delays. So only read analogs every 20ms or so */ 33 | int samplingInterval = 19; // how often to run the main loop (in ms) 34 | 35 | void sendPort(byte portNumber, byte portValue) 36 | { 37 | portValue = portValue & portStatus[portNumber]; 38 | if (previousPINs[portNumber] != portValue) { 39 | Firmata.sendDigitalPort(portNumber, portValue); 40 | previousPINs[portNumber] = portValue; 41 | } 42 | } 43 | 44 | void setup() 45 | { 46 | byte i, port, status; 47 | 48 | Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION); 49 | 50 | for (pin = 0; pin < TOTAL_PINS; pin++) { 51 | if IS_PIN_DIGITAL(pin) pinMode(PIN_TO_DIGITAL(pin), INPUT); 52 | } 53 | 54 | for (port = 0; port < TOTAL_PORTS; port++) { 55 | status = 0; 56 | for (i = 0; i < 8; i++) { 57 | if (IS_PIN_DIGITAL(port * 8 + i)) status |= (1 << i); 58 | } 59 | portStatus[port] = status; 60 | } 61 | 62 | Firmata.begin(57600); 63 | } 64 | 65 | void loop() 66 | { 67 | byte i; 68 | 69 | for (i = 0; i < TOTAL_PORTS; i++) { 70 | sendPort(i, readPort(i, 0xff)); 71 | } 72 | /* make sure that the FTDI buffer doesn't go over 60 bytes, otherwise you 73 | get long, random delays. So only read analogs every 20ms or so */ 74 | currentMillis = millis(); 75 | if (currentMillis - previousMillis > samplingInterval) { 76 | previousMillis += samplingInterval; 77 | while (Firmata.available()) { 78 | Firmata.processInput(); 79 | } 80 | for (pin = 0; pin < TOTAL_ANALOG_PINS; pin++) { 81 | analogValue = analogRead(pin); 82 | if (analogValue != previousAnalogValues[pin]) { 83 | Firmata.sendAnalog(pin, analogValue); 84 | previousAnalogValues[pin] = analogValue; 85 | } 86 | } 87 | } 88 | } 89 | 90 | 91 | -------------------------------------------------------------------------------- /examples/AnalogFirmata/AnalogFirmata.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Firmata is a generic protocol for communicating with microcontrollers 3 | * from software on a host computer. It is intended to work with 4 | * any host computer software package. 5 | * 6 | * To download a host software package, please click on the following link 7 | * to open the list of Firmata client libraries in your default browser. 8 | * 9 | * https://github.com/firmata/arduino#firmata-client-libraries 10 | */ 11 | 12 | /* This firmware supports as many analog ports as possible, all analog inputs, 13 | * four PWM outputs, and two with servo support. 14 | * 15 | * This example code is in the public domain. 16 | */ 17 | #include 18 | #include 19 | 20 | /*============================================================================== 21 | * GLOBAL VARIABLES 22 | *============================================================================*/ 23 | 24 | /* servos */ 25 | Servo servo9, servo10; // one instance per pin 26 | /* analog inputs */ 27 | int analogInputsToReport = 0; // bitwise array to store pin reporting 28 | int analogPin = 0; // counter for reading analog pins 29 | /* timer variables */ 30 | unsigned long currentMillis; // store the current value from millis() 31 | unsigned long previousMillis; // for comparison with currentMillis 32 | 33 | 34 | /*============================================================================== 35 | * FUNCTIONS 36 | *============================================================================*/ 37 | 38 | void analogWriteCallback(byte pin, int value) 39 | { 40 | switch (pin) { 41 | case 9: servo9.write(value); break; 42 | case 10: servo10.write(value); break; 43 | case 3: 44 | case 5: 45 | case 6: 46 | case 11: // PWM pins 47 | analogWrite(pin, value); 48 | break; 49 | } 50 | } 51 | // ----------------------------------------------------------------------------- 52 | // sets bits in a bit array (int) to toggle the reporting of the analogIns 53 | void reportAnalogCallback(byte pin, int value) 54 | { 55 | if (value == 0) { 56 | analogInputsToReport = analogInputsToReport & ~ (1 << pin); 57 | } 58 | else { // everything but 0 enables reporting of that pin 59 | analogInputsToReport = analogInputsToReport | (1 << pin); 60 | } 61 | // TODO: save status to EEPROM here, if changed 62 | } 63 | 64 | /*============================================================================== 65 | * SETUP() 66 | *============================================================================*/ 67 | void setup() 68 | { 69 | Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION); 70 | Firmata.attach(ANALOG_MESSAGE, analogWriteCallback); 71 | Firmata.attach(REPORT_ANALOG, reportAnalogCallback); 72 | 73 | servo9.attach(9); 74 | servo10.attach(10); 75 | Firmata.begin(57600); 76 | } 77 | 78 | /*============================================================================== 79 | * LOOP() 80 | *============================================================================*/ 81 | void loop() 82 | { 83 | while (Firmata.available()) 84 | Firmata.processInput(); 85 | currentMillis = millis(); 86 | if (currentMillis - previousMillis > 20) { 87 | previousMillis += 20; // run this every 20ms 88 | for (analogPin = 0; analogPin < TOTAL_ANALOG_PINS; analogPin++) { 89 | if ( analogInputsToReport & (1 << analogPin) ) 90 | Firmata.sendAnalog(analogPin, analogRead(analogPin)); 91 | } 92 | } 93 | } 94 | 95 | -------------------------------------------------------------------------------- /examples/EchoString/EchoString.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Firmata is a generic protocol for communicating with microcontrollers 3 | * from software on a host computer. It is intended to work with 4 | * any host computer software package. 5 | * 6 | * To download a host software package, please click on the following link 7 | * to open the list of Firmata client libraries in your default browser. 8 | * 9 | * https://github.com/firmata/arduino#firmata-client-libraries 10 | */ 11 | 12 | /* This sketch accepts strings and raw sysex messages and echos them back. 13 | * 14 | * This example code is in the public domain. 15 | */ 16 | #include 17 | 18 | void stringCallback(char *myString) 19 | { 20 | Firmata.sendString(myString); 21 | } 22 | 23 | 24 | void sysexCallback(byte command, byte argc, byte *argv) 25 | { 26 | Firmata.sendSysex(command, argc, argv); 27 | } 28 | 29 | void setup() 30 | { 31 | Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION); 32 | Firmata.attach(STRING_DATA, stringCallback); 33 | Firmata.attach(START_SYSEX, sysexCallback); 34 | Firmata.begin(57600); 35 | } 36 | 37 | void loop() 38 | { 39 | while (Firmata.available()) { 40 | Firmata.processInput(); 41 | } 42 | } 43 | 44 | 45 | -------------------------------------------------------------------------------- /examples/OldStandardFirmata/OldStandardFirmata.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Firmata is a generic protocol for communicating with microcontrollers 3 | * from software on a host computer. It is intended to work with 4 | * any host computer software package. 5 | * 6 | * To download a host software package, please click on the following link 7 | * to open the list of Firmata client libraries in your default browser. 8 | * 9 | * https://github.com/firmata/arduino#firmata-client-libraries 10 | */ 11 | 12 | /* 13 | Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved. 14 | 15 | This library is free software; you can redistribute it and/or 16 | modify it under the terms of the GNU Lesser General Public 17 | License as published by the Free Software Foundation; either 18 | version 2.1 of the License, or (at your option) any later version. 19 | 20 | See file LICENSE.txt for further informations on licensing terms. 21 | */ 22 | 23 | /* 24 | * This is an old version of StandardFirmata (v2.0). It is kept here because 25 | * its the last version that works on an ATMEGA8 chip. Also, it can be used 26 | * for host software that has not been updated to a newer version of the 27 | * protocol. It also uses the old baud rate of 115200 rather than 57600. 28 | */ 29 | 30 | #include 31 | #include 32 | 33 | /*============================================================================== 34 | * GLOBAL VARIABLES 35 | *============================================================================*/ 36 | 37 | /* analog inputs */ 38 | int analogInputsToReport = 0; // bitwise array to store pin reporting 39 | int analogPin = 0; // counter for reading analog pins 40 | 41 | /* digital pins */ 42 | byte reportPINs[TOTAL_PORTS]; // PIN == input port 43 | byte previousPINs[TOTAL_PORTS]; // PIN == input port 44 | byte pinStatus[TOTAL_PINS]; // store pin status, default OUTPUT 45 | byte portStatus[TOTAL_PORTS]; 46 | 47 | /* timer variables */ 48 | unsigned long currentMillis; // store the current value from millis() 49 | unsigned long previousMillis; // for comparison with currentMillis 50 | 51 | 52 | /*============================================================================== 53 | * FUNCTIONS 54 | *============================================================================*/ 55 | 56 | void outputPort(byte portNumber, byte portValue) 57 | { 58 | portValue = portValue & ~ portStatus[portNumber]; 59 | if (previousPINs[portNumber] != portValue) { 60 | Firmata.sendDigitalPort(portNumber, portValue); 61 | previousPINs[portNumber] = portValue; 62 | Firmata.sendDigitalPort(portNumber, portValue); 63 | } 64 | } 65 | 66 | /* ----------------------------------------------------------------------------- 67 | * check all the active digital inputs for change of state, then add any events 68 | * to the Serial output queue using Serial.print() */ 69 | void checkDigitalInputs(void) 70 | { 71 | byte i, tmp; 72 | for (i = 0; i < TOTAL_PORTS; i++) { 73 | if (reportPINs[i]) { 74 | switch (i) { 75 | case 0: outputPort(0, PIND & ~ B00000011); break; // ignore Rx/Tx 0/1 76 | case 1: outputPort(1, PINB); break; 77 | case 2: outputPort(2, PINC); break; 78 | } 79 | } 80 | } 81 | } 82 | 83 | // ----------------------------------------------------------------------------- 84 | /* sets the pin mode to the correct state and sets the relevant bits in the 85 | * two bit-arrays that track Digital I/O and PWM status 86 | */ 87 | void setPinModeCallback(byte pin, int mode) { 88 | byte port = 0; 89 | byte offset = 0; 90 | 91 | if (pin < 8) { 92 | port = 0; 93 | offset = 0; 94 | } else if (pin < 14) { 95 | port = 1; 96 | offset = 8; 97 | } else if (pin < 22) { 98 | port = 2; 99 | offset = 14; 100 | } 101 | 102 | if (pin > 1) { // ignore RxTx (pins 0 and 1) 103 | pinStatus[pin] = mode; 104 | switch (mode) { 105 | case INPUT: 106 | pinMode(pin, INPUT); 107 | portStatus[port] = portStatus[port] & ~ (1 << (pin - offset)); 108 | break; 109 | case OUTPUT: 110 | digitalWrite(pin, LOW); // disable PWM 111 | case PWM: 112 | pinMode(pin, OUTPUT); 113 | portStatus[port] = portStatus[port] | (1 << (pin - offset)); 114 | break; 115 | //case ANALOG: // TODO figure this out 116 | default: 117 | Firmata.sendString(""); 118 | } 119 | // TODO: save status to EEPROM here, if changed 120 | } 121 | } 122 | 123 | void analogWriteCallback(byte pin, int value) 124 | { 125 | setPinModeCallback(pin, PIN_MODE_PWM); 126 | analogWrite(pin, value); 127 | } 128 | 129 | void digitalWriteCallback(byte port, int value) 130 | { 131 | switch (port) { 132 | case 0: // pins 2-7 (don't change Rx/Tx, pins 0 and 1) 133 | // 0xFF03 == B1111111100000011 0x03 == B00000011 134 | PORTD = (value & ~ 0xFF03) | (PORTD & 0x03); 135 | break; 136 | case 1: // pins 8-13 (14,15 are disabled for the crystal) 137 | PORTB = (byte)value; 138 | break; 139 | case 2: // analog pins used as digital 140 | PORTC = (byte)value; 141 | break; 142 | } 143 | } 144 | 145 | // ----------------------------------------------------------------------------- 146 | /* sets bits in a bit array (int) to toggle the reporting of the analogIns 147 | */ 148 | //void FirmataClass::setAnalogPinReporting(byte pin, byte state) { 149 | //} 150 | void reportAnalogCallback(byte pin, int value) 151 | { 152 | if (value == 0) { 153 | analogInputsToReport = analogInputsToReport & ~ (1 << pin); 154 | } 155 | else { // everything but 0 enables reporting of that pin 156 | analogInputsToReport = analogInputsToReport | (1 << pin); 157 | } 158 | // TODO: save status to EEPROM here, if changed 159 | } 160 | 161 | void reportDigitalCallback(byte port, int value) 162 | { 163 | reportPINs[port] = (byte)value; 164 | if (port == 2) // turn off analog reporting when used as digital 165 | analogInputsToReport = 0; 166 | } 167 | 168 | /*============================================================================== 169 | * SETUP() 170 | *============================================================================*/ 171 | void setup() 172 | { 173 | byte i; 174 | 175 | Firmata.setFirmwareVersion(2, 0); 176 | 177 | Firmata.attach(ANALOG_MESSAGE, analogWriteCallback); 178 | Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback); 179 | Firmata.attach(REPORT_ANALOG, reportAnalogCallback); 180 | Firmata.attach(REPORT_DIGITAL, reportDigitalCallback); 181 | Firmata.attach(SET_PIN_MODE, setPinModeCallback); 182 | 183 | portStatus[0] = B00000011; // ignore Tx/RX pins 184 | portStatus[1] = B11000000; // ignore 14/15 pins 185 | portStatus[2] = B00000000; 186 | 187 | // for(i=0; i 20) { 222 | previousMillis += 20; // run this every 20ms 223 | /* SERIALREAD - Serial.read() uses a 128 byte circular buffer, so handle 224 | * all serialReads at once, i.e. empty the buffer */ 225 | while (Firmata.available()) 226 | Firmata.processInput(); 227 | /* SEND FTDI WRITE BUFFER - make sure that the FTDI buffer doesn't go over 228 | * 60 bytes. use a timer to sending an event character every 4 ms to 229 | * trigger the buffer to dump. */ 230 | 231 | /* ANALOGREAD - right after the event character, do all of the 232 | * analogReads(). These only need to be done every 4ms. */ 233 | for (analogPin = 0; analogPin < TOTAL_ANALOG_PINS; analogPin++) { 234 | if ( analogInputsToReport & (1 << analogPin) ) { 235 | Firmata.sendAnalog(analogPin, analogRead(analogPin)); 236 | } 237 | } 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /examples/ServoFirmata/ServoFirmata.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Firmata is a generic protocol for communicating with microcontrollers 3 | * from software on a host computer. It is intended to work with 4 | * any host computer software package. 5 | * 6 | * To download a host software package, please click on the following link 7 | * to open the list of Firmata client libraries in your default browser. 8 | * 9 | * https://github.com/firmata/arduino#firmata-client-libraries 10 | */ 11 | 12 | /* This firmware supports as many servos as possible using the Servo library 13 | * included in Arduino 0017 14 | * 15 | * This example code is in the public domain. 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | Servo servos[MAX_SERVOS]; 22 | byte servoPinMap[TOTAL_PINS]; 23 | byte servoCount = 0; 24 | 25 | void analogWriteCallback(byte pin, int value) 26 | { 27 | if (IS_PIN_DIGITAL(pin)) { 28 | servos[servoPinMap[pin]].write(value); 29 | } 30 | } 31 | 32 | void systemResetCallback() 33 | { 34 | servoCount = 0; 35 | } 36 | 37 | void setup() 38 | { 39 | byte pin; 40 | 41 | Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION); 42 | Firmata.attach(ANALOG_MESSAGE, analogWriteCallback); 43 | Firmata.attach(SYSTEM_RESET, systemResetCallback); 44 | 45 | Firmata.begin(57600); 46 | systemResetCallback(); 47 | 48 | // attach servos from first digital pin up to max number of 49 | // servos supported for the board 50 | for (pin = 0; pin < TOTAL_PINS; pin++) { 51 | if (IS_PIN_DIGITAL(pin)) { 52 | if (servoCount < MAX_SERVOS) { 53 | servoPinMap[pin] = servoCount; 54 | servos[servoPinMap[pin]].attach(PIN_TO_DIGITAL(pin)); 55 | servoCount++; 56 | } 57 | } 58 | } 59 | } 60 | 61 | void loop() 62 | { 63 | while (Firmata.available()) 64 | Firmata.processInput(); 65 | } 66 | -------------------------------------------------------------------------------- /examples/SimpleAnalogFirmata/SimpleAnalogFirmata.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Firmata is a generic protocol for communicating with microcontrollers 3 | * from software on a host computer. It is intended to work with 4 | * any host computer software package. 5 | * 6 | * To download a host software package, please click on the following link 7 | * to open the list of Firmata client libraries in your default browser. 8 | * 9 | * https://github.com/firmata/arduino#firmata-client-libraries 10 | */ 11 | 12 | /* Supports as many analog inputs and analog PWM outputs as possible. 13 | * 14 | * This example code is in the public domain. 15 | */ 16 | #include 17 | 18 | byte analogPin = 0; 19 | 20 | void analogWriteCallback(byte pin, int value) 21 | { 22 | if (IS_PIN_PWM(pin)) { 23 | pinMode(PIN_TO_DIGITAL(pin), OUTPUT); 24 | analogWrite(PIN_TO_PWM(pin), value); 25 | } 26 | } 27 | 28 | void setup() 29 | { 30 | Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION); 31 | Firmata.attach(ANALOG_MESSAGE, analogWriteCallback); 32 | Firmata.begin(57600); 33 | } 34 | 35 | void loop() 36 | { 37 | while (Firmata.available()) { 38 | Firmata.processInput(); 39 | } 40 | // do one analogRead per loop, so if PC is sending a lot of 41 | // analog write messages, we will only delay 1 analogRead 42 | Firmata.sendAnalog(analogPin, analogRead(analogPin)); 43 | analogPin = analogPin + 1; 44 | if (analogPin >= TOTAL_ANALOG_PINS) analogPin = 0; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /examples/SimpleDigitalFirmata/SimpleDigitalFirmata.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Firmata is a generic protocol for communicating with microcontrollers 3 | * from software on a host computer. It is intended to work with 4 | * any host computer software package. 5 | * 6 | * To download a host software package, please click on the following link 7 | * to open the list of Firmata client libraries in your default browser. 8 | * 9 | * https://github.com/firmata/arduino#firmata-client-libraries 10 | */ 11 | 12 | /* Supports as many digital inputs and outputs as possible. 13 | * 14 | * This example code is in the public domain. 15 | */ 16 | #include 17 | 18 | byte previousPIN[TOTAL_PORTS]; // PIN means PORT for input 19 | byte previousPORT[TOTAL_PORTS]; 20 | 21 | void outputPort(byte portNumber, byte portValue) 22 | { 23 | // only send the data when it changes, otherwise you get too many messages! 24 | if (previousPIN[portNumber] != portValue) { 25 | Firmata.sendDigitalPort(portNumber, portValue); 26 | previousPIN[portNumber] = portValue; 27 | } 28 | } 29 | 30 | void setPinModeCallback(byte pin, int mode) { 31 | if (IS_PIN_DIGITAL(pin)) { 32 | pinMode(PIN_TO_DIGITAL(pin), mode); 33 | } 34 | } 35 | 36 | void digitalWriteCallback(byte port, int value) 37 | { 38 | byte i; 39 | byte currentPinValue, previousPinValue; 40 | 41 | if (port < TOTAL_PORTS && value != previousPORT[port]) { 42 | for (i = 0; i < 8; i++) { 43 | currentPinValue = (byte) value & (1 << i); 44 | previousPinValue = previousPORT[port] & (1 << i); 45 | if (currentPinValue != previousPinValue) { 46 | digitalWrite(i + (port * 8), currentPinValue); 47 | } 48 | } 49 | previousPORT[port] = value; 50 | } 51 | } 52 | 53 | void setup() 54 | { 55 | Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION); 56 | Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback); 57 | Firmata.attach(SET_PIN_MODE, setPinModeCallback); 58 | Firmata.begin(57600); 59 | } 60 | 61 | void loop() 62 | { 63 | byte i; 64 | 65 | for (i = 0; i < TOTAL_PORTS; i++) { 66 | outputPort(i, readPort(i, 0xff)); 67 | } 68 | 69 | while (Firmata.available()) { 70 | Firmata.processInput(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /examples/StandardFirmataBLE/bleConfig.h: -------------------------------------------------------------------------------- 1 | /*================================================================================================== 2 | * BLE CONFIGURATION 3 | * 4 | * If you are using a device supported by the ArduinoBLE library or an Arduino 101, you do not need 5 | * to make any changes to this file (unless you need a unique ble local name (see below)). If you 6 | * are using another supported BLE board or shield, follow the instructions for the specific board 7 | * or shield below. 8 | * 9 | * Supported boards and shields: 10 | * - Devices supported by the ArduinoBLE library, including the Arduino MKR WiFi 1010, 11 | * Arduino UNO WiFi Rev.2, Arduino Nano 33 IoT, and Arduino Nano 33 BLE 12 | * - Arduino 101 13 | * - RedBearLab BLE Shield (v2) ** to be verified ** 14 | * - RedBearLab BLE Nano ** works with modifications ** 15 | * - Adafruit Feather M0 Bluefruit LE 16 | * 17 | *================================================================================================*/ 18 | 19 | // change this to a unique name per board if running StandardFirmataBLE on multiple boards 20 | // within the same physical space 21 | #define FIRMATA_BLE_LOCAL_NAME "FIRMATA" 22 | 23 | /* 24 | * ArduinoBLE devices 25 | * 26 | * Be sure to install the ArduinoBLE library via the Arduino Library Manager. 27 | * 28 | */ 29 | #if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_ARDUINO_NANO33BLE) 30 | #define ARDUINO_BLE 31 | 32 | // Value is specified in units of 0.625 ms 33 | #define FIRMATA_BLE_ADVERTISING_INTERVAL 32 // 20ms (20 / 0.625) 34 | 35 | // These values are specified in units of 1.25 ms and must be between 36 | // 0x0006 (7.5ms) and 0x0c80 (4s). 37 | #define FIRMATA_BLE_MIN_INTERVAL 0x000c // 15ms (15 / 1.25) 38 | #define FIRMATA_BLE_MAX_INTERVAL 0x0018 // 30ms (30 / 1.25) 39 | #endif 40 | 41 | 42 | /* 43 | * Arduino 101 44 | * 45 | * Make sure you have the Intel Curie Boards package v2.0.2 or higher installed via the Arduino 46 | * Boards Manager. 47 | * 48 | * Test script: https://gist.github.com/soundanalogous/927360b797574ed50e27 49 | */ 50 | #ifdef _VARIANT_ARDUINO_101_X_ 51 | // After conversion to units of 1.25ms, both values must be between 52 | // 0x0006 (7.5ms) and 0x0c80 (4s) 53 | #define FIRMATA_BLE_MIN_INTERVAL 8 // ( 8 * 1000) / 1250 == 0x06 -> 7.5ms 54 | #define FIRMATA_BLE_MAX_INTERVAL 30 // (30 * 1000) / 1250 == 0x18 -> 30ms 55 | #endif 56 | 57 | 58 | /* 59 | * RedBearLab BLE Shield 60 | * 61 | * If you are using a RedBearLab BLE shield, uncomment the define below. 62 | * Also, change the define for BLE_RST if you have the jumper set to pin 7 rather than pin 4. 63 | * 64 | * You will need to use the shield with an Arduino Zero, Due, Mega, or other board with sufficient 65 | * Flash and RAM. Arduino Uno, Leonardo and other ATmega328p and Atmega32u4 boards to not have 66 | * enough memory to run StandardFirmataBLE. 67 | * 68 | * TODO: verify if this works and with which boards it works. 69 | * 70 | * Test script: https://gist.github.com/soundanalogous/927360b797574ed50e27 71 | */ 72 | //#define REDBEAR_BLE_SHIELD 73 | 74 | #ifdef REDBEAR_BLE_SHIELD 75 | #define BLE_REQ 9 76 | #define BLE_RDY 8 77 | #define BLE_RST 4 // 4 or 7 via jumper on shield 78 | #endif 79 | 80 | 81 | /* 82 | * Adafruit Feather M0 Bluefruit LE 83 | * 84 | * If you are using an Adafruit Feather M0 Bluefruit LE, uncomment the define below. 85 | * This configuration should also work with other Bluefruit LE boards/modules that communicate 86 | * with the nRF51822 via SPI (e.g. Bluefruit LE SPI Friend, Bluefruit LE Shield), although 87 | * you may need to change the values of BLE_SPI_CS, BLE_SPI_IRQ, and/or BLE_SPI_RST below. 88 | * 89 | * You will need to install the latest version of the Adafruit BluefruitLE nRF51 package, 90 | * available at: 91 | * https://github.com/adafruit/Adafruit_BluefruitLE_nRF51/archive/master.zip 92 | */ 93 | //#define BLUEFRUIT_LE_SPI 94 | 95 | #ifdef BLUEFRUIT_LE_SPI 96 | // Value must be between 20ms and 10.24s 97 | #define FIRMATA_BLE_ADVERTISING_INTERVAL 20 // 20ms 98 | 99 | // Both values must be between 10ms and 4s 100 | #define FIRMATA_BLE_MIN_INTERVAL 15 // 15ms 101 | #define FIRMATA_BLE_MAX_INTERVAL 30 // 30ms 102 | 103 | #define BLE_SPI_CS 8 104 | #define BLE_SPI_IRQ 7 105 | #define BLE_SPI_RST 4 106 | #endif 107 | 108 | 109 | /* 110 | * Generic settings 111 | */ 112 | #if !defined(FIRMATA_BLE_MIN_INTERVAL) && !defined(FIRMATA_BLE_MAX_INTERVAL) 113 | // These values apply to all devices using the Arduino BLEPeripheral library 114 | // with a Nordic nRF8001 or nRF51822. Both values must be between 115 | // 0x0006 (7.5ms) and 0x0c80 (4s). 116 | #define FIRMATA_BLE_MIN_INTERVAL 0x0006 // 7.5ms (7.5 / 1.25) 117 | #define FIRMATA_BLE_MAX_INTERVAL 0x0018 // 30ms (30 / 1.25) 118 | #endif 119 | 120 | #if !defined(FIRMATA_BLE_TXBUFFER_FLUSH_INTERVAL) 121 | #define FIRMATA_BLE_TXBUFFER_FLUSH_INTERVAL 30 // 30ms 122 | #endif 123 | 124 | 125 | /*================================================================================================== 126 | * END BLE CONFIGURATION - you should not need to change anything below this line 127 | *================================================================================================*/ 128 | 129 | #ifdef ARDUINO_BLE 130 | #include "utility/ArduinoBLE_UART_Stream.h" 131 | ArduinoBLE_UART_Stream stream; 132 | #endif 133 | 134 | 135 | #ifdef _VARIANT_ARDUINO_101_X_ 136 | #include "utility/BLEStream.h" 137 | BLEStream stream; 138 | #endif 139 | 140 | 141 | #ifdef REDBEAR_BLE_SHIELD 142 | #include 143 | #include "utility/BLEStream.h" 144 | BLEStream stream(BLE_REQ, BLE_RDY, BLE_RST); 145 | #endif 146 | 147 | 148 | #ifdef BLUEFRUIT_LE_SPI 149 | #include "utility/BluefruitLE_SPI_Stream.h" 150 | BluefruitLE_SPI_Stream stream(BLE_SPI_CS, BLE_SPI_IRQ, BLE_SPI_RST); 151 | #endif 152 | 153 | 154 | /* 155 | * RedBearLab BLE Nano (with default switch settings) 156 | * 157 | * Blocked on this issue: https://github.com/RedBearLab/nRF51822-Arduino/issues/46 158 | * Works with modifications. See comments at top of the test script referenced below. 159 | * When the RBL nRF51822-Arduino library issue is resolved, this should work witout 160 | * any modifications. 161 | * 162 | * Test script: https://gist.github.com/soundanalogous/d39bb3eb36333a0906df 163 | * 164 | * Note: If you have changed the solder jumpers on the Nano you may encounter issues since 165 | * the pins are currently mapped in Firmata only for the default (factory) jumper settings. 166 | */ 167 | // #ifdef BLE_NANO 168 | // #include "utility/BLEStream.h" 169 | // BLEStream stream; 170 | // #endif 171 | 172 | 173 | /* 174 | * RedBearLab Blend and Blend Micro 175 | * 176 | * StandardFirmataBLE requires too much Flash and RAM to run on the ATmega32u4-based Blend 177 | * and Blend Micro boards. It may work with ConfigurableFirmata selecting only analog and/or 178 | * digital I/O. 179 | */ 180 | // #if defined(BLEND_MICRO) || defined(BLEND) 181 | // #include 182 | // #include "utility/BLEStream.h" 183 | 184 | // #define BLE_REQ 6 185 | // #define BLE_RDY 7 186 | // #define BLE_RST 4 187 | 188 | // BLEStream stream(BLE_REQ, BLE_RDY, BLE_RST); 189 | // #endif 190 | 191 | 192 | #if defined(BLE_REQ) && defined(BLE_RDY) && defined(BLE_RST) 193 | #define IS_IGNORE_BLE_PINS(p) ((p) == BLE_REQ || (p) == BLE_RDY || (p) == BLE_RST) 194 | #elif defined(BLE_SPI_CS) && defined(BLE_SPI_IRQ) && defined(BLE_SPI_RST) 195 | #define IS_IGNORE_BLE_PINS(p) ((p) == BLE_SPI_CS || (p) == BLE_SPI_IRQ || (p) == BLE_SPI_RST) 196 | #endif 197 | -------------------------------------------------------------------------------- /examples/StandardFirmataEthernet/ethernetConfig.h: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | * NETWORK CONFIGURATION 3 | * 4 | * You must configure your particular hardware. Follow the steps below. 5 | * 6 | * By default, StandardFirmataEthernet is configured as a TCP client. 7 | * To configure as a TCP server, see STEP 2 8 | *============================================================================*/ 9 | 10 | // STEP 1 [REQUIRED] 11 | // Uncomment / comment the appropriate set of includes for your hardware (OPTION A or B) 12 | // Option A is enabled by default. 13 | 14 | /* 15 | * OPTION A: Configure for Arduino Ethernet board or Arduino Ethernet shield (or clone) 16 | * 17 | * To configure StandardFirmataEthernet to use the original WIZ5100-based 18 | * ethernet shield or Arduino Ethernet uncomment the WIZ5100_ETHERNET define below 19 | */ 20 | #define WIZ5100_ETHERNET 21 | 22 | #ifdef WIZ5100_ETHERNET 23 | #include 24 | #include 25 | EthernetClient client; 26 | #endif 27 | 28 | /* 29 | * OPTION B: Configure for Arduin Yun 30 | * 31 | * The Ethernet port on the Arduino Yun board can be used with Firmata in this configuration. 32 | * 33 | * To execute StandardFirmataEthernet on Yun uncomment the YUN_ETHERNET define below and make 34 | * sure the WIZ5100_ETHERNET define (above) is commented out. 35 | * 36 | * On Yun there's no need to configure local_ip and mac address as this is automatically 37 | * configured on the linux-side of Yun. 38 | * 39 | * Note that it may take several seconds to establish a connection with the Yun. 40 | */ 41 | //#define YUN_ETHERNET 42 | 43 | #ifdef YUN_ETHERNET 44 | #include 45 | #include 46 | YunClient client; 47 | #endif 48 | 49 | // STEP 2 [REQUIRED for all boards and shields] 50 | // TCP Client configuration: 51 | // To configure your board as a TCP client, set the IP address of the server you want to connect to. 52 | // TCP Server configuration: 53 | // To configure your board as a TCP server, comment out the following line and also ensure that 54 | // remote_host is also commented out. 55 | #define remote_ip IPAddress(10, 0, 0, 3) 56 | // *** REMOTE HOST IS NOT YET WORKING *** 57 | // replace with hostname of server you want to connect to, comment out if using 'remote_ip' 58 | // #define remote_host "server.local" 59 | 60 | // STEP 3 [REQUIRED] 61 | // Replace with the port that your client or server is listening on. 62 | #define network_port 3030 63 | 64 | // STEP 4 [REQUIRED unless using DHCP] 65 | // Replace with your board or ethernet shield's IP address 66 | // Comment out if you want to use DHCP 67 | #define local_ip IPAddress(10, 0, 0, 15) 68 | 69 | // STEP 5 [REQUIRED] 70 | // replace with ethernet shield mac. Must be unique for your network 71 | const byte mac[] = {0x90, 0xA2, 0xDA, 0x00, 0x53, 0xE5}; 72 | 73 | /*============================================================================== 74 | * CONFIGURATION ERROR CHECK (don't change anything here) 75 | *============================================================================*/ 76 | 77 | #if !defined WIZ5100_ETHERNET && !defined YUN_ETHERNET 78 | #error "you must define either WIZ5100_ETHERNET or YUN_ETHERNET in ethernetConfig.h" 79 | #endif 80 | 81 | #if defined remote_ip && defined remote_host 82 | #error "cannot define both remote_ip and remote_host at the same time in ethernetConfig.h" 83 | #endif 84 | 85 | /*============================================================================== 86 | * PIN IGNORE MACROS (don't change anything here) 87 | *============================================================================*/ 88 | 89 | #if defined(WIZ5100_ETHERNET) 90 | 91 | // ignore SPI pins, pin 10 (Ethernet SS) and pin 4 (SS for SD-Card on Ethernet shield) 92 | #define IS_IGNORE_PIN(p) ((IS_PIN_SPI(p) || (p) == 4) || (p) == 10) 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Firmata 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | Firmata KEYWORD1 Firmata 10 | callbackFunction KEYWORD1 11 | systemResetCallbackFunction KEYWORD1 12 | stringCallbackFunction KEYWORD1 13 | sysexCallbackFunction KEYWORD1 14 | 15 | ####################################### 16 | # Methods and Functions (KEYWORD2) 17 | ####################################### 18 | 19 | begin KEYWORD2 20 | printVersion KEYWORD2 21 | blinkVersion KEYWORD2 22 | printFirmwareVersion KEYWORD2 23 | setFirmwareVersion KEYWORD2 24 | setFirmwareNameAndVersion KEYWORD2 25 | available KEYWORD2 26 | processInput KEYWORD2 27 | isParsingMessage KEYWORD2 28 | parse KEYWORD2 29 | sendAnalog KEYWORD2 30 | sendDigital KEYWORD2 31 | sendDigitalPort KEYWORD2 32 | sendString KEYWORD2 33 | sendSysex KEYWORD2 34 | getPinMode KEYWORD2 35 | setPinMode KEYWORD2 36 | getPinState KEYWORD2 37 | setPinState KEYWORD2 38 | attach KEYWORD2 39 | detach KEYWORD2 40 | write KEYWORD2 41 | sendValueAsTwo7bitBytes KEYWORD2 42 | startSysex KEYWORD2 43 | endSysex KEYWORD2 44 | writePort KEYWORD2 45 | readPort KEYWORD2 46 | disableBlinkVersion KEYWORD2 47 | 48 | 49 | ####################################### 50 | # Constants (LITERAL1) 51 | ####################################### 52 | 53 | FIRMATA_MAJOR_VERSION LITERAL1 54 | FIRMATA_MINOR_VERSION LITERAL1 55 | FIRMATA_BUGFIX_VERSION LITERAL1 56 | 57 | MAX_DATA_BYTES LITERAL1 58 | 59 | DIGITAL_MESSAGE LITERAL1 60 | ANALOG_MESSAGE LITERAL1 61 | REPORT_ANALOG LITERAL1 62 | REPORT_DIGITAL LITERAL1 63 | REPORT_VERSION LITERAL1 64 | SET_PIN_MODE LITERAL1 65 | SET_DIGITAL_PIN_VALUE LITERAL1 66 | SYSTEM_RESET LITERAL1 67 | START_SYSEX LITERAL1 68 | END_SYSEX LITERAL1 69 | REPORT_FIRMWARE LITERAL1 70 | STRING_DATA LITERAL1 71 | 72 | PIN_MODE_ANALOG LITERAL1 73 | PIN_MODE_PWM LITERAL1 74 | PIN_MODE_SERVO LITERAL1 75 | PIN_MODE_SHIFT LITERAL1 76 | PIN_MODE_I2C LITERAL1 77 | PIN_MODE_ONEWIRE LITERAL1 78 | PIN_MODE_STEPPER LITERAL1 79 | PIN_MODE_ENCODER LITERAL1 80 | PIN_MODE_SERIAL LITERAL1 81 | PIN_MODE_PULLUP LITERAL1 82 | PIN_MODE_IGNORE LITERAL1 83 | 84 | TOTAL_PINS LITERAL1 85 | TOTAL_ANALOG_PINS LITERAL1 86 | TOTAL_DIGITAL_PINS LITERAL1 87 | TOTAL_PIN_MODES LITERAL1 88 | TOTAL_PORTS LITERAL1 89 | ANALOG_PORT LITERAL1 90 | MAX_SERVOS LITERAL1 91 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=Firmata 2 | version=2.5.9 3 | author=Firmata Developers 4 | maintainer=Firmata team 5 | sentence=Enables the communication with computer apps using a standard serial protocol. For all Arduino/Genuino boards. 6 | paragraph=The Firmata library implements the Firmata protocol for communicating with software on the host computer. This allows you to write custom firmware without having to create your own protocol and objects for the programming environment that you are using. 7 | category=Device Control 8 | url=https://github.com/firmata/arduino 9 | architectures=* 10 | -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # [Optional] use this script to package Firmata for distribution 4 | 5 | # package for Arduino 1.0.x 6 | mkdir -p temp/Firmata 7 | cp -r examples temp/Firmata 8 | cp -r extras temp/Firmata 9 | cp -r utility temp/Firmata 10 | cp *.cpp temp/Firmata 11 | cp *.h temp/Firmata 12 | cp keywords.txt temp/Firmata 13 | cp readme.md temp/Firmata 14 | cd temp 15 | find . -name "*.DS_Store" -type f -delete 16 | zip -r Firmata.zip ./Firmata/ 17 | cd .. 18 | mv ./temp/Firmata.zip Arduino-1.0.x-Firmata-2.5.9.zip 19 | 20 | #package for Arduino 1.6.x and 1.8.x 21 | cp library.properties temp/Firmata 22 | cd temp/Firmata 23 | mv readme.md ./extras/ 24 | mkdir src 25 | mv *.cpp ./src/ 26 | mv *.h ./src/ 27 | mv utility ./src/ 28 | cd .. 29 | find . -name "*.DS_Store" -type f -delete 30 | zip -r Firmata.zip ./Firmata/ 31 | cd .. 32 | mv ./temp/Firmata.zip Firmata-2.5.9.zip 33 | rm -r ./temp 34 | -------------------------------------------------------------------------------- /utility/ArduinoBLE_UART_Stream.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Implementation is in ArduinoBLE_UART_Stream.h to avoid making ArduinoBLE a 3 | * build-time dependency for all projects that use the Firmata library. 4 | */ 5 | -------------------------------------------------------------------------------- /utility/ArduinoBLE_UART_Stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | ArduinoBLE_UART_Stream.h 3 | 4 | Based on BLEStream.h and the HardwareBLESerial library: 5 | https://github.com/Uberi/Arduino-HardwareBLESerial 6 | */ 7 | 8 | #ifndef _ARDUINO_BLE_UART_STREAM_H_ 9 | #define _ARDUINO_BLE_UART_STREAM_H_ 10 | 11 | #include 12 | 13 | #define BLE_ATTRIBUTE_MAX_VALUE_LENGTH 20 14 | 15 | 16 | class ArduinoBLE_UART_Stream : public Stream 17 | { 18 | public: 19 | ArduinoBLE_UART_Stream(); 20 | 21 | void setLocalName(const char *localName); 22 | void setAdvertisingInterval(unsigned short advertisingInterval); 23 | void setConnectionInterval(unsigned short minConnInterval, unsigned short maxConnInterval); 24 | void setFlushInterval(int flushInterval); 25 | 26 | void begin(); 27 | bool poll(); 28 | void end(); 29 | 30 | // Print overrides 31 | size_t write(uint8_t byte); 32 | using Print::write; // Expose other write variants 33 | 34 | // Stream overrides 35 | int available(); 36 | int read(); 37 | int peek(); 38 | void flush(); 39 | 40 | private: 41 | void dataReceived(const unsigned char *data, size_t size); 42 | 43 | static void connectedHandler(BLEDevice central); 44 | static void disconnectedHandler(BLEDevice central); 45 | 46 | static void rxWrittenHandler(BLEDevice central, BLECharacteristic characteristic); 47 | 48 | static void txSubscribedHandler(BLEDevice central, BLECharacteristic characteristic); 49 | static void txUnsubscribedHandler(BLEDevice central, BLECharacteristic characteristic); 50 | 51 | BLEService uartService; 52 | BLECharacteristic rxCharacteristic; 53 | BLECharacteristic txCharacteristic; 54 | 55 | String localName; 56 | unsigned short advertisingInterval; 57 | unsigned short minConnInterval; 58 | unsigned short maxConnInterval; 59 | int flushInterval; 60 | 61 | bool connected; 62 | 63 | unsigned char rxBuffer[256]; 64 | size_t rxHead; 65 | size_t rxTail; 66 | 67 | bool txSubscribed; 68 | unsigned char txBuffer[BLE_ATTRIBUTE_MAX_VALUE_LENGTH]; 69 | size_t txCount; 70 | unsigned long lastFlushTime; 71 | 72 | static ArduinoBLE_UART_Stream *instance; 73 | }; 74 | 75 | 76 | ArduinoBLE_UART_Stream::ArduinoBLE_UART_Stream() : 77 | uartService("6E400001-B5A3-F393-E0A9-E50E24DCCA9E"), 78 | rxCharacteristic("6E400002-B5A3-F393-E0A9-E50E24DCCA9E", BLEWriteWithoutResponse | BLEWrite, BLE_ATTRIBUTE_MAX_VALUE_LENGTH), 79 | txCharacteristic("6E400003-B5A3-F393-E0A9-E50E24DCCA9E", BLENotify, BLE_ATTRIBUTE_MAX_VALUE_LENGTH), 80 | advertisingInterval(0), 81 | minConnInterval(0), 82 | maxConnInterval(0), 83 | flushInterval(100), // Default flush interval is 100ms 84 | connected(false), 85 | rxHead(0), 86 | rxTail(0), 87 | txSubscribed(false), 88 | txCount(0), 89 | lastFlushTime(0) 90 | { 91 | instance = this; 92 | } 93 | 94 | void ArduinoBLE_UART_Stream::setLocalName(const char *localName) 95 | { 96 | this->localName = localName; 97 | } 98 | 99 | void ArduinoBLE_UART_Stream::setAdvertisingInterval(unsigned short advertisingInterval) 100 | { 101 | this->advertisingInterval = advertisingInterval; 102 | } 103 | 104 | void ArduinoBLE_UART_Stream::setConnectionInterval(unsigned short minConnInterval, unsigned short maxConnInterval) 105 | { 106 | this->minConnInterval = minConnInterval; 107 | this->maxConnInterval = maxConnInterval; 108 | } 109 | 110 | void ArduinoBLE_UART_Stream::setFlushInterval(int flushInterval) 111 | { 112 | // The minimum allowed connection interval is 7.5ms, so don't try to flush 113 | // more frequently than that 114 | this->flushInterval = max(flushInterval, 8); 115 | } 116 | 117 | void ArduinoBLE_UART_Stream::begin() 118 | { 119 | BLE.begin(); 120 | 121 | if (localName.length() > 0) { 122 | BLE.setLocalName(localName.c_str()); 123 | } 124 | if (advertisingInterval > 0) { 125 | BLE.setAdvertisingInterval(advertisingInterval); 126 | } 127 | if (minConnInterval > 0 && maxConnInterval > 0) { 128 | BLE.setConnectionInterval(minConnInterval, maxConnInterval); 129 | } 130 | 131 | BLE.setEventHandler(BLEConnected, connectedHandler); 132 | BLE.setEventHandler(BLEDisconnected, disconnectedHandler); 133 | 134 | rxCharacteristic.setEventHandler(BLEWritten, rxWrittenHandler); 135 | uartService.addCharacteristic(rxCharacteristic); 136 | 137 | txCharacteristic.setEventHandler(BLESubscribed, txSubscribedHandler); 138 | txCharacteristic.setEventHandler(BLEUnsubscribed, txUnsubscribedHandler); 139 | uartService.addCharacteristic(txCharacteristic); 140 | 141 | BLE.addService(uartService); 142 | BLE.setAdvertisedService(uartService); 143 | BLE.advertise(); 144 | } 145 | 146 | bool ArduinoBLE_UART_Stream::poll() 147 | { 148 | if (millis() - lastFlushTime > flushInterval) { 149 | flush(); // Always calls BLE.poll() 150 | } else { 151 | BLE.poll(); 152 | } 153 | return connected; 154 | } 155 | 156 | void ArduinoBLE_UART_Stream::end() 157 | { 158 | flush(); 159 | txCharacteristic.setEventHandler(BLEUnsubscribed, NULL); 160 | txCharacteristic.setEventHandler(BLESubscribed, NULL); 161 | txSubscribed = false; 162 | 163 | rxCharacteristic.setEventHandler(BLEWritten, NULL); 164 | rxHead = 0; 165 | rxTail = 0; 166 | 167 | BLE.setEventHandler(BLEDisconnected, NULL); 168 | BLE.setEventHandler(BLEConnected, NULL); 169 | connected = false; 170 | 171 | BLE.end(); 172 | } 173 | 174 | size_t ArduinoBLE_UART_Stream::write(uint8_t byte) 175 | { 176 | if (!txSubscribed) { 177 | return 0; 178 | } 179 | txBuffer[txCount] = byte; 180 | txCount++; 181 | if (txCount == sizeof(txBuffer)) { 182 | flush(); 183 | } 184 | return 1; 185 | } 186 | 187 | int ArduinoBLE_UART_Stream::available() 188 | { 189 | return (rxHead - rxTail + sizeof(rxBuffer)) % sizeof(rxBuffer); 190 | } 191 | 192 | int ArduinoBLE_UART_Stream::read() 193 | { 194 | if (rxTail == rxHead) { 195 | return -1; 196 | } 197 | uint8_t byte = rxBuffer[rxTail]; 198 | rxTail = (rxTail + 1) % sizeof(rxBuffer); 199 | return byte; 200 | } 201 | 202 | int ArduinoBLE_UART_Stream::peek() 203 | { 204 | if (rxTail == rxHead) { 205 | return -1; 206 | } 207 | return rxBuffer[rxTail]; 208 | } 209 | 210 | void ArduinoBLE_UART_Stream::flush() 211 | { 212 | if (txCount > 0) { 213 | txCharacteristic.setValue(txBuffer, txCount); 214 | txCount = 0; 215 | } 216 | lastFlushTime = millis(); 217 | BLE.poll(); 218 | } 219 | 220 | void ArduinoBLE_UART_Stream::dataReceived(const unsigned char *data, size_t size) 221 | { 222 | for (size_t i = 0; i < size; i++) { 223 | rxBuffer[rxHead] = data[i]; 224 | rxHead = (rxHead + 1) % sizeof(rxBuffer); 225 | } 226 | } 227 | 228 | void ArduinoBLE_UART_Stream::connectedHandler(BLEDevice central) 229 | { 230 | instance->connected = true; 231 | } 232 | 233 | void ArduinoBLE_UART_Stream::disconnectedHandler(BLEDevice central) 234 | { 235 | instance->connected = false; 236 | } 237 | 238 | void ArduinoBLE_UART_Stream::rxWrittenHandler(BLEDevice central, BLECharacteristic characteristic) 239 | { 240 | instance->dataReceived(characteristic.value(), characteristic.valueLength()); 241 | } 242 | 243 | void ArduinoBLE_UART_Stream::txSubscribedHandler(BLEDevice central, BLECharacteristic characteristic) 244 | { 245 | instance->txSubscribed = true; 246 | } 247 | 248 | void ArduinoBLE_UART_Stream::txUnsubscribedHandler(BLEDevice central, BLECharacteristic characteristic) 249 | { 250 | instance->txSubscribed = false; 251 | } 252 | 253 | ArduinoBLE_UART_Stream * ArduinoBLE_UART_Stream::instance = NULL; 254 | 255 | 256 | #endif // _ARDUINO_BLE_UART_STREAM_H_ 257 | -------------------------------------------------------------------------------- /utility/BLEStream.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Implementation is in BLEStream.h to avoid linker issues. 3 | */ 4 | -------------------------------------------------------------------------------- /utility/BLEStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | BLEStream.h 3 | 4 | Based on BLESerial.cpp by Voita Molda 5 | https://github.com/sandeepmistry/arduino-BLEPeripheral/blob/master/examples/serial/BLESerial.h 6 | 7 | Last updated April 4th, 2016 8 | */ 9 | 10 | #ifndef _BLE_STREAM_H_ 11 | #define _BLE_STREAM_H_ 12 | 13 | #include 14 | #if defined(_VARIANT_ARDUINO_101_X_) 15 | #include 16 | #define _MAX_ATTR_DATA_LEN_ BLE_MAX_ATTR_DATA_LEN 17 | #else 18 | #include 19 | #define _MAX_ATTR_DATA_LEN_ BLE_ATTRIBUTE_MAX_VALUE_LENGTH 20 | #endif 21 | 22 | #define BLESTREAM_TXBUFFER_FLUSH_INTERVAL 80 23 | #define BLESTREAM_MIN_FLUSH_INTERVAL 8 // minimum interval for flushing the TX buffer 24 | 25 | // #define BLE_SERIAL_DEBUG 26 | 27 | class BLEStream : public BLEPeripheral, public Stream 28 | { 29 | public: 30 | BLEStream(unsigned char req = 0, unsigned char rdy = 0, unsigned char rst = 0); 31 | 32 | void begin(...); 33 | bool poll(); 34 | void end(); 35 | void setFlushInterval(int); 36 | 37 | virtual int available(void); 38 | virtual int peek(void); 39 | virtual int read(void); 40 | virtual void flush(void); 41 | virtual size_t write(uint8_t byte); 42 | using Print::write; 43 | virtual operator bool(); 44 | 45 | private: 46 | bool _connected; 47 | unsigned long _flushed; 48 | int _flushInterval; 49 | static BLEStream* _instance; 50 | 51 | size_t _rxHead; 52 | size_t _rxTail; 53 | size_t _rxCount() const; 54 | unsigned char _rxBuffer[256]; 55 | size_t _txCount; 56 | unsigned char _txBuffer[_MAX_ATTR_DATA_LEN_]; 57 | 58 | BLEService _uartService = BLEService("6E400001-B5A3-F393-E0A9-E50E24DCCA9E"); 59 | BLEDescriptor _uartNameDescriptor = BLEDescriptor("2901", "UART"); 60 | BLECharacteristic _rxCharacteristic = BLECharacteristic("6E400002-B5A3-F393-E0A9-E50E24DCCA9E", BLEWriteWithoutResponse, _MAX_ATTR_DATA_LEN_); 61 | BLEDescriptor _rxNameDescriptor = BLEDescriptor("2901", "RX - Receive Data (Write)"); 62 | BLECharacteristic _txCharacteristic = BLECharacteristic("6E400003-B5A3-F393-E0A9-E50E24DCCA9E", BLENotify, _MAX_ATTR_DATA_LEN_); 63 | BLEDescriptor _txNameDescriptor = BLEDescriptor("2901", "TX - Transfer Data (Notify)"); 64 | 65 | void _received(const unsigned char* data, size_t size); 66 | static void _received(BLECentral& /*central*/, BLECharacteristic& rxCharacteristic); 67 | }; 68 | 69 | 70 | /* 71 | * BLEStream.cpp 72 | * Copied here as a hack to avoid having to install the BLEPeripheral libarary even if it's 73 | * not needed. 74 | */ 75 | 76 | BLEStream* BLEStream::_instance = NULL; 77 | 78 | BLEStream::BLEStream(unsigned char req, unsigned char rdy, unsigned char rst) : 79 | #if defined(_VARIANT_ARDUINO_101_X_) 80 | BLEPeripheral() 81 | #else 82 | BLEPeripheral(req, rdy, rst) 83 | #endif 84 | { 85 | this->_txCount = 0; 86 | this->_rxHead = this->_rxTail = 0; 87 | this->_flushed = 0; 88 | this->_flushInterval = BLESTREAM_TXBUFFER_FLUSH_INTERVAL; 89 | BLEStream::_instance = this; 90 | 91 | addAttribute(this->_uartService); 92 | addAttribute(this->_uartNameDescriptor); 93 | setAdvertisedServiceUuid(this->_uartService.uuid()); 94 | addAttribute(this->_rxCharacteristic); 95 | addAttribute(this->_rxNameDescriptor); 96 | this->_rxCharacteristic.setEventHandler(BLEWritten, BLEStream::_received); 97 | addAttribute(this->_txCharacteristic); 98 | addAttribute(this->_txNameDescriptor); 99 | } 100 | 101 | void BLEStream::begin(...) 102 | { 103 | BLEPeripheral::begin(); 104 | #ifdef BLE_SERIAL_DEBUG 105 | Serial.println(F("BLEStream::begin()")); 106 | #endif 107 | } 108 | 109 | bool BLEStream::poll() 110 | { 111 | // BLEPeripheral::poll is called each time connected() is called 112 | this->_connected = BLEPeripheral::connected(); 113 | if (millis() > this->_flushed + this->_flushInterval) { 114 | flush(); 115 | } 116 | return this->_connected; 117 | } 118 | 119 | void BLEStream::end() 120 | { 121 | this->_rxCharacteristic.setEventHandler(BLEWritten, (void(*)(BLECentral&, BLECharacteristic&))NULL); 122 | this->_rxHead = this->_rxTail = 0; 123 | flush(); 124 | BLEPeripheral::disconnect(); 125 | } 126 | 127 | int BLEStream::available(void) 128 | { 129 | // BLEPeripheral::poll only calls delay(1) in CurieBLE so skipping it here to avoid the delay 130 | #ifndef _VARIANT_ARDUINO_101_X_ 131 | // TODO Need to do more testing to determine if all of these calls to BLEPeripheral::poll are 132 | // actually necessary. Seems to run fine without them, but only minimal testing so far. 133 | BLEPeripheral::poll(); 134 | #endif 135 | int retval = (this->_rxHead - this->_rxTail + sizeof(this->_rxBuffer)) % sizeof(this->_rxBuffer); 136 | #ifdef BLE_SERIAL_DEBUG 137 | if (retval > 0) { 138 | Serial.print(F("BLEStream::available() = ")); 139 | Serial.println(retval); 140 | } 141 | #endif 142 | return retval; 143 | } 144 | 145 | int BLEStream::peek(void) 146 | { 147 | #ifndef _VARIANT_ARDUINO_101_X_ 148 | BLEPeripheral::poll(); 149 | #endif 150 | if (this->_rxTail == this->_rxHead) return -1; 151 | uint8_t byte = this->_rxBuffer[this->_rxTail]; 152 | #ifdef BLE_SERIAL_DEBUG 153 | Serial.print(F("BLEStream::peek() = 0x")); 154 | Serial.println(byte, HEX); 155 | #endif 156 | return byte; 157 | } 158 | 159 | int BLEStream::read(void) 160 | { 161 | #ifndef _VARIANT_ARDUINO_101_X_ 162 | BLEPeripheral::poll(); 163 | #endif 164 | if (this->_rxTail == this->_rxHead) return -1; 165 | this->_rxTail = (this->_rxTail + 1) % sizeof(this->_rxBuffer); 166 | uint8_t byte = this->_rxBuffer[this->_rxTail]; 167 | #ifdef BLE_SERIAL_DEBUG 168 | Serial.print(F("BLEStream::read() = 0x")); 169 | Serial.println(byte, HEX); 170 | #endif 171 | return byte; 172 | } 173 | 174 | void BLEStream::flush(void) 175 | { 176 | if (this->_txCount == 0) return; 177 | #ifndef _VARIANT_ARDUINO_101_X_ 178 | // ensure there are available packets before sending 179 | while(!this->_txCharacteristic.canNotify()) { 180 | BLEPeripheral::poll(); 181 | } 182 | #endif 183 | this->_txCharacteristic.setValue(this->_txBuffer, this->_txCount); 184 | this->_flushed = millis(); 185 | this->_txCount = 0; 186 | #ifdef BLE_SERIAL_DEBUG 187 | Serial.println(F("BLEStream::flush()")); 188 | #endif 189 | } 190 | 191 | size_t BLEStream::write(uint8_t byte) 192 | { 193 | #ifndef _VARIANT_ARDUINO_101_X_ 194 | BLEPeripheral::poll(); 195 | #endif 196 | if (this->_txCharacteristic.subscribed() == false) return 0; 197 | this->_txBuffer[this->_txCount++] = byte; 198 | if (this->_txCount == sizeof(this->_txBuffer)) flush(); 199 | #ifdef BLE_SERIAL_DEBUG 200 | Serial.print(F("BLEStream::write( 0x")); 201 | Serial.print(byte, HEX); 202 | Serial.println(F(") = 1")); 203 | #endif 204 | return 1; 205 | } 206 | 207 | BLEStream::operator bool() 208 | { 209 | bool retval = this->_connected = BLEPeripheral::connected(); 210 | #ifdef BLE_SERIAL_DEBUG 211 | Serial.print(F("BLEStream::operator bool() = ")); 212 | Serial.println(retval); 213 | #endif 214 | return retval; 215 | } 216 | 217 | void BLEStream::setFlushInterval(int interval) 218 | { 219 | if (interval > BLESTREAM_MIN_FLUSH_INTERVAL) { 220 | this->_flushInterval = interval; 221 | } 222 | } 223 | 224 | void BLEStream::_received(const unsigned char* data, size_t size) 225 | { 226 | for (size_t i = 0; i < size; i++) { 227 | this->_rxHead = (this->_rxHead + 1) % sizeof(this->_rxBuffer); 228 | this->_rxBuffer[this->_rxHead] = data[i]; 229 | } 230 | #ifdef BLE_SERIAL_DEBUG 231 | Serial.print(F("BLEStream::received(")); 232 | for (int i = 0; i < size; i++) Serial.print(data[i], HEX); 233 | Serial.println(F(")")); 234 | #endif 235 | } 236 | 237 | void BLEStream::_received(BLECentral& /*central*/, BLECharacteristic& rxCharacteristic) 238 | { 239 | BLEStream::_instance->_received(rxCharacteristic.value(), rxCharacteristic.valueLength()); 240 | } 241 | 242 | 243 | #endif // _BLE_STREAM_H_ 244 | -------------------------------------------------------------------------------- /utility/BluefruitLE_SPI_Stream.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Implementation is in BluefruitLE_SPI_Stream.h to avoid making 3 | * Adafruit_BluefruitLE_nRF51 a build-time dependency for all projects that use 4 | * the Firmata library. 5 | */ 6 | -------------------------------------------------------------------------------- /utility/BluefruitLE_SPI_Stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | BluefruitLE_SPI_Stream.h 3 | 4 | Documentation for the various AT commands used below is available at 5 | https://learn.adafruit.com/adafruit-feather-m0-bluefruit-le/at-commands 6 | */ 7 | 8 | #ifndef _BLUEFRUIT_LE_SPI_STREAM_H_ 9 | #define _BLUEFRUIT_LE_SPI_STREAM_H_ 10 | 11 | #include 12 | 13 | 14 | class BluefruitLE_SPI_Stream : public Stream 15 | { 16 | public: 17 | BluefruitLE_SPI_Stream(int8_t csPin, int8_t irqPin, int8_t rstPin); 18 | 19 | void setLocalName(const char *localName); 20 | void setAdvertisingInterval(unsigned short advertisingInterval); 21 | void setConnectionInterval(unsigned short minConnInterval, unsigned short maxConnInterval); 22 | void setFlushInterval(int flushInterval); 23 | 24 | void begin(); 25 | bool poll(); 26 | void end(); 27 | 28 | // Print overrides 29 | size_t write(uint8_t byte); 30 | using Print::write; // Expose other write variants 31 | 32 | // Stream overrides 33 | int available(); 34 | int read(); 35 | int peek(); 36 | void flush(); 37 | 38 | private: 39 | Adafruit_BluefruitLE_SPI ble; 40 | 41 | String localName; 42 | unsigned short advertisingInterval; 43 | unsigned short minConnInterval; 44 | unsigned short maxConnInterval; 45 | 46 | uint8_t txBuffer[SDEP_MAX_PACKETSIZE]; 47 | size_t txCount; 48 | }; 49 | 50 | 51 | BluefruitLE_SPI_Stream::BluefruitLE_SPI_Stream(int8_t csPin, int8_t irqPin, int8_t rstPin) : 52 | ble(csPin, irqPin, rstPin), 53 | advertisingInterval(0), 54 | minConnInterval(0), 55 | maxConnInterval(0), 56 | txCount(0) 57 | { } 58 | 59 | void BluefruitLE_SPI_Stream::setLocalName(const char *localName) 60 | { 61 | this->localName = localName; 62 | } 63 | 64 | void BluefruitLE_SPI_Stream::setAdvertisingInterval(unsigned short advertisingInterval) 65 | { 66 | this->advertisingInterval = advertisingInterval; 67 | } 68 | 69 | void BluefruitLE_SPI_Stream::setConnectionInterval(unsigned short minConnInterval, unsigned short maxConnInterval) 70 | { 71 | this->minConnInterval = minConnInterval; 72 | this->maxConnInterval = maxConnInterval; 73 | } 74 | 75 | void BluefruitLE_SPI_Stream::setFlushInterval(int flushInterval) 76 | { 77 | // Not used 78 | } 79 | 80 | void BluefruitLE_SPI_Stream::begin() 81 | { 82 | // Initialize the SPI interface 83 | ble.begin(); 84 | 85 | // Perform a factory reset to make sure everything is in a known state 86 | ble.factoryReset(); 87 | 88 | // Disable command echo from Bluefruit 89 | ble.echo(false); 90 | 91 | // Change the MODE LED to indicate BLE UART activity 92 | ble.println("AT+HWMODELED=BLEUART"); 93 | 94 | // Set local name 95 | if (localName.length() > 0) { 96 | ble.print("AT+GAPDEVNAME="); 97 | ble.println(localName); 98 | } 99 | 100 | // Set connection and advertising intervals 101 | ble.print("AT+GAPINTERVALS="); 102 | if (minConnInterval > 0) ble.print(minConnInterval); 103 | ble.print(","); 104 | if (maxConnInterval > 0) ble.print(maxConnInterval); 105 | ble.print(","); 106 | if (advertisingInterval > 0) ble.print(advertisingInterval); 107 | ble.print(",,"); // Always omit fast advertising timeout, hence two commas 108 | if (advertisingInterval > 0) ble.print(advertisingInterval); 109 | ble.println(); 110 | 111 | // Disable real and simulated mode switch (i.e. "+++") command 112 | ble.println("AT+MODESWITCHEN=local,0"); 113 | ble.enableModeSwitchCommand(false); 114 | 115 | // Switch to data mode 116 | ble.setMode(BLUEFRUIT_MODE_DATA); 117 | } 118 | 119 | bool BluefruitLE_SPI_Stream::poll() 120 | { 121 | // If there's outgoing data in the buffer, just send it. The firmware on 122 | // the nRF51822 will decide when to transmit the data in its TX FIFO. 123 | if (txCount) flush(); 124 | 125 | // In order to check for a connection, we would need to switch from data to 126 | // command mode and back again. However, due to the internal workings of 127 | // Adafruit_BluefruitLE_SPI, this can lead to unread incoming data being 128 | // lost. Therefore, we always return true. 129 | return true; 130 | } 131 | 132 | void BluefruitLE_SPI_Stream::end() 133 | { 134 | flush(); 135 | ble.end(); 136 | } 137 | 138 | size_t BluefruitLE_SPI_Stream::write(uint8_t byte) 139 | { 140 | txBuffer[txCount++] = byte; 141 | if (txCount == sizeof(txBuffer)) flush(); 142 | return 1; 143 | } 144 | 145 | int BluefruitLE_SPI_Stream::available() 146 | { 147 | return ble.available(); 148 | } 149 | 150 | int BluefruitLE_SPI_Stream::read() 151 | { 152 | return ble.read(); 153 | } 154 | 155 | int BluefruitLE_SPI_Stream::peek() 156 | { 157 | return ble.peek(); 158 | } 159 | 160 | void BluefruitLE_SPI_Stream::flush() 161 | { 162 | ble.write(txBuffer, txCount); 163 | txCount = 0; 164 | } 165 | 166 | 167 | #endif // _BLUEFRUIT_LE_SPI_STREAM_H_ 168 | -------------------------------------------------------------------------------- /utility/EthernetClientStream.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Implementation is in EthernetClientStream.h to avoid linker issues. 3 | */ 4 | -------------------------------------------------------------------------------- /utility/EthernetClientStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | EthernetClientStream.h 3 | An Arduino-Stream that wraps an instance of Client reconnecting to 4 | the remote-ip in a transparent way. A disconnected client may be 5 | recognized by the returnvalues -1 from calls to peek or read and 6 | a 0 from calls to write. 7 | 8 | Copyright (C) 2013 Norbert Truchsess. All rights reserved. 9 | 10 | This library is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU Lesser General Public 12 | License as published by the Free Software Foundation; either 13 | version 2.1 of the License, or (at your option) any later version. 14 | 15 | See file LICENSE.txt for further informations on licensing terms. 16 | 17 | Last updated March 10th, 2020 18 | */ 19 | 20 | #ifndef ETHERNETCLIENTSTREAM_H 21 | #define ETHERNETCLIENTSTREAM_H 22 | 23 | #include 24 | #include 25 | 26 | //#define SERIAL_DEBUG 27 | #include "firmataDebug.h" 28 | 29 | #define MILLIS_RECONNECT 5000 30 | 31 | #define HOST_CONNECTION_DISCONNECTED 0 32 | #define HOST_CONNECTION_CONNECTED 1 33 | 34 | extern "C" { 35 | // callback function types 36 | typedef void (*hostConnectionCallbackFunction)(byte); 37 | } 38 | 39 | class EthernetClientStream : public Stream 40 | { 41 | public: 42 | EthernetClientStream(Client &client, IPAddress localip, IPAddress ip, const char* host, uint16_t port); 43 | int available(); 44 | int read(); 45 | int peek(); 46 | void flush(); 47 | size_t write(uint8_t); 48 | void maintain(IPAddress localip); 49 | void attach(hostConnectionCallbackFunction newFunction); 50 | 51 | private: 52 | Client &client; 53 | IPAddress localip; 54 | IPAddress ip; 55 | const char* host; 56 | uint16_t port; 57 | bool connected; 58 | uint32_t time_connect; 59 | hostConnectionCallbackFunction currentHostConnectionCallback; 60 | bool maintain(); 61 | void stop(); 62 | }; 63 | 64 | 65 | /* 66 | * EthernetClientStream.cpp 67 | * Copied here as a hack to linker issues with 3rd party board packages that don't properly 68 | * implement the Arduino network APIs. 69 | */ 70 | EthernetClientStream::EthernetClientStream(Client &client, IPAddress localip, IPAddress ip, const char* host, uint16_t port) 71 | : client(client), 72 | localip(localip), 73 | ip(ip), 74 | host(host), 75 | port(port), 76 | connected(false) 77 | , currentHostConnectionCallback(nullptr) 78 | { 79 | } 80 | 81 | int 82 | EthernetClientStream::available() 83 | { 84 | return maintain() ? client.available() : 0; 85 | } 86 | 87 | int 88 | EthernetClientStream::read() 89 | { 90 | return maintain() ? client.read() : -1; 91 | } 92 | 93 | int 94 | EthernetClientStream::peek() 95 | { 96 | return maintain() ? client.peek() : -1; 97 | } 98 | 99 | void EthernetClientStream::flush() 100 | { 101 | if (maintain()) 102 | client.flush(); 103 | } 104 | 105 | size_t 106 | EthernetClientStream::write(uint8_t c) 107 | { 108 | return maintain() ? client.write(c) : 0; 109 | } 110 | 111 | void 112 | EthernetClientStream::maintain(IPAddress localip) 113 | { 114 | // ensure the local IP is updated in the case that it is changed by the DHCP server 115 | if (this->localip != localip) { 116 | this->localip = localip; 117 | if (connected) 118 | stop(); 119 | } 120 | } 121 | 122 | void 123 | EthernetClientStream::stop() 124 | { 125 | client.stop(); 126 | if (currentHostConnectionCallback) 127 | { 128 | (*currentHostConnectionCallback)(HOST_CONNECTION_DISCONNECTED); 129 | } 130 | connected = false; 131 | time_connect = millis(); 132 | } 133 | 134 | void 135 | EthernetClientStream::attach(hostConnectionCallbackFunction newFunction) 136 | { 137 | currentHostConnectionCallback = newFunction; 138 | } 139 | 140 | bool 141 | EthernetClientStream::maintain() 142 | { 143 | if (client && client.connected()) 144 | return true; 145 | 146 | if (connected) { 147 | stop(); 148 | } 149 | // if the client is disconnected, attempt to reconnect every 5 seconds 150 | else if (millis() - time_connect >= MILLIS_RECONNECT) { 151 | connected = host ? client.connect(host, port) : client.connect(ip, port); 152 | if (!connected) { 153 | time_connect = millis(); 154 | DEBUG_PRINTLN("Connection failed. Attempting to reconnect..."); 155 | } else { 156 | DEBUG_PRINTLN("Connected"); 157 | if (currentHostConnectionCallback) 158 | { 159 | (*currentHostConnectionCallback)(HOST_CONNECTION_CONNECTED); 160 | } 161 | } 162 | } 163 | return connected; 164 | } 165 | 166 | #endif /* ETHERNETCLIENTSTREAM_H */ 167 | -------------------------------------------------------------------------------- /utility/EthernetServerStream.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Implementation is in EthernetServerStream.h to avoid linker issues. 3 | */ 4 | -------------------------------------------------------------------------------- /utility/EthernetServerStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | EthernetServerStream.h 3 | 4 | Copyright (C) 2017 Marc Josef Pees. All rights reserved. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | See file LICENSE.txt for further informations on licensing terms. 12 | 13 | Last updated July 10th, 2017 14 | */ 15 | 16 | #ifndef ETHERNETSERVERSTREAM_H 17 | #define ETHERNETSERVERSTREAM_H 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | //#define SERIAL_DEBUG 24 | #include "firmataDebug.h" 25 | 26 | class EthernetServerStream : public Stream 27 | { 28 | public: 29 | EthernetServerStream(IPAddress localip, uint16_t port); 30 | int available(); 31 | int read(); 32 | int peek(); 33 | void flush(); 34 | size_t write(uint8_t); 35 | void maintain(IPAddress localip); 36 | 37 | private: 38 | EthernetClient client; 39 | IPAddress localip; 40 | uint16_t port; 41 | bool connected; 42 | bool maintain(); 43 | void stop(); 44 | 45 | protected: 46 | EthernetServer server = EthernetServer(3030); 47 | bool listening = false; 48 | bool connect_client(); 49 | }; 50 | 51 | 52 | /* 53 | * EthernetServerStream.cpp 54 | * Copied here as a hack to linker issues with 3rd party board packages that don't properly 55 | * implement the Arduino network APIs. 56 | */ 57 | EthernetServerStream::EthernetServerStream(IPAddress localip, uint16_t port) 58 | : localip(localip), 59 | port(port), 60 | connected(false) 61 | { 62 | } 63 | 64 | bool EthernetServerStream::connect_client() 65 | { 66 | if ( connected ) 67 | { 68 | if ( client && client.connected() ) return true; 69 | stop(); 70 | } 71 | 72 | EthernetClient newClient = server.available(); 73 | if ( !newClient ) return false; 74 | client = newClient; 75 | connected = true; 76 | DEBUG_PRINTLN("Connected"); 77 | return true; 78 | } 79 | 80 | int 81 | EthernetServerStream::available() 82 | { 83 | return maintain() ? client.available() : 0; 84 | } 85 | 86 | int 87 | EthernetServerStream::read() 88 | { 89 | return maintain() ? client.read() : -1; 90 | } 91 | 92 | int 93 | EthernetServerStream::peek() 94 | { 95 | return maintain() ? client.peek() : -1; 96 | } 97 | 98 | void EthernetServerStream::flush() 99 | { 100 | if (maintain()) 101 | client.flush(); 102 | } 103 | 104 | size_t 105 | EthernetServerStream::write(uint8_t c) 106 | { 107 | return maintain() ? client.write(c) : 0; 108 | } 109 | 110 | void 111 | EthernetServerStream::maintain(IPAddress localip) 112 | { 113 | // ensure the local IP is updated in the case that it is changed by the DHCP server 114 | if (this->localip != localip) { 115 | this->localip = localip; 116 | if (connected) 117 | stop(); 118 | } 119 | } 120 | 121 | void 122 | EthernetServerStream::stop() 123 | { 124 | if(client) 125 | { 126 | client.stop(); 127 | } 128 | connected = false; 129 | } 130 | 131 | bool 132 | EthernetServerStream::maintain() 133 | { 134 | if (connect_client()) return true; 135 | 136 | stop(); 137 | 138 | if(!listening) 139 | { 140 | server = EthernetServer(port); 141 | server.begin(); 142 | listening = true; 143 | } 144 | return false; 145 | } 146 | 147 | #endif /* ETHERNETSERVERSTREAM_H */ 148 | -------------------------------------------------------------------------------- /utility/FirmataFeature.h: -------------------------------------------------------------------------------- 1 | /* 2 | FirmataFeature.h 3 | Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved. 4 | Copyright (C) 2010-2011 Paul Stoffregen. All rights reserved. 5 | Copyright (C) 2009 Shigeru Kobayashi. All rights reserved. 6 | Copyright (C) 2013 Norbert Truchsess. All rights reserved. 7 | Copyright (C) 2009-2016 Jeff Hoefs. All rights reserved. 8 | 9 | This library is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU Lesser General Public 11 | License as published by the Free Software Foundation; either 12 | version 2.1 of the License, or (at your option) any later version. 13 | 14 | Interface for Firmata feature classes. 15 | 16 | This version of FirmataFeature.h differs from the ConfigurableFirmata 17 | version in the following ways: 18 | 19 | - Imports Firmata.h rather than ConfigurableFirmata.h 20 | 21 | See file LICENSE.txt for further informations on licensing terms. 22 | */ 23 | 24 | #ifndef FirmataFeature_h 25 | #define FirmataFeature_h 26 | 27 | #include 28 | 29 | class FirmataFeature 30 | { 31 | public: 32 | virtual void handleCapability(byte pin) = 0; 33 | virtual boolean handlePinMode(byte pin, int mode) = 0; 34 | virtual boolean handleSysex(byte command, byte argc, byte* argv) = 0; 35 | virtual void reset() = 0; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /utility/WiFiClientStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | WiFiClientStream.h 3 | 4 | An Arduino Stream that wraps an instance of a WiFiClient. For use 5 | with legacy Arduino WiFi shield and other boards and shields that 6 | are compatible with the Arduino WiFi library. 7 | 8 | Copyright (C) 2016 Jens B. All rights reserved. 9 | 10 | This library is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU Lesser General Public 12 | License as published by the Free Software Foundation; either 13 | version 2.1 of the License, or (at your option) any later version. 14 | 15 | See file LICENSE.txt for further informations on licensing terms. 16 | 17 | Parts of this class are based on 18 | 19 | - EthernetClientStream - Copyright (C) 2013 Norbert Truchsess. All rights reserved. 20 | 21 | published under the same license. 22 | 23 | Last updated April 23rd, 2016 24 | */ 25 | 26 | #ifndef WIFI_CLIENT_STREAM_H 27 | #define WIFI_CLIENT_STREAM_H 28 | 29 | #include "WiFiStream.h" 30 | 31 | #define MILLIS_RECONNECT 5000 32 | 33 | class WiFiClientStream : public WiFiStream 34 | { 35 | protected: 36 | uint32_t _time_connect = 0; 37 | 38 | /** 39 | * check if TCP client is connected 40 | * @return true if connected 41 | */ 42 | virtual inline bool connect_client() 43 | { 44 | if ( _connected ) 45 | { 46 | if ( _client && _client.connected() ) return true; 47 | stop(); 48 | } 49 | 50 | // active TCP connect 51 | if ( WiFi.status() == WL_CONNECTED ) 52 | { 53 | // if the client is disconnected, try to reconnect every 5 seconds 54 | if ( millis() - _time_connect >= MILLIS_RECONNECT ) 55 | { 56 | _connected = _client.connect( _remote_ip, _port ); 57 | if ( !_connected ) 58 | { 59 | _time_connect = millis(); 60 | } 61 | else if ( _currentHostConnectionCallback ) 62 | { 63 | (*_currentHostConnectionCallback)(HOST_CONNECTION_CONNECTED); 64 | } 65 | } 66 | } 67 | 68 | return _connected; 69 | } 70 | 71 | public: 72 | /** 73 | * create a WiFi stream with a TCP client 74 | */ 75 | WiFiClientStream(IPAddress server_ip, uint16_t server_port) : WiFiStream(server_ip, server_port) {} 76 | 77 | /** 78 | * maintain WiFi and TCP connection 79 | * @return true if WiFi and TCP connection are established 80 | */ 81 | virtual inline bool maintain() 82 | { 83 | return connect_client(); 84 | } 85 | 86 | /** 87 | * stop client connection 88 | */ 89 | virtual inline void stop() 90 | { 91 | if ( _client) 92 | { 93 | _client.stop(); 94 | if ( _currentHostConnectionCallback ) 95 | { 96 | (*_currentHostConnectionCallback)(HOST_CONNECTION_DISCONNECTED); 97 | } 98 | } 99 | _connected = false; 100 | _time_connect = millis(); 101 | } 102 | 103 | }; 104 | 105 | #endif //WIFI_CLIENT_STREAM_H 106 | -------------------------------------------------------------------------------- /utility/WiFiServerStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | WiFiServerStream.h 3 | 4 | An Arduino Stream extension for a WiFiClient or WiFiServer to be used 5 | with legacy Arduino WiFi shield and other boards and shields that 6 | are compatible with the Arduino WiFi library. 7 | 8 | Copyright (C) 2016 Jens B. All rights reserved. 9 | 10 | This library is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU Lesser General Public 12 | License as published by the Free Software Foundation; either 13 | version 2.1 of the License, or (at your option) any later version. 14 | 15 | See file LICENSE.txt for further informations on licensing terms. 16 | 17 | Parts of this class are based on 18 | 19 | - WiFiStream - Copyright (C) 2015-2016 Jesse Frush. All rights reserved. 20 | 21 | published under the same license. 22 | 23 | Last updated April 23rd, 2016 24 | */ 25 | 26 | #ifndef WIFI_SERVER_STREAM_H 27 | #define WIFI_SERVER_STREAM_H 28 | 29 | #include "WiFiStream.h" 30 | 31 | class WiFiServerStream : public WiFiStream 32 | { 33 | protected: 34 | WiFiServer _server = WiFiServer(3030); 35 | bool _listening = false; 36 | 37 | /** 38 | * check if TCP client is connected 39 | * @return true if connected 40 | */ 41 | virtual inline bool connect_client() 42 | { 43 | if ( _connected ) 44 | { 45 | if ( _client && _client.connected() ) return true; 46 | stop(); 47 | } 48 | 49 | // passive TCP connect (accept) 50 | WiFiClient newClient = _server.available(); 51 | if ( !newClient ) return false; 52 | _client = newClient; 53 | _connected = true; 54 | if ( _currentHostConnectionCallback ) 55 | { 56 | (*_currentHostConnectionCallback)(HOST_CONNECTION_CONNECTED); 57 | } 58 | 59 | return true; 60 | } 61 | 62 | public: 63 | /** 64 | * create a WiFi stream with a TCP server 65 | */ 66 | WiFiServerStream(uint16_t server_port) : WiFiStream(server_port) {} 67 | 68 | /** 69 | * maintain WiFi and TCP connection 70 | * @return true if WiFi and TCP connection are established 71 | */ 72 | virtual inline bool maintain() 73 | { 74 | if ( connect_client() ) return true; 75 | 76 | stop(); 77 | 78 | if ( !_listening && WiFi.status() == WL_CONNECTED ) 79 | { 80 | // start TCP server after first WiFi connect 81 | _server = WiFiServer(_port); 82 | _server.begin(); 83 | _listening = true; 84 | } 85 | 86 | return false; 87 | } 88 | 89 | /** 90 | * stop client connection 91 | */ 92 | virtual inline void stop() 93 | { 94 | if ( _client) 95 | { 96 | _client.stop(); 97 | if ( _currentHostConnectionCallback ) 98 | { 99 | (*_currentHostConnectionCallback)(HOST_CONNECTION_DISCONNECTED); 100 | } 101 | } 102 | _connected = false; 103 | } 104 | 105 | }; 106 | 107 | #endif //WIFI_SERVER_STREAM_H 108 | -------------------------------------------------------------------------------- /utility/WiFiStream.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Implementation is in WiFiStream.h to avoid linker issues. Legacy WiFi and modern WiFi101 both define WiFiClass which 3 | * will cause linker errors whenever Firmata.h is included. 4 | */ 5 | -------------------------------------------------------------------------------- /utility/WiFiStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | WiFiStream.h 3 | 4 | An Arduino Stream extension for a WiFiClient or WiFiServer to be used 5 | with legacy Arduino WiFi shield and other boards and shields that 6 | are compatible with the Arduino WiFi library. 7 | 8 | Copyright (C) 2015-2016 Jesse Frush. All rights reserved. 9 | Copyright (C) 2016 Jens B. All rights reserved. 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Lesser General Public 13 | License as published by the Free Software Foundation; either 14 | version 2.1 of the License, or (at your option) any later version. 15 | 16 | See file LICENSE.txt for further informations on licensing terms. 17 | 18 | Last updated April 23rd, 2016 19 | */ 20 | 21 | #ifndef WIFI_STREAM_H 22 | #define WIFI_STREAM_H 23 | 24 | #include 25 | #include 26 | 27 | #define HOST_CONNECTION_DISCONNECTED 0 28 | #define HOST_CONNECTION_CONNECTED 1 29 | 30 | extern "C" { 31 | // callback function types 32 | typedef void (*hostConnectionCallbackFunction)(byte); 33 | } 34 | 35 | class WiFiStream : public Stream 36 | { 37 | protected: 38 | WiFiClient _client; 39 | bool _connected = false; 40 | hostConnectionCallbackFunction _currentHostConnectionCallback; 41 | 42 | //configuration members 43 | IPAddress _local_ip; // DHCP 44 | IPAddress _subnet; 45 | IPAddress _gateway; 46 | IPAddress _remote_ip; 47 | uint16_t _port; 48 | uint8_t _key_idx; //WEP 49 | const char *_key = nullptr; //WEP 50 | const char *_passphrase = nullptr; //WPA 51 | char *_ssid = nullptr; 52 | 53 | /** 54 | * check if TCP client is connected 55 | * @return true if connected 56 | */ 57 | virtual bool connect_client() = 0; 58 | 59 | public: 60 | /** constructor for TCP server */ 61 | WiFiStream(uint16_t server_port) : _port(server_port) {} 62 | 63 | /** constructor for TCP client */ 64 | WiFiStream(IPAddress server_ip, uint16_t server_port) : _remote_ip(server_ip), _port(server_port) {} 65 | 66 | inline void attach( hostConnectionCallbackFunction newFunction ) { _currentHostConnectionCallback = newFunction; } 67 | 68 | /****************************************************************************** 69 | * network configuration 70 | ******************************************************************************/ 71 | 72 | #ifndef ESP8266 73 | /** 74 | * configure a static local IP address without defining the local network 75 | * DHCP will be used as long as local IP address is not defined 76 | */ 77 | inline void config(IPAddress local_ip) 78 | { 79 | _local_ip = local_ip; 80 | WiFi.config( local_ip ); 81 | } 82 | #endif 83 | 84 | /** 85 | * configure a static local IP address 86 | * DHCP will be used as long as local IP address is not defined 87 | */ 88 | inline void config(IPAddress local_ip, IPAddress gateway, IPAddress subnet) 89 | { 90 | _local_ip = local_ip; 91 | _subnet = subnet; 92 | _gateway = gateway; 93 | #ifndef ESP8266 94 | WiFi.config( local_ip, IPAddress(0, 0, 0, 0), gateway, subnet ); 95 | #else 96 | WiFi.config( local_ip, gateway, subnet ); 97 | #endif 98 | } 99 | 100 | /** 101 | * @return local IP address 102 | */ 103 | inline IPAddress getLocalIP() 104 | { 105 | return WiFi.localIP(); 106 | } 107 | 108 | /****************************************************************************** 109 | * network functions 110 | ******************************************************************************/ 111 | 112 | /** 113 | * maintain WiFi and TCP connection 114 | * @return true if WiFi and TCP connection are established 115 | */ 116 | virtual bool maintain() = 0; 117 | 118 | #ifdef ESP8266 119 | /** 120 | * get status of TCP connection 121 | * @return status of TCP connection 122 | * CLOSED = 0 (typical) 123 | * LISTEN = 1 (not used) 124 | * SYN_SENT = 2 125 | * SYN_RCVD = 3 126 | * ESTABLISHED = 4 (typical) 127 | * FIN_WAIT_1 = 5 128 | * FIN_WAIT_2 = 6 129 | * CLOSE_WAIT = 7 130 | * CLOSING = 8 131 | * LAST_ACK = 9 132 | * TIME_WAIT = 10 133 | */ 134 | inline uint8_t status() 135 | { 136 | return _client.status(); 137 | } 138 | #endif 139 | 140 | /** 141 | * close TCP client connection 142 | */ 143 | virtual void stop() = 0; 144 | 145 | /****************************************************************************** 146 | * WiFi configuration 147 | ******************************************************************************/ 148 | 149 | /** 150 | * initialize WiFi without security (open) and initiate client connection 151 | * if WiFi connection is already established 152 | * @return WL_CONNECTED if WiFi connection is established 153 | */ 154 | inline int begin(char *ssid) 155 | { 156 | _ssid = ssid; 157 | 158 | WiFi.begin(ssid); 159 | int result = WiFi.status(); 160 | return WiFi.status(); 161 | } 162 | 163 | #ifndef ESP8266 164 | /** 165 | * initialize WiFi with WEP security and initiate client connection 166 | * if WiFi connection is already established 167 | * @return WL_CONNECTED if WiFi connection is established 168 | */ 169 | inline int begin(char *ssid, uint8_t key_idx, const char *key) 170 | { 171 | _ssid = ssid; 172 | _key_idx = key_idx; 173 | _key = key; 174 | 175 | WiFi.begin( ssid, key_idx, key ); 176 | return WiFi.status(); 177 | } 178 | #endif 179 | 180 | /** 181 | * initialize WiFi with WPA-PSK security and initiate client connection 182 | * if WiFi connection is already established 183 | * @return WL_CONNECTED if WiFi connection is established 184 | */ 185 | inline int begin(char *ssid, const char *passphrase) 186 | { 187 | _ssid = ssid; 188 | _passphrase = passphrase; 189 | 190 | WiFi.begin(ssid, passphrase); 191 | return WiFi.status(); 192 | } 193 | 194 | 195 | /****************************************************************************** 196 | * stream functions 197 | ******************************************************************************/ 198 | 199 | inline int available() 200 | { 201 | return connect_client() ? _client.available() : 0; 202 | } 203 | 204 | inline void flush() 205 | { 206 | if( _client ) _client.flush(); 207 | } 208 | 209 | inline int peek() 210 | { 211 | return connect_client() ? _client.peek(): 0; 212 | } 213 | 214 | inline int read() 215 | { 216 | return connect_client() ? _client.read() : -1; 217 | } 218 | 219 | inline size_t write(uint8_t byte) 220 | { 221 | return connect_client() ? _client.write( byte ) : 0; 222 | } 223 | 224 | }; 225 | 226 | #endif //WIFI_STREAM_H 227 | -------------------------------------------------------------------------------- /utility/firmataDebug.h: -------------------------------------------------------------------------------- 1 | #ifndef FIRMATA_DEBUG_H 2 | #define FIRMATA_DEBUG_H 3 | 4 | #ifdef SERIAL_DEBUG 5 | #define DEBUG_BEGIN(baud) Serial.begin(baud); while(!Serial) {;} 6 | #define DEBUG_PRINTLN(x) Serial.println (x); Serial.flush() 7 | #define DEBUG_PRINT(x) Serial.print (x) 8 | #else 9 | #define DEBUG_BEGIN(baud) 10 | #define DEBUG_PRINTLN(x) 11 | #define DEBUG_PRINT(x) 12 | #endif 13 | 14 | #endif /* FIRMATA_DEBUG_H */ 15 | --------------------------------------------------------------------------------