From 3401a00512d9ce3c644c803e0736c8de31f77d1e Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Tue, 22 Jan 2008 23:52:02 +0000 Subject: God I hate subversion. --- libraries/Firmata/Firmata.cpp | 133 ----------------------------------------- libraries/Firmata/Firmata.h | 95 ----------------------------- libraries/Firmata/keywords.txt | 18 ------ 3 files changed, 246 deletions(-) delete mode 100644 libraries/Firmata/Firmata.cpp delete mode 100644 libraries/Firmata/Firmata.h delete mode 100644 libraries/Firmata/keywords.txt diff --git a/libraries/Firmata/Firmata.cpp b/libraries/Firmata/Firmata.cpp deleted file mode 100644 index feb3def..0000000 --- a/libraries/Firmata/Firmata.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - Firmata.cpp - Firmata library - Copyright (c) 2007 Free Software Foundation. All right reserved. - Written by Hans-Christoph Steiner - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -//****************************************************************************** -//* Includes -//****************************************************************************** - -extern "C" { - // AVR LibC Includes - #include - #include - - // use the abs in WConstants.h, not the one in stdlib.h - #undef abs - - // Wiring Core Includes - #include "WConstants.h" -} - - -#include "Firmata.h" -#include "EEPROM.h" -#include "HardwareSerial.h" - -//****************************************************************************** -//* Definitions -//****************************************************************************** - -//****************************************************************************** -//* Constructors -//****************************************************************************** - -FirmataClass::FirmataClass() -{ - // TODO: init serial here - // TODO: printVersion -} - -//****************************************************************************** -//* Private Methods -//****************************************************************************** -// resets the system state upon a SYSTEM_RESET message from the host software -void FirmataClass::systemReset(void) -{ - // TODO automatically call this in response to SYSTEM_RESET - // TODO reset EEPROM to 0 here -} - -//****************************************************************************** -//* Public Methods -//****************************************************************************** - -// output type of message that is next on the queue -int FirmataClass::available(void) -{ - return -1; - // TODO output next available message type, or -1 if nothing -} - - -// output the protocol version message to the serial port -void FirmataClass::printVersion() { - Serial.print(REPORT_VERSION, BYTE); - Serial.print(FIRMATA_MINOR_VERSION, BYTE); - Serial.print(FIRMATA_MAJOR_VERSION, BYTE); -} - -// send an analog message -void FirmataClass::sendAnalog(int pin, int value) -{ - // pin can only be 0-15, so chop higher bits - Serial.print(ANALOG_MESSAGE | (pin & 0xF), BYTE); - Serial.print(value % 128, BYTE); - Serial.print(value >> 7, BYTE); -} - -// send a single digital pin in a digital message -void FirmataClass::sendDigital(int pin, int value) -{ - // TODO add single pin digital messages to the protocol -} - -// send 14-bits in a single digital message -void FirmataClass::sendDigitalPortPair(int port, int value) -{ - // TODO: the digital message should not be sent on the serial port every - // time sendDigital() is called. Instead, it should add it to an int - // which will be sent on a schedule. If a pin changes more than once - // before the digital message is sent on the serial port, it should send a - // digital message for each change. - - // TODO: some math needs to happen for pin > 14 since MIDI channels are used - Serial.print(DIGITAL_MESSAGE | (port & 0xF),BYTE); - Serial.print(value % 128, BYTE); // Tx pins 0-6 - Serial.print(value >> 7, BYTE); // Tx pins 7-13 -} - -// Internal Actions///////////////////////////////////////////////////////////// - -void FirmataClass::loadState(void) -{ - // TODO load state from EEPROM -} - -void FirmataClass::saveState(void) -{ - // TODO save state to EEPROM -} - -void FirmataClass::resetState(void) -{ - // TODO reset state bytes in EEPROM -} - -// make one instance for the user to use -FirmataClass Firmata; diff --git a/libraries/Firmata/Firmata.h b/libraries/Firmata/Firmata.h deleted file mode 100644 index 1c6604b..0000000 --- a/libraries/Firmata/Firmata.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - Firmata.h - Firmata library - Copyright (c) 2007 Free Software Foundation. All right reserved. - Written by Hans-Christoph Steiner - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef Firmata_h -#define Firmata_h - -#include - -class FirmataClass -{ -private: - void systemReset(void); -public: - FirmataClass(); - int available(void); - // serial receive actions - // send serial messages - void printVersion(void); - void sendAnalog(int, int); - void sendDigital(int, int); - void sendDigitalPortPair(int, int); - // internal actions - void loadState(void); - void saveState(void); - void resetState(void); -}; - -extern FirmataClass Firmata; - -/*============================================================================== - * MACROS - *============================================================================*/ - -/* Version numbers for the protocol. The protocol is still changing, so these - * version numbers are important. This number can be queried so that host - * software can test whether it will be compatible with the currently - * installed firmware. */ -#define FIRMATA_MAJOR_VERSION 1 // for non-compatible changes -#define FIRMATA_MINOR_VERSION 0 // for backwards compatible changes - -// total number of pins currently supported -#define TOTAL_ANALOG_PINS 6 -#define TOTAL_DIGITAL_PINS 14 - -// for comparing along with INPUT and OUTPUT -#define PWM 2 - -// for selecting digital inputs -#define PB 2 // digital input, pins 8-13 -#define PC 3 // analog input port -#define PD 4 // digital input, pins 0-7 - -#define MAX_DATA_BYTES 2 // max number of data bytes in non-SysEx messages -// message command bytes -#define DIGITAL_MESSAGE 0x90 // send data for a digital pin -#define ANALOG_MESSAGE 0xE0 // send data for an analog pin (or PWM) -//#define PULSE_MESSAGE 0xA0 // proposed pulseIn/Out message (SysEx) -//#define SHIFTOUT_MESSAGE 0xB0 // proposed shiftOut message (SysEx) -#define REPORT_ANALOG_PIN 0xC0 // enable analog input by pin # -#define REPORT_DIGITAL_PORTS 0xD0 // enable digital input by port pair -#define START_SYSEX 0xF0 // start a MIDI SysEx message -#define SET_DIGITAL_PIN_MODE 0xF4 // set a digital pin to INPUT or OUTPUT -#define END_SYSEX 0xF7 // end a MIDI SysEx message -#define REPORT_VERSION 0xF9 // report firmware version -#define SYSTEM_RESET 0xFF // reset from MIDI - -// these are used for EEPROM reading and writing -#define ANALOGINPUTSTOREPORT_LOW_BYTE 0x1F0 // analogInputsToReport is an int -#define ANALOGINPUTSTOREPORT_HIGH_BYTE 0x1F1 // analogInputsToReport is an int -#define REPORTDIGITALINPUTS_BYTE 0x1F2 // -#define DIGITALPINSTATUS_LOW_BYTE 0x1F3 // digitalPinStatus is an int -#define DIGITALPINSTATUS_HIGH_BYTE 0x1F4 // digitalPinStatus is an int -#define PWMSTATUS_LOW_BYTE 0x1F5 // pwmStatus is an int -#define PWMSTATUS_HIGH_BYTE 0x1F6 // pwmStatus is an int - - -#endif /* Firmata_h */ - diff --git a/libraries/Firmata/keywords.txt b/libraries/Firmata/keywords.txt deleted file mode 100644 index a241593..0000000 --- a/libraries/Firmata/keywords.txt +++ /dev/null @@ -1,18 +0,0 @@ -####################################### -# Syntax Coloring Map For Firmata -####################################### - -####################################### -# Datatypes (KEYWORD1) -####################################### - -Firmata KEYWORD1 - -####################################### -# Methods and Functions (KEYWORD2) -####################################### - -####################################### -# Constants (LITERAL1) -####################################### - -- cgit v1.2.3-18-g5258