Package pymata_aio :: Module private_constants
[hide private]
[frames] | no frames]

Source Code for Module pymata_aio.private_constants

 1  """ 
 2  Copyright (c) 20115 Alan Yorinks All rights reserved. 
 3   
 4  This program is free software; you can redistribute it and/or 
 5  modify it under the terms of the GNU  General Public 
 6  License as published by the Free Software Foundation; either 
 7  version 3 of the License, or (at your option) any later version. 
 8   
 9  This library is distributed in the hope that it will be useful, 
10  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12  General Public License for more details. 
13   
14  You should have received a copy of the GNU General Public 
15  License along with this library; if not, write to the Free Software 
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
17  """ 
18   
19   
20 -class PrivateConstants:
21 """ 22 This class contains a set of constants for PyMata internal use . 23 """ 24 # the following defines are from Firmata.h 25 # message command bytes (128-255/ 0x80- 0xFF) 26 # from this client to firmata 27 MSG_CMD_MIN = 0x80 # minimum value for a message from firmata 28 REPORT_ANALOG = 0xC0 # enable analog input by pin # 29 REPORT_DIGITAL = 0xD0 # enable digital input by port pair 30 SET_PIN_MODE = 0xF4 # set a pin to INPUT/OUTPUT/PWM/etc 31 START_SYSEX = 0xF0 # start a MIDI Sysex message 32 END_SYSEX = 0xF7 # end a MIDI Sysex message 33 SYSTEM_RESET = 0xFF # reset from MIDI 34 35 # messages from firmata 36 DIGITAL_MESSAGE = 0x90 # send or receive data for a digital pin 37 ANALOG_MESSAGE = 0xE0 # send or receive data for a PWM configured pin 38 REPORT_VERSION = 0xF9 # report protocol version 39 40 # start of FirmataPlus defined SYSEX commands 41 TONE_DATA = 0x5F # play a tone at a specified frequency and duration 42 ENCODER_CONFIG = 0x60 # create and enable encoder object 43 ENCODER_DATA = 0x61 # current encoder position data 44 SONAR_CONFIG = 0x62 # configure pins to control a Ping type sonar distance device 45 SONAR_DATA = 0x63 # distance data returned 46 # end of FirmataPlus defined SYSEX commands 47 48 SERVO_CONFIG = 0x70 # set servo pin and max and min angles 49 STRING_DATA = 0x71 # a string message with 14-bits per char 50 STEPPER_DATA = 0x72 # Stepper motor command 51 I2C_REQUEST = 0x76 # send an I2C read/write request 52 I2C_REPLY = 0x77 # a reply to an I2C read request 53 I2C_CONFIG = 0x78 # config I2C settings such as delay times and power pins 54 REPORT_FIRMWARE = 0x79 # report name and version of the firmware 55 SAMPLING_INTERVAL = 0x7A # modify the sampling interval 56 57 EXTENDED_ANALOG = 0x6F # analog write (PWM, Servo, etc) to any pin 58 PIN_STATE_QUERY = 0x6D # ask for a pin's current mode and value 59 PIN_STATE_RESPONSE = 0x6E # reply with pin's current mode and value 60 CAPABILITY_QUERY = 0x6B # ask for supported modes and resolution of all pins 61 CAPABILITY_RESPONSE = 0x6C # reply with supported modes and resolution 62 ANALOG_MAPPING_QUERY = 0x69 # ask for mapping of analog to pin numbers 63 ANALOG_MAPPING_RESPONSE = 0x6A # reply with analog mapping data 64 65 # reserved values 66 SYSEX_NON_REALTIME = 0x7E # MIDI Reserved for non-realtime messages 67 SYSEX_REALTIME = 0x7F # MIDI Reserved for realtime messages 68 69 # reserved for PyMata 70 PYMATA_VERSION = "1.1" 71 72 # each byte represents a digital port and its value contains the current port settings 73 DIGITAL_OUTPUT_PORT_PINS = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] 75 76 # These values are the index into the data passed by _arduino and used to reassemble integer values 77 MSB = 2 78 LSB = 1 79 80 REPORTING_ENABLE = 1 # enable reporting for REPORT_ANALOG or REPORT_DIGITAL message sent to firmata 81 REPORTING_DISABLE = 0 # disable reporting for REPORT_ANALOG or REPORT_DIGITAL message sent to firmata 82 83 # Stepper Motor Sub-commands 84 STEPPER_CONFIGURE = 0 # configure a stepper motor for operation 85 STEPPER_STEP = 1 # command a motor to move at the provided speed 86 STEPPER_LIBRARY_VERSION = 2 # used to get stepper library version number
87