Init commit with many years of arduino sketches and projects. I dont know if the esp8266 includes much, but there are also libraries. I hope they dont have crazy automatic versioning through the Arduino IDE.

This commit is contained in:
2019-05-30 23:41:53 +02:00
parent 2d047634f2
commit 6c84b31f2c
1480 changed files with 198581 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
*.pyc
*.cache
*.sublime-workspace
*.sublime-project
.build

View File

@@ -0,0 +1,6 @@
{
"cmd": ["ino", "clean"],
"selector": "source.c++.arduino",
"working_dir": "$file_path/..",
"path": "/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"
}

View File

@@ -0,0 +1,6 @@
{
"cmd": ["ino", "build"],
"selector": "source.c++.arduino",
"working_dir": "$file_path/..",
"path": "/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"
}

View File

@@ -0,0 +1,10 @@
{
"cmd": ["sh", "-c", "ino build && ino upload"],
"windows": {
"shell": true,
"cmd": ["ino", "build", "&;", "ino", "upload"]
},
"selector": "source.c++.arduino",
"working_dir": "$file_path/..",
"path": "/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"
}

View File

@@ -0,0 +1,6 @@
{
"cmd": ["ino", "upload"],
"selector": "source.c++.arduino",
"working_dir": "$file_path/..",
"path": "/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"
}

View File

@@ -0,0 +1,128 @@
{
"scope": "source.c++.arduino",
"completions": [
"HIGH",
"LOW",
"INPUT",
"OUTPUT",
"DEC",
"BIN",
"HEX",
"OCT",
"BYTE",
"PI",
"HALF_PI",
"TWO_PI",
"LSBFIRST",
"MSBFIRST",
"CHANGE",
"FALLING",
"RISING",
"DEFAULT",
"EXTERNAL",
"INTERAL",
"boolean",
"break",
"byte",
"case",
"char",
"class",
"continue",
"default",
"do",
"double",
"else",
"false",
"float",
"for",
"if",
"int",
"long",
"new",
"null",
"private",
"protected",
"public",
"return",
"short",
"signed",
"static",
"switch",
"this",
"throw",
"try",
"true",
"unsigned",
"void",
"while",
"word",
"boolean",
"byte",
"char",
"float",
"int",
"long",
"word",
"abs",
"acos",
"asin",
"atan",
"atan2",
"ceil",
"constrain",
"cos",
"degrees",
"exp",
"floor",
"log",
"map",
"max",
"min",
"radians",
"random",
"randomSeed",
"round",
"sin",
"sq",
"sqrt",
"tan",
"bitRead",
"bitWrite",
"bitSet",
"bitClear",
"bit",
"highByte",
"lowByte",
"analogReference",
"analogRead",
"analogWrite",
"attachInterrupt",
"detachInterrupt",
"delay",
"delayMicroseconds",
"digitalWrite",
"digitalRead",
"interrupts",
"millis",
"micros",
"noInterrupts",
"noTone",
"pinMode",
"pulseIn",
"shiftOut",
"tone",
"Serial",
"Serial1",
"Serial2",
"Serial3",
"begin",
"end",
"read",
"print",
"println",
"available",
"flush",
"setup",
"loop"
]
}

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>pde</string>
<string>ino</string>
</array>
<key>foldingStartMarker</key>
<string>/\*\*|\{\s*$</string>
<key>foldingStopMarker</key>
<string>\*\*/|^\s*\}</string>
<key>name</key>
<string>Arduino</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#special_block</string>
</dict>
<dict>
<key>include</key>
<string>source.c++</string>
</dict>
<dict>
<key>match</key>
<string>\b(HIGH|LOW|INPUT|OUTPUT|DEC|BIN|HEX|OCT|BYTE|PI|HALF_PI|TWO_PI|LSBFIRST|MSBFIRST|CHANGE|FALLING|RISING|DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56|null)\b</string>
<key>name</key>
<string>constant.c++.arduino</string>
</dict>
<dict>
<key>match</key>
<string>\b(boolean|byte|word)\b</string>
<key>name</key>
<string>storage.c++.arduino</string>
</dict>
<dict>
<key>match</key>
<string>\b(abs|acos|asin|atan|atan2|ceil|constrain|cos|degrees|exp|floor|log|map|max|min|radians|random|randomSeed|round|sin|sq|sqrt|tan|bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte|analogReference|analogRead|analogWrite|attachInterrupt|detachInterrupt|delay|delayMicroseconds|digitalWrite|digitalRead|interrupts|millis|micros|noInterrupts|noTone|pinMode|pulseIn|shiftOut|tone|begin|end|read|print|println|available|flush|setup|loop)\b</string>
<key>name</key>
<string>support.function.c++.arduino</string>
</dict>
<dict>
<key>match</key>
<string>\b(Serial\d?)\b</string>
<key>name</key>
<string>support.class.c++.arduino</string>
</dict>
<dict>
<key>match</key>
<string>\b(private|protected|public)</string>
<key>name</key>
<string>storage.modifier.c++.arduino</string>
</dict>
</array>
<key>scopeName</key>
<string>source.c++.arduino</string>
<key>uuid</key>
<string>65E5AFAE-4AE7-4DAE-837B-1B99810E464C</string>
</dict>
</plist>

View File

@@ -0,0 +1,26 @@
[
{
"caption": "New sketch",
"command": "new_sketch"
},
{
"caption": "Open Arduino Libraries",
"command": "open_arduino_libraries"
},
{
"caption": "Compile Arduino sketch",
"command": "compile"
},
{
"caption": "Upload Arduino sketch",
"command": "upload"
},
{
"caption": "Compile and Upload Arduino sketch",
"command": "compile_upload"
},
{
"caption": "Clean Arduino sketch",
"command": "clean"
}
]

View File

@@ -0,0 +1,5 @@
[
{ "keys": ["super+ctrl+shift+b"], "command": "compile" },
{ "keys": ["super+ctrl+shift+u"], "command": "upload"},
{ "keys": ["super+ctrl+shift+c"], "command": "clean"}
]

View File

@@ -0,0 +1,7 @@
Copyright (c) 2012 Robby Colvin
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 furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
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.

View File

@@ -0,0 +1,106 @@
[
{
"caption": "Tools",
"mnemonic": "t",
"id": "tools",
"children": [
{
"id": "arduinomenu",
"caption": "Arduino",
"children": [
{
"id": "arduinocompile",
"caption": "Compile Sketch",
"command": "compile"
},
{
"id": "arduinoupload",
"caption": "Upload Sketch",
"command": "upload"
},
{
"id": "arduinoclean",
"caption": "Clean Sketch",
"command": "clean"
},
// {
// "id": "arduinomonitor",
// "caption": "Monitor USB Port",
// "command": "watch_serial_port"
// },
{
"id": "arduinolocalhelp",
"caption": "Local Help for Keyword",
"command": "local_help"
},
{
"id": "arduinonewsketchmenu",
"caption": "New Sketch",
"command": "new_sketch"
},
{
"id": "arduinoopen",
"caption": "Open",
"children": [
{
"id": "arduinodirectory",
"caption": "Arduino Directory",
"command": "open_arduino_directory"
},
{
"id": "arduinolibraries",
"caption": "Arduino Libraries",
"command": "open_arduino_libraries"
},
{
"id": "arduinoexamples",
"caption": "Arduino Examples",
"command": "open_arduino_examples"
},
{
"id": "arduinouserdirectory",
"caption": "User Arduino Directory",
"command": "open_user_arduino_directory"
},
{
"id": "arduinolibraries",
"caption": "User Arduino Libraries",
"command": "open_user_arduino_libraries"
}
]
}
]
}
]
},
{
"caption": "Preferences",
"mnemonic": "n",
"id": "preferences",
"children":[{
"caption": "Package Settings",
"mnemonic": "P",
"id": "package-settings",
"children":[{
"caption": "Arduino",
"children": [{
"command": "open_file",
"args": {
"file": "${packages}/Arduino/Arduino.sublime-settings"
},
"caption": "Settings Default"
},
{
"command": "open_file",
"args": {
"file": "${packages}/User/Arduino.sublime-settings"
},
"caption": "Settings User"
},
{
"caption": "-"
}]
}]
}]
}
]

View File

@@ -0,0 +1,38 @@
# ST2 Arduino
Sublime Text 2 plugin for Arduino.
## Notes
Currently, this plugin is only tested and optimized (read works) for OS X. I don't have access to Windows or Linux, so feel free to fork and add that functionality.
## Prerequisites
Dealing with a Makefile on my own was proving too cumbersome, so I've now opted to use the `ino` tool instead.
The best way to install ino is to build from source:
```bash
git clone git://github.com/amperka/ino.git && cd ino
make install
```
However you install ino, make sure that its location is available in your $PATH so this plugin can find it.
Please visit [ino's website](http://inotool.org/) for more information.
## Installation
Download and extract to Sublime Text 2 Packages folder
1. Download a [zipball](https://github.com/geetarista/ST2-Arduino/zipball/master) or [tarball](https://github.com/geetarista/ST2-Arduino/tarball/master)
2. Extract the plugin
3. Copy it to your packages directory:
* Mac OS X: ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/
* Linux: ~/.config/sublime-text-2/Packages
* Windows: %APPDATA%\Sublime Text 2\Packages
4. Rename to Arduino.
## License
MIT. See `LICENSE`.

View File

@@ -0,0 +1,9 @@
<snippet>
<content><![CDATA[void loop() {
${1:/* code */}
}
]]></content>
<tabTrigger>loop</tabTrigger>
<scope>source.c++.arduino</scope>
<description>Arduino loop</description>
</snippet>

View File

@@ -0,0 +1,9 @@
<snippet>
<content><![CDATA[void setup() {
${1:/* code */}
}
]]></content>
<tabTrigger>setup</tabTrigger>
<scope>source.c++.arduino</scope>
<description>Arduino setup</description>
</snippet>

View File

@@ -0,0 +1,44 @@
#!/bin/bash
echo "executing monitor script"
set -- /dev/*usb*
# make sure there's a usb port
echo "$1"
if [ -r "$1" ]; then
# get the list of USB ports
dev_list=(`ls /dev/*usb*`)
# echo them out with their index
counter=0
for filename in "${dev_list[@]}"; do
echo "${counter}. ${filename:5}"
counter=`expr $counter + 1`
done
# ask the user which port they'd like to monitor
echo "Which port would you like to monitor? [enter digit then enter, defaults to zero]:"
read dev_port
# if they didn't supply one, just use zero
if [ -n dev_port ]; then
dev_port=0
fi
# ask them what baud they'd like to use
echo "Enter the baud rate [defaults to 9600]:"
read dev_baud
# if they didn't supply one, just use 9600
if [ -n dev_baud ]; then
dev_baud=9600
fi
# give them a heads up
echo "Monitoring ${dev_list[$dev_port]:5} on ${dev_baud}"
# start monitoring
screen ${dev_list[$dev_port]} ${dev_baud}
else
echo "No USB ports found"
fi

View File

@@ -0,0 +1 @@
from arduino import *

View File

@@ -0,0 +1,140 @@
import sublime
import sublime_plugin
import os
import thread
import subprocess
import sys
# import re
PLUGIN_DIRECTORY = os.getcwd().replace(os.path.normpath(os.path.join(os.getcwd(), '..', '..')) + os.path.sep, '').replace(os.path.sep, '/')
PLUGIN_PATH = os.getcwd().replace(os.path.join(os.getcwd(), '..', '..') + os.path.sep, '').replace(os.path.sep, '/')
RESULT_VIEW_NAME = 'monitor_result_view'
PACKAGES_DIR = sublime.packages_path()
ARDUINO_DIR = '/Applications/Arduino.app/Contents/Resources/Java'
REFERENCE_DIR = '%s/reference' % ARDUINO_DIR
KEYWORDS_FILE = '%s/lib/keywords.txt' % ARDUINO_DIR
CSS_FILE = "%s/arduinoUno.css" % REFERENCE_DIR
USER_DIR = '${HOME}/Documents/Arduino/'
def plugin_file(name):
return os.path.join(PLUGIN_PATH, name)
class CompileCommand(sublime_plugin.WindowCommand):
""" Compile the current file """
def run(self):
self.window.run_command('set_build_system', {
'file': "%s/Arduino-Compile.sublime-build" % PLUGIN_PATH
})
self.window.run_command('build')
class UploadCommand(sublime_plugin.WindowCommand):
""" Upload the current sketch to the board """
def run(self):
self.window.run_command('set_build_system', {
'file': "%s/Arduino-Upload.sublime-build" % PLUGIN_PATH
})
self.window.run_command('build')
class CompileUploadCommand(sublime_plugin.WindowCommand):
""" Upload and compile the current sketch to the board """
def run(self):
self.window.run_command('set_build_system', {
'file': "%s/Arduino-Compile-Upload.sublime-build" % PLUGIN_PATH
})
self.window.run_command('build')
class CleanCommand(sublime_plugin.WindowCommand):
""" Clean the current file """
def run(self):
self.window.run_command('set_build_system', {
'file': "%s/Arduino-Clean.sublime-build" % PLUGIN_PATH
})
self.window.run_command('build')
class NewSketchCommand(sublime_plugin.WindowCommand):
""" Create new sketch file from template """
def run(self):
template = open(plugin_file('sketch_template'), 'r').read()
file = self.window.new_file()
edit = file.begin_edit()
file.insert(edit, 0, template)
file.end_edit(edit)
class OpenArduinoDirectoryCommand(sublime_plugin.WindowCommand):
""" Open Arduino's application directory """
def run(self):
if sys.platform == 'darwin':
path = ARDUINO_DIR
subprocess.check_call(['open', '--', path])
class OpenArduinoLibrariesCommand(sublime_plugin.WindowCommand):
""" Open Arduino's built-in libraries """
def run(self):
if sys.platform == 'darwin':
path = '%s/libraries' % ARDUINO_DIR
subprocess.check_call(['open', '--', path])
class OpenArduinoExamplesCommand(sublime_plugin.WindowCommand):
""" Open Arduino's example sketches directory """
def run(self):
if sys.platform == 'darwin':
path = '%s/examples' % ARDUINO_DIR
subprocess.check_call(['open', '--', path])
class OpenUserArduinoDirectoryCommand(sublime_plugin.WindowCommand):
""" Open user's arduino directory """
def run(self):
path = os.getenv('HOME') + '/Documents/Arduino'
subprocess.check_call(['open', '--', path])
class OpenUserArduinoLibrariesCommand(sublime_plugin.WindowCommand):
""" Open user's library files """
def run(self):
path = os.getenv('HOME') + '/Documents/Arduino/libraries'
subprocess.check_call(['open', '--', path])
# class WatchSerialPortCommand(sublime_plugin.WindowCommand):
# """ Watch serial port for activity """
# def run(self):
# script = plugin_file('Support/Monitor')
# subprocess.call([script], shell=True)
class LocalHelpCommand(sublime_plugin.TextCommand):
""" Open Arduino help for currently selected word """
def run(self, edit):
loop = 'loop'
sel = self.view.sel()[0]
if not sel.empty():
word = self.view.substr(sel)
else:
word = ""
lines = [line.split() for line in open(KEYWORDS_FILE)]
keywords = [l for l in lines if ((len(l) >= 2) or (l and l[0] != "#"))]
for kw in keywords:
if word == kw[0]:
html_file = '%s/%s.html' % (REFERENCE_DIR, kw[-1])
if 'html_file' in locals():
try:
subprocess.check_call(['open', html_file])
# Will add this if sublime ever gets formatted output window
# html = open(html_file).read()
# css = open(CSS_FILE).read() + """
# #wikitext p:first-child,
# #pageheader,
# #pagenav,
# #pagefooter {
# display: none;
# }
# #page {
# width: 100%;
# }
# """
# html = re.sub('<link.*arduino.*\.css.*?>', "<style type='text/css'>#{css}</style>", html, re.S|re.I)
except Exception, e:
print "failed to open html"
else:
print 'No documentation found for "%s"' % word

View File

@@ -0,0 +1,4 @@
{
"install": "messages/install.txt",
"1.0.0": "messages/1.0.0.txt"
}

View File

@@ -0,0 +1,4 @@
Version 1.0.0
-------------
This is the first version of the plugin.

View File

@@ -0,0 +1,4 @@
Arduino Sublime Text 2 Package
==============================
Easily integrate with your Arduino.

View File

@@ -0,0 +1,13 @@
/*
New sketch
*/
void setup ()
{
// setup
}
void loop()
{
// loop
}

View File

@@ -0,0 +1,7 @@
/*
This is a dummy file to test the compile command.
*/
void setup () {}
void loop() {}