├── .no-sublime-package
├── libs
├── serial
│ ├── tools
│ │ ├── __init__.py
│ │ ├── list_ports_common.py
│ │ ├── list_ports.py
│ │ ├── list_ports_linux.py
│ │ ├── list_ports_posix.py
│ │ ├── hexlify_codec.py
│ │ ├── list_ports_osx.py
│ │ └── list_ports_windows.py
│ ├── urlhandler
│ │ ├── __init__.py
│ │ ├── protocol_rfc2217.py
│ │ ├── protocol_serve-rfc2217.py
│ │ ├── protocol_alt.py
│ │ ├── protocol_hwgrep.py
│ │ ├── protocol_spy.py
│ │ └── protocol_loop.py
│ ├── README.rst
│ ├── LICENSE.txt
│ ├── __init__.py
│ ├── rs485.py
│ ├── serialjava.py
│ ├── serialcli.py
│ ├── threaded
│ │ └── __init__.py
│ └── win32.py
├── base_utils
│ ├── __init__.py
│ ├── exceptions.py
│ ├── decos.py
│ ├── default_arduino_dirs.py
│ ├── default_st_dirs.py
│ ├── task_listener.py
│ ├── progress_bar.py
│ ├── language_file.py
│ ├── sys_dirs.py
│ ├── sys_info.py
│ ├── task_queue.py
│ ├── serial_monitor.py
│ ├── index_file.py
│ ├── downloader.py
│ ├── plain_params_file.py
│ ├── file.py
│ └── serial_port.py
└── stino_runtime
│ ├── const.py
│ ├── st_monitor_view.py
│ ├── panel.sublime-syntax
│ ├── programmers.txt
│ └── st_panel.py
├── snippets
├── abs.sublime-snippet
├── int.sublime-snippet
├── byte.sublime-snippet
├── char.sublime-snippet
├── long.sublime-snippet
├── sqrt.sublime-snippet
├── delay.sublime-snippet
├── float.sublime-snippet
├── max.sublime-snippet
├── micros.sublime-snippet
├── millis.sublime-snippet
├── min.sublime-snippet
├── loop.sublime-snippet
├── noTone.sublime-snippet
├── mif.sublime-snippet
├── pow.sublime-snippet
├── serial_end.sublime-snippet
├── serial_peek.sublime-snippet
├── serial_read.sublime-snippet
├── setup.sublime-snippet
├── sizeof.sublime-snippet
├── if.sublime-snippet
├── melif.sublime-snippet
├── random.sublime-snippet
├── serial_flush.sublime-snippet
├── analogRead.sublime-snippet
├── ifdef.sublime-snippet
├── include_1.sublime-snippet
├── include_2.sublime-snippet
├── pinmode.sublime-snippet
├── undef.sublime-snippet
├── define.sublime-snippet
├── digitalRead.sublime-snippet
├── ifndef.sublime-snippet
├── randomSeed.sublime-snippet
├── serial_begin.sublime-snippet
├── serial_find.sublime-snippet
├── serial_parseInt.sublime-snippet
├── serial_write.sublime-snippet
├── constrain.sublime-snippet
├── serial_parseFloat.sublime-snippet
├── tone.sublime-snippet
├── analogWrite.sublime-snippet
├── pulseIn.sublime-snippet
├── serial_print.sublime-snippet
├── digitalWrite.sublime-snippet
├── serial_setTimeOut.sublime-snippet
├── while.sublime-snippet
├── for.sublime-snippet
├── serial_println.sublime-snippet
├── shiftIn.sublime-snippet
├── delayMicroseconds.sublime-snippet
├── detachInterrupt.sublime-snippet
├── map.sublime-snippet
├── serial_readBytes.sublime-snippet
├── serial_event.sublime-snippet
├── serial_findUntil.sublime-snippet
├── shiftOut.sublime-snippet
├── attachInterrupt.sublime-snippet
├── serial_available.sublime-snippet
├── dowhile.sublime-snippet
├── ifelse.sublime-snippet
├── serial_readBytesUntil.sublime-snippet
└── switch.sublime-snippet
├── LICENSE
├── Arduino.sublime-syntax
└── README.md
/.no-sublime-package:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/libs/serial/tools/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/libs/serial/urlhandler/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/libs/base_utils/__init__.py:
--------------------------------------------------------------------------------
1 | """__init__."""
2 |
--------------------------------------------------------------------------------
/snippets/abs.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | abs
6 | source.arduino
7 | Arduino abs()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/int.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | int
6 | source.arduino
7 | Arduino int()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/byte.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | byte
6 | source.arduino
7 | Arduino byte()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/char.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | char
6 | source.arduino
7 | Arduino char()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/long.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | long
6 | source.arduino
7 | Arduino long()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/sqrt.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | sqrt
6 | source.arduino
7 | Arduino sqrt()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/delay.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | delay
6 | source.arduino
7 | Arduino delay()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/float.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | float
6 | source.arduino
7 | Arduino float()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/max.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | max
6 | source.arduino
7 | Arduino max()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/micros.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | micros
6 | source.arduino
7 | Arduino micros()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/millis.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | millis
6 | source.arduino
7 | Arduino millis()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/min.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | min
6 | source.arduino
7 | Arduino min()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/loop.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
7 | loop
8 | source.arduino
9 | Arduino loop
10 |
11 |
--------------------------------------------------------------------------------
/snippets/noTone.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | noTone
6 | source.arduino
7 | Arduino noTone()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/mif.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | if
6 | source.arduino
7 | Arduino Macro if
8 |
9 |
--------------------------------------------------------------------------------
/snippets/pow.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | pow
6 | source.arduino
7 | Arduino pow()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_end.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | send
6 | source.arduino
7 | Arduino Serial.end()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_peek.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | speek
6 | source.arduino
7 | Arduino Serial.peek()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_read.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | sread
6 | source.arduino
7 | Arduino Serial.read()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/setup.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
7 | setup
8 | source.arduino
9 | Arduino setup
10 |
11 |
--------------------------------------------------------------------------------
/snippets/sizeof.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | sizeof
6 | source.arduino
7 | Arduino sizeof()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/if.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
7 | if
8 | source.arduino
9 | Arduino if
10 |
11 |
--------------------------------------------------------------------------------
/snippets/melif.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | elif
6 | source.arduino
7 | Arduino Macro elif
8 |
9 |
--------------------------------------------------------------------------------
/snippets/random.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | random
6 | source.arduino
7 | Arduino random()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_flush.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | sflush
6 | source.arduino
7 | Arduino Serial.flush()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/analogRead.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | analogRead
6 | source.arduino
7 | Arduino analogRead
8 |
9 |
--------------------------------------------------------------------------------
/snippets/ifdef.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | ifdef
6 | source.arduino
7 | Arduino Macro ifdef
8 |
9 |
--------------------------------------------------------------------------------
/snippets/include_1.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | include
6 | source.arduino
7 | Arduino include userlib
8 |
9 |
--------------------------------------------------------------------------------
/snippets/include_2.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
4 | ]]>
5 | include
6 | source.arduino
7 | Arduino include syslib
8 |
9 |
--------------------------------------------------------------------------------
/snippets/pinmode.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | pinMode
6 | source.arduino
7 | Arduino pinMode
8 |
9 |
--------------------------------------------------------------------------------
/snippets/undef.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | undef
6 | source.arduino
7 | Arduino Macro undef
8 |
9 |
--------------------------------------------------------------------------------
/snippets/define.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | define
6 | source.arduino
7 | Arduino Macro define
8 |
9 |
--------------------------------------------------------------------------------
/snippets/digitalRead.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | digitalRead
6 | source.arduino
7 | Arduino digitalRead
8 |
9 |
--------------------------------------------------------------------------------
/snippets/ifndef.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | ifndef
6 | source.arduino
7 | Arduino Macro ifndef
8 |
9 |
--------------------------------------------------------------------------------
/snippets/randomSeed.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | randomSeed
6 | source.arduino
7 | Arduino randomSeed()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_begin.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | sbegin
6 | source.arduino
7 | Arduino Serial.begin()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_find.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | sfind
6 | source.arduino
7 | Arduino Serial.find()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_parseInt.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | spint
6 | source.arduino
7 | Arduino Serial.parseInt()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_write.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | swrite
6 | source.arduino
7 | Arduino Serial.write()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/constrain.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | constrain
6 | source.arduino
7 | Arduino constrain()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_parseFloat.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | spfloat
6 | source.arduino
7 | Arduino Serial.parseFloat()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/tone.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | tone
6 | source.arduino
7 | Arduino tone()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/analogWrite.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | analogWrite
6 | source.arduino
7 | Arduino analogWrite
8 |
9 |
--------------------------------------------------------------------------------
/snippets/pulseIn.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | pulseIn
6 | source.arduino
7 | Arduino pulseIn()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_print.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | sprint
6 | source.arduino
7 | Arduino Serial.print()
8 |
9 |
--------------------------------------------------------------------------------
/libs/base_utils/exceptions.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | """Doc."""
5 |
6 | from __future__ import absolute_import
7 | from __future__ import print_function
8 | from __future__ import division
9 | from __future__ import unicode_literals
10 |
11 |
--------------------------------------------------------------------------------
/snippets/digitalWrite.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | digitalWrite
6 | source.arduino
7 | Arduino digitalWrite
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_setTimeOut.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | stimeout
6 | source.arduino
7 | Arduino Serial.setTimeout()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/while.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
7 | while
8 | source.arduino
9 | Arduino while
10 |
11 |
--------------------------------------------------------------------------------
/snippets/for.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
7 | for
8 | source.arduino
9 | Arduino for
10 |
11 |
--------------------------------------------------------------------------------
/snippets/serial_println.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | sprint
6 | source.arduino
7 | Arduino Serial.println()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/shiftIn.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | shiftIn
6 | source.arduino
7 | Arduino shiftIn()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/delayMicroseconds.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | delayMicroseconds
6 | source.arduino
7 | Arduino delayMicroseconds()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/detachInterrupt.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | detachInterrupt
6 | source.arduino
7 | Arduino detachInterrupt()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/map.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | map
6 | source.arduino
7 | Arduino map()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_readBytes.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | sreadBytes
6 | source.arduino
7 | Arduino Serial.readBytes()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_event.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
7 | sevent
8 | source.arduino
9 | Arduino serialEvent()
10 |
11 |
--------------------------------------------------------------------------------
/snippets/serial_findUntil.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | sfindUntil
6 | source.arduino
7 | Arduino Serial.findUntil()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/shiftOut.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | shiftOut
6 | source.arduino
7 | Arduino shiftOut()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/attachInterrupt.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | attachInterrupt
6 | source.arduino
7 | Arduino attachInterrupt()
8 |
9 |
--------------------------------------------------------------------------------
/snippets/serial_available.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 | ${1:0}) {
4 | ${2}
5 | }
6 | ]]>
7 | savailable
8 | source.arduino
9 | Arduino Serial.available()
10 |
11 |
--------------------------------------------------------------------------------
/snippets/dowhile.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
8 | dowhile
9 | source.arduino
10 | Arduino do-while
11 |
12 |
--------------------------------------------------------------------------------
/snippets/ifelse.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
9 | ifelse
10 | source.arduino
11 | Arduino if-else
12 |
13 |
--------------------------------------------------------------------------------
/snippets/serial_readBytesUntil.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | sreadBytesUntil
6 | source.arduino
7 | Arduino Serial.readBytesUntil()
8 |
9 |
--------------------------------------------------------------------------------
/libs/serial/urlhandler/protocol_rfc2217.py:
--------------------------------------------------------------------------------
1 | #! python
2 | #
3 | # This is a thin wrapper to load the rfc2271 implementation.
4 | #
5 | # This file is part of pySerial. https://github.com/pyserial/pyserial
6 | # (C) 2011 Chris Liechti
7 | #
8 | # SPDX-License-Identifier: BSD-3-Clause
9 |
10 | from serial.rfc2217 import Serial # noqa
11 |
--------------------------------------------------------------------------------
/libs/serial/urlhandler/protocol_serve-rfc2217.py:
--------------------------------------------------------------------------------
1 | #! python
2 | #
3 | # This is a thin wrapper to load the rfc2271 implementation.
4 | #
5 | # This file is part of pySerial. https://github.com/pyserial/pyserial
6 | # (C) 2011 Chris Liechti
7 | #
8 | # SPDX-License-Identifier: BSD-3-Clause
9 |
10 | from serial.rfc2217 import Serial # noqa
11 |
--------------------------------------------------------------------------------
/libs/stino_runtime/const.py:
--------------------------------------------------------------------------------
1 | """Constants."""
2 |
3 | PLUGIN_NAME = 'Stino'
4 | PACKAGE_INDEX_URL = \
5 | 'http://downloads.arduino.cc/packages/package_index.json'
6 | LIBRARY_INDEX_URL = \
7 | 'http://downloads.arduino.cc/libraries/library_index.json'
8 | LIBRARY_INDEX_URL_GZ = \
9 | 'http://downloads.arduino.cc/libraries/library_index.json.gz'
10 | REMOTE_CHECK_PERIOD = 1800
11 |
--------------------------------------------------------------------------------
/snippets/switch.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
14 | switch
15 | source.arduino
16 | Arduino switch
17 |
18 |
--------------------------------------------------------------------------------
/libs/base_utils/decos.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | """."""
5 |
6 | from __future__ import absolute_import
7 | from __future__ import print_function
8 | from __future__ import division
9 | from __future__ import unicode_literals
10 |
11 |
12 | def singleton(cls):
13 | """From PEP-318 http://www.python.org/dev/peps/pep-0318/#examples."""
14 | _instances = {}
15 |
16 | def get_instance(*args, **kwargs):
17 | if cls not in _instances:
18 | _instances[cls] = cls(*args, **kwargs)
19 | return _instances[cls]
20 | return get_instance
21 |
--------------------------------------------------------------------------------
/libs/base_utils/default_arduino_dirs.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | """Package Docs."""
5 |
6 | from __future__ import absolute_import
7 | from __future__ import print_function
8 | from __future__ import division
9 | from __future__ import unicode_literals
10 |
11 | import os
12 | from . import sys_info
13 | from . import sys_dirs
14 |
15 |
16 | def arduino_app_path():
17 | """Function Docs."""
18 | app_path = os.path.join(sys_dirs.get_user_config_path(), 'Arduino15')
19 | if sys_info.get_os_name() == 'linux':
20 | home = os.getenv('HOME')
21 | app_path = os.path.join(home, '.arduino15')
22 | return app_path
23 |
24 |
25 | def arduino_sketchbook_path():
26 | """Function Docs."""
27 | doc_path = sys_dirs.get_document_path()
28 | sketchbook_path = os.path.join(doc_path, 'Arduino')
29 | return sketchbook_path
30 |
--------------------------------------------------------------------------------
/libs/base_utils/default_st_dirs.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | """Package Docs."""
5 |
6 | from __future__ import absolute_import
7 | from __future__ import print_function
8 | from __future__ import division
9 | from __future__ import unicode_literals
10 |
11 | import os
12 | import sublime
13 |
14 | from . import file
15 |
16 |
17 | def get_user_path():
18 | """."""
19 | packages_path = sublime.packages_path()
20 | user_path = os.path.join(packages_path, 'User')
21 | return user_path
22 |
23 |
24 | def get_plugin_config_path(plugin_name):
25 | """."""
26 | user_path = get_user_path()
27 | config_path = os.path.join(user_path, plugin_name)
28 | file.check_dir(config_path)
29 | return config_path
30 |
31 |
32 | def get_plugin_menu_path(plugin_name):
33 | """."""
34 | config_path = get_plugin_config_path(plugin_name)
35 | menu_path = os.path.join(config_path, 'menu')
36 | file.check_dir(menu_path)
37 | return menu_path
38 |
--------------------------------------------------------------------------------
/libs/stino_runtime/st_monitor_view.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | """Doc."""
5 |
6 | from __future__ import absolute_import
7 | from __future__ import print_function
8 | from __future__ import division
9 | from __future__ import unicode_literals
10 |
11 |
12 | class StMonitorView:
13 | """."""
14 |
15 | def __init__(self, win, port, arduino_info, view=None):
16 | """."""
17 | self._name = '%s - Serial Monitor' % port
18 | if view:
19 | self._view = view
20 | else:
21 | self._view = win.new_file()
22 | self._view.set_name(self._name)
23 | self._info = arduino_info
24 |
25 | def get_view(self):
26 | """."""
27 | return self._view
28 |
29 | def write(self, text=''):
30 | """."""
31 | do_scroll = self._info['selected'].get('monitor_auto_scroll')
32 | self._view.run_command('stino_panel_write',
33 | {'text': text, 'do_scroll': do_scroll})
34 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Stino
2 | A Sublime Text Plugin for Arduino
3 |
4 | Copyright (C) 2012-2017 Sen .
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
7 | furnished to do so, subject to the following conditions:
8 |
9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 |
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 |
13 |
--------------------------------------------------------------------------------
/Arduino.sublime-syntax:
--------------------------------------------------------------------------------
1 | %YAML 1.2
2 | ---
3 | # http://www.sublimetext.com/docs/3/syntax.html
4 | name: Arduino
5 | file_extensions: [ino, pde]
6 | scope: source.arduino
7 |
8 | contexts:
9 | main:
10 | - match: ''
11 | push: Packages/C++/C++.sublime-syntax
12 | with_prototype:
13 | - match: \b(HIGH|LOW|INPUT|OUTPUT|INPUT_PULLUP|LED_BUILTIN)\b
14 | scope: constant.language.arduino
15 | - match: \b(boolean|word|String|string|array)\b
16 | scope: storage.type.arduino
17 | - match: PROGRAM
18 | scope: storage.modifier.arduino
19 | - match: \b(Serial|Stream|Keyboard|Mouse)\b
20 | scope: entity.name.class.arduino
21 | - match: \b(pinMode|digitalWrite|digitalRead|analogReference|analogRead|analogWrite|analogReadResolution|analogWriteResolution|tone|noTone|shiftOut|shiftIn|pulseIn|millis|micros|delay|delayMicroseconds|min|max|constrain|map|pow|sqrt|sin|cos|tan|isAlphaNumeric|isAlpha|isAscii|isWhitespace|isControl|isDigit|isGraph|isLowerCase|isPrintable|isPunct|isSpace|isUpperCase|isHexadecimalDigit|randomSeed|random|lowByte|highByte|bitRead|bitWrite|bitSet|bitClear|bit|attachInterrupt|detachInterrupt|interrupts|noInterrupts)\b
22 | scope: entity.name.function.arduino
23 |
--------------------------------------------------------------------------------
/libs/base_utils/task_listener.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | """Doc."""
5 |
6 | from __future__ import absolute_import
7 | from __future__ import print_function
8 | from __future__ import division
9 | from __future__ import unicode_literals
10 |
11 | import time
12 | import threading
13 |
14 |
15 | class TaskListener(object):
16 | """."""
17 |
18 | def __init__(self, task, response=None, delay=0.01):
19 | """."""
20 | self._is_alive = False
21 | self._task = task
22 | self._response = response
23 | self._delay = delay
24 |
25 | def start(self):
26 | """."""
27 | if not self._is_alive:
28 | self._is_alive = True
29 | thread = threading.Thread(target=self._loop)
30 | thread.start()
31 |
32 | def _loop(self):
33 | """."""
34 | while True:
35 | self._run()
36 | time.sleep(self._delay)
37 |
38 | def _run(self):
39 | """."""
40 | if callable(self._task):
41 | state = self._task()
42 | if state is True and callable(self._response):
43 | self._response()
44 |
45 | def stop(self):
46 | """."""
47 | self._is_alive = False
48 |
--------------------------------------------------------------------------------
/libs/stino_runtime/panel.sublime-syntax:
--------------------------------------------------------------------------------
1 | %YAML 1.2
2 | ---
3 | # http://www.sublimetext.com/docs/3/syntax.html
4 | name: Stino Panel
5 | file_extensions: []
6 | scope: source.stino-panel
7 |
8 | contexts:
9 | main:
10 | - match: ''
11 | push: Packages/C++/C++.sublime-syntax
12 | with_prototype:
13 | - match: \b(HIGH|LOW|INPUT|OUTPUT|INPUT_PULLUP|LED_BUILTIN)\b
14 | scope: constant.language.stino-panel
15 | - match: \b(boolean|word|String|string|array)\b
16 | scope: storage.type.stino-panel
17 | - match: PROGRAM
18 | scope: storage.modifier.stino-panel
19 | - match: \b(Serial|Stream|Keyboard|Mouse)\b
20 | scope: entity.name.class.stino-panel
21 | - match: \b(pinMode|digitalWrite|digitalRead|analogReference|analogRead|analogWrite|analogReadResolution|analogWriteResolution|tone|noTone|shiftOut|shiftIn|pulseIn|millis|micros|delay|delayMicroseconds|min|max|constrain|map|pow|sqrt|sin|cos|tan|isAlphaNumeric|isAlpha|isAscii|isWhitespace|isControl|isDigit|isGraph|isLowerCase|isPrintable|isPunct|isSpace|isUpperCase|isHexadecimalDigit|randomSeed|random|lowByte|highByte|bitRead|bitWrite|bitSet|bitClear|bit|attachInterrupt|detachInterrupt|interrupts|noInterrupts)\b
22 | scope: entity.name.function.stino-panel
23 |
--------------------------------------------------------------------------------
/libs/base_utils/progress_bar.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | """Package Docs."""
5 |
6 | from __future__ import absolute_import
7 | from __future__ import print_function
8 | from __future__ import division
9 | from __future__ import unicode_literals
10 |
11 | import sys
12 | import threading
13 | import time
14 |
15 |
16 | class ProgressBar:
17 | """."""
18 |
19 | def __init__(self):
20 | """."""
21 | self._is_alive = False
22 |
23 | def start(self, consumer=sys.stdout.write, caption=''):
24 | """."""
25 | self._caption = caption
26 | if callable(consumer):
27 | self._consumer = consumer
28 | if not self._is_alive:
29 | self._is_alive = True
30 | thread = threading.Thread(target=self._run)
31 | thread.start()
32 |
33 | def _run(self):
34 | """."""
35 | width = 16
36 | status = 1
37 | direction = 'right'
38 | while self._is_alive:
39 | before_blank = ' ' * (status - 1)
40 | after_blank = ' ' * (width - status)
41 | text = '%s [%s=%s]' % (self._caption, before_blank, after_blank)
42 | self._consumer(text)
43 |
44 | if direction == 'right':
45 | status += 1
46 | else:
47 | status -= 1
48 |
49 | if status == width:
50 | direction = 'left'
51 | if status == 1:
52 | direction = 'right'
53 |
54 | time.sleep(0.5)
55 |
56 | def stop(self):
57 | """."""
58 | self._is_alive = False
59 |
--------------------------------------------------------------------------------
/libs/base_utils/language_file.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #-*- coding: utf-8 -*-
3 |
4 | # 1. Copyright
5 | # 2. Lisence
6 | # 3. Author
7 |
8 | """
9 | Documents
10 | """
11 |
12 | from __future__ import absolute_import
13 | from __future__ import print_function
14 | from __future__ import division
15 | from __future__ import unicode_literals
16 |
17 | from . import abs_file
18 |
19 |
20 | class LanguageFile(abs_file.File):
21 | def __init__(self, path):
22 | super(LanguageFile, self).__init__(path)
23 | text = self.read()
24 | self.trans_dict = load_trans_dict(text)
25 |
26 | def get_trans_dict(self):
27 | return self.trans_dict
28 |
29 |
30 | def load_trans_dict(text):
31 | trans_dict = {}
32 | lines = text.split('\n')
33 | lines = [line.strip() for line in lines if lines if line.strip() and
34 | not line.strip().startswith('#')]
35 | blocks = split_lines(lines)
36 | for block in blocks:
37 | key, value = load_trans_pair(block)
38 | trans_dict[key] = value
39 | return trans_dict
40 |
41 |
42 | def split_lines(lines):
43 | blocks = []
44 | block = []
45 | for line in lines:
46 | if line.startswith('msgid'):
47 | blocks.append(block)
48 | block = []
49 | block.append(line)
50 | blocks.append(block)
51 | blocks.pop(0)
52 | return blocks
53 |
54 |
55 | def load_trans_pair(block):
56 | is_key = True
57 | key = ''
58 | value = ''
59 | for line in block:
60 | index = line.index('"')
61 | cur_str = line[index + 1: -1]
62 | if line.startswith('msgstr'):
63 | is_key = False
64 | if is_key:
65 | key += cur_str
66 | else:
67 | value += cur_str
68 | return (key, value)
69 |
--------------------------------------------------------------------------------
/libs/base_utils/sys_dirs.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | """Package Docs."""
5 |
6 | from __future__ import absolute_import
7 | from __future__ import print_function
8 | from __future__ import division
9 | from __future__ import unicode_literals
10 |
11 | import os
12 | from . import sys_info
13 |
14 |
15 | def get_document_path():
16 | """Function Docs."""
17 | _os_name = sys_info.get_os_name()
18 | if _os_name == 'windows':
19 | if sys_info.get_python_version() < 3:
20 | import _winreg as winreg
21 | else:
22 | import winreg
23 | key = winreg.OpenKey(
24 | winreg.HKEY_CURRENT_USER, r'Software\Microsoft\Windows' +
25 | r'\CurrentVersion\Explorer\Shell Folders',)
26 | document_path = winreg.QueryValueEx(key, 'Personal')[0]
27 | elif _os_name == 'osx':
28 | home_path = os.getenv('HOME')
29 | document_path = os.path.join(home_path, 'Documents')
30 | else:
31 | document_path = os.getenv('HOME')
32 | return document_path
33 |
34 |
35 | def get_tmp_path():
36 | """Function Docs."""
37 | tmp_path = '/tmp'
38 | if sys_info.get_os_name() == 'windows':
39 | tmp_path = os.environ['tmp']
40 | return tmp_path
41 |
42 |
43 | def get_user_config_path():
44 | """Function Docs."""
45 | _os_name = sys_info.get_os_name()
46 | home = os.getenv('HOME')
47 | if _os_name == 'windows':
48 | user_config_path = os.getenv('LOCALAPPDATA')
49 | if not user_config_path:
50 | user_config_path = os.getenv('APPDATA')
51 | elif _os_name == 'linux':
52 | user_config_path = os.path.join(home, '.config')
53 | elif _os_name == 'osx':
54 | user_config_path = os.path.join(home, 'Library')
55 | return user_config_path
56 |
--------------------------------------------------------------------------------
/libs/base_utils/sys_info.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | """Package Docs."""
5 |
6 | from __future__ import absolute_import
7 | from __future__ import print_function
8 | from __future__ import division
9 | from __future__ import unicode_literals
10 |
11 | import sys
12 | import codecs
13 | import locale
14 |
15 |
16 | def get_python_version():
17 | """Function Docs."""
18 | python_version = sys.version_info[0]
19 | return python_version
20 |
21 |
22 | def get_os_name():
23 | """Function Docs."""
24 | name = sys.platform
25 | if name == 'win32':
26 | os_name = 'windows'
27 | elif name == 'darwin':
28 | os_name = 'osx'
29 | elif 'linux' in name:
30 | os_name = 'linux'
31 | else:
32 | os_name = 'other'
33 | return os_name
34 |
35 |
36 | def get_host():
37 | """Function Docs."""
38 | machine = 'pc'
39 | ext = 'x32'
40 |
41 | if is_x64():
42 | ext = 'x64'
43 | host = '-'.join((machine, get_os_name(), ext))
44 | return host
45 |
46 |
47 | def get_sys_encoding():
48 | """Function Docs."""
49 | if get_os_name() == 'osx':
50 | sys_encoding = 'utf-8'
51 | else:
52 | sys_encoding = codecs.lookup(locale.getpreferredencoding()).name
53 | return sys_encoding
54 |
55 |
56 | def get_sys_language():
57 | """Function Docs."""
58 | sys_language = locale.getdefaultlocale()[0]
59 | if not sys_language:
60 | sys_language = 'en'
61 | else:
62 | sys_language = sys_language.lower()
63 | return sys_language
64 |
65 |
66 | def is_x64():
67 | """Function Docs."""
68 | return sys.maxsize > 2**32
69 |
70 |
71 | def is_in_submlimetext():
72 | """Function Docs."""
73 | state = False
74 | try:
75 | import sublime
76 | except ImportError:
77 | pass
78 | else:
79 | state = True
80 | return state
81 |
--------------------------------------------------------------------------------
/libs/serial/README.rst:
--------------------------------------------------------------------------------
1 | =================================
2 | pySerial |build-status| |docs|
3 | =================================
4 |
5 | Overview
6 | ========
7 | This module encapsulates the access for the serial port. It provides backends
8 | for Python_ running on Windows, OSX, Linux, BSD (possibly any POSIX compliant
9 | system) and IronPython. The module named "serial" automatically selects the
10 | appropriate backend.
11 |
12 | - Project Homepage: https://github.com/pyserial/pyserial
13 | - Download Page: https://pypi.python.org/pypi/pyserial
14 |
15 | BSD license, (C) 2001-2016 Chris Liechti
16 |
17 |
18 | Documentation
19 | =============
20 | For API documentation, usage and examples see files in the "documentation"
21 | directory. The ".rst" files can be read in any text editor or being converted to
22 | HTML or PDF using Sphinx_. A HTML version is online at
23 | https://pythonhosted.org/pyserial/
24 |
25 | Examples
26 | ========
27 | Examples and unit tests are in the directory examples_.
28 |
29 |
30 | Installation
31 | ============
32 | ``pip install pyserial`` should work for most users.
33 |
34 | Detailed information can be found in `documentation/pyserial.rst`_.
35 |
36 | The usual setup.py for Python_ libraries is used for the source distribution.
37 | Windows installers are also available (see download link above).
38 |
39 | .. _`documentation/pyserial.rst`: https://github.com/pyserial/pyserial/blob/master/documentation/pyserial.rst#installation
40 | .. _examples: https://github.com/pyserial/pyserial/blob/master/examples
41 | .. _Python: http://python.org/
42 | .. _Sphinx: http://sphinx-doc.org/
43 | .. |build-status| image:: https://travis-ci.org/pyserial/pyserial.svg?branch=master
44 | :target: https://travis-ci.org/pyserial/pyserial
45 | :alt: Build status
46 | .. |docs| image:: https://readthedocs.org/projects/pyserial/badge/?version=latest
47 | :target: http://pyserial.readthedocs.io/
48 | :alt: Documentation
49 |
--------------------------------------------------------------------------------
/libs/serial/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2001-2016 Chris Liechti
2 | All Rights Reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above
12 | copyright notice, this list of conditions and the following
13 | disclaimer in the documentation and/or other materials provided
14 | with the distribution.
15 |
16 | * Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived
18 | from this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | ---------------------------------------------------------------------------
33 | Note:
34 | Individual files contain the following tag instead of the full license text.
35 |
36 | SPDX-License-Identifier: BSD-3-Clause
37 |
38 | This enables machine processing of license information based on the SPDX
39 | License Identifiers that are here available: http://spdx.org/licenses/
40 |
--------------------------------------------------------------------------------
/libs/serial/urlhandler/protocol_alt.py:
--------------------------------------------------------------------------------
1 | #! python
2 | #
3 | # This module implements a special URL handler that allows selecting an
4 | # alternate implementation provided by some backends.
5 | #
6 | # This file is part of pySerial. https://github.com/pyserial/pyserial
7 | # (C) 2015 Chris Liechti
8 | #
9 | # SPDX-License-Identifier: BSD-3-Clause
10 | #
11 | # URL format: alt://port[?option[=value][&option[=value]]]
12 | # options:
13 | # - class=X used class named X instead of Serial
14 | #
15 | # example:
16 | # use poll based implementation on Posix (Linux):
17 | # python -m serial.tools.miniterm alt:///dev/ttyUSB0?class=PosixPollSerial
18 |
19 | try:
20 | import urlparse
21 | except ImportError:
22 | import urllib.parse as urlparse
23 |
24 | import serial
25 |
26 |
27 | def serial_class_for_url(url):
28 | """extract host and port from an URL string"""
29 | parts = urlparse.urlsplit(url)
30 | if parts.scheme != 'alt':
31 | raise serial.SerialException(
32 | 'expected a string in the form "alt://port[?option[=value][&option[=value]]]": '
33 | 'not starting with alt:// ({!r})'.format(parts.scheme))
34 | class_name = 'Serial'
35 | try:
36 | for option, values in urlparse.parse_qs(parts.query, True).items():
37 | if option == 'class':
38 | class_name = values[0]
39 | else:
40 | raise ValueError('unknown option: {!r}'.format(option))
41 | except ValueError as e:
42 | raise serial.SerialException(
43 | 'expected a string in the form '
44 | '"alt://port[?option[=value][&option[=value]]]": {!r}'.format(e))
45 | if not hasattr(serial, class_name):
46 | raise ValueError('unknown class: {!r}'.format(class_name))
47 | cls = getattr(serial, class_name)
48 | if not issubclass(cls, serial.Serial):
49 | raise ValueError('class {!r} is not an instance of Serial'.format(class_name))
50 | return (''.join([parts.netloc, parts.path]), cls)
51 |
52 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
53 | if __name__ == '__main__':
54 | s = serial.serial_for_url('alt:///dev/ttyS0?class=PosixPollSerial')
55 | print(s)
56 |
--------------------------------------------------------------------------------
/libs/base_utils/task_queue.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | """Doc."""
5 |
6 | from __future__ import absolute_import
7 | from __future__ import print_function
8 | from __future__ import division
9 | from __future__ import unicode_literals
10 |
11 | import time
12 | import sys
13 | import threading
14 |
15 |
16 | class ActionQueue(object):
17 | """."""
18 |
19 | def __init__(self, delay=0):
20 | """."""
21 | self._queue = []
22 | self._is_alive = False
23 | self._delay = delay
24 |
25 | def put(self, action, *args, **kwargs):
26 | """."""
27 | if callable(action):
28 | self._queue.append((action, args, kwargs))
29 | self._start()
30 |
31 | def _start(self):
32 | """."""
33 | if not self._is_alive:
34 | self._is_alive = True
35 | thread = threading.Thread(target=self._run)
36 | thread.start()
37 |
38 | def _run(self):
39 | """."""
40 | while self._queue:
41 | params = self._queue.pop(0)
42 | action = params[0]
43 | args = params[1]
44 | kwargs = params[2]
45 | if args and kwargs:
46 | action(*args, **kwargs)
47 | elif args:
48 | action(*args)
49 | elif kwargs:
50 | action(**kwargs)
51 | else:
52 | action()
53 | time.sleep(self._delay)
54 | self._is_alive = False
55 |
56 |
57 | class TaskQueue(object):
58 | """."""
59 |
60 | def __init__(self, consumer=sys.stdout.write, delay=0):
61 | """."""
62 | self._queue = []
63 | self._is_alive = False
64 | self._consumer = consumer
65 | self._delay = delay
66 | self._callable = callable(self._consumer)
67 |
68 | def put(self, *args):
69 | """."""
70 | if self._callable:
71 | self._queue.append(args)
72 | self._start()
73 |
74 | def _start(self):
75 | """."""
76 | if not self._is_alive:
77 | self._is_alive = True
78 | thread = threading.Thread(target=self._run)
79 | thread.start()
80 |
81 | def _run(self):
82 | """."""
83 | while self._queue:
84 | args = self._queue.pop(0)
85 | if isinstance(args, tuple):
86 | self._consumer(*args)
87 | else:
88 | self._consumer(args)
89 | time.sleep(self._delay)
90 | self._is_alive = False
91 |
--------------------------------------------------------------------------------
/libs/base_utils/serial_monitor.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | """Doc."""
5 |
6 | from __future__ import absolute_import
7 | from __future__ import print_function
8 | from __future__ import division
9 | from __future__ import unicode_literals
10 |
11 | import threading
12 | import serial
13 | from. import task_queue
14 |
15 |
16 | class SerialMonitor:
17 | """."""
18 |
19 | def __init__(self, port, baudrate, consumer):
20 | """."""
21 | self._is_alive = False
22 | self._is_ready = False
23 | self._msg_queue = task_queue.TaskQueue(consumer)
24 | self._port = port
25 | self._baudrate = baudrate
26 |
27 | self.ser = serial.Serial()
28 | self.ser.port = self._port
29 | self.ser.baudrate = self._baudrate
30 |
31 | def _check_ready(self):
32 | """."""
33 | try:
34 | self.ser.open()
35 | except serial.SerialException:
36 | self.ser = serial.Serial()
37 | self.ser.port = self._port
38 | self.ser.baudrate = self._baudrate
39 | try:
40 | self.ser.open()
41 | except serial.SerialException:
42 | self._is_ready = False
43 | else:
44 | self._is_ready = True
45 | else:
46 | self._is_ready = True
47 |
48 | def start(self):
49 | """."""
50 | self._check_ready()
51 | if not self._is_alive and self._is_ready:
52 | self._is_alive = True
53 | thread = threading.Thread(target=self._run)
54 | thread.start()
55 |
56 | def _run(self):
57 | """."""
58 | is_normal = True
59 | while self._is_alive:
60 | try:
61 | number = self.ser.in_waiting
62 | except serial.SerialException:
63 | is_normal = False
64 | self._is_alive = False
65 | break
66 | else:
67 | if number > 0:
68 | text = self.ser.read(number)
69 | text = text.decode('utf-8', 'replace')
70 | self._msg_queue.put(text)
71 | if is_normal:
72 | self.ser.close()
73 |
74 | def stop(self):
75 | """."""
76 | self._is_alive = False
77 |
78 | def send(self, text):
79 | """."""
80 | if self._is_alive:
81 | self._msg_queue.put(text)
82 | self.ser.write(text.encode('utf-8', 'replace'))
83 |
84 | def is_running(self):
85 | """."""
86 | return self._is_alive
87 |
--------------------------------------------------------------------------------
/libs/stino_runtime/programmers.txt:
--------------------------------------------------------------------------------
1 | avrisp.name=AVR ISP
2 | avrisp.communication=serial
3 | avrisp.protocol=stk500v1
4 | avrisp.program.protocol=stk500v1
5 | avrisp.program.tool=avrdude
6 | avrisp.program.extra_params=-P{serial.port}
7 |
8 | avrispmkii.name=AVRISP mkII
9 | avrispmkii.communication=usb
10 | avrispmkii.protocol=stk500v2
11 | avrispmkii.program.protocol=stk500v2
12 | avrispmkii.program.tool=avrdude
13 | avrispmkii.program.extra_params=-Pusb
14 |
15 | usbtinyisp.name=USBtinyISP
16 | usbtinyisp.protocol=usbtiny
17 | usbtinyisp.program.tool=avrdude
18 | usbtinyisp.program.extra_params=
19 |
20 | arduinoisp.name=ArduinoISP
21 | arduinoisp.protocol=arduinoisp
22 | arduinoisp.program.tool=avrdude
23 | arduinoisp.program.extra_params=
24 |
25 | arduinoisporg.name=ArduinoISP.org
26 | arduinoisporg.protocol=arduinoisporg
27 | arduinoisporg.program.tool=avrdude
28 | arduinoisporg.program.extra_params=
29 |
30 | usbasp.name=USBasp
31 | usbasp.communication=usb
32 | usbasp.protocol=usbasp
33 | usbasp.program.protocol=usbasp
34 | usbasp.program.tool=avrdude
35 | usbasp.program.extra_params=-Pusb
36 |
37 | parallel.name=Parallel Programmer
38 | parallel.protocol=dapa
39 | parallel.force=true
40 | # parallel.delay=200
41 | parallel.program.tool=avrdude
42 | parallel.program.extra_params=-F
43 |
44 | arduinoasisp.name=Arduino as ISP
45 | arduinoasisp.communication=serial
46 | arduinoasisp.protocol=stk500v1
47 | arduinoasisp.speed=19200
48 | arduinoasisp.program.protocol=stk500v1
49 | arduinoasisp.program.speed=19200
50 | arduinoasisp.program.tool=avrdude
51 | arduinoasisp.program.extra_params=-P{serial.port} -b{program.speed}
52 |
53 | usbGemma.name=Arduino Gemma
54 | usbGemma.protocol=arduinogemma
55 | usbGemma.program.tool=avrdude
56 | usbGemma.program.extra_params=
57 | usbGemma.config.path={runtime.platform.path}/bootloaders/gemma/avrdude.conf
58 |
59 | # STK500 firmware version v1 and v2 use different serial protocols.
60 | # Using the 'stk500' protocol tells avrdude to try and autodetect the
61 | # firmware version. If this leads to problems, we might need to add
62 | # stk500v1 and stk500v2 entries to allow explicitely selecting the
63 | # firmware version.
64 | stk500.name=Atmel STK500 development board
65 | stk500.communication=serial
66 | stk500.protocol=stk500
67 | stk500.program.protocol=stk500
68 | stk500.program.tool=avrdude
69 | stk500.program.extra_params=-P{serial.port}
70 |
71 | ## Notes about Dangerous Prototypes Bus Pirate as ISP
72 | ## Bus Pirate V3 need Firmware v5.10 or later
73 | ## Bus Pirate V4 need Firmware v6.3-r2151 or later
74 | ## Could happen that BP does not have enough current to power an Arduino board
75 | ## through the ICSP connector. In this case disconnect the +Vcc from ICSP connector
76 | ## and power Arduino board in the normal way.
77 | buspirate.name=BusPirate as ISP
78 | buspirate.communication=serial
79 | buspirate.protocol=buspirate
80 | buspirate.program.protocol=buspirate
81 | buspirate.program.tool=avrdude
82 | buspirate.program.extra_params=-P{serial.port}
83 |
84 |
--------------------------------------------------------------------------------
/libs/serial/tools/list_ports_common.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # This is a helper module for the various platform dependent list_port
4 | # implementations.
5 | #
6 | # This file is part of pySerial. https://github.com/pyserial/pyserial
7 | # (C) 2015 Chris Liechti
8 | #
9 | # SPDX-License-Identifier: BSD-3-Clause
10 | import re
11 |
12 |
13 | def numsplit(text):
14 | """\
15 | Convert string into a list of texts and numbers in order to support a
16 | natural sorting.
17 | """
18 | result = []
19 | for group in re.split(r'(\d+)', text):
20 | if group:
21 | try:
22 | group = int(group)
23 | except ValueError:
24 | pass
25 | result.append(group)
26 | return result
27 |
28 |
29 | class ListPortInfo(object):
30 | """Info collection base class for serial ports"""
31 |
32 | def __init__(self, device=None):
33 | self.device = device
34 | self.name = None
35 | self.description = 'n/a'
36 | self.hwid = 'n/a'
37 | # USB specific data
38 | self.vid = None
39 | self.pid = None
40 | self.serial_number = None
41 | self.location = None
42 | self.manufacturer = None
43 | self.product = None
44 | self.interface = None
45 |
46 | def usb_description(self):
47 | """return a short string to name the port based on USB info"""
48 | if self.interface is not None:
49 | return '{} - {}'.format(self.product, self.interface)
50 | elif self.product is not None:
51 | return self.product
52 | else:
53 | return self.name
54 |
55 | def usb_info(self):
56 | """return a string with USB related information about device"""
57 | return 'USB VID:PID={:04X}:{:04X}{}{}'.format(
58 | self.vid or 0,
59 | self.pid or 0,
60 | ' SER={}'.format(self.serial_number) if self.serial_number is not None else '',
61 | ' LOCATION={}'.format(self.location) if self.location is not None else '')
62 |
63 | def apply_usb_info(self):
64 | """update description and hwid from USB data"""
65 | self.description = self.usb_description()
66 | self.hwid = self.usb_info()
67 |
68 | def __eq__(self, other):
69 | return self.device == other.device
70 |
71 | def __lt__(self, other):
72 | return numsplit(self.device) < numsplit(other.device)
73 |
74 | def __str__(self):
75 | return '{} - {}'.format(self.device, self.description)
76 |
77 | def __getitem__(self, index):
78 | """Item access: backwards compatible -> (port, desc, hwid)"""
79 | if index == 0:
80 | return self.device
81 | elif index == 1:
82 | return self.description
83 | elif index == 2:
84 | return self.hwid
85 | else:
86 | raise IndexError('{} > 2'.format(index))
87 |
88 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
89 | # test
90 | if __name__ == '__main__':
91 | print(ListPortInfo('dummy'))
92 |
--------------------------------------------------------------------------------
/libs/serial/urlhandler/protocol_hwgrep.py:
--------------------------------------------------------------------------------
1 | #! python
2 | #
3 | # This module implements a special URL handler that uses the port listing to
4 | # find ports by searching the string descriptions.
5 | #
6 | # This file is part of pySerial. https://github.com/pyserial/pyserial
7 | # (C) 2011-2015 Chris Liechti
8 | #
9 | # SPDX-License-Identifier: BSD-3-Clause
10 | #
11 | # URL format: hwgrep://&