1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

Merge branch 'master' into wifly_integration

This commit is contained in:
amcewen
2011-08-28 20:28:53 +01:00
196 changed files with 6729 additions and 8770 deletions

View File

@ -2,9 +2,11 @@
<classpath> <classpath>
<classpathentry excluding="processing/app/tools/format/|processing/app/tools/format/src/|processing/app/Trace.java|processing/app/RunnerClassLoader.java" kind="src" path="app/src"/> <classpathentry excluding="processing/app/tools/format/|processing/app/tools/format/src/|processing/app/Trace.java|processing/app/RunnerClassLoader.java" kind="src" path="app/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/core"/> <classpathentry combineaccessrules="false" kind="src" path="/processing-core"/>
<classpathentry kind="lib" path="build/shared/lib/antlr.jar"/> <classpathentry kind="lib" path="app/lib/antlr.jar"/>
<classpathentry kind="lib" path="build/shared/lib/registry.jar"/> <classpathentry kind="lib" path="app/lib/apple.jar"/>
<classpathentry kind="lib" path="build/shared/lib/apple.jar"/> <classpathentry kind="lib" path="app/lib/ecj.jar"/>
<classpathentry kind="lib" path="app/lib/jna.jar"/>
<classpathentry kind="lib" path="app/lib/RXTXcomm.jar"/>
<classpathentry kind="output" path="app/bin"/> <classpathentry kind="output" path="app/bin"/>
</classpath> </classpath>

View File

@ -1,10 +1,15 @@
#Thu Jan 10 10:50:38 PST 2008 #Tue Aug 16 19:08:40 CEST 2011
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.compliance=1.4 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.source=1.3 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16

View File

@ -41,9 +41,9 @@ import processing.core.*;
* files and images, etc) that comes from that. * files and images, etc) that comes from that.
*/ */
public class Base { public class Base {
public static final int REVISION = 22; public static final int REVISION = 100;
/** This might be replaced by main() if there's a lib/version.txt file. */ /** This might be replaced by main() if there's a lib/version.txt file. */
static String VERSION_NAME = "0022"; static String VERSION_NAME = "0100";
/** Set true if this a proper release rather than a numbered revision. */ /** Set true if this a proper release rather than a numbered revision. */
static public boolean RELEASE = false; static public boolean RELEASE = false;
@ -349,6 +349,10 @@ public class Base {
int opened = 0; int opened = 0;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
String path = Preferences.get("last.sketch" + i + ".path"); String path = Preferences.get("last.sketch" + i + ".path");
// don't automatically rename sketches that were left open from a
// pre-1.0 version of Arduino (wait for the user to explicitly open
// the sketch before renaming it).
if (path.toLowerCase().endsWith(".pde")) continue;
int[] location; int[] location;
if (windowPositionValid) { if (windowPositionValid) {
String locationStr = Preferences.get("last.sketch" + i + ".location"); String locationStr = Preferences.get("last.sketch" + i + ".location");
@ -545,7 +549,7 @@ public class Base {
newbieDir.mkdirs(); newbieDir.mkdirs();
// Make an empty pde file // Make an empty pde file
File newbieFile = new File(newbieDir, newbieName + ".pde"); File newbieFile = new File(newbieDir, newbieName + ".ino");
new FileOutputStream(newbieFile); // create the file new FileOutputStream(newbieFile); // create the file
return newbieFile.getAbsolutePath(); return newbieFile.getAbsolutePath();
} }
@ -637,7 +641,8 @@ public class Base {
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
// TODO this doesn't seem to ever be used. AWESOME. // TODO this doesn't seem to ever be used. AWESOME.
//System.out.println("check filter on " + dir + " " + name); //System.out.println("check filter on " + dir + " " + name);
return name.toLowerCase().endsWith(".pde"); return name.toLowerCase().endsWith(".ino")
|| name.toLowerCase().endsWith(".pde");
} }
}); });
@ -988,6 +993,13 @@ public class Base {
} }
public void onBoardOrPortChange() {
for (Editor editor : editors) {
editor.onBoardOrPortChange();
}
}
public void rebuildBoardsMenu(JMenu menu) { public void rebuildBoardsMenu(JMenu menu) {
//System.out.println("rebuilding boards menu"); //System.out.println("rebuilding boards menu");
menu.removeAll(); menu.removeAll();
@ -1000,6 +1012,7 @@ public class Base {
//System.out.println("Switching to " + target + ":" + board); //System.out.println("Switching to " + target + ":" + board);
Preferences.set("target", (String) getValue("target")); Preferences.set("target", (String) getValue("target"));
Preferences.set("board", (String) getValue("board")); Preferences.set("board", (String) getValue("board"));
onBoardOrPortChange();
} }
}; };
action.putValue("target", target.getName()); action.putValue("target", target.getName());
@ -1016,22 +1029,28 @@ public class Base {
} }
public void rebuildBurnBootloaderMenu(JMenu menu) { public void rebuildProgrammerMenu(JMenu menu) {
//System.out.println("rebuilding burn bootloader menu"); //System.out.println("rebuilding programmer menu");
menu.removeAll(); menu.removeAll();
ButtonGroup group = new ButtonGroup();
for (Target target : targetsTable.values()) { for (Target target : targetsTable.values()) {
for (String programmer : target.getProgrammers().keySet()) { for (String programmer : target.getProgrammers().keySet()) {
AbstractAction action = AbstractAction action =
new AbstractAction( new AbstractAction(
"w/ " + target.getProgrammers().get(programmer).get("name")) { target.getProgrammers().get(programmer).get("name")) {
public void actionPerformed(ActionEvent actionevent) { public void actionPerformed(ActionEvent actionevent) {
activeEditor.handleBurnBootloader((String) getValue("target"), Preferences.set("programmer", getValue("target") + ":" +
(String) getValue("programmer")); getValue("programmer"));
} }
}; };
action.putValue("target", target.getName()); action.putValue("target", target.getName());
action.putValue("programmer", programmer); action.putValue("programmer", programmer);
JMenuItem item = new JMenuItem(action); JMenuItem item = new JRadioButtonMenuItem(action);
if (Preferences.get("programmer").equals(target.getName() + ":" +
programmer)) {
item.setSelected(true);
}
group.add(item);
menu.add(item); menu.add(item);
} }
} }
@ -1091,7 +1110,10 @@ public class Base {
File subfolder = new File(folder, list[i]); File subfolder = new File(folder, list[i]);
if (!subfolder.isDirectory()) continue; if (!subfolder.isDirectory()) continue;
File entry = new File(subfolder, list[i] + ".pde"); File entry = new File(subfolder, list[i] + ".ino");
if (!entry.exists() && (new File(subfolder, list[i] + ".pde")).exists()) {
entry = new File(subfolder, list[i] + ".pde");
}
// if a .pde file of the same prefix as the folder exists.. // if a .pde file of the same prefix as the folder exists..
if (entry.exists()) { if (entry.exists()) {
//String sanityCheck = sanitizedName(list[i]); //String sanityCheck = sanitizedName(list[i]);

View File

@ -46,6 +46,7 @@ import gnu.io.*;
/** /**
* Main editor panel for the Processing Development Environment. * Main editor panel for the Processing Development Environment.
*/ */
@SuppressWarnings("serial")
public class Editor extends JFrame implements RunnerListener { public class Editor extends JFrame implements RunnerListener {
Base base; Base base;
@ -113,7 +114,7 @@ public class Editor extends JFrame implements RunnerListener {
EditorLineStatus lineStatus; EditorLineStatus lineStatus;
JEditorPane editorPane; //JEditorPane editorPane;
JEditTextArea textarea; JEditTextArea textarea;
EditorListener listener; EditorListener listener;
@ -195,8 +196,10 @@ public class Editor extends JFrame implements RunnerListener {
//PdeKeywords keywords = new PdeKeywords(); //PdeKeywords keywords = new PdeKeywords();
//sketchbook = new Sketchbook(this); //sketchbook = new Sketchbook(this);
if (serialMonitor == null) if (serialMonitor == null) {
serialMonitor = new SerialMonitor(Preferences.get("serial.port")); serialMonitor = new SerialMonitor(Preferences.get("serial.port"));
serialMonitor.setIconImage(getIconImage());
}
buildMenuBar(); buildMenuBar();
@ -538,7 +541,7 @@ public class Editor extends JFrame implements RunnerListener {
}); });
fileMenu.add(saveAsMenuItem); fileMenu.add(saveAsMenuItem);
item = newJMenuItem("Upload to I/O Board", 'U'); item = newJMenuItem("Upload", 'U');
item.addActionListener(new ActionListener() { item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
handleExport(false); handleExport(false);
@ -546,13 +549,13 @@ public class Editor extends JFrame implements RunnerListener {
}); });
fileMenu.add(item); fileMenu.add(item);
// item = newJMenuItemShift("Upload to I/O Board (verbose)", 'U'); item = newJMenuItemShift("Upload Using Programmer", 'U');
// item.addActionListener(new ActionListener() { item.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
// handleExport(true); handleExport(true);
// } }
// }); });
// fileMenu.add(item); fileMenu.add(item);
fileMenu.addSeparator(); fileMenu.addSeparator();
@ -618,13 +621,13 @@ public class Editor extends JFrame implements RunnerListener {
// }); // });
// sketchMenu.add(item); // sketchMenu.add(item);
item = new JMenuItem("Stop"); // item = new JMenuItem("Stop");
item.addActionListener(new ActionListener() { // item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { // public void actionPerformed(ActionEvent e) {
handleStop(); // handleStop();
} // }
}); // });
sketchMenu.add(item); // sketchMenu.add(item);
sketchMenu.addSeparator(); sketchMenu.addSeparator();
@ -696,9 +699,17 @@ public class Editor extends JFrame implements RunnerListener {
menu.addSeparator(); menu.addSeparator();
JMenu bootloaderMenu = new JMenu("Burn Bootloader"); JMenu programmerMenu = new JMenu("Programmer");
base.rebuildBurnBootloaderMenu(bootloaderMenu); base.rebuildProgrammerMenu(programmerMenu);
menu.add(bootloaderMenu); menu.add(programmerMenu);
item = new JMenuItem("Burn Bootloader");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleBurnBootloader();
}
});
menu.add(item);
menu.addMenuListener(new MenuListener() { menu.addMenuListener(new MenuListener() {
public void menuCanceled(MenuEvent e) {} public void menuCanceled(MenuEvent e) {}
@ -899,6 +910,7 @@ public class Editor extends JFrame implements RunnerListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
selectSerialPort(((JCheckBoxMenuItem)e.getSource()).getText()); selectSerialPort(((JCheckBoxMenuItem)e.getSource()).getText());
base.onBoardOrPortChange();
} }
/* /*
@ -1810,7 +1822,7 @@ public class Editor extends JFrame implements RunnerListener {
internalCloseRunner(); internalCloseRunner();
running = true; running = true;
toolbar.activate(EditorToolbar.RUN); toolbar.activate(EditorToolbar.RUN);
statusNotice("Compiling..."); status.progress("Compiling sketch...");
// do this to advance/clear the terminal window / dos prompt / etc // do this to advance/clear the terminal window / dos prompt / etc
for (int i = 0; i < 10; i++) System.out.println(); for (int i = 0; i < 10; i++) System.out.println();
@ -1830,12 +1842,14 @@ public class Editor extends JFrame implements RunnerListener {
public void run() { public void run() {
try { try {
sketch.prepare(); sketch.prepare();
String appletClassName = sketch.build(false); sketch.build(false);
statusNotice("Done compiling."); statusNotice("Done compiling.");
} catch (Exception e) { } catch (Exception e) {
status.unprogress();
statusError(e); statusError(e);
} }
status.unprogress();
toolbar.deactivate(EditorToolbar.RUN); toolbar.deactivate(EditorToolbar.RUN);
} }
} }
@ -1845,12 +1859,14 @@ public class Editor extends JFrame implements RunnerListener {
public void run() { public void run() {
try { try {
sketch.prepare(); sketch.prepare();
String appletClassName = sketch.build(true); sketch.build(true);
statusNotice("Done compiling."); statusNotice("Done compiling.");
} catch (Exception e) { } catch (Exception e) {
status.unprogress();
statusError(e); statusError(e);
} }
status.unprogress();
toolbar.deactivate(EditorToolbar.RUN); toolbar.deactivate(EditorToolbar.RUN);
} }
} }
@ -1887,12 +1903,12 @@ public class Editor extends JFrame implements RunnerListener {
* Implements Sketch &rarr; Stop, or pressing Stop on the toolbar. * Implements Sketch &rarr; Stop, or pressing Stop on the toolbar.
*/ */
public void handleStop() { // called by menu or buttons public void handleStop() { // called by menu or buttons
toolbar.activate(EditorToolbar.STOP); // toolbar.activate(EditorToolbar.STOP);
internalCloseRunner(); internalCloseRunner();
toolbar.deactivate(EditorToolbar.RUN); toolbar.deactivate(EditorToolbar.RUN);
toolbar.deactivate(EditorToolbar.STOP); // toolbar.deactivate(EditorToolbar.STOP);
// focus the PDE again after quitting presentation mode [toxi 030903] // focus the PDE again after quitting presentation mode [toxi 030903]
toFront(); toFront();
@ -2032,12 +2048,63 @@ public class Editor extends JFrame implements RunnerListener {
* modifications (if any) to the previous sketch need to be saved. * modifications (if any) to the previous sketch need to be saved.
*/ */
protected boolean handleOpenInternal(String path) { protected boolean handleOpenInternal(String path) {
// rename .pde files to .ino
File[] oldFiles = (new File(path)).getParentFile().listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return (name.toLowerCase().endsWith(".pde"));
}
});
if (oldFiles != null && oldFiles.length > 0) {
if (!Preferences.getBoolean("editor.update_extension")) {
Object[] options = { "OK", "Cancel" };
String prompt =
"In Arduino 1.0, the file extension for sketches changed\n" +
"from \".pde\" to \".ino\". This version of the software only\n" +
"supports the new extension. Rename the files in this sketch\n" +
"(and future sketches) and continue?";
int result = JOptionPane.showOptionDialog(this,
prompt,
"New extension",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
options[0]);
if (result != JOptionPane.YES_OPTION) {
return false;
}
Preferences.setBoolean("editor.update_extension", true);
}
for (int i = 0; i < oldFiles.length; i++) {
String oldPath = oldFiles[i].getPath();
File newFile = new File(oldPath.substring(0, oldPath.length() - 4) + ".ino");
try {
Base.copyFile(oldFiles[i], newFile);
} catch (IOException e) {
Base.showWarning("Error", "Could not copy to a proper location.", e);
return false;
}
// remove the original file, so user doesn't get confused
oldFiles[i].delete();
// update with the new path
if (oldFiles[i].compareTo(new File(path)) == 0) {
path = newFile.getAbsolutePath();
}
}
}
// check to make sure that this .pde file is // check to make sure that this .pde file is
// in a folder of the same name // in a folder of the same name
File file = new File(path); File file = new File(path);
File parentFile = new File(file.getParent()); File parentFile = new File(file.getParent());
String parentName = parentFile.getName(); String parentName = parentFile.getName();
String pdeName = parentName + ".pde"; String pdeName = parentName + ".ino";
File altFile = new File(file.getParent(), pdeName); File altFile = new File(file.getParent(), pdeName);
if (pdeName.equals(file.getName())) { if (pdeName.equals(file.getName())) {
@ -2049,10 +2116,10 @@ public class Editor extends JFrame implements RunnerListener {
path = altFile.getAbsolutePath(); path = altFile.getAbsolutePath();
//System.out.println("found alt file in same folder"); //System.out.println("found alt file in same folder");
} else if (!path.endsWith(".pde")) { } else if (!path.endsWith(".ino")) {
Base.showWarning("Bad file selected", Base.showWarning("Bad file selected",
"Processing can only open its own sketches\n" + "Processing can only open its own sketches\n" +
"and other files ending in .pde", null); "and other files ending in .ino", null);
return false; return false;
} else { } else {
@ -2252,6 +2319,7 @@ public class Editor extends JFrame implements RunnerListener {
0); 0);
if (result == null) return false; if (result == null) return false;
selectSerialPort(result); selectSerialPort(result);
base.onBoardOrPortChange();
return true; return true;
} }
@ -2271,13 +2339,13 @@ public class Editor extends JFrame implements RunnerListener {
* Made synchronized to (hopefully) avoid problems of people * Made synchronized to (hopefully) avoid problems of people
* hitting export twice, quickly, and horking things up. * hitting export twice, quickly, and horking things up.
*/ */
synchronized public void handleExport(final boolean verbose) { synchronized public void handleExport(final boolean usingProgrammer) {
//if (!handleExportCheckModified()) return; //if (!handleExportCheckModified()) return;
toolbar.activate(EditorToolbar.EXPORT); toolbar.activate(EditorToolbar.EXPORT);
console.clear(); console.clear();
statusNotice("Uploading to I/O Board..."); status.progress("Uploading to I/O Board...");
new Thread(verbose ? exportAppHandler : exportHandler).start(); new Thread(usingProgrammer ? exportAppHandler : exportHandler).start();
} }
// DAM: in Arduino, this is upload // DAM: in Arduino, this is upload
@ -2304,10 +2372,12 @@ public class Editor extends JFrame implements RunnerListener {
} catch (RunnerException e) { } catch (RunnerException e) {
//statusError("Error during upload."); //statusError("Error during upload.");
//e.printStackTrace(); //e.printStackTrace();
status.unprogress();
statusError(e); statusError(e);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
status.unprogress();
uploading = false; uploading = false;
//toolbar.clear(); //toolbar.clear();
toolbar.deactivate(EditorToolbar.EXPORT); toolbar.deactivate(EditorToolbar.EXPORT);
@ -2338,10 +2408,12 @@ public class Editor extends JFrame implements RunnerListener {
} catch (RunnerException e) { } catch (RunnerException e) {
//statusError("Error during upload."); //statusError("Error during upload.");
//e.printStackTrace(); //e.printStackTrace();
status.unprogress();
statusError(e); statusError(e);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
status.unprogress();
uploading = false; uploading = false;
//toolbar.clear(); //toolbar.clear();
toolbar.deactivate(EditorToolbar.EXPORT); toolbar.deactivate(EditorToolbar.EXPORT);
@ -2395,14 +2467,14 @@ public class Editor extends JFrame implements RunnerListener {
} }
protected void handleBurnBootloader(final String target, final String programmer) { protected void handleBurnBootloader() {
console.clear(); console.clear();
statusNotice("Burning bootloader to I/O Board (this may take a minute)..."); statusNotice("Burning bootloader to I/O Board (this may take a minute)...");
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
public void run() { public void run() {
try { try {
Uploader uploader = new AvrdudeUploader(); Uploader uploader = new AvrdudeUploader();
if (uploader.burnBootloader(target, programmer)) { if (uploader.burnBootloader()) {
statusNotice("Done burning bootloader."); statusNotice("Done burning bootloader.");
} else { } else {
statusError("Error while burning bootloader."); statusError("Error while burning bootloader.");
@ -2556,22 +2628,41 @@ public class Editor extends JFrame implements RunnerListener {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
protected void onBoardOrPortChange() {
Map<String, String> boardPreferences = Base.getBoardPreferences();
lineStatus.setBoardName(boardPreferences.get("name"));
lineStatus.setSerialPort(Preferences.get("serial.port"));
lineStatus.repaint();
}
/** /**
* Returns the edit popup menu. * Returns the edit popup menu.
*/ */
class TextAreaPopup extends JPopupMenu { class TextAreaPopup extends JPopupMenu {
//String currentDir = System.getProperty("user.dir"); //private String currentDir = System.getProperty("user.dir");
String referenceFile = null; private String referenceFile = null;
JMenuItem cutItem; private JMenuItem cutItem;
JMenuItem copyItem; private JMenuItem copyItem;
JMenuItem discourseItem; private JMenuItem discourseItem;
JMenuItem referenceItem; private JMenuItem referenceItem;
private JMenuItem openURLItem;
private JSeparator openURLItemSeparator;
private String clickedURL;
public TextAreaPopup() { public TextAreaPopup() {
JMenuItem item; openURLItem = new JMenuItem("Open URL");
openURLItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.openURL(clickedURL);
}
});
add(openURLItem);
openURLItemSeparator = new JSeparator();
add(openURLItemSeparator);
cutItem = new JMenuItem("Cut"); cutItem = new JMenuItem("Cut");
cutItem.addActionListener(new ActionListener() { cutItem.addActionListener(new ActionListener() {
@ -2579,7 +2670,7 @@ public class Editor extends JFrame implements RunnerListener {
handleCut(); handleCut();
} }
}); });
this.add(cutItem); add(cutItem);
copyItem = new JMenuItem("Copy"); copyItem = new JMenuItem("Copy");
copyItem.addActionListener(new ActionListener() { copyItem.addActionListener(new ActionListener() {
@ -2587,7 +2678,7 @@ public class Editor extends JFrame implements RunnerListener {
handleCopy(); handleCopy();
} }
}); });
this.add(copyItem); add(copyItem);
discourseItem = new JMenuItem("Copy for Forum"); discourseItem = new JMenuItem("Copy for Forum");
discourseItem.addActionListener(new ActionListener() { discourseItem.addActionListener(new ActionListener() {
@ -2595,7 +2686,7 @@ public class Editor extends JFrame implements RunnerListener {
handleDiscourseCopy(); handleDiscourseCopy();
} }
}); });
this.add(discourseItem); add(discourseItem);
discourseItem = new JMenuItem("Copy as HTML"); discourseItem = new JMenuItem("Copy as HTML");
discourseItem.addActionListener(new ActionListener() { discourseItem.addActionListener(new ActionListener() {
@ -2603,15 +2694,15 @@ public class Editor extends JFrame implements RunnerListener {
handleHTMLCopy(); handleHTMLCopy();
} }
}); });
this.add(discourseItem); add(discourseItem);
item = new JMenuItem("Paste"); JMenuItem item = new JMenuItem("Paste");
item.addActionListener(new ActionListener() { item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
handlePaste(); handlePaste();
} }
}); });
this.add(item); add(item);
item = new JMenuItem("Select All"); item = new JMenuItem("Select All");
item.addActionListener(new ActionListener() { item.addActionListener(new ActionListener() {
@ -2619,9 +2710,9 @@ public class Editor extends JFrame implements RunnerListener {
handleSelectAll(); handleSelectAll();
} }
}); });
this.add(item); add(item);
this.addSeparator(); addSeparator();
item = new JMenuItem("Comment/Uncomment"); item = new JMenuItem("Comment/Uncomment");
item.addActionListener(new ActionListener() { item.addActionListener(new ActionListener() {
@ -2629,7 +2720,7 @@ public class Editor extends JFrame implements RunnerListener {
handleCommentUncomment(); handleCommentUncomment();
} }
}); });
this.add(item); add(item);
item = new JMenuItem("Increase Indent"); item = new JMenuItem("Increase Indent");
item.addActionListener(new ActionListener() { item.addActionListener(new ActionListener() {
@ -2637,7 +2728,7 @@ public class Editor extends JFrame implements RunnerListener {
handleIndentOutdent(true); handleIndentOutdent(true);
} }
}); });
this.add(item); add(item);
item = new JMenuItem("Decrease Indent"); item = new JMenuItem("Decrease Indent");
item.addActionListener(new ActionListener() { item.addActionListener(new ActionListener() {
@ -2645,9 +2736,9 @@ public class Editor extends JFrame implements RunnerListener {
handleIndentOutdent(false); handleIndentOutdent(false);
} }
}); });
this.add(item); add(item);
this.addSeparator(); addSeparator();
referenceItem = new JMenuItem("Find in Reference"); referenceItem = new JMenuItem("Find in Reference");
referenceItem.addActionListener(new ActionListener() { referenceItem.addActionListener(new ActionListener() {
@ -2655,11 +2746,23 @@ public class Editor extends JFrame implements RunnerListener {
handleFindReference(); handleFindReference();
} }
}); });
this.add(referenceItem); add(referenceItem);
} }
// if no text is selected, disable copy and cut menu items // if no text is selected, disable copy and cut menu items
public void show(Component component, int x, int y) { public void show(Component component, int x, int y) {
int lineNo = textarea.getLineOfOffset(textarea.xyToOffset(x, y));
int offset = textarea.xToOffset(lineNo, x);
String line = textarea.getLineText(lineNo);
clickedURL = textarea.checkClickedURL(line, offset);
if (clickedURL != null) {
openURLItem.setVisible(true);
openURLItemSeparator.setVisible(true);
} else {
openURLItem.setVisible(false);
openURLItemSeparator.setVisible(false);
}
if (textarea.isSelectionActive()) { if (textarea.isSelectionActive()) {
cutItem.setEnabled(true); cutItem.setEnabled(true);
copyItem.setEnabled(true); copyItem.setEnabled(true);

View File

@ -25,6 +25,9 @@ package processing.app;
import processing.app.syntax.*; import processing.app.syntax.*;
import java.awt.*; import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.util.Map;
import javax.swing.*; import javax.swing.*;
@ -39,10 +42,14 @@ public class EditorLineStatus extends JComponent {
Color foreground; Color foreground;
Color background; Color background;
Color messageForeground;
Font font; Font font;
int high; int high;
String text = ""; String text = "";
String name = "";
String serialport = "";
public EditorLineStatus(JEditTextArea textarea) { public EditorLineStatus(JEditTextArea textarea) {
@ -87,6 +94,11 @@ public class EditorLineStatus extends JComponent {
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
if (name=="" && serialport=="") {
Map<String, String> boardPreferences = Base.getBoardPreferences();
setBoardName(boardPreferences.get("name"));
setSerialPort(Preferences.get("serial.port"));
}
g.setColor(background); g.setColor(background);
Dimension size = getSize(); Dimension size = getSize();
g.fillRect(0, 0, size.width, size.height); g.fillRect(0, 0, size.width, size.height);
@ -96,11 +108,20 @@ public class EditorLineStatus extends JComponent {
int baseline = (high + g.getFontMetrics().getAscent()) / 2; int baseline = (high + g.getFontMetrics().getAscent()) / 2;
g.drawString(text, 6, baseline); g.drawString(text, 6, baseline);
g.setColor(messageForeground);
String tmp = name + " on " + serialport;
Rectangle2D bounds = g.getFontMetrics().getStringBounds(tmp, null);
g.drawString(tmp, size.width - (int) bounds.getWidth() -20 , baseline);
if (Base.isMacOS()) { if (Base.isMacOS()) {
g.drawImage(resize, size.width - 20, 0, this); g.drawImage(resize, size.width - 20, 0, this);
} }
} }
public void setBoardName(String name) { this.name = name; }
public void setSerialPort(String serialport) { this.serialport = serialport; }
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(300, high); return new Dimension(300, high);

View File

@ -40,6 +40,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
//static final int PROMPT = 2; //static final int PROMPT = 2;
//static final int EDIT = 3; //static final int EDIT = 3;
static final int EDIT = 2; static final int EDIT = 2;
static final int PROGRESS = 5;
static final int YES = 1; static final int YES = 1;
static final int NO = 2; static final int NO = 2;
@ -66,6 +67,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
JButton cancelButton; JButton cancelButton;
JButton okButton; JButton okButton;
JTextField editField; JTextField editField;
JProgressBar progressBar;
//Thread promptThread; //Thread promptThread;
int response; int response;
@ -76,16 +78,22 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
empty(); empty();
if (bgcolor == null) { if (bgcolor == null) {
bgcolor = new Color[3]; //4]; bgcolor = new Color[6];
bgcolor[0] = Theme.getColor("status.notice.bgcolor"); bgcolor[0] = Theme.getColor("status.notice.bgcolor");
bgcolor[1] = Theme.getColor("status.error.bgcolor"); bgcolor[1] = Theme.getColor("status.error.bgcolor");
bgcolor[2] = Theme.getColor("status.edit.bgcolor"); bgcolor[2] = Theme.getColor("status.edit.bgcolor");
bgcolor[3] = null;
bgcolor[4] = null;
bgcolor[5] = Theme.getColor("status.notice.bgcolor");
fgcolor = new Color[3]; //4]; fgcolor = new Color[6];
fgcolor[0] = Theme.getColor("status.notice.fgcolor"); fgcolor[0] = Theme.getColor("status.notice.fgcolor");
fgcolor[1] = Theme.getColor("status.error.fgcolor"); fgcolor[1] = Theme.getColor("status.error.fgcolor");
fgcolor[2] = Theme.getColor("status.edit.fgcolor"); fgcolor[2] = Theme.getColor("status.edit.fgcolor");
} fgcolor[3] = null;
fgcolor[4] = null;
fgcolor[5] = Theme.getColor("status.notice.fgcolor");
}
} }
@ -163,6 +171,54 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
empty(); empty();
} }
public void progress(String message)
{
mode = PROGRESS;
this.message = message;
progressBar.setIndeterminate(false);
progressBar.setVisible(true);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
repaint();
}
public void progressIndeterminate(String message)
{
mode = PROGRESS;
this.message = message;
progressBar.setIndeterminate(true);
progressBar.setValue(50);
progressBar.setVisible(true);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
repaint();
}
public void progressNotice(String message) {
//mode = NOTICE;
this.message = message;
//update();
repaint();
}
public void unprogress()
{
if (Preferences.getBoolean("editor.beep.compile")) {
Toolkit.getDefaultToolkit().beep();
}
progressBar.setVisible(false);
progressBar.setValue(0);
setCursor(null);
//empty();
}
public void progressUpdate(int value)
{
progressBar.setValue(value);
repaint();
}
/* /*
public void update() { public void update() {
@ -369,6 +425,19 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
}); });
add(editField); add(editField);
editField.setVisible(false); editField.setVisible(false);
progressBar = new JProgressBar(JScrollBar.HORIZONTAL);
progressBar.setIndeterminate(false);
if (Base.isMacOS()) {
//progressBar.setBackground(bgcolor[PROGRESS]);
//progressBar.putClientProperty("JProgressBar.style", "circular");
}
progressBar.setValue(0);
progressBar.setBorderPainted(true);
//progressBar.setStringPainted(true);
add(progressBar);
progressBar.setVisible(false);
} }
} }
@ -385,11 +454,13 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
//noButton.setLocation(noLeft, top); //noButton.setLocation(noLeft, top);
cancelButton.setLocation(cancelLeft, top); cancelButton.setLocation(cancelLeft, top);
okButton.setLocation(noLeft, top); okButton.setLocation(noLeft, top);
progressBar.setLocation(noLeft, top);
//yesButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); //yesButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
//noButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); //noButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
cancelButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); cancelButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
okButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); okButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
progressBar.setSize(2*Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
// edit field height is awkward, and very different between mac and pc, // edit field height is awkward, and very different between mac and pc,
// so use at least the preferred height for now. // so use at least the preferred height for now.
@ -398,6 +469,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
int editTop = (1 + sizeH - editHeight) / 2; // add 1 for ceil int editTop = (1 + sizeH - editHeight) / 2; // add 1 for ceil
editField.setBounds(yesLeft - Preferences.BUTTON_WIDTH, editTop, editField.setBounds(yesLeft - Preferences.BUTTON_WIDTH, editTop,
editWidth, editHeight); editWidth, editHeight);
progressBar.setBounds(noLeft, editTop, editWidth, editHeight);
} }

View File

@ -37,12 +37,12 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
/** Rollover titles for each button. */ /** Rollover titles for each button. */
static final String title[] = { static final String title[] = {
"Verify", "Stop", "New", "Open", "Save", "Upload", "Serial Monitor" "Verify", "Upload", "New", "Open", "Save", "Serial Monitor"
}; };
/** Titles for each button when the shift key is pressed. */ /** Titles for each button when the shift key is pressed. */
static final String titleShift[] = { static final String titleShift[] = {
"Verify (w/ Verbose Output)", "Stop", "New Editor Window", "Open in Another Window", "Save", "Upload (w/ Verbose Output)", "Serial Monitor" "Verify", "Upload Using Programmer", "New Editor Window", "Open in Another Window", "Save", "Serial Monitor"
}; };
static final int BUTTON_COUNT = title.length; static final int BUTTON_COUNT = title.length;
@ -57,14 +57,13 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
static final int RUN = 0; static final int RUN = 0;
static final int STOP = 1; static final int EXPORT = 1;
static final int NEW = 2; static final int NEW = 2;
static final int OPEN = 3; static final int OPEN = 3;
static final int SAVE = 4; static final int SAVE = 4;
static final int EXPORT = 5;
static final int SERIAL = 6; static final int SERIAL = 5;
static final int INACTIVE = 0; static final int INACTIVE = 0;
static final int ROLLOVER = 1; static final int ROLLOVER = 1;
@ -105,11 +104,10 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
//which[buttonCount++] = NOTHING; //which[buttonCount++] = NOTHING;
which[buttonCount++] = RUN; which[buttonCount++] = RUN;
which[buttonCount++] = STOP; which[buttonCount++] = EXPORT;
which[buttonCount++] = NEW; which[buttonCount++] = NEW;
which[buttonCount++] = OPEN; which[buttonCount++] = OPEN;
which[buttonCount++] = SAVE; which[buttonCount++] = SAVE;
which[buttonCount++] = EXPORT;
which[buttonCount++] = SERIAL; which[buttonCount++] = SERIAL;
currentRollover = -1; currentRollover = -1;
@ -172,6 +170,10 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
x2[i] = x1[i] + BUTTON_WIDTH; x2[i] = x1[i] + BUTTON_WIDTH;
offsetX = x2[i]; offsetX = x2[i];
} }
// Serial button must be on the right
x1[SERIAL] = width - BUTTON_WIDTH - 14;
x2[SERIAL] = width - 14;
} }
Graphics g = offscreen.getGraphics(); Graphics g = offscreen.getGraphics();
g.setColor(bgcolor); //getBackground()); g.setColor(bgcolor); //getBackground());
@ -196,9 +198,15 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
g2.drawString(status, statusX, statusY); g2.drawString(status, statusX, statusY);
*/ */
if (currentRollover != -1) { if (currentRollover != -1) {
int statusY = (BUTTON_HEIGHT + g.getFontMetrics().getAscent()) / 2; int statusY = (BUTTON_HEIGHT + g.getFontMetrics().getAscent()) / 2;
String status = shiftPressed ? titleShift[currentRollover] : title[currentRollover]; String status = shiftPressed ? titleShift[currentRollover] : title[currentRollover];
g.drawString(status, buttonCount * BUTTON_WIDTH + 3 * BUTTON_GAP, statusY); if (currentRollover != SERIAL)
g.drawString(status, (buttonCount-1) * BUTTON_WIDTH + 3 * BUTTON_GAP, statusY);
else {
int statusX = x1[SERIAL] - BUTTON_GAP;
statusX -= g.getFontMetrics().stringWidth(status);
g.drawString(status, statusX, statusY);
}
} }
screen.drawImage(offscreen, 0, 0, null); screen.drawImage(offscreen, 0, 0, null);
@ -312,13 +320,13 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
switch (sel) { switch (sel) {
case RUN: case RUN:
editor.handleRun(e.isShiftDown()); editor.handleRun(false);
break;
case STOP:
editor.handleStop();
break; break;
// case STOP:
// editor.handleStop();
// break;
//
case OPEN: case OPEN:
popup = menu.getPopupMenu(); popup = menu.getPopupMenu();
popup.show(EditorToolbar.this, x, y); popup.show(EditorToolbar.this, x, y);

View File

@ -113,6 +113,8 @@ public class Preferences {
JTextField sketchbookLocationField; JTextField sketchbookLocationField;
JCheckBox exportSeparateBox; JCheckBox exportSeparateBox;
JCheckBox verboseCompilationBox;
JCheckBox verboseUploadBox;
JCheckBox deletePreviousBox; JCheckBox deletePreviousBox;
JCheckBox externalEditorBox; JCheckBox externalEditorBox;
JCheckBox memoryOverrideBox; JCheckBox memoryOverrideBox;
@ -279,6 +281,21 @@ public class Preferences {
top += d.height + GUI_BETWEEN; top += d.height + GUI_BETWEEN;
// Show verbose output during: [ ] compilation [ ] upload
box = Box.createHorizontalBox();
label = new JLabel("Show verbose output during: ");
box.add(label);
verboseCompilationBox = new JCheckBox("compilation ");
box.add(verboseCompilationBox);
verboseUploadBox = new JCheckBox("upload");
box.add(verboseUploadBox);
pain.add(box);
d = box.getPreferredSize();
box.setBounds(left, top, d.width, d.height);
top += d.height + GUI_BETWEEN;
// [ ] Delete previous applet or application folder on export // [ ] Delete previous applet or application folder on export
deletePreviousBox = deletePreviousBox =
@ -461,6 +478,8 @@ public class Preferences {
*/ */
protected void applyFrame() { protected void applyFrame() {
// put each of the settings into the table // put each of the settings into the table
setBoolean("build.verbose", verboseCompilationBox.isSelected());
setBoolean("upload.verbose", verboseUploadBox.isSelected());
setBoolean("export.delete_target_folder", setBoolean("export.delete_target_folder",
deletePreviousBox.isSelected()); deletePreviousBox.isSelected());
@ -516,6 +535,8 @@ public class Preferences {
this.editor = editor; this.editor = editor;
// set all settings entry boxes to their actual status // set all settings entry boxes to their actual status
verboseCompilationBox.setSelected(getBoolean("build.verbose"));
verboseUploadBox.setSelected(getBoolean("upload.verbose"));
deletePreviousBox. deletePreviousBox.
setSelected(getBoolean("export.delete_target_folder")); setSelected(getBoolean("export.delete_target_folder"));
@ -751,8 +772,9 @@ public class Preferences {
s = st.nextToken(); s = st.nextToken();
boolean bold = (s.indexOf("bold") != -1); boolean bold = (s.indexOf("bold") != -1);
boolean italic = (s.indexOf("italic") != -1); boolean italic = (s.indexOf("italic") != -1);
boolean underlined = (s.indexOf("underlined") != -1);
//System.out.println(what + " = " + str + " " + bold + " " + italic); //System.out.println(what + " = " + str + " " + bold + " " + italic);
return new SyntaxStyle(color, italic, bold); return new SyntaxStyle(color, italic, bold, underlined);
} }
} }

View File

@ -315,7 +315,7 @@ public class Sketch {
renamingCode = true; renamingCode = true;
String prompt = (currentIndex == 0) ? String prompt = (currentIndex == 0) ?
"New name for sketch:" : "New name for file:"; "New name for sketch:" : "New name for file:";
String oldName = (current.isExtension("pde")) ? String oldName = (current.isExtension("ino")) ?
current.getPrettyName() : current.getFileName(); current.getPrettyName() : current.getFileName();
editor.status.edit(prompt, oldName); editor.status.edit(prompt, oldName);
} }
@ -495,7 +495,7 @@ public class Sketch {
} }
// if successful, set base properties for the sketch // if successful, set base properties for the sketch
File newMainFile = new File(newFolder, newName + ".pde"); File newMainFile = new File(newFolder, newName + ".ino");
String newMainFilePath = newMainFile.getAbsolutePath(); String newMainFilePath = newMainFile.getAbsolutePath();
// having saved everything and renamed the folder and the main .pde, // having saved everything and renamed the folder and the main .pde,
@ -860,7 +860,7 @@ public class Sketch {
} }
// save the main tab with its new name // save the main tab with its new name
File newFile = new File(newFolder, newName + ".pde"); File newFile = new File(newFolder, newName + ".ino");
code[0].saveAs(newFile); code[0].saveAs(newFile);
editor.handleOpenUnchecked(newFile.getPath(), editor.handleOpenUnchecked(newFile.getPath(),
@ -1261,7 +1261,7 @@ public class Sketch {
StringBuffer bigCode = new StringBuffer(); StringBuffer bigCode = new StringBuffer();
int bigCount = 0; int bigCount = 0;
for (SketchCode sc : code) { for (SketchCode sc : code) {
if (sc.isExtension("pde")) { if (sc.isExtension("ino")) {
sc.setPreprocOffset(bigCount); sc.setPreprocOffset(bigCount);
bigCode.append(sc.getProgram()); bigCode.append(sc.getProgram());
bigCode.append('\n'); bigCode.append('\n');
@ -1357,7 +1357,7 @@ public class Sketch {
} }
// sc.setPreprocName(filename); // sc.setPreprocName(filename);
} else if (sc.isExtension("pde")) { } else if (sc.isExtension("ino")) {
// The compiler and runner will need this to have a proper offset // The compiler and runner will need this to have a proper offset
sc.addPreprocOffset(headerOffset); sc.addPreprocOffset(headerOffset);
} }
@ -1386,7 +1386,7 @@ public class Sketch {
// SketchCode errorCode = null; // SketchCode errorCode = null;
// if (filename.equals(appletJavaFile)) { // if (filename.equals(appletJavaFile)) {
// for (SketchCode code : getCode()) { // for (SketchCode code : getCode()) {
// if (code.isExtension("pde")) { // if (code.isExtension("ino")) {
// if (line >= code.getPreprocOffset()) { // if (line >= code.getPreprocOffset()) {
// errorCode = code; // errorCode = code;
// } // }
@ -1507,6 +1507,7 @@ public class Sketch {
throws RunnerException { throws RunnerException {
// run the preprocessor // run the preprocessor
editor.status.progressUpdate(20);
String primaryClassName = preprocess(buildPath); String primaryClassName = preprocess(buildPath);
// compile the program. errors will happen as a RunnerException // compile the program. errors will happen as a RunnerException
@ -1520,15 +1521,15 @@ public class Sketch {
} }
protected boolean exportApplet(boolean verbose) throws Exception { protected boolean exportApplet(boolean usingProgrammer) throws Exception {
return exportApplet(tempBuildFolder.getAbsolutePath(), verbose); return exportApplet(tempBuildFolder.getAbsolutePath(), usingProgrammer);
} }
/** /**
* Handle export to applet. * Handle export to applet.
*/ */
public boolean exportApplet(String appletPath, boolean verbose) public boolean exportApplet(String appletPath, boolean usingProgrammer)
throws RunnerException, IOException, SerialException { throws RunnerException, IOException, SerialException {
// Make sure the user didn't hide the sketch folder // Make sure the user didn't hide the sketch folder
@ -1552,6 +1553,7 @@ public class Sketch {
appletFolder.mkdirs(); appletFolder.mkdirs();
// build the sketch // build the sketch
editor.status.progressNotice("Compiling sketch...");
String foundName = build(appletFolder.getPath(), false); String foundName = build(appletFolder.getPath(), false);
// (already reported) error during export, exit this function // (already reported) error during export, exit this function
if (foundName == null) return false; if (foundName == null) return false;
@ -1565,12 +1567,18 @@ public class Sketch {
// return false; // return false;
// } // }
upload(appletFolder.getPath(), foundName, verbose); editor.status.progressNotice("Uploading...");
upload(appletFolder.getPath(), foundName, usingProgrammer);
editor.status.progressUpdate(100);
return true; return true;
} }
public void setCompilingProgress(int percent) {
editor.status.progressUpdate(percent);
}
protected void size(String buildPath, String suggestedClassName) protected void size(String buildPath, String suggestedClassName)
throws RunnerException { throws RunnerException {
long size = 0; long size = 0;
@ -1592,7 +1600,7 @@ public class Sketch {
} }
protected String upload(String buildPath, String suggestedClassName, boolean verbose) protected String upload(String buildPath, String suggestedClassName, boolean usingProgrammer)
throws RunnerException, SerialException { throws RunnerException, SerialException {
Uploader uploader; Uploader uploader;
@ -1602,7 +1610,7 @@ public class Sketch {
uploader = new AvrdudeUploader(); uploader = new AvrdudeUploader();
boolean success = uploader.uploadUsingPreferences(buildPath, boolean success = uploader.uploadUsingPreferences(buildPath,
suggestedClassName, suggestedClassName,
verbose); usingProgrammer);
return success ? suggestedClassName : null; return success ? suggestedClassName : null;
} }
@ -1791,7 +1799,7 @@ public class Sketch {
* Returns the default extension for this editor setup. * Returns the default extension for this editor setup.
*/ */
public String getDefaultExtension() { public String getDefaultExtension() {
return "pde"; return "ino";
} }
@ -1799,7 +1807,7 @@ public class Sketch {
* Returns a String[] array of proper extensions. * Returns a String[] array of proper extensions.
*/ */
public String[] getExtensions() { public String[] getExtensions() {
return new String[] { "pde", "c", "cpp", "h" }; return new String[] { "ino", "c", "cpp", "h" };
} }

View File

@ -196,7 +196,8 @@ public class Theme {
s = st.nextToken(); s = st.nextToken();
boolean bold = (s.indexOf("bold") != -1); boolean bold = (s.indexOf("bold") != -1);
boolean italic = (s.indexOf("italic") != -1); boolean italic = (s.indexOf("italic") != -1);
boolean underlined = (s.indexOf("underlined") != -1);
return new SyntaxStyle(color, italic, bold); return new SyntaxStyle(color, italic, bold, underlined);
} }
} }

View File

@ -42,33 +42,28 @@ public class AvrdudeUploader extends Uploader {
public AvrdudeUploader() { public AvrdudeUploader() {
} }
// XXX: add support for uploading sketches using a programmer public boolean uploadUsingPreferences(String buildPath, String className, boolean usingProgrammer)
public boolean uploadUsingPreferences(String buildPath, String className, boolean verbose)
throws RunnerException, SerialException { throws RunnerException, SerialException {
this.verbose = verbose; this.verbose = verbose;
Map<String, String> boardPreferences = Base.getBoardPreferences(); Map<String, String> boardPreferences = Base.getBoardPreferences();
String uploadUsing = boardPreferences.get("upload.using");
if (uploadUsing == null) {
// fall back on global preference
uploadUsing = Preferences.get("upload.using");
}
if (uploadUsing.equals("bootloader")) {
return uploadViaBootloader(buildPath, className);
} else {
Target t;
if (uploadUsing.indexOf(':') == -1) { // if no protocol is specified for this board, assume it lacks a
t = Base.getTarget(); // the current target (associated with the board) // bootloader and upload using the selected programmer.
} else { if (usingProgrammer || boardPreferences.get("upload.protocol") == null) {
String targetName = uploadUsing.substring(0, uploadUsing.indexOf(':')); String programmer = Preferences.get("programmer");
t = Base.targetsTable.get(targetName); Target target = Base.getTarget();
uploadUsing = uploadUsing.substring(uploadUsing.indexOf(':') + 1);
if (programmer.indexOf(":") != -1) {
target = Base.targetsTable.get(programmer.substring(0, programmer.indexOf(":")));
programmer = programmer.substring(programmer.indexOf(":") + 1);
} }
Collection params = getProgrammerCommands(t, uploadUsing); Collection params = getProgrammerCommands(target, programmer);
params.add("-Uflash:w:" + buildPath + File.separator + className + ".hex:i"); params.add("-Uflash:w:" + buildPath + File.separator + className + ".hex:i");
return avrdude(params); return avrdude(params);
} }
return uploadViaBootloader(buildPath, className);
} }
private boolean uploadViaBootloader(String buildPath, String className) private boolean uploadViaBootloader(String buildPath, String className)
@ -96,8 +91,14 @@ public class AvrdudeUploader extends Uploader {
return avrdude(commandDownloader); return avrdude(commandDownloader);
} }
public boolean burnBootloader(String targetName, String programmer) throws RunnerException { public boolean burnBootloader() throws RunnerException {
return burnBootloader(getProgrammerCommands(Base.targetsTable.get(targetName), programmer)); String programmer = Preferences.get("programmer");
Target target = Base.getTarget();
if (programmer.indexOf(":") != -1) {
target = Base.targetsTable.get(programmer.substring(0, programmer.indexOf(":")));
programmer = programmer.substring(programmer.indexOf(":") + 1);
}
return burnBootloader(getProgrammerCommands(target, programmer));
} }
private Collection getProgrammerCommands(Target target, String programmer) { private Collection getProgrammerCommands(Target target, String programmer) {

View File

@ -86,23 +86,42 @@ public class Compiler implements MessageConsumer {
corePath = coreFolder.getAbsolutePath(); corePath = coreFolder.getAbsolutePath();
} else { } else {
Target t = Base.targetsTable.get(core.substring(0, core.indexOf(':'))); Target t = Base.targetsTable.get(core.substring(0, core.indexOf(':')));
File coresFolder = new File(t.getFolder(), "cores"); File coreFolder = new File(t.getFolder(), "cores");
File coreFolder = new File(coresFolder, core.substring(core.indexOf(':') + 1)); coreFolder = new File(coreFolder, core.substring(core.indexOf(':') + 1));
corePath = coreFolder.getAbsolutePath(); corePath = coreFolder.getAbsolutePath();
} }
String variant = boardPreferences.get("build.variant");
String variantPath = null;
if (variant != null) {
if (variant.indexOf(':') == -1) {
Target t = Base.getTarget();
File variantFolder = new File(new File(t.getFolder(), "variants"), variant);
variantPath = variantFolder.getAbsolutePath();
} else {
Target t = Base.targetsTable.get(variant.substring(0, variant.indexOf(':')));
File variantFolder = new File(t.getFolder(), "variants");
variantFolder = new File(variantFolder, variant.substring(variant.indexOf(':') + 1));
variantPath = variantFolder.getAbsolutePath();
}
}
List<File> objectFiles = new ArrayList<File>(); List<File> objectFiles = new ArrayList<File>();
// 0. include paths for core + all libraries // 0. include paths for core + all libraries
sketch.setCompilingProgress(20);
List includePaths = new ArrayList(); List includePaths = new ArrayList();
includePaths.add(corePath); includePaths.add(corePath);
if (variantPath != null) includePaths.add(variantPath);
for (File file : sketch.getImportedLibraries()) { for (File file : sketch.getImportedLibraries()) {
includePaths.add(file.getPath()); includePaths.add(file.getPath());
} }
// 1. compile the sketch (already in the buildPath) // 1. compile the sketch (already in the buildPath)
sketch.setCompilingProgress(30);
objectFiles.addAll( objectFiles.addAll(
compileFiles(avrBasePath, buildPath, includePaths, compileFiles(avrBasePath, buildPath, includePaths,
findFilesInPath(buildPath, "S", false), findFilesInPath(buildPath, "S", false),
@ -112,6 +131,7 @@ public class Compiler implements MessageConsumer {
// 2. compile the libraries, outputting .o files to: <buildPath>/<library>/ // 2. compile the libraries, outputting .o files to: <buildPath>/<library>/
sketch.setCompilingProgress(40);
for (File libraryFolder : sketch.getImportedLibraries()) { for (File libraryFolder : sketch.getImportedLibraries()) {
File outputFolder = new File(buildPath, libraryFolder.getName()); File outputFolder = new File(buildPath, libraryFolder.getName());
File utilityFolder = new File(libraryFolder, "utility"); File utilityFolder = new File(libraryFolder, "utility");
@ -139,8 +159,10 @@ public class Compiler implements MessageConsumer {
// 3. compile the core, outputting .o files to <buildPath> and then // 3. compile the core, outputting .o files to <buildPath> and then
// collecting them into the core.a library file. // collecting them into the core.a library file.
sketch.setCompilingProgress(50);
includePaths.clear(); includePaths.clear();
includePaths.add(corePath); // include path for core only includePaths.add(corePath); // include path for core only
if (variantPath != null) includePaths.add(variantPath);
List<File> coreObjectFiles = List<File> coreObjectFiles =
compileFiles(avrBasePath, buildPath, includePaths, compileFiles(avrBasePath, buildPath, includePaths,
findFilesInPath(corePath, "S", true), findFilesInPath(corePath, "S", true),
@ -162,6 +184,7 @@ public class Compiler implements MessageConsumer {
// 4. link it all together into the .elf file // 4. link it all together into the .elf file
sketch.setCompilingProgress(60);
List baseCommandLinker = new ArrayList(Arrays.asList(new String[] { List baseCommandLinker = new ArrayList(Arrays.asList(new String[] {
avrBasePath + "avr-gcc", avrBasePath + "avr-gcc",
"-Os", "-Os",
@ -190,6 +213,7 @@ public class Compiler implements MessageConsumer {
List commandObjcopy; List commandObjcopy;
// 5. extract EEPROM data (from EEMEM directive) to .eep file. // 5. extract EEPROM data (from EEMEM directive) to .eep file.
sketch.setCompilingProgress(70);
commandObjcopy = new ArrayList(baseCommandObjcopy); commandObjcopy = new ArrayList(baseCommandObjcopy);
commandObjcopy.add(2, "ihex"); commandObjcopy.add(2, "ihex");
commandObjcopy.set(3, "-j"); commandObjcopy.set(3, "-j");
@ -203,6 +227,7 @@ public class Compiler implements MessageConsumer {
execAsynchronously(commandObjcopy); execAsynchronously(commandObjcopy);
// 6. build the .hex file // 6. build the .hex file
sketch.setCompilingProgress(80);
commandObjcopy = new ArrayList(baseCommandObjcopy); commandObjcopy = new ArrayList(baseCommandObjcopy);
commandObjcopy.add(2, "ihex"); commandObjcopy.add(2, "ihex");
commandObjcopy.add(".eeprom"); // remove eeprom data commandObjcopy.add(".eeprom"); // remove eeprom data
@ -210,6 +235,8 @@ public class Compiler implements MessageConsumer {
commandObjcopy.add(buildPath + File.separator + primaryClassName + ".hex"); commandObjcopy.add(buildPath + File.separator + primaryClassName + ".hex");
execAsynchronously(commandObjcopy); execAsynchronously(commandObjcopy);
sketch.setCompilingProgress(90);
return true; return true;
} }
@ -369,6 +396,12 @@ public class Compiler implements MessageConsumer {
"\nYou appear to be using it or another library that depends on the SPI library."; "\nYou appear to be using it or another library that depends on the SPI library.";
} }
if (pieces[3].trim().equals("'BYTE' was not declared in this scope")) {
e = new RunnerException("The 'BYTE' keyword is no longer supported.");
s += "\nAs of Arduino 1.0, the 'BYTE' keyword is no longer supported." +
"\nPlease use Serial.write() instead.";
}
if (exception == null && e != null) { if (exception == null && e != null) {
exception = e; exception = e;
exception.hideStackTrace(); exception.hideStackTrace();

View File

@ -64,10 +64,10 @@ public abstract class Uploader implements MessageConsumer {
public Uploader() { public Uploader() {
} }
public abstract boolean uploadUsingPreferences(String buildPath, String className, boolean verbose) public abstract boolean uploadUsingPreferences(String buildPath, String className, boolean usingProgrammer)
throws RunnerException, SerialException; throws RunnerException, SerialException;
public abstract boolean burnBootloader(String target, String programmer) throws RunnerException; public abstract boolean burnBootloader() throws RunnerException;
protected void flushSerialBuffer() throws RunnerException, SerialException { protected void flushSerialBuffer() throws RunnerException, SerialException {
// Cleanup the serial buffer // Cleanup the serial buffer

View File

@ -46,7 +46,7 @@ public class PdePreprocessor {
public int prototypeCount = 0; public int prototypeCount = 0;
// stores number of included library headers written // stores number of included library headers written
// we always write one header: WProgram.h // we always write one header: Arduino.h
public int headerCount = 1; public int headerCount = 1;
// the prototypes that are generated by the preprocessor // the prototypes that are generated by the preprocessor
@ -199,7 +199,7 @@ public class PdePreprocessor {
int prototypeInsertionPoint = firstStatement(program); int prototypeInsertionPoint = firstStatement(program);
out.print(program.substring(0, prototypeInsertionPoint)); out.print(program.substring(0, prototypeInsertionPoint));
out.print("#include \"WProgram.h\"\n"); out.print("#include \"Arduino.h\"\n");
// print user defined prototypes // print user defined prototypes
for (int i = 0; i < prototypes.size(); i++) { for (int i = 0; i < prototypes.size(); i++) {

View File

@ -2045,6 +2045,17 @@ public class JEditTextArea extends JComponent
} }
} }
public String checkClickedURL(String line, int offset) {
String[] parse = SyntaxUtilities.parseCommentUrls(line);
if (parse==null)
return null;
int start = parse[0].length();
int stop = start + parse[1].length();
if (offset<start|| offset>stop)
return null;
return parse[1];
}
class MouseHandler extends MouseAdapter class MouseHandler extends MouseAdapter
{ {
public void mousePressed(MouseEvent evt) public void mousePressed(MouseEvent evt)
@ -2095,6 +2106,13 @@ public class JEditTextArea extends JComponent
private void doSingleClick(MouseEvent evt, int line, private void doSingleClick(MouseEvent evt, int line,
int offset, int dot) { int offset, int dot) {
// Check for click on urls
String clickedURL = checkClickedURL(getLineText(line), offset);
if (clickedURL != null) {
Base.openURL(clickedURL);
return;
}
if ((evt.getModifiers() & InputEvent.SHIFT_MASK) != 0) { if ((evt.getModifiers() & InputEvent.SHIFT_MASK) != 0) {
rectSelect = (evt.getModifiers() & InputEvent.CTRL_MASK) != 0; rectSelect = (evt.getModifiers() & InputEvent.CTRL_MASK) != 0;
select(getMarkPosition(),dot); select(getMarkPosition(),dot);

View File

@ -169,6 +169,9 @@ public class PdeTextAreaDefaults extends TextAreaDefaults {
// ?? // ??
styles[Token.LABEL] = Theme.getStyle("label"); styles[Token.LABEL] = Theme.getStyle("label");
// http://arduino.cc/
styles[Token.URL] = Theme.getStyle("url");
// + - = / // + - = /
styles[Token.OPERATOR] = Theme.getStyle("operator"); styles[Token.OPERATOR] = Theme.getStyle("operator");

View File

@ -10,6 +10,10 @@
package processing.app.syntax; package processing.app.syntax;
import java.awt.*; import java.awt.*;
import java.awt.font.TextAttribute;
import java.util.Hashtable;
import java.util.Map;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -27,11 +31,12 @@ public class SyntaxStyle
* @param italic True if the text should be italics * @param italic True if the text should be italics
* @param bold True if the text should be bold * @param bold True if the text should be bold
*/ */
public SyntaxStyle(Color color, boolean italic, boolean bold) public SyntaxStyle(Color color, boolean italic, boolean bold, boolean underlined)
{ {
this.color = color; this.color = color;
this.italic = italic; this.italic = italic;
this.bold = bold; this.bold = bold;
this.underlined = underlined;
} }
/** /**
@ -47,7 +52,7 @@ public class SyntaxStyle
*/ */
public boolean isPlain() public boolean isPlain()
{ {
return !(bold || italic); return !(bold || italic || underlined);
} }
/** /**
@ -67,7 +72,14 @@ public class SyntaxStyle
} }
/** /**
* Returns the specified font, but with the style's bold and * @return true if underline is enabled for this style.
*/
public boolean isUnderlined() {
return underlined;
}
/**
* Returns the specified font, but with the style's bold, underline and
* italic flags applied. * italic flags applied.
*/ */
public Font getStyledFont(Font font) public Font getStyledFont(Font font)
@ -78,10 +90,16 @@ public class SyntaxStyle
if(font.equals(lastFont)) if(font.equals(lastFont))
return lastStyledFont; return lastStyledFont;
lastFont = font; lastFont = font;
lastStyledFont = new Font(font.getFamily(), lastStyledFont = new Font(font.getFamily(),
(bold ? Font.BOLD : 0) (bold ? Font.BOLD : 0)
| (italic ? Font.ITALIC : 0), | (italic ? Font.ITALIC : 0),
font.getSize()); font.getSize());
if (underlined) {
Map<TextAttribute, Object> attr = new Hashtable<TextAttribute, Object>();
attr.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
lastStyledFont = lastStyledFont.deriveFont(attr);
}
return lastStyledFont; return lastStyledFont;
} }
@ -100,6 +118,11 @@ public class SyntaxStyle
(bold ? Font.BOLD : 0) (bold ? Font.BOLD : 0)
| (italic ? Font.ITALIC : 0), | (italic ? Font.ITALIC : 0),
font.getSize()); font.getSize());
if (underlined) {
Map<TextAttribute, Object> attr = new Hashtable<TextAttribute, Object>();
attr.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
lastStyledFont = lastStyledFont.deriveFont(attr);
}
//fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(lastStyledFont); //fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(lastStyledFont);
fontMetrics = comp.getFontMetrics(lastStyledFont); fontMetrics = comp.getFontMetrics(lastStyledFont);
return fontMetrics; return fontMetrics;
@ -125,13 +148,16 @@ public class SyntaxStyle
{ {
return getClass().getName() + "[color=" + color + return getClass().getName() + "[color=" + color +
(italic ? ",italic" : "") + (italic ? ",italic" : "") +
(bold ? ",bold" : "") + "]"; (bold ? ",bold" : "") +
(underlined ? ",underlined" : "") +
"]";
} }
// private members // private members
private Color color; private Color color;
private boolean italic; private boolean italic;
private boolean bold; private boolean bold;
private boolean underlined;
private Font lastFont; private Font lastFont;
private Font lastStyledFont; private Font lastStyledFont;
private FontMetrics fontMetrics; private FontMetrics fontMetrics;

View File

@ -11,6 +11,8 @@ package processing.app.syntax;
import javax.swing.text.*; import javax.swing.text.*;
import java.awt.*; import java.awt.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
@ -93,16 +95,17 @@ public class SyntaxUtilities
{ {
SyntaxStyle[] styles = new SyntaxStyle[Token.ID_COUNT]; SyntaxStyle[] styles = new SyntaxStyle[Token.ID_COUNT];
styles[Token.COMMENT1] = new SyntaxStyle(Color.black,true,false); styles[Token.COMMENT1] = new SyntaxStyle(Color.black,true,false,false);
styles[Token.COMMENT2] = new SyntaxStyle(new Color(0x990033),true,false); styles[Token.COMMENT2] = new SyntaxStyle(new Color(0x990033),true,false,false);
styles[Token.KEYWORD1] = new SyntaxStyle(Color.black,false,true); styles[Token.KEYWORD1] = new SyntaxStyle(Color.black,false,true,false);
styles[Token.KEYWORD2] = new SyntaxStyle(Color.magenta,false,false); styles[Token.KEYWORD2] = new SyntaxStyle(Color.magenta,false,false,false);
styles[Token.KEYWORD3] = new SyntaxStyle(new Color(0x009600),false,false); styles[Token.KEYWORD3] = new SyntaxStyle(new Color(0x009600),false,false,false);
styles[Token.LITERAL1] = new SyntaxStyle(new Color(0x650099),false,false); styles[Token.LITERAL1] = new SyntaxStyle(new Color(0x650099),false,false,false);
styles[Token.LITERAL2] = new SyntaxStyle(new Color(0x650099),false,true); styles[Token.LITERAL2] = new SyntaxStyle(new Color(0x650099),false,true,false);
styles[Token.LABEL] = new SyntaxStyle(new Color(0x990033),false,true); styles[Token.LABEL] = new SyntaxStyle(new Color(0x990033),false,true,false);
styles[Token.OPERATOR] = new SyntaxStyle(Color.black,false,true); styles[Token.OPERATOR] = new SyntaxStyle(Color.black,false,true,false);
styles[Token.INVALID] = new SyntaxStyle(Color.red,false,true); styles[Token.URL] = new SyntaxStyle(Color.blue,true,false,false);
styles[Token.INVALID] = new SyntaxStyle(Color.red,false,true,false);
return styles; return styles;
} }
@ -148,7 +151,10 @@ public class SyntaxUtilities
styles[id].setGraphicsFlags(gfx,defaultFont); styles[id].setGraphicsFlags(gfx,defaultFont);
line.count = length; line.count = length;
x = Utilities.drawTabbedText(line,x,y,gfx,expander,0); if (id == Token.COMMENT1 || id == Token.COMMENT2)
x = drawTabbedCommentsText(line, x, y, gfx, expander, styles, styles[id]);
else
x = Utilities.drawTabbedText(line, x, y, gfx, expander, 0);
line.offset += length; line.offset += length;
offset += length; offset += length;
@ -158,6 +164,66 @@ public class SyntaxUtilities
return x; return x;
} }
/**
* Parse comments and identify "@schematics <b>&lt;something&gt;</b>" pattern.
*
* @param line
* A string to parse
* @return <b>null</b> if the pattern is not found, otherwise an array of
* String is returned: the elements with index 0, 1 and 2 are
* respectively the preamble, the <b>&lt;something&gt;</b> stuff, and
* the remaining part of the string.
*/
public static String[] parseCommentUrls(String line) {
Matcher m = urlPattern.matcher(line.toString());
if (!m.find())
return null;
String res[] = new String[3];
res[0] = line.substring(0, m.start(1));
res[1] = line.substring(m.start(1), m.end(1));
res[2] = line.substring(m.end(1));
// System.out.println("0 =>"+res[0]+"<\n1 =>"+res[1]+"< \n2 =>"+res[2]+"<");
return res;
}
static private Pattern urlPattern = Pattern.compile(
"((?:https?|ftp)://" + // ( Protocol
"(?:(?:[\\w_\\-]+:)?[\\w_\\-]+@)?" + // Username and password
"(?:[\\w_\\-]+\\.)+[\\w_\\-]+" + // Domain name
"(?::[0-9]{1,5})?" + // Port
"(?:/[\\w_\\-./?%&=+]*)?)" + // Path )
"(?:\\s|$)"); // whitespace or EOL
public static Segment stringToSegment(String v) {
return new Segment(v.toCharArray(), 0, v.length());
}
private static int drawTabbedCommentsText(Segment line, int x, int y,
Graphics gfx, TabExpander expander, SyntaxStyle[] styles,
SyntaxStyle commentStyle) {
String parse[] = parseCommentUrls(line.toString());
if (parse == null)
// Revert to plain writing.
return Utilities.drawTabbedText(line, x, y, gfx, expander, 0);
Segment pre = stringToSegment(parse[0]);
Segment tag = stringToSegment(parse[1]);
Segment post = stringToSegment(parse[2]);
if (pre.count>0)
x = Utilities.drawTabbedText(pre, x, y, gfx, expander, 0);
Font f = gfx.getFont();
styles[Token.URL].setGraphicsFlags(gfx, f);
x = Utilities.drawTabbedText(tag, x, y, gfx, expander, 0);
commentStyle.setGraphicsFlags(gfx, f);
if (post.count>0)
x = Utilities.drawTabbedText(post, x, y, gfx, expander, 0);
return x;
}
// private members // private members
private SyntaxUtilities() {} private SyntaxUtilities() {}
} }

View File

@ -83,17 +83,22 @@ public class Token
*/ */
public static final byte OPERATOR = 9; public static final byte OPERATOR = 9;
/**
* URL token id.
*/
public static final byte URL = 10;
/** /**
* Invalid token id. This can be used to mark invalid * Invalid token id. This can be used to mark invalid
* or incomplete tokens, so the user can easily spot * or incomplete tokens, so the user can easily spot
* syntax errors. * syntax errors.
*/ */
public static final byte INVALID = 10; public static final byte INVALID = 11;
/** /**
* The total number of defined token ids. * The total number of defined token ids.
*/ */
public static final byte ID_COUNT = 11; public static final byte ID_COUNT = 12;
/** /**
* The first id that can be used for internal state * The first id that can be used for internal state

View File

@ -44,8 +44,8 @@ public class Platform extends processing.app.Platform {
static final String openCommand = static final String openCommand =
System.getProperty("user.dir").replace('/', '\\') + System.getProperty("user.dir").replace('/', '\\') +
"\\processing.exe \"%1\""; "\\arduino.exe \"%1\"";
static final String DOC = "Processing.Document"; static final String DOC = "Arduino.Document";
public void init(Base base) { public void init(Base base) {
super.init(base); super.init(base);
@ -86,13 +86,13 @@ public class Platform extends processing.app.Platform {
*/ */
protected void setAssociations() throws UnsupportedEncodingException { protected void setAssociations() throws UnsupportedEncodingException {
if (Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, if (Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT,
"", ".pde") && "", ".ino") &&
Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT,
".pde", "", DOC) && ".ino", "", DOC) &&
Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, "", DOC) && Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, "", DOC) &&
Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, DOC, "", Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, DOC, "",
"Processing Source Code") && "Arduino Source Code") &&
Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT,
DOC, "shell") && DOC, "shell") &&

View File

@ -1,17 +1,23 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<project name="Arduino" default="build"> <project name="Arduino" default="build">
<!--echo message="os.name = ${os.name}" /-->
<!--echo message="os.arch = ${os.arch}" /-->
<!--echo message="os.version = ${os.version}" /-->
<!-- Sets properties for macosx/windows/linux depending on current system --> <!-- Sets properties for macosx/windows/linux depending on current system -->
<condition property="macosx"><os family="mac" /></condition> <condition property="macosx"><os family="mac" /></condition>
<condition property="windows"><os family="windows" /></condition> <condition property="windows"><os family="windows" /></condition>
<condition property="linux"><os family="unix" /></condition> <condition property="linux"><os family="unix" /></condition>
<condition property="linux64"><os family="unix" arch="amd64" /></condition>
<condition property="platform" <condition property="platform"
value="macosx"><os family="mac" /></condition> value="macosx"><os family="mac" /></condition>
<condition property="platform" <condition property="platform"
value="windows"><os family="windows" /></condition> value="windows"><os family="windows" /></condition>
<condition property="platform" <condition property="platform"
value="linux"><os family="unix" /></condition> value="linux"><os family="unix" arch="i386" /></condition>
<condition property="platform"
value="linux64"><os family="unix" arch="amd64" /></condition>
<!-- Libraries required for running arduino --> <!-- Libraries required for running arduino -->
<fileset dir=".." id="runtime.jars"> <fileset dir=".." id="runtime.jars">
@ -318,12 +324,22 @@
<chmod perm="755" file="linux/work/arduino" /> <chmod perm="755" file="linux/work/arduino" />
</target> </target>
<target name="linux64-build" depends="linux-build" description="Build linux (64-bit) version">
<copy tofile="linux/work/hardware/tools/avrdude" file="linux/dist/tools/avrdude64" overwrite="true" />
<copy tofile="linux/work/lib/librxtxSerial.so" file="linux/dist/lib/librxtxSerial64.so" overwrite="true" />
</target>
<target name="linux-run" depends="linux-build" <target name="linux-run" depends="linux-build"
description="Run Linux version"> description="Run Linux (32-bit) version">
<exec executable="./linux/work/arduino" spawn="false"/> <exec executable="./linux/work/arduino" spawn="false"/>
</target> </target>
<target name="linux-dist" depends="linux-build" <target name="linux64-run" depends="linux64-build"
description="Run Linux (64-bit) version">
<exec executable="./linux/work/arduino" spawn="false"/>
</target>
<target name="linux-dist" depends="build"
description="Build .tar.gz of linux version"> description="Build .tar.gz of linux version">
<!--get src="http://dev.processing.org/build/jre-tools-6u18-linux-i586.tgz" <!--get src="http://dev.processing.org/build/jre-tools-6u18-linux-i586.tgz"
@ -360,6 +376,9 @@
</target> </target>
<target name="linux64-dist" depends="linux-dist"
description="Build .tar.gz of linux version" />
<!-- - - - - - - - --> <!-- - - - - - - - -->
<!-- Windows --> <!-- Windows -->
<!-- - - - - - - - --> <!-- - - - - - - - -->

BIN
build/linux/dist/lib/librxtxSerial64.so vendored Executable file

Binary file not shown.

BIN
build/linux/dist/tools/avrdude64 vendored Executable file

Binary file not shown.

View File

@ -7,11 +7,11 @@
<!-- all these need to change for new releases --> <!-- all these need to change for new releases -->
<key>CFBundleGetInfoString</key> <key>CFBundleGetInfoString</key>
<string>0022</string> <string>1.0-beta2</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0022</string> <string>0100</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0022</string> <string>1.0-beta2</string>
<!-- now stop changing things and get outta here --> <!-- now stop changing things and get outta here -->
<key>CFBundleAllowMixedLocalizations</key> <key>CFBundleAllowMixedLocalizations</key>
@ -35,13 +35,15 @@
<dict> <dict>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
<array> <array>
<string>pde</string> <string>ino</string>
<string>java</string> <string>c</string>
<string>cpp</string>
<string>h</string>
</array> </array>
<key>CFBundleTypeIconFile</key> <key>CFBundleTypeIconFile</key>
<string>pde.icns</string> <string>pde.icns</string>
<key>CFBundleTypeName</key> <key>CFBundleTypeName</key>
<string>Processing Source File</string> <string>Arduino Source File</string>
<key>CFBundleTypeMIMETypes</key> <key>CFBundleTypeMIMETypes</key>
<array> <array>
<string>text/plain</string> <string>text/plain</string>

Binary file not shown.

View File

@ -38,7 +38,7 @@ void loop()
// prints value unaltered, i.e. the raw binary version of the // prints value unaltered, i.e. the raw binary version of the
// byte. The serial monitor interprets all bytes as // byte. The serial monitor interprets all bytes as
// ASCII, so 33, the first number, will show up as '!' // ASCII, so 33, the first number, will show up as '!'
Serial.print(thisByte, BYTE); Serial.write(thisByte);
Serial.print(", dec: "); Serial.print(", dec: ");
// prints value as string as an ASCII-encoded decimal (base 10). // prints value as string as an ASCII-encoded decimal (base 10).

View File

@ -84,281 +84,29 @@ void loop() {
/* Max/MSP v5 patch for this example /* Max/MSP v5 patch for this example
{ ----------begin_max5_patcher----------
"boxes" : [ { 1008.3ocuXszaiaCD9r8uhA5rqAeHIa0aAMaAVf1S6hdoYQAsDiL6JQZHQ2M
"box" : { YWr+2KeX4vjnjXKKkKhhiGQ9MeyCNz+X9rnMp63sQvuB+MLa1OlOalSjUvrC
"maxclass" : "comment", ymEUytKuh05TKJWUWyk5nE9eSyuS6jesvHu4F4MxOuUzB6X57sPKWVzBLXiP
"text" : "Dimmer\n\nThis patch sends a binary number from 0 to 255 out the serial port to an Arduino connected to the port. It dims an LED attached to the Arduino.\n\ncreated 2006\nby David A. Mellis\nmodified 14 Apr 2009\nby Scott Fitzgerald and Tom Igoe", xZtGj6q2vafaaT0.BzJfjj.p8ZPukazsQvpfcpFs8mXR3plh8BoBxURIOWyK
"linecount" : 10, rxspZ0YI.eTCEh5Vqp+wGtFXZMKe6CZc3yWZwTdCmYW.BBkdiby8v0r+ST.W
"patching_rect" : [ 209.0, 55.0, 344.0, 144.0 ], sD9SdUkn8FYspPbqvnBNFtZWiUyLmleJWo0vuKzeuj2vpJLaWA7YiE7wREui
"numoutlets" : 0, FpDFDp1KcbAFcP5sJoVxp4NB5Jq40ougIDxJt1wo3GDZHiNocKhiIExx+owv
"fontsize" : 12.0, AdOEAksDs.RRrOoww1Arc.9RvN2J9tamwjkcqknvAE0l+8WnjHqreNet8whK
"id" : "obj-32", z6mukIK4d+Xknv3jstvJs8EirMMhxsZIusET25jXbX8xczIl5xPVxhPcTGFu
"fontname" : "Arial", xNDu9rXtUCg37g9Q8Yc+EuofIYmg8QdkPCrOnXsaHwYs3rWx9PGsO+pqueG2
"numinlets" : 1 uNQBqWFh1X7qQG+3.VHcHrfO1nyR2TlqpTM9MDsLKNCQVz6KO.+Sfc5j1Ykj
} jzkn2jwNDRP7LVb3d9LtoWBAOnvB92Le6yRmZ4UF7YpQhiFi7A5Ka8zXhKdA
4r9TRGG7V4COiSbAJKdXrWNhhF0hNUh7uBa4Mba0l7JUK+omjDMwkSn95Izr
} TOwkdp7W.oPRmNRQsiKeu4j3CkfVgt.NYPEYqMGvvJ48vIlPiyzrIuZskWIS
, { xGJPcmPiWOfLodybH3wjPbMYwlbFIMNHPHFOtLBNaLSa9sGk1TxMzCX5KTa6
"box" : { WIH2ocxSdngM0QPqFRxyPHFsprrhGc9Gy9xoBjz0NWdR2yW9DUa2F85jG2v9
"maxclass" : "comment", FgTO4Q8qiC7fzzQNpmNpsY3BrYPVJBMJQ1uVmoItRhw9NrVGO3NMNzYZ+zS7
"text" : "change the slider to alter the brightness of the LED", 3WTvTOnUydG5kHMKLqAOjTe7fN2bGSxOZDkMrBrGQ9J1gONBEy0k4gVo8qHc
"linecount" : 3, cxmfxVihWz6a3yqY9NazzUYkua9UnynadOtogW.JfsVGRVNEbWF8I+eHtcwJ
"patching_rect" : [ 90.0, 235.0, 117.0, 48.0 ], +wLXqZeSdWLo+FQF6731Tva0BISKTx.cLwmgJsUTTvkg1YsnXmxDge.CDR7x
"numoutlets" : 0, D6YmX6fMznaF7kdczmJXwm.XSOOrdoHhNA7GMiZYLZZR.+4lconMaJP6JOZ8
"fontsize" : 12.0, ftCs1YWHZI3o.sIXezX5ihMSuXzZtk3ai1mXRSczoCS32hAydeyXNEu5SHyS
"id" : "obj-7", xqZqbd3ZLdera1iPqYxOm++v7SUSz
"fontname" : "Arial", -----------end_max5_patcher-----------
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "number",
"patching_rect" : [ 215.0, 385.0, 50.0, 19.0 ],
"numoutlets" : 2,
"fontsize" : 10.0,
"outlettype" : [ "int", "bang" ],
"id" : "obj-6",
"fontname" : "Verdana",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "slider",
"patching_rect" : [ 215.0, 235.0, 20.0, 140.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"bgcolor" : [ 0.94902, 0.94902, 0.94902, 0.0 ],
"id" : "obj-1",
"size" : 256.0,
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "select 0 1",
"patching_rect" : [ 342.0, 305.0, 62.0, 20.0 ],
"numoutlets" : 3,
"fontsize" : 12.0,
"outlettype" : [ "bang", "bang", "" ],
"id" : "obj-30",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "click here to close the serial port",
"patching_rect" : [ 390.0, 396.0, 206.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-26",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "click here to open the serial port",
"patching_rect" : [ 415.0, 370.0, 206.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-27",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "close",
"patching_rect" : [ 342.0, 396.0, 39.0, 18.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-21",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "port a",
"patching_rect" : [ 364.0, 370.0, 41.0, 18.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-19",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Click here to get a list of serial ports",
"patching_rect" : [ 435.0, 344.0, 207.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-2",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 342.0, 268.0, 15.0, 15.0 ],
"numoutlets" : 1,
"outlettype" : [ "int" ],
"id" : "obj-11",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "print",
"patching_rect" : [ 384.0, 344.0, 36.0, 18.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-13",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "serial a 9600",
"patching_rect" : [ 259.0, 420.0, 84.0, 20.0 ],
"numoutlets" : 2,
"fontsize" : 12.0,
"outlettype" : [ "int", "" ],
"id" : "obj-14",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Click to start",
"patching_rect" : [ 369.0, 268.0, 117.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-17",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "panel",
"patching_rect" : [ 215.0, 235.0, 21.0, 139.0 ],
"numoutlets" : 0,
"mode" : 1,
"grad1" : [ 1.0, 1.0, 1.0, 1.0 ],
"id" : "obj-8",
"grad2" : [ 0.509804, 0.509804, 0.509804, 1.0 ],
"numinlets" : 1,
"angle" : 270.0
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-30", 0 ],
"hidden" : 0,
"midpoints" : [ 351.0, 296.0, 351.5, 296.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-30", 1 ],
"destination" : [ "obj-19", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-30", 0 ],
"destination" : [ "obj-21", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-21", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 351.5, 416.5, 268.5, 416.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 373.5, 393.5, 268.5, 393.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-13", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 393.5, 365.5, 268.5, 365.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-6", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 224.5, 411.5, 268.5, 411.5 ]
}
}
]
}
*/ */

View File

@ -107,473 +107,43 @@ void loop() {
*/ */
/* Max/MSP v5 patch for this example /* Max/MSP v5 patch for this example
{ ----------begin_max5_patcher----------
"boxes" : [ { 1591.3oc0YszbaaCD9r7uBL5RalQUAO3CvdyS5zVenWZxs5NcfHgjPCIfJIT
"box" : { RTxj+6AOHkoTDooroUs0AQPR73a+1cwtK3WtZxzEpOwqlB9YveAlL4KWMYh6
"maxclass" : "comment", Q1GLo99ISKXeJMmU451zTUQAWpmNy+NM+SZ2y+sR1l02JuU9t0hJvFlNcMPy
"text" : "Graph\n\nThis patch takes a string, containing ASCII formatted number from 0 to 1023, with a carriage return and linefeed at the end. It converts the string to an integer and graphs it.\n\ncreated 2006\nby David A. Mellis\nmodified 14 Apr 2009\nby Scott Fitzgerald and Tom Igoe", dOuBv.U5Rgb0LPpRpYBooM3529latArTUVvzZdFPtsXAuDrrTU.f.sBffXxL
"linecount" : 10, vGE50lIHkUVJXq3fRtdaoDvjYfbgjujaFJSCzq4.tLaN.bi1tJefWpqbO0uz
"patching_rect" : [ 479.0, 6.0, 344.0, 144.0 ], 1IjIABoluxrJ1guxh2JfPO2B5zRNyBCLDFcqbwNvuv9fHCb8bvevyyEU2JKT
"numoutlets" : 0, YhkBSWPAfq2TZ6YhqmuMUo0feUn+rYpY4YtY+cFw3lUJdCMYAapZqzwUHX8S
"fontsize" : 12.0, crjAd+SIOU6UBAwIygy.Q1+HAA1KH6EveWOFQlitUK92ehfal9kFhUxJ3tWc
"id" : "obj-32", sgpxadigWExbt1o7Ps5dk3yttivyg20W0VcSmg1G90qtx92rAZbH4ez.ruy1
"fontname" : "Arial", nhmaDPidE07J+5n2sg6E6oKXxUSmc20o6E3SPRDbrkXnPGUYE.i5nCNB9TxQ
"numinlets" : 1 jG.G0kCTZtH88f07Rt0ZMMWUw8VvbKVAaTk6GyoraPdZff7rQTejBN54lgyv
} HE0Ft7AvIvvgvIwO23jBdUkYOuSvIFSiNcjFhiSsUBwsUCh1AgfNSBAeNDBZ
DIDqY.f8.YjfjV1HAn9XDTxyNFYatVTkKx3kcK9GraZpI5jv7GOx+Z37Xh82
} LSKHIDmDXaESoXRngIZQDKVkpxUkMCyXCQhcCK1z.G457gi3TzMz4RFD515F
, { G3bIQQwcP3SOF0zlkGhiCBQ1kOHHFFlXaEBQIQnCwv9QF1LxPZ.A4jR5cyQs
"box" : { vbvHMJsLll01We+rE2LazX6zYmCraRrsPFwKg1ANBZFY.IAihr8Ox.aH0oAL
"maxclass" : "newobj", hB8nQVw0FSJiZeunOykbT6t3r.NP8.iL+bnwNiXuVMNJH9H9YCm89CFXPBER
"text" : "select 0 1", bz422p8.O4dg6kRxdyjDqRwMIHTbT3QFLskxJ8tbmQK4tm0XGeZWF7wKKtYY
"patching_rect" : [ 327.0, 80.0, 62.0, 20.0 ], aTAF.XPNFaaQBinQMJ4QLF0aNHF0JtYuHSxoUZfZY6.UU2ejJTb8lQw8Fo5k
"numoutlets" : 3, Rv6e2PI+fOM71o2ecY1VgTYdCSxxUqLokuYq9jYJi6lxPgD2NIPePLB0mwbG
"fontsize" : 12.0, YA9Rgxdiu1k5xiLlSU6JVnx6wzg3sYHwTesB8Z5D7RiGZpXyvDNJY.DQX3.H
"outlettype" : [ "bang", "bang", "" ], hvmcUN4bP1yCkhpTle2P37jtBsKrLWcMScEmltOPv22ZfAqQAdKr9HzATQwZ
"id" : "obj-30", q18PrUGt6Tst2XMCRUfGuhXs6ccn23YloomMqcTiC5iMGPsHsHRWhWFlaenV
"fontname" : "Arial", XcqwgCQiGGJzptyS2ZMODBz6fGza0bzmXBj7+DA94bvpR01MffAlueO7HwcI
"numinlets" : 1 pWCwmzJdvi9ILgflLAFmyXB6O7ML0YbD26lenmcGxjVsZUN+A6pUK7AtTrPg
} M+eRYG0qD9j4I7eEbco8Xh6WcO.or9XDC6UCiewbXHkh6xm5LiPEkzpJDRTu
mEB44Fgz4NCtJvX.SM1vo2SlTCZGAe7GZu6ahdRyzFOhYZ+mbVVSYptBw.K1
} tboIkatIA7c1cTKD1u.honLYV04VkluHsXe0szv9pQCE9Ro3jaVB1o15pz2X
, { zYoBvO5KXCAe0LCYJybE8ZODf4fV8t9qW0zYxq.YJfTosj1bv0xc.SaC0+AV
"box" : { 9V9L.KKyV3SyTcRtmzi6rO.O16USvts4B5xe9EymDvebK0eMfW6+NIsNlE2m
"maxclass" : "comment", eqRyJ0utRq13+RjmqYKN1e.4d61jjdsauXe3.2p6jgi9hsNIv97CoyJ01xzl
"text" : "click here to close the serial port", c3ZhUCtSHx3UZgjoEJYqNY+hYs5zZQVFW19L3JDYaTlMLqAAt1G2yXlnFg9a
"patching_rect" : [ 412.0, 231.0, 206.0, 20.0 ], 53L1FJVcv.cOX0dh7mCVGCLce7GFcQwDdH5Ta3nyAS0pQbHxegr+tGIZORgM
"numoutlets" : 0, RnMj5vGl1Fs16drnk7Tf1XOLgv1n0d2iEsCxR.eQsNOZ4FGF7whofgfI3kES
"fontsize" : 12.0, 1kCeOX5L2rifbdu0A9ae2X.V33B1Z+.Bj1FrP5iFrCYCG5EUWSG.hhunHJd.
"id" : "obj-26", HJ5hhnng3h9HPj4lud02.1bxGw.
"fontname" : "Arial", -----------end_max5_patcher-----------
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "click here to open the serial port",
"patching_rect" : [ 412.0, 205.0, 206.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-27",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "close",
"patching_rect" : [ 327.0, 231.0, 39.0, 18.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-21",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "port a",
"patching_rect" : [ 349.0, 205.0, 41.0, 18.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-19",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "multislider",
"candicane7" : [ 0.878431, 0.243137, 0.145098, 1.0 ],
"patching_rect" : [ 302.0, 450.0, 246.0, 167.0 ],
"contdata" : 1,
"numoutlets" : 2,
"peakcolor" : [ 0.498039, 0.498039, 0.498039, 1.0 ],
"slidercolor" : [ 0.066667, 0.058824, 0.776471, 1.0 ],
"candicane8" : [ 0.027451, 0.447059, 0.501961, 1.0 ],
"outlettype" : [ "", "" ],
"setminmax" : [ 0.0, 1023.0 ],
"settype" : 0,
"candicane6" : [ 0.733333, 0.035294, 0.788235, 1.0 ],
"setstyle" : 3,
"bgcolor" : [ 0.231373, 0.713726, 1.0, 1.0 ],
"id" : "obj-1",
"candicane4" : [ 0.439216, 0.619608, 0.070588, 1.0 ],
"candicane5" : [ 0.584314, 0.827451, 0.431373, 1.0 ],
"candicane2" : [ 0.145098, 0.203922, 0.356863, 1.0 ],
"candicane3" : [ 0.290196, 0.411765, 0.713726, 1.0 ],
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Click here to get a list of serial ports",
"patching_rect" : [ 412.0, 179.0, 207.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-2",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Here's the number from Arduino's analog input",
"linecount" : 2,
"patching_rect" : [ 153.0, 409.0, 138.0, 34.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-3",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Convert ASCII to symbol",
"patching_rect" : [ 379.0, 378.0, 147.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-4",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Convert integer to ASCII",
"patching_rect" : [ 379.0, 355.0, 147.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-5",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "number",
"patching_rect" : [ 302.0, 414.0, 37.0, 20.0 ],
"numoutlets" : 2,
"fontsize" : 12.0,
"outlettype" : [ "int", "bang" ],
"bgcolor" : [ 0.866667, 0.866667, 0.866667, 1.0 ],
"id" : "obj-6",
"triscale" : 0.9,
"fontname" : "Arial",
"htextcolor" : [ 0.870588, 0.870588, 0.870588, 1.0 ],
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "fromsymbol",
"patching_rect" : [ 302.0, 378.0, 74.0, 20.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-7",
"fontname" : "Arial",
"color" : [ 1.0, 0.890196, 0.090196, 1.0 ],
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "itoa",
"patching_rect" : [ 302.0, 355.0, 46.0, 20.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "int" ],
"id" : "obj-8",
"fontname" : "Arial",
"color" : [ 1.0, 0.890196, 0.090196, 1.0 ],
"numinlets" : 3
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl group 4",
"patching_rect" : [ 302.0, 332.0, 64.0, 20.0 ],
"numoutlets" : 2,
"fontsize" : 12.0,
"outlettype" : [ "", "" ],
"id" : "obj-9",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "select 10 13",
"patching_rect" : [ 244.0, 281.0, 77.0, 20.0 ],
"numoutlets" : 3,
"fontsize" : 12.0,
"outlettype" : [ "bang", "bang", "" ],
"id" : "obj-10",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 244.0, 43.0, 15.0, 15.0 ],
"numoutlets" : 1,
"outlettype" : [ "int" ],
"id" : "obj-11",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "qmetro 10",
"patching_rect" : [ 244.0, 80.0, 65.0, 20.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "bang" ],
"id" : "obj-12",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "print",
"patching_rect" : [ 369.0, 179.0, 36.0, 18.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-13",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "serial a 9600",
"patching_rect" : [ 244.0, 255.0, 84.0, 20.0 ],
"numoutlets" : 2,
"fontsize" : 12.0,
"outlettype" : [ "int", "" ],
"id" : "obj-14",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Read serial input buffer every 10 milliseconds",
"linecount" : 2,
"patching_rect" : [ 53.0, 72.0, 185.0, 34.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-15",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "If you get newline (ASCII 10), send the list. If you get return (ASCII 13) do nothing. Any other value, add to the list",
"linecount" : 3,
"patching_rect" : [ 332.0, 269.0, 320.0, 48.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-16",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Click to open/close serial port and start/stop patch",
"linecount" : 2,
"patching_rect" : [ 271.0, 32.0, 199.0, 34.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-17",
"fontname" : "Arial",
"numinlets" : 1
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-7", 0 ],
"destination" : [ "obj-6", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"midpoints" : [ 253.5, 308.0, 311.5, 308.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 2 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"midpoints" : [ 311.5, 320.0, 311.5, 320.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-12", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-13", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 378.5, 200.5, 253.5, 200.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 358.5, 228.5, 253.5, 228.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-21", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 336.5, 251.5, 253.5, 251.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-30", 0 ],
"destination" : [ "obj-21", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-30", 1 ],
"destination" : [ "obj-19", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-30", 0 ],
"hidden" : 0,
"midpoints" : [ 253.0, 71.0, 336.5, 71.0 ]
}
}
]
}
*/ */

View File

@ -29,7 +29,7 @@ void setup() {
void loop() { void loop() {
// play notes from F#-0 (0x1E) to F#-5 (0x5A): // play notes from F#-0 (0x1E) to F#-5 (0x5A):
for (intnote = 0x1E; note < 0x5A; note ++) { for (int note = 0x1E; note < 0x5A; note ++) {
//Note on channel 1 (0x90), some note value (note), middle velocity (0x45): //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
noteOn(0x90, note, 0x45); noteOn(0x90, note, 0x45);
delay(100); delay(100);
@ -42,8 +42,8 @@ void loop() {
// plays a MIDI note. Doesn't check to see that // plays a MIDI note. Doesn't check to see that
// cmd is greater than 127, or that data values are less than 127: // cmd is greater than 127, or that data values are less than 127:
void noteOn(int cmd, int pitch, int velocity) { void noteOn(int cmd, int pitch, int velocity) {
Serial.print(cmd, BYTE); Serial.write(cmd);
Serial.print(pitch, BYTE); Serial.write(pitch);
Serial.print(velocity, BYTE); Serial.write(velocity);
} }

View File

@ -28,6 +28,6 @@ void loop() {
// read from port 1, send to port 0: // read from port 1, send to port 0:
if (Serial1.available()) { if (Serial1.available()) {
int inByte = Serial1.read(); int inByte = Serial1.read();
Serial.print(inByte, BYTE); Serial.write(inByte);
} }
} }

View File

@ -123,589 +123,48 @@ void loop() {
*/ */
/* /*
{ Max/MSP version 5 patch to run with this example:
"boxes" : [ {
"box" : {
"maxclass" : "comment",
"text" : "Physical Pixel\n\nThis patch sends an ASCII H or an ASCII L out the serial port to turn on an LED attached to an Arduino board. It can also send alternating H and L characters once every second to make the LED blink.\n\ncreated 2006\nby David A. Mellis\nmodified 14 Apr 2009\nby Scott Fitzgerald and Tom Igoe",
"linecount" : 11,
"patching_rect" : [ 14.0, 35.0, 354.0, 158.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-1",
"fontname" : "Arial",
"numinlets" : 1
}
} ----------begin_max5_patcher----------
, { 1672.3oc2ZszaaiCD9ryuBBebQVCQRYao8xhf1cQCPVfBzh8RRQ.sDsM2HSZ
"box" : { HQmlzh9eu7gjsjsEk7y0oWjiHoHm4aluYHGlueUmtiDuPy5B9Cv8fNc99Uc5
"maxclass" : "comment", XZR2Pm726zcF4knDRlYXciDylQ4xtWa6SReQZZ+iSeMiEQR.ej8BM4A9C7OO
"text" : "Click to blink every second", kkAlSjQSAYTdbFfvA27o2c6sfO.Doqd6NfXgDHmRUCKkolg4hT06BfbQJGH3
"patching_rect" : [ 99.0, 251.0, 161.0, 20.0 ], 5Qd2e8d.QJIQSow5tzebZ7BFW.FIHow8.2JAQpVIIYByxo9KIMkSjL9D0BRT
"numoutlets" : 0, sbGHZJIkDoZOSMuQT.8YZ5qpgGI3locF4IpQRzq2nDF+odZMIJkRjpEF44M3
"fontsize" : 12.0, A9nWAum7LKFbSOv+PSRXYOvmIhYiYpg.8A2LOUOxPyH+TjPJA+MS9sIzTRRr
"id" : "obj-38", QP9rXF31IBZAHpVHkHrfaPRHLuUCzoj9GSoQRqIB52y6Z.tu8o4EX+fddfuj
"fontname" : "Arial", +MrXiwPL5+9cXwrOVvkbxLpomazHbQO7EyX7DpzXYgkFdF6algCQpkX4XUlo
"numinlets" : 1 hA6oa7GWck9w0Gnmy6RXQOoQeCfWwlzsdnHLTq8n9PCHLv7Cxa6PAN3RCKjh
} ISRVZ+sSl704Tqt0kocE9R8J+P+RJOZ4ysp6gN0vppBbOTEN8qp0YCq5bq47
PUwfA5e766z7NbGMuncw7VgNRSyQhbnPMGrDsGaFSvKM5NcWoIVdZn44.eOi
9DTRUT.7jDQzSTiF4UzXLc7tLGh4T9pwaFQkGUGIiOOkpBSJUwGsBd40krHQ
9XEvwq2V6eLIhV6GuzP7uzzXBmzsXPSRYwBtVLp7s5lKVv6UN2VW7xRtYDbx
7s7wRgHYDI8YVFaTBshkP49R3rYpH3RlUhTQmK5jMadJyF3cYaTNQMGSyhRE
IIUlJaOOukdhoOyhnekEKmZlqU3UkLrk7bpPrpztKBVUR1uorLddk6xIOqNt
lBOroRrNVFJGLrDxudpET4kzkstNp2lzuUHVMgk5TDZx9GWumnoQTbhXsEtF
tzCcM+z0QKXsngCUtTOEIN0SX2iHTTIIz968.Kf.uhfzUCUuAd3UKd.OKt.N
HTynxTQyjpQD9jlwEXeKQxfHCBahUge6RprSa2V4m3aYOMyaP6gah2Yf1zbD
jVwZVGFZHHxINFxpjr5CiTS9JiZn6e6nTlXQZTAFj6QCppQwzL0AxVtoi6WE
QXsANkEGWMEuwNvhmKTnat7A9RqLq6pXuEwY6xM5xRraoTiurj51J1vKLzFs
CvM7HI14Mpje6YRxHOSieTsJpvJORjxT1nERK6s7YTN7sr6rylNwf5zMiHI4
meZ4rTYt2PpVettZERbjJ6PjfqN2loPSrUcusH01CegsGEE5467rnCdqT1ES
QxtCvFq.cvGz+BaAHXKzRSfP+2Jf.KCvj5ZLJRAhwi+SWHvPyN3vXiaPn6JR
3eoA.0TkFhTvpsDMIrL20nAkCI4EoYfSHAuiPBdmJRyd.IynYYjIzMvjOTKf
3DLvnvRLDLpWeEOYXMfAZqfQ0.qsnlUdmA33t8CNJ7MZEb.u7fiZHLYzDkJp
R7CqEVLGN75U+1JXxFUY.xEEBcRCqhOEkz2bENEWnh4pbh0wY25EefbD6EmW
UA6Ip8wFLyuFXx+Wrp8m6iff1B86W7bqJO9+mx8er4E3.abCLrYdA16sBuHx
vKT6BlpIGQIhL55W7oicf3ayv3ixQCm4aQuY1HZUPQWY+cASx2WZ3f1fICuz
vj5R5ZbM1y8gXYN4dIXaYGq4NhQvS5MmcDADy+S.j8CQ78vk7Q7gtPDX3kFh
3NGaAsYBUAO.8N1U4WKycxbQdrWxJdXd10gNIO+hkUMmm.CZwknu7JbNUYUq
0sOsTsI1QudDtjw0t+xZ85wWZd80tMCiiMADNX4UzrcSeK23su87IANqmA7j
tiRzoXi2YRh67ldAk79gPmTe3YKuoY0qdEDV3X8xylCJMTN45JIakB7uY8XW
uVr3PO8wWwEoTW8lsfraX7ZqzZDDXCRqNkztHsGCYpIDDAOqxDpMVUMKcOrp
942acPvx2NPocMC1wQZ8glRn3myTykVaEUNLoEeJjVaAevA4EAZnsNgkeyO+
3rEZB7f0DTazDcQTNmdt8aACGi1QOWnMmd+.6YjMHH19OB5gKsMF877x8wsJ
hN97JSnSfLUXGUoj6ujWXd6Pk1SAC+Pkogm.tZ.1lX1qL.pe6PE11DPeMMZ2
.P0K+3peBt3NskC
-----------end_max5_patcher-----------
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 74.0, 251.0, 21.0, 21.0 ],
"numoutlets" : 1,
"outlettype" : [ "int" ],
"id" : "obj-39",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "p blink",
"patching_rect" : [ 74.0, 286.0, 45.0, 20.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "int" ],
"id" : "obj-37",
"fontname" : "Arial",
"numinlets" : 2,
"patcher" : {
"fileversion" : 1,
"rect" : [ 54.0, 94.0, 640.0, 480.0 ],
"bglocked" : 0,
"defrect" : [ 54.0, 94.0, 640.0, 480.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 10.0,
"default_fontface" : 0,
"default_fontname" : "Verdana",
"gridonopen" : 0,
"gridsize" : [ 25.0, 25.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "* 1000",
"patching_rect" : [ 200.0, 150.0, 46.0, 19.0 ],
"numoutlets" : 1,
"fontsize" : 10.0,
"outlettype" : [ "int" ],
"id" : "obj-12",
"fontname" : "Verdana",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "inlet",
"patching_rect" : [ 200.0, 75.0, 25.0, 25.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"id" : "obj-11",
"numinlets" : 0,
"comment" : ""
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 125.0, 250.0, 20.0, 20.0 ],
"numoutlets" : 1,
"outlettype" : [ "int" ],
"id" : "obj-10",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "metro 1000",
"patching_rect" : [ 115.0, 190.0, 69.0, 19.0 ],
"numoutlets" : 1,
"fontsize" : 10.0,
"outlettype" : [ "bang" ],
"id" : "obj-3",
"fontname" : "Verdana",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "outlet",
"patching_rect" : [ 125.0, 400.0, 25.0, 25.0 ],
"numoutlets" : 0,
"id" : "obj-2",
"numinlets" : 1,
"comment" : ""
}
}
, {
"box" : {
"maxclass" : "inlet",
"patching_rect" : [ 100.0, 25.0, 25.0, 25.0 ],
"numoutlets" : 1,
"outlettype" : [ "int" ],
"id" : "obj-1",
"numinlets" : 0,
"comment" : ""
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-12", 0 ],
"destination" : [ "obj-3", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-2", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
]
}
,
"saved_object_attributes" : {
"fontface" : 0,
"fontsize" : 10.0,
"default_fontface" : 0,
"default_fontname" : "Verdana",
"default_fontsize" : 10.0,
"fontname" : "Verdana",
"globalpatchername" : ""
}
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "convert to int",
"patching_rect" : [ 154.0, 386.0, 104.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-36",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "send L if 0, H if 1",
"patching_rect" : [ 154.0, 361.0, 104.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-35",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "is it on or off?",
"patching_rect" : [ 179.0, 336.0, 95.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-34",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "atoi",
"patching_rect" : [ 279.0, 386.0, 46.0, 20.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "list" ],
"id" : "obj-33",
"fontname" : "Arial",
"numinlets" : 3
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "H",
"patching_rect" : [ 329.0, 361.0, 32.5, 17.0 ],
"numoutlets" : 1,
"fontsize" : 10.0,
"outlettype" : [ "" ],
"id" : "obj-32",
"fontname" : "Verdana",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "L",
"patching_rect" : [ 279.0, 361.0, 32.5, 17.0 ],
"numoutlets" : 1,
"fontsize" : 10.0,
"outlettype" : [ "" ],
"id" : "obj-31",
"fontname" : "Verdana",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "select 0 1",
"patching_rect" : [ 279.0, 336.0, 62.0, 20.0 ],
"numoutlets" : 3,
"fontsize" : 12.0,
"outlettype" : [ "bang", "bang", "" ],
"id" : "obj-25",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Click to turn the LED on and off",
"linecount" : 2,
"patching_rect" : [ 130.0, 205.0, 143.0, 34.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-24",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 279.0, 211.0, 24.0, 24.0 ],
"numoutlets" : 1,
"outlettype" : [ "int" ],
"id" : "obj-23",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "select 0 1",
"patching_rect" : [ 381.0, 331.0, 62.0, 20.0 ],
"numoutlets" : 3,
"fontsize" : 12.0,
"outlettype" : [ "bang", "bang", "" ],
"id" : "obj-30",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "click here to close the serial port",
"patching_rect" : [ 429.0, 422.0, 206.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-26",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "click here to open the serial port",
"patching_rect" : [ 454.0, 396.0, 206.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-27",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "close",
"patching_rect" : [ 381.0, 422.0, 39.0, 18.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-21",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "port a",
"patching_rect" : [ 403.0, 396.0, 41.0, 18.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-19",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Click here to get a list of serial ports",
"patching_rect" : [ 474.0, 370.0, 207.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-2",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 381.0, 181.0, 21.0, 21.0 ],
"numoutlets" : 1,
"outlettype" : [ "int" ],
"id" : "obj-11",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "print",
"patching_rect" : [ 423.0, 370.0, 36.0, 18.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-13",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "serial a 9600",
"patching_rect" : [ 279.0, 461.0, 84.0, 20.0 ],
"numoutlets" : 2,
"fontsize" : 12.0,
"outlettype" : [ "int", "" ],
"id" : "obj-14",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Click to start",
"patching_rect" : [ 408.0, 181.0, 117.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-17",
"fontname" : "Arial",
"numinlets" : 1
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-39", 0 ],
"destination" : [ "obj-37", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-37", 0 ],
"destination" : [ "obj-25", 0 ],
"hidden" : 0,
"midpoints" : [ 83.5, 320.5, 288.5, 320.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-33", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-32", 0 ],
"destination" : [ "obj-33", 0 ],
"hidden" : 0,
"midpoints" : [ 338.5, 381.5, 288.5, 381.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-31", 0 ],
"destination" : [ "obj-33", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-25", 0 ],
"destination" : [ "obj-31", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-25", 1 ],
"destination" : [ "obj-32", 0 ],
"hidden" : 0,
"midpoints" : [ 310.0, 358.0, 338.5, 358.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-23", 0 ],
"destination" : [ "obj-25", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-13", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 432.5, 389.0, 367.0, 389.0, 367.0, 411.0, 288.5, 411.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 412.5, 417.0, 288.5, 417.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-21", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 390.5, 450.0, 288.5, 450.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-30", 0 ],
"destination" : [ "obj-21", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-30", 1 ],
"destination" : [ "obj-19", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-30", 0 ],
"hidden" : 0,
"midpoints" : [ 390.5, 322.0, 390.5, 322.0 ]
}
}
]
}
*/ */

View File

@ -0,0 +1,57 @@
/*
Serial Event example
When new serial data arrives, this sketch adds it to a String.
When a newline is received, the loop prints the string and
clears it.
A good test for this is to try it with a GPS receiver
that sends out NMEA 0183 sentences.
Created 9 May 2011
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/SerialEvent
*/
String inputString = ""; // a string to hold incoming data
boolean stringComplete = false; // whether the string is complete
void setup() {
// initialize serial:
Serial.begin(9600);
// reserve 200 bytes for the inputString:
inputString.reserve(200);
}
void loop() {
// print the string when a newline arrives:
if (stringComplete) {
Serial.println(inputString);
// clear the string:
inputString = "";
stringComplete = false;
}
}
/*
SerialEvent occurs whenever a new byte comes in the
hardware serial RX. Don't do complex things here, as the
processor halts the regular program to run this routine:
*/
void serialEvent() {
// get the new byte:
char inChar = (char)Serial.read();
// add it to the inputString:
inputString += inChar;
// if the incoming character is a newline, set a flag
// so the main loop can do something about it:
if (inChar == '\n') {
stringComplete = true;
}
}

View File

@ -88,612 +88,43 @@ void loop()
*/ */
/* Max/MSP patch for this example /* Max/MSP patch for this example
{
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "/ 4",
"patching_rect" : [ 448.0, 502.0, 32.5, 20.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "int" ],
"id" : "obj-25",
"fontname" : "Arial",
"numinlets" : 2
}
} ----------begin_max5_patcher----------
, { 1512.3oc4Z00aaaCE8YmeED9ktB35xOjrj1aAsXX4g8xZQeYoXfVh1gqRjdT
"box" : { TsIsn+2K+PJUovVVJ1VMdCAvxThV7bO7b48dIyWtXxzkxaYkSA+J3u.Sl7kK
"maxclass" : "newobj", lLwcK6MlT2dxzB5so4zRW2lJXeRt7elNy+HM6Vs61uDDzbOYkNmo02sg4euS
"text" : "/ 4", 4BSede8S2P0o2vEq+aEKU66PPP7b3LPHDauPvyCmAvv4v6+M7L2XXF2WfCaF
"patching_rect" : [ 398.0, 502.0, 32.5, 20.0 ], lURgVPKbCxzKUbZdySDUEbgABN.ia08R9mccGYGn66qGutNir27qWbg8iY+7
"numoutlets" : 1, HDRx.Hjf+OPHCQgPdpQHoxhBlwB+QF4cbkthlCRk4REnfeKScs3ZwaugWBbj
"fontsize" : 12.0, .PS+.qDPAkZkgPlY5oPS4By2A5aTLFv9pounjsgpnZVF3x27pqtBrRpJnZaa
"outlettype" : [ "int" ], C3WxTkfUJYA.BzR.BhIy.ehquw7dSoJCsrlATLckR.nhLPNWvVwL+Vp1LHL.
"id" : "obj-24", SjMG.tRaG7OxT5R2c8Hx9B8.wLCxVaGI6qnpj45Ug84kL+6YIM8CqUxJyycF
"fontname" : "Arial", 7bqsBRULGvwfWyRMyovElat7NvqoejaLm4f+fkmyKuVTHy3q3ldhB.WtQY6Z
"numinlets" : 2 x0BSOeSpTqA+FW+Yy3SyybH3sFy8p0RVCmaMpTyX6HdDZ2JsPbfSogbBMueH
} JLd6RMBdfRMzPjZvimuWIK2XgFA.ZmtfKoh0Sm88qc6OF4bDQ3P6kEtF6xej
.OkjD4H5OllyS+.3FlhY0so4xRlWqyrXErQpt+2rsnXgQNZHZgmMVzEofW7T
S4zORQtgIdDbRHrObRzSMNofUVZVcbKbhQZrSOo934TqRHIN2ncr7BF8TKR1
tHDqL.PejLRRPKMR.pKFAkbtDa+UOvsYsIFH0DYsTCjqZ66T1CmGeDILLpSm
myk0SdkOKh5LUr4GbWwRYdW7fm.BvDmzHnSdH3biGpSbxxDNJoGDAD1ChH7L
I0DaloOTBLvkO7zPs5HJnKNoGAXbol5eytUhfyiSfnjE1uAq+Fp0a+wygGwR
q3ZI8.psJpkpJnyPzwmXBj7Sh.+bNvVZxlcKAm0OYHIxcIjzEKdRChgO5UMf
LkMPNN0MfiS7Ev6TYQct.F5IWcCZ4504rGsiVswGWWSYyma01QcZgmL+f+sf
oU18Hn6o6dXkMkFF14TL9rIAWE+6wvGV.p.TPqz3HK5L+VxYxl4UmBKEjr.B
6zinuKI3C+D2Y7azIM6N7QL6t+jQyZxymK1ToAKqVsxjlGyjz2c1kTK3180h
kJEYkacWpv6lyp2VJTjWK47wHA6fyBOWxH9pUf6jUtZkLpNKW.9EeUBH3ymY
XSQlaqGrkQMGzp20adYSmIOGjIABo1xZyAWJtCX9tg6+HMuhMCPyx76ao+Us
UxmzUE79H8d2ZB1m1ztbnOa1mGeAq0awyK8a9UqBUc6pZolpzurTK232e5gp
aInVw8QIIcpaiNSJfY4Z+92Cs+Mc+mgg2cEsvGlLY6V+1kMuioxnB5VM+fsY
9vSu4WI1PMBGXye6KXvNuzmZTh7U9h5j6vvASdngPdgOFxycNL6ia1axUMmT
JIzebXcQCn3SKMf+4QCMmOZung+6xBCPLfwO8ngcEI52YJ1y7mx3CN9xKUYU
bg7Y1yXjlKW6SrZnguQdsSfOSSDItqv2jwJFjavc1vO7OigyBr2+gDYorRk1
HXZpVFfu2FxXkZtfp4RQqNkX5y2sya3YYL2iavWAOaizH+pw.Ibg8f1I9h3Z
2B79sNeOHvBOtfEalWsvyu0KMf015.AaROvZ7vv5AhnndfHLbTgjcCK1KlHv
gOk5B26OqrXjcJ005.QqCHn8fVTxnxfj93SfQiJlv8YV0VT9fVUwOOhSV3uD
eeqCUClbBPa.j3vWDoMZssNTzRNEnE6gYPXazZaMF921syaLWyAeBXvCESA8
ASi6Zyw8.RQi65J8ZsNx3ho93OhGWENtWpowepae4YhCFeLErOLENtXJrOSc
iadi39rf4hwc8xdhHz3gn3dBI7iDRlFe8huAfIZhq
-----------end_max5_patcher-----------
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "/ 4",
"patching_rect" : [ 348.0, 502.0, 32.5, 20.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "int" ],
"id" : "obj-23",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Virtual color mixer\n\nThis patch takes a string, containing three comma-separated ASCII formatted numbers from 0 to 1023, with a carriage return and linefeed at the end. It converts the string to three integers and uses them to set the background color.\n\n created 2 Dec 2006\n by David A. Mellis\nmodified 14 Apr 2009\nby Scott Fitzgerald and Tom Igoe",
"linecount" : 11,
"patching_rect" : [ 524.0, 51.0, 398.0, 158.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-32",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "select 0 1",
"patching_rect" : [ 372.0, 125.0, 62.0, 20.0 ],
"numoutlets" : 3,
"fontsize" : 12.0,
"outlettype" : [ "bang", "bang", "" ],
"id" : "obj-30",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "click here to close the serial port",
"patching_rect" : [ 457.0, 276.0, 206.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-26",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "click here to open the serial port",
"patching_rect" : [ 457.0, 250.0, 206.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-27",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "close",
"patching_rect" : [ 372.0, 276.0, 39.0, 18.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-21",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "port a",
"patching_rect" : [ 394.0, 250.0, 41.0, 18.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-19",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Click here to get a list of serial ports",
"patching_rect" : [ 457.0, 224.0, 207.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-2",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Convert ASCII to symbol",
"patching_rect" : [ 424.0, 423.0, 147.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-4",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Convert integer to ASCII",
"patching_rect" : [ 424.0, 400.0, 147.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-5",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "fromsymbol",
"patching_rect" : [ 347.0, 423.0, 74.0, 20.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-7",
"fontname" : "Arial",
"color" : [ 1.0, 0.890196, 0.090196, 1.0 ],
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "itoa",
"patching_rect" : [ 347.0, 400.0, 46.0, 20.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "int" ],
"id" : "obj-8",
"fontname" : "Arial",
"color" : [ 1.0, 0.890196, 0.090196, 1.0 ],
"numinlets" : 3
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl group",
"patching_rect" : [ 347.0, 377.0, 53.0, 20.0 ],
"numoutlets" : 2,
"fontsize" : 12.0,
"outlettype" : [ "", "" ],
"id" : "obj-9",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "select 10 13",
"patching_rect" : [ 289.0, 326.0, 77.0, 20.0 ],
"numoutlets" : 3,
"fontsize" : 12.0,
"outlettype" : [ "bang", "bang", "" ],
"id" : "obj-10",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 289.0, 88.0, 15.0, 15.0 ],
"numoutlets" : 1,
"outlettype" : [ "int" ],
"id" : "obj-11",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "qmetro 10",
"patching_rect" : [ 289.0, 125.0, 65.0, 20.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "bang" ],
"id" : "obj-12",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "print",
"patching_rect" : [ 414.0, 224.0, 36.0, 18.0 ],
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"id" : "obj-13",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "serial a 9600",
"patching_rect" : [ 289.0, 300.0, 84.0, 20.0 ],
"numoutlets" : 2,
"fontsize" : 12.0,
"outlettype" : [ "int", "" ],
"id" : "obj-14",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Read serial input buffer every 10 milliseconds",
"linecount" : 2,
"patching_rect" : [ 98.0, 117.0, 185.0, 34.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-15",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "If you get newline (ASCII 10), send the list. If you get return (ASCII 13) do nothing. Any other value, add to the list",
"linecount" : 3,
"patching_rect" : [ 377.0, 314.0, 320.0, 48.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-16",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Click to open/close serial port and start/stop patch",
"linecount" : 2,
"patching_rect" : [ 316.0, 77.0, 199.0, 34.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-17",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "bgcolor 0 0 0",
"patching_rect" : [ 348.0, 585.0, 169.0, 19.0 ],
"numoutlets" : 0,
"fontsize" : 10.0,
"id" : "obj-6",
"fontname" : "Verdana",
"numinlets" : 4
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "unpack 0 0 0 0 0",
"patching_rect" : [ 347.0, 470.0, 119.0, 19.0 ],
"numoutlets" : 5,
"fontsize" : 10.0,
"outlettype" : [ "int", "int", "int", "int", "int" ],
"id" : "obj-20",
"fontname" : "Verdana",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "number",
"patching_rect" : [ 448.0, 535.0, 50.0, 19.0 ],
"numoutlets" : 2,
"fontsize" : 10.0,
"outlettype" : [ "int", "bang" ],
"id" : "obj-18",
"fontname" : "Verdana",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "number",
"patching_rect" : [ 398.0, 535.0, 50.0, 19.0 ],
"numoutlets" : 2,
"fontsize" : 10.0,
"outlettype" : [ "int", "bang" ],
"id" : "obj-1",
"fontname" : "Verdana",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "number",
"patching_rect" : [ 348.0, 535.0, 50.0, 19.0 ],
"numoutlets" : 2,
"fontsize" : 10.0,
"outlettype" : [ "int", "bang" ],
"id" : "obj-22",
"fontname" : "Verdana",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Here's the numbers from Arduino's analog input",
"linecount" : 3,
"patching_rect" : [ 198.0, 484.0, 138.0, 48.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-3",
"fontname" : "Arial",
"numinlets" : 1
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-18", 0 ],
"destination" : [ "obj-6", 2 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-6", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-22", 0 ],
"destination" : [ "obj-6", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-25", 0 ],
"destination" : [ "obj-18", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-20", 4 ],
"destination" : [ "obj-25", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-20", 2 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-24", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-23", 0 ],
"destination" : [ "obj-22", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-20", 0 ],
"destination" : [ "obj-23", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-12", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-13", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 423.5, 245.5, 298.5, 245.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 403.5, 273.5, 298.5, 273.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-21", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 381.5, 296.5, 298.5, 296.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-30", 0 ],
"destination" : [ "obj-21", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-30", 1 ],
"destination" : [ "obj-19", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-30", 0 ],
"hidden" : 0,
"midpoints" : [ 298.0, 116.0, 381.5, 116.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-7", 0 ],
"destination" : [ "obj-20", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"midpoints" : [ 298.5, 353.0, 356.5, 353.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 2 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"midpoints" : [ 356.5, 365.0, 356.5, 365.0 ]
}
}
]
}
*/ */

BIN
build/shared/lib/about.jpg Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -8,7 +8,6 @@ DEC LITERAL1 Serial_Print
BIN LITERAL1 Serial_Print BIN LITERAL1 Serial_Print
HEX LITERAL1 Serial_Print HEX LITERAL1 Serial_Print
OCT LITERAL1 Serial_Print OCT LITERAL1 Serial_Print
BYTE LITERAL1 Serial_Print
PI LITERAL1 PI LITERAL1
HALF_PI LITERAL1 HALF_PI LITERAL1
TWO_PI LITERAL1 TWO_PI LITERAL1
@ -173,6 +172,13 @@ print KEYWORD2 Serial_Print
println KEYWORD2 Serial_Println println KEYWORD2 Serial_Println
available KEYWORD2 Serial_Available available KEYWORD2 Serial_Available
flush KEYWORD2 Serial_Flush flush KEYWORD2 Serial_Flush
setTimeout KEYWORD2
find KEYWORD2
findUntil KEYWORD2
parseInt KEYWORD2
parseFloat KEYWORD2
readBytes KEYWORD2
readBytesUntil KEYWORD2
setup KEYWORD3 Setup setup KEYWORD3 Setup
loop KEYWORD3 Loop loop KEYWORD3 Loop

View File

@ -240,6 +240,8 @@ run.present.exclusive.macosx = true
board = uno board = uno
target = arduino target = arduino
programmer = arduino:avrispmkii
upload.using = bootloader upload.using = bootloader
serial.port=COM1 serial.port=COM1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 869 B

After

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 891 B

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

After

Width:  |  Height:  |  Size: 54 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 834 B

After

Width:  |  Height:  |  Size: 87 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 844 B

After

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 896 B

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 828 B

After

Width:  |  Height:  |  Size: 54 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 842 B

After

Width:  |  Height:  |  Size: 73 B

View File

@ -1,35 +1,35 @@
# GUI - STATUS # GUI - STATUS
status.notice.fgcolor = #000000 status.notice.fgcolor = #002325
status.notice.bgcolor = #54919e status.notice.bgcolor = #17A1A5
status.error.fgcolor = #ffffff status.error.fgcolor = #FFFFFF
status.error.bgcolor = #662000 status.error.bgcolor = #E34C00
status.edit.fgcolor = #000000 status.edit.fgcolor = #000000
status.edit.bgcolor = #cc9900 status.edit.bgcolor = #F1B500
status.font = SansSerif,plain,12 status.font = SansSerif,plain,12
# GUI - TABS # GUI - TABS
# settings for the tabs at the top # settings for the tabs at the top
# (tab images are stored in the lib/theme folder) # (tab images are stored in the lib/theme folder)
header.bgcolor = #216886 header.bgcolor = #17A1A5
header.text.selected.color = #1a1a00 header.text.selected.color = #005B5B
header.text.unselected.color = #ffffff header.text.unselected.color = #007e82
header.text.font = SansSerif,plain,12 header.text.font = SansSerif,plain,12
# GUI - CONSOLE # GUI - CONSOLE
console.font = Monospaced,plain,11 console.font = Monospaced,plain,11
console.font.macosx = Monaco,plain,10 console.font.macosx = Monaco,plain,10
console.color = #000000 console.color = #000000
console.output.color = #cccccc console.output.color = #eeeeee
console.error.color = #ff3000 console.error.color = #E34C00
# GUI - BUTTONS # GUI - BUTTONS
buttons.bgcolor = #044f6f buttons.bgcolor = #006468
buttons.status.font = SansSerif,plain,12 buttons.status.font = SansSerif,plain,12
buttons.status.color = #ffffff buttons.status.color = #ffffff
# GUI - LINESTATUS # GUI - LINESTATUS
linestatus.color = #ffffff linestatus.color = #17A1A5
linestatus.bgcolor = #044f6f linestatus.bgcolor = #006468
# EDITOR - DETAILS # EDITOR - DETAILS
@ -83,6 +83,9 @@ editor.literal1.style = #006699,plain
# p5 built in variables: e.g. mouseX, width, pixels # p5 built in variables: e.g. mouseX, width, pixels
editor.literal2.style = #006699,plain editor.literal2.style = #006699,plain
# http://arduino.cc/
editor.url.style = #0000ff,underlined
# e.g. + - = / # e.g. + - = /
editor.operator.style = #000000,plain editor.operator.style = #000000,plain

View File

@ -1,7 +0,0 @@
[DEFAULT]
BASEURL=http://www.ftdichip.com/Documents/AppNotes.htm
[InternetShortcut]
URL=http://www.ftdichip.com/Documents/AppNotes.htm
Modified=C055946F4AF7C5011F
IconFile=C:\WINNT\system32\url.dll
IconIndex=0

View File

@ -1,875 +0,0 @@
/*++
Copyright (c) 2001-2005 Future Technology Devices International Ltd.
Module Name:
ftd2xx.h
Abstract:
Native USB device driver for FTDI FT8U232/245
FTD2XX library definitions
Environment:
kernel & user mode
Revision History:
13/03/01 awm Created.
13/01/03 awm Added device information support.
19/03/03 awm Added FT_W32_CancelIo.
12/06/03 awm Added FT_StopInTask and FT_RestartInTask.
18/09/03 awm Added FT_SetResetPipeRetryCount.
10/10/03 awm Added FT_ResetPort.
23/01/04 awm Added support for open-by-location.
16/03/04 awm Added support for FT2232C.
23/09/04 awm Added support for FT232R.
20/10/04 awm Added FT_CyclePort.
18/01/05 awm Added FT_DEVICE_LIST_INFO_NODE type.
11/02/05 awm Added LocId to FT_DEVICE_LIST_INFO_NODE.
25/08/05 awm Added FT_SetDeadmanTimeout.
02/12/05 awm Removed obsolete references.
05/12/05 awm Added FT_GetVersion, FT_GetVersionEx.
--*/
#ifndef FTD2XX_H
#define FTD2XX_H
// The following ifdef block is the standard way of creating macros
// which make exporting from a DLL simpler. All files within this DLL
// are compiled with the FTD2XX_EXPORTS symbol defined on the command line.
// This symbol should not be defined on any project that uses this DLL.
// This way any other project whose source files include this file see
// FTD2XX_API functions as being imported from a DLL, whereas this DLL
// sees symbols defined with this macro as being exported.
#ifdef FTD2XX_EXPORTS
#define FTD2XX_API __declspec(dllexport)
#else
#define FTD2XX_API __declspec(dllimport)
#endif
typedef PVOID FT_HANDLE;
typedef ULONG FT_STATUS;
//
// Device status
//
enum {
FT_OK,
FT_INVALID_HANDLE,
FT_DEVICE_NOT_FOUND,
FT_DEVICE_NOT_OPENED,
FT_IO_ERROR,
FT_INSUFFICIENT_RESOURCES,
FT_INVALID_PARAMETER,
FT_INVALID_BAUD_RATE,
FT_DEVICE_NOT_OPENED_FOR_ERASE,
FT_DEVICE_NOT_OPENED_FOR_WRITE,
FT_FAILED_TO_WRITE_DEVICE,
FT_EEPROM_READ_FAILED,
FT_EEPROM_WRITE_FAILED,
FT_EEPROM_ERASE_FAILED,
FT_EEPROM_NOT_PRESENT,
FT_EEPROM_NOT_PROGRAMMED,
FT_INVALID_ARGS,
FT_NOT_SUPPORTED,
FT_OTHER_ERROR
};
#define FT_SUCCESS(status) ((status) == FT_OK)
//
// FT_OpenEx Flags
//
#define FT_OPEN_BY_SERIAL_NUMBER 1
#define FT_OPEN_BY_DESCRIPTION 2
#define FT_OPEN_BY_LOCATION 4
//
// FT_ListDevices Flags (used in conjunction with FT_OpenEx Flags
//
#define FT_LIST_NUMBER_ONLY 0x80000000
#define FT_LIST_BY_INDEX 0x40000000
#define FT_LIST_ALL 0x20000000
#define FT_LIST_MASK (FT_LIST_NUMBER_ONLY|FT_LIST_BY_INDEX|FT_LIST_ALL)
//
// Baud Rates
//
#define FT_BAUD_300 300
#define FT_BAUD_600 600
#define FT_BAUD_1200 1200
#define FT_BAUD_2400 2400
#define FT_BAUD_4800 4800
#define FT_BAUD_9600 9600
#define FT_BAUD_14400 14400
#define FT_BAUD_19200 19200
#define FT_BAUD_38400 38400
#define FT_BAUD_57600 57600
#define FT_BAUD_115200 115200
#define FT_BAUD_230400 230400
#define FT_BAUD_460800 460800
#define FT_BAUD_921600 921600
//
// Word Lengths
//
#define FT_BITS_8 (UCHAR) 8
#define FT_BITS_7 (UCHAR) 7
#define FT_BITS_6 (UCHAR) 6
#define FT_BITS_5 (UCHAR) 5
//
// Stop Bits
//
#define FT_STOP_BITS_1 (UCHAR) 0
#define FT_STOP_BITS_1_5 (UCHAR) 1
#define FT_STOP_BITS_2 (UCHAR) 2
//
// Parity
//
#define FT_PARITY_NONE (UCHAR) 0
#define FT_PARITY_ODD (UCHAR) 1
#define FT_PARITY_EVEN (UCHAR) 2
#define FT_PARITY_MARK (UCHAR) 3
#define FT_PARITY_SPACE (UCHAR) 4
//
// Flow Control
//
#define FT_FLOW_NONE 0x0000
#define FT_FLOW_RTS_CTS 0x0100
#define FT_FLOW_DTR_DSR 0x0200
#define FT_FLOW_XON_XOFF 0x0400
//
// Purge rx and tx buffers
//
#define FT_PURGE_RX 1
#define FT_PURGE_TX 2
//
// Events
//
typedef void (*PFT_EVENT_HANDLER)(DWORD,DWORD);
#define FT_EVENT_RXCHAR 1
#define FT_EVENT_MODEM_STATUS 2
//
// Timeouts
//
#define FT_DEFAULT_RX_TIMEOUT 300
#define FT_DEFAULT_TX_TIMEOUT 300
//
// Device types
//
typedef ULONG FT_DEVICE;
enum {
FT_DEVICE_BM,
FT_DEVICE_AM,
FT_DEVICE_100AX,
FT_DEVICE_UNKNOWN,
FT_DEVICE_2232C,
FT_DEVICE_232R
};
#ifdef __cplusplus
extern "C" {
#endif
FTD2XX_API
FT_STATUS WINAPI FT_Open(
int deviceNumber,
FT_HANDLE *pHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_OpenEx(
PVOID pArg1,
DWORD Flags,
FT_HANDLE *pHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_ListDevices(
PVOID pArg1,
PVOID pArg2,
DWORD Flags
);
FTD2XX_API
FT_STATUS WINAPI FT_Close(
FT_HANDLE ftHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_Read(
FT_HANDLE ftHandle,
LPVOID lpBuffer,
DWORD nBufferSize,
LPDWORD lpBytesReturned
);
FTD2XX_API
FT_STATUS WINAPI FT_Write(
FT_HANDLE ftHandle,
LPVOID lpBuffer,
DWORD nBufferSize,
LPDWORD lpBytesWritten
);
FTD2XX_API
FT_STATUS WINAPI FT_IoCtl(
FT_HANDLE ftHandle,
DWORD dwIoControlCode,
LPVOID lpInBuf,
DWORD nInBufSize,
LPVOID lpOutBuf,
DWORD nOutBufSize,
LPDWORD lpBytesReturned,
LPOVERLAPPED lpOverlapped
);
FTD2XX_API
FT_STATUS WINAPI FT_SetBaudRate(
FT_HANDLE ftHandle,
ULONG BaudRate
);
FTD2XX_API
FT_STATUS WINAPI FT_SetDivisor(
FT_HANDLE ftHandle,
USHORT Divisor
);
FTD2XX_API
FT_STATUS WINAPI FT_SetDataCharacteristics(
FT_HANDLE ftHandle,
UCHAR WordLength,
UCHAR StopBits,
UCHAR Parity
);
FTD2XX_API
FT_STATUS WINAPI FT_SetFlowControl(
FT_HANDLE ftHandle,
USHORT FlowControl,
UCHAR XonChar,
UCHAR XoffChar
);
FTD2XX_API
FT_STATUS WINAPI FT_ResetDevice(
FT_HANDLE ftHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_SetDtr(
FT_HANDLE ftHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_ClrDtr(
FT_HANDLE ftHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_SetRts(
FT_HANDLE ftHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_ClrRts(
FT_HANDLE ftHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_GetModemStatus(
FT_HANDLE ftHandle,
ULONG *pModemStatus
);
FTD2XX_API
FT_STATUS WINAPI FT_SetChars(
FT_HANDLE ftHandle,
UCHAR EventChar,
UCHAR EventCharEnabled,
UCHAR ErrorChar,
UCHAR ErrorCharEnabled
);
FTD2XX_API
FT_STATUS WINAPI FT_Purge(
FT_HANDLE ftHandle,
ULONG Mask
);
FTD2XX_API
FT_STATUS WINAPI FT_SetTimeouts(
FT_HANDLE ftHandle,
ULONG ReadTimeout,
ULONG WriteTimeout
);
FTD2XX_API
FT_STATUS WINAPI FT_GetQueueStatus(
FT_HANDLE ftHandle,
DWORD *dwRxBytes
);
FTD2XX_API
FT_STATUS WINAPI FT_SetEventNotification(
FT_HANDLE ftHandle,
DWORD Mask,
PVOID Param
);
FTD2XX_API
FT_STATUS WINAPI FT_GetStatus(
FT_HANDLE ftHandle,
DWORD *dwRxBytes,
DWORD *dwTxBytes,
DWORD *dwEventDWord
);
FTD2XX_API
FT_STATUS WINAPI FT_SetBreakOn(
FT_HANDLE ftHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_SetBreakOff(
FT_HANDLE ftHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_SetWaitMask(
FT_HANDLE ftHandle,
DWORD Mask
);
FTD2XX_API
FT_STATUS WINAPI FT_WaitOnMask(
FT_HANDLE ftHandle,
DWORD *Mask
);
FTD2XX_API
FT_STATUS WINAPI FT_GetEventStatus(
FT_HANDLE ftHandle,
DWORD *dwEventDWord
);
FTD2XX_API
FT_STATUS WINAPI FT_ReadEE(
FT_HANDLE ftHandle,
DWORD dwWordOffset,
LPWORD lpwValue
);
FTD2XX_API
FT_STATUS WINAPI FT_WriteEE(
FT_HANDLE ftHandle,
DWORD dwWordOffset,
WORD wValue
);
FTD2XX_API
FT_STATUS WINAPI FT_EraseEE(
FT_HANDLE ftHandle
);
//
// structure to hold program data for FT_Program function
//
typedef struct ft_program_data {
DWORD Signature1; // Header - must be 0x00000000
DWORD Signature2; // Header - must be 0xffffffff
DWORD Version; // Header - FT_PROGRAM_DATA version
// 0 = original
// 1 = FT2232C extensions
// 2 = FT232R extensions
WORD VendorId; // 0x0403
WORD ProductId; // 0x6001
char *Manufacturer; // "FTDI"
char *ManufacturerId; // "FT"
char *Description; // "USB HS Serial Converter"
char *SerialNumber; // "FT000001" if fixed, or NULL
WORD MaxPower; // 0 < MaxPower <= 500
WORD PnP; // 0 = disabled, 1 = enabled
WORD SelfPowered; // 0 = bus powered, 1 = self powered
WORD RemoteWakeup; // 0 = not capable, 1 = capable
//
// Rev4 extensions
//
UCHAR Rev4; // non-zero if Rev4 chip, zero otherwise
UCHAR IsoIn; // non-zero if in endpoint is isochronous
UCHAR IsoOut; // non-zero if out endpoint is isochronous
UCHAR PullDownEnable; // non-zero if pull down enabled
UCHAR SerNumEnable; // non-zero if serial number to be used
UCHAR USBVersionEnable; // non-zero if chip uses USBVersion
WORD USBVersion; // BCD (0x0200 => USB2)
//
// FT2232C extensions
//
UCHAR Rev5; // non-zero if Rev5 chip, zero otherwise
UCHAR IsoInA; // non-zero if in endpoint is isochronous
UCHAR IsoInB; // non-zero if in endpoint is isochronous
UCHAR IsoOutA; // non-zero if out endpoint is isochronous
UCHAR IsoOutB; // non-zero if out endpoint is isochronous
UCHAR PullDownEnable5; // non-zero if pull down enabled
UCHAR SerNumEnable5; // non-zero if serial number to be used
UCHAR USBVersionEnable5; // non-zero if chip uses USBVersion
WORD USBVersion5; // BCD (0x0200 => USB2)
UCHAR AIsHighCurrent; // non-zero if interface is high current
UCHAR BIsHighCurrent; // non-zero if interface is high current
UCHAR IFAIsFifo; // non-zero if interface is 245 FIFO
UCHAR IFAIsFifoTar; // non-zero if interface is 245 FIFO CPU target
UCHAR IFAIsFastSer; // non-zero if interface is Fast serial
UCHAR AIsVCP; // non-zero if interface is to use VCP drivers
UCHAR IFBIsFifo; // non-zero if interface is 245 FIFO
UCHAR IFBIsFifoTar; // non-zero if interface is 245 FIFO CPU target
UCHAR IFBIsFastSer; // non-zero if interface is Fast serial
UCHAR BIsVCP; // non-zero if interface is to use VCP drivers
//
// FT232R extensions
//
UCHAR UseExtOsc; // Use External Oscillator
UCHAR HighDriveIOs; // High Drive I/Os
UCHAR EndpointSize; // Endpoint size
UCHAR PullDownEnableR; // non-zero if pull down enabled
UCHAR SerNumEnableR; // non-zero if serial number to be used
UCHAR InvertTXD; // non-zero if invert TXD
UCHAR InvertRXD; // non-zero if invert RXD
UCHAR InvertRTS; // non-zero if invert RTS
UCHAR InvertCTS; // non-zero if invert CTS
UCHAR InvertDTR; // non-zero if invert DTR
UCHAR InvertDSR; // non-zero if invert DSR
UCHAR InvertDCD; // non-zero if invert DCD
UCHAR InvertRI; // non-zero if invert RI
UCHAR Cbus0; // Cbus Mux control
UCHAR Cbus1; // Cbus Mux control
UCHAR Cbus2; // Cbus Mux control
UCHAR Cbus3; // Cbus Mux control
UCHAR Cbus4; // Cbus Mux control
UCHAR RIsVCP; // non-zero if using VCP drivers
} FT_PROGRAM_DATA, *PFT_PROGRAM_DATA;
FTD2XX_API
FT_STATUS WINAPI FT_EE_Program(
FT_HANDLE ftHandle,
PFT_PROGRAM_DATA pData
);
FTD2XX_API
FT_STATUS WINAPI FT_EE_ProgramEx(
FT_HANDLE ftHandle,
PFT_PROGRAM_DATA pData,
char *Manufacturer,
char *ManufacturerId,
char *Description,
char *SerialNumber
);
FTD2XX_API
FT_STATUS WINAPI FT_EE_Read(
FT_HANDLE ftHandle,
PFT_PROGRAM_DATA pData
);
FTD2XX_API
FT_STATUS WINAPI FT_EE_ReadEx(
FT_HANDLE ftHandle,
PFT_PROGRAM_DATA pData,
char *Manufacturer,
char *ManufacturerId,
char *Description,
char *SerialNumber
);
FTD2XX_API
FT_STATUS WINAPI FT_EE_UASize(
FT_HANDLE ftHandle,
LPDWORD lpdwSize
);
FTD2XX_API
FT_STATUS WINAPI FT_EE_UAWrite(
FT_HANDLE ftHandle,
PUCHAR pucData,
DWORD dwDataLen
);
FTD2XX_API
FT_STATUS WINAPI FT_EE_UARead(
FT_HANDLE ftHandle,
PUCHAR pucData,
DWORD dwDataLen,
LPDWORD lpdwBytesRead
);
FTD2XX_API
FT_STATUS WINAPI FT_SetLatencyTimer(
FT_HANDLE ftHandle,
UCHAR ucLatency
);
FTD2XX_API
FT_STATUS WINAPI FT_GetLatencyTimer(
FT_HANDLE ftHandle,
PUCHAR pucLatency
);
FTD2XX_API
FT_STATUS WINAPI FT_SetBitMode(
FT_HANDLE ftHandle,
UCHAR ucMask,
UCHAR ucEnable
);
FTD2XX_API
FT_STATUS WINAPI FT_GetBitMode(
FT_HANDLE ftHandle,
PUCHAR pucMode
);
FTD2XX_API
FT_STATUS WINAPI FT_SetUSBParameters(
FT_HANDLE ftHandle,
ULONG ulInTransferSize,
ULONG ulOutTransferSize
);
FTD2XX_API
FT_STATUS WINAPI FT_SetDeadmanTimeout(
FT_HANDLE ftHandle,
ULONG ulDeadmanTimeout
);
FTD2XX_API
FT_STATUS WINAPI FT_GetDeviceInfo(
FT_HANDLE ftHandle,
FT_DEVICE *lpftDevice,
LPDWORD lpdwID,
PCHAR SerialNumber,
PCHAR Description,
LPVOID Dummy
);
FTD2XX_API
FT_STATUS WINAPI FT_StopInTask(
FT_HANDLE ftHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_RestartInTask(
FT_HANDLE ftHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_SetResetPipeRetryCount(
FT_HANDLE ftHandle,
DWORD dwCount
);
FTD2XX_API
FT_STATUS WINAPI FT_ResetPort(
FT_HANDLE ftHandle
);
FTD2XX_API
FT_STATUS WINAPI FT_CyclePort(
FT_HANDLE ftHandle
);
//
// Win32-type functions
//
FTD2XX_API
FT_HANDLE WINAPI FT_W32_CreateFile(
LPCSTR lpszName,
DWORD dwAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreate,
DWORD dwAttrsAndFlags,
HANDLE hTemplate
);
FTD2XX_API
BOOL WINAPI FT_W32_CloseHandle(
FT_HANDLE ftHandle
);
FTD2XX_API
BOOL WINAPI FT_W32_ReadFile(
FT_HANDLE ftHandle,
LPVOID lpBuffer,
DWORD nBufferSize,
LPDWORD lpBytesReturned,
LPOVERLAPPED lpOverlapped
);
FTD2XX_API
BOOL WINAPI FT_W32_WriteFile(
FT_HANDLE ftHandle,
LPVOID lpBuffer,
DWORD nBufferSize,
LPDWORD lpBytesWritten,
LPOVERLAPPED lpOverlapped
);
FTD2XX_API
DWORD WINAPI FT_W32_GetLastError(
FT_HANDLE ftHandle
);
FTD2XX_API
BOOL WINAPI FT_W32_GetOverlappedResult(
FT_HANDLE ftHandle,
LPOVERLAPPED lpOverlapped,
LPDWORD lpdwBytesTransferred,
BOOL bWait
);
FTD2XX_API
BOOL WINAPI FT_W32_CancelIo(
FT_HANDLE ftHandle
);
//
// Win32 COMM API type functions
//
typedef struct _FTCOMSTAT {
DWORD fCtsHold : 1;
DWORD fDsrHold : 1;
DWORD fRlsdHold : 1;
DWORD fXoffHold : 1;
DWORD fXoffSent : 1;
DWORD fEof : 1;
DWORD fTxim : 1;
DWORD fReserved : 25;
DWORD cbInQue;
DWORD cbOutQue;
} FTCOMSTAT, *LPFTCOMSTAT;
typedef struct _FTDCB {
DWORD DCBlength; /* sizeof(FTDCB) */
DWORD BaudRate; /* Baudrate at which running */
DWORD fBinary: 1; /* Binary Mode (skip EOF check) */
DWORD fParity: 1; /* Enable parity checking */
DWORD fOutxCtsFlow:1; /* CTS handshaking on output */
DWORD fOutxDsrFlow:1; /* DSR handshaking on output */
DWORD fDtrControl:2; /* DTR Flow control */
DWORD fDsrSensitivity:1; /* DSR Sensitivity */
DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */
DWORD fOutX: 1; /* Enable output X-ON/X-OFF */
DWORD fInX: 1; /* Enable input X-ON/X-OFF */
DWORD fErrorChar: 1; /* Enable Err Replacement */
DWORD fNull: 1; /* Enable Null stripping */
DWORD fRtsControl:2; /* Rts Flow control */
DWORD fAbortOnError:1; /* Abort all reads and writes on Error */
DWORD fDummy2:17; /* Reserved */
WORD wReserved; /* Not currently used */
WORD XonLim; /* Transmit X-ON threshold */
WORD XoffLim; /* Transmit X-OFF threshold */
BYTE ByteSize; /* Number of bits/byte, 4-8 */
BYTE Parity; /* 0-4=None,Odd,Even,Mark,Space */
BYTE StopBits; /* 0,1,2 = 1, 1.5, 2 */
char XonChar; /* Tx and Rx X-ON character */
char XoffChar; /* Tx and Rx X-OFF character */
char ErrorChar; /* Error replacement char */
char EofChar; /* End of Input character */
char EvtChar; /* Received Event character */
WORD wReserved1; /* Fill for now. */
} FTDCB, *LPFTDCB;
typedef struct _FTTIMEOUTS {
DWORD ReadIntervalTimeout; /* Maximum time between read chars. */
DWORD ReadTotalTimeoutMultiplier; /* Multiplier of characters. */
DWORD ReadTotalTimeoutConstant; /* Constant in milliseconds. */
DWORD WriteTotalTimeoutMultiplier; /* Multiplier of characters. */
DWORD WriteTotalTimeoutConstant; /* Constant in milliseconds. */
} FTTIMEOUTS,*LPFTTIMEOUTS;
FTD2XX_API
BOOL WINAPI FT_W32_ClearCommBreak(
FT_HANDLE ftHandle
);
FTD2XX_API
BOOL WINAPI FT_W32_ClearCommError(
FT_HANDLE ftHandle,
LPDWORD lpdwErrors,
LPFTCOMSTAT lpftComstat
);
FTD2XX_API
BOOL WINAPI FT_W32_EscapeCommFunction(
FT_HANDLE ftHandle,
DWORD dwFunc
);
FTD2XX_API
BOOL WINAPI FT_W32_GetCommModemStatus(
FT_HANDLE ftHandle,
LPDWORD lpdwModemStatus
);
FTD2XX_API
BOOL WINAPI FT_W32_GetCommState(
FT_HANDLE ftHandle,
LPFTDCB lpftDcb
);
FTD2XX_API
BOOL WINAPI FT_W32_GetCommTimeouts(
FT_HANDLE ftHandle,
FTTIMEOUTS *pTimeouts
);
FTD2XX_API
BOOL WINAPI FT_W32_PurgeComm(
FT_HANDLE ftHandle,
DWORD dwMask
);
FTD2XX_API
BOOL WINAPI FT_W32_SetCommBreak(
FT_HANDLE ftHandle
);
FTD2XX_API
BOOL WINAPI FT_W32_SetCommMask(
FT_HANDLE ftHandle,
ULONG ulEventMask
);
FTD2XX_API
BOOL WINAPI FT_W32_SetCommState(
FT_HANDLE ftHandle,
LPFTDCB lpftDcb
);
FTD2XX_API
BOOL WINAPI FT_W32_SetCommTimeouts(
FT_HANDLE ftHandle,
FTTIMEOUTS *pTimeouts
);
FTD2XX_API
BOOL WINAPI FT_W32_SetupComm(
FT_HANDLE ftHandle,
DWORD dwReadBufferSize,
DWORD dwWriteBufferSize
);
FTD2XX_API
BOOL WINAPI FT_W32_WaitCommEvent(
FT_HANDLE ftHandle,
PULONG pulEvent,
LPOVERLAPPED lpOverlapped
);
//
// Device information
//
typedef struct _ft_device_list_info_node {
ULONG Flags;
ULONG Type;
ULONG ID;
DWORD LocId;
char SerialNumber[16];
char Description[64];
FT_HANDLE ftHandle;
} FT_DEVICE_LIST_INFO_NODE;
FTD2XX_API
FT_STATUS WINAPI FT_CreateDeviceInfoList(
LPDWORD lpdwNumDevs
);
FTD2XX_API
FT_STATUS WINAPI FT_GetDeviceInfoList(
FT_DEVICE_LIST_INFO_NODE *pDest,
LPDWORD lpdwNumDevs
);
FTD2XX_API
FT_STATUS WINAPI FT_GetDeviceInfoDetail(
DWORD dwIndex,
LPDWORD lpdwFlags,
LPDWORD lpdwType,
LPDWORD lpdwID,
LPDWORD lpdwLocId,
LPVOID lpSerialNumber,
LPVOID lpDescription,
FT_HANDLE *pftHandle
);
//
// Version information
//
FTD2XX_API
FT_STATUS WINAPI FT_GetDriverVersion(
FT_HANDLE ftHandle,
LPDWORD lpdwVersion
);
FTD2XX_API
FT_STATUS WINAPI FT_GetLibraryVersion(
LPDWORD lpdwVersion
);
#ifdef __cplusplus
}
#endif
#endif /* FTD2XX_H */

View File

@ -1,88 +0,0 @@
; FTDIBUS.INF
; Copyright (c) 2000-2006 FTDI Ltd.
;
; USB serial converter driver installation for Windows 2000 and XP.
;
[Version]
Signature="$Windows NT$"
DriverPackageType=PlugAndPlay
DriverPackageDisplayName=%DESC%
Class=USB
ClassGUID={36fc9e60-c465-11cf-8056-444553540000}
Provider=%FTDI%
CatalogFile=ftdibus.cat
DriverVer=05/19/2006,2.00.00
[SourceDisksNames]
1=%DriversDisk%,,,
[SourceDisksFiles]
ftdibus.sys = 1
ftdiunin.exe = 1
ftdiun2k.ini = 1
ftbusui.dll = 1
ftd2xx.dll = 1
[DestinationDirs]
FtdiBus.NT.Copy = 10,system32\drivers
FtdiBus.NT.Copy2 = 10,system32
[Manufacturer]
%Ftdi%=FtdiHw
[FtdiHw]
%USB\VID_0403&PID_6001.DeviceDesc%=FtdiBus,USB\VID_0403&PID_6001
%USB\VID_0403&PID_6010&MI_00.DeviceDesc%=FtdiBus,USB\VID_0403&PID_6010&MI_00
%USB\VID_0403&PID_6010&MI_01.DeviceDesc%=FtdiBus,USB\VID_0403&PID_6010&MI_01
[ControlFlags]
ExcludeFromSelect=*
[FtdiBus.NT]
CopyFiles=FtdiBus.NT.Copy,FtdiBus.NT.Copy2
AddReg=FtdiBus.NT.AddReg,FtdiBusUnInst.NT.Reg
[FtdiBus.NT.Services]
AddService = FTDIBUS, 0x00000002, FtdiBus.NT.AddService
[FtdiBus.NT.AddService]
DisplayName = %SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\system32\drivers\ftdibus.sys
LoadOrderGroup = Base
[FtdiBus.NT.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,ftdibus.sys
HKR,,EnumPropPages32,,"ftbusui.dll,FTBUSUIPropPageProvider"
[FtdiBus.NT.Copy]
ftdibus.sys
[FtdiBus.NT.Copy2]
ftdiunin.exe
ftdiun2k.ini
ftbusui.dll
ftd2xx.dll
[FtdiBusUnInst.NT.Reg]
HKLM,%WINUN%,"FTDICOMM"
HKLM,%WINUN%\FTDICOMM , "UninstallString",,"%11%\ftdiunin.exe %11%\ftdiun2k.ini"
HKLM,%WINUN%\FTDICOMM , "DisplayName",,"FTDI USB Serial Converter Drivers"
HKLM,%WINUN%\FTDICOMM , "URLInfoAbout",,"http://www.ftdichip.com"
HKLM,%WINUN%\FTDICOMM , "Publisher",,"FTDI Ltd"
HKLM,%WINUN%\FTDICOMM , "DisplayVersion",,"2.00.00"
[Strings]
Ftdi="FTDI"
DESC="CDM Driver Package"
DriversDisk="FTDI USB Drivers Disk"
USB\VID_0403&PID_6001.DeviceDesc="USB Serial Converter"
USB\VID_0403&PID_6010&MI_00.DeviceDesc="USB Serial Converter A"
USB\VID_0403&PID_6010&MI_01.DeviceDesc="USB Serial Converter B"
WINUN="Software\Microsoft\Windows\CurrentVersion\Uninstall"
SvcDesc="USB Serial Converter Driver"
ClassName="USB"

View File

@ -1,127 +0,0 @@
; FTDIPORT.INF
; Copyright (c) 2000-2006 FTDI Ltd.
;
; USB serial port driver installation for Windows 2000 and XP.
;
[Version]
Signature="$Windows NT$"
DriverPackageType=PlugAndPlay
DriverPackageDisplayName=%DESC%
Class=Ports
ClassGUID={4d36e978-e325-11ce-bfc1-08002be10318}
Provider=%FTDI%
CatalogFile=ftdiport.cat
DriverVer=05/19/2006,2.00.00
[SourceDisksNames]
1=%DriversDisk%,,,
[SourceDisksFiles]
ftser2k.sys=1
ftserui2.dll=1
FTLang.Dll = 1
ftcserco.dll = 1
[DestinationDirs]
FtdiPort.NT.Copy=10,system32\drivers
FtdiPort.NT.CopyUI=10,system32
FtdiPort2232.NT.CopyCoInst=10,system32
[ControlFlags]
ExcludeFromSelect=*
[Manufacturer]
%FTDI%=FtdiHw
[FtdiHw]
%VID_0403&PID_6001.DeviceDesc%=FtdiPort232,FTDIBUS\COMPORT&VID_0403&PID_6001
%VID_0403&PID_6010.DeviceDesc%=FtdiPort2232,FTDIBUS\COMPORT&VID_0403&PID_6010
[FtdiPort.NT.AddService]
DisplayName = %SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\system32\drivers\ftser2k.sys
LoadOrderGroup = Base
; -------------- Serenum Driver install section
[SerEnum_AddService]
DisplayName = %SerEnum.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\serenum.sys
LoadOrderGroup = PNP Filter
[FtdiPort.NT.AddReg]
HKR,,EnumPropPages32,,"ftserui2.dll,SerialPortPropPageProvider"
[FtdiPort.NT.Copy]
ftser2k.sys
;serenum.sys
[FtdiPort.NT.CopyUI]
ftserui2.dll
FTLang.dll
[FtdiPort232.NT]
CopyFiles=FtdiPort.NT.Copy,FtdiPort.NT.CopyUI
AddReg=FtdiPort.NT.AddReg
[FtdiPort232.NT.HW]
AddReg=FtdiPort232.NT.HW.AddReg
[FtdiPort232.NT.Services]
AddService = FTSER2K, 0x00000002, FtdiPort.NT.AddService
AddService = Serenum,,SerEnum_AddService
DelService = FTSERIAL
[FtdiPort232.NT.HW.AddReg]
HKR,,"UpperFilters",0x00010000,"serenum"
;HKR,,"ConfigData",1,01,00,3F,3F,10,27,88,13,C4,09,E2,04,71,02,38,41,9c,80,4E,C0,34,00,1A,00,0D,00,06,40,03,80,00,00,d0,80
HKR,,"ConfigData",1,11,00,3F,3F,10,27,00,00,88,13,00,00,C4,09,00,00,E2,04,00,00,71,02,00,00,38,41,00,00,9C,80,00,00,4E,C0,00,00,34,00,00,00,1A,00,00,00,0D,00,00,00,06,40,00,00,03,80,00,00,00,00,00,00,D0,80,00,00
HKR,,"MinReadTimeout",0x00010001,0
HKR,,"MinWriteTimeout",0x00010001,0
HKR,,"LatencyTimer",0x00010001,16
; -------
; FT2232C
; -------
[FtdiPort2232.NT]
CopyFiles=FtdiPort.NT.Copy,FtdiPort.NT.CopyUI
AddReg=FtdiPort.NT.AddReg
[FtdiPort2232.NT.HW]
AddReg=FtdiPort232.NT.HW.AddReg
[FtdiPort2232.NT.CoInstallers]
AddReg=FtdiPort2232.NT.CoInstallers.AddReg
CopyFiles=FtdiPort2232.NT.CopyCoInst
[FtdiPort2232.NT.Services]
AddService = FTSER2K, 0x00000002, FtdiPort.NT.AddService
AddService = Serenum,,SerEnum_AddService
DelService = FTSERIAL
[FtdiPort2232.NT.CoInstallers.AddReg]
HKR,,CoInstallers32,0x00010000,"ftcserco.Dll,FTCSERCoInstaller"
[FtdiPort2232.NT.CopyCoInst]
ftcserco.dll
;---------------------------------------------------------------;
[Strings]
FTDI="FTDI"
DESC="CDM Driver Package"
DriversDisk="FTDI USB Drivers Disk"
PortsClassName = "Ports (COM & LPT)"
VID_0403&PID_6001.DeviceDesc="USB Serial Port"
VID_0403&PID_6010.DeviceDesc="USB Serial Port"
SvcDesc="USB Serial Port Driver"
SerEnum.SvcDesc="Serenum Filter Driver"

View File

@ -1,6 +0,0 @@
[Uninstall]
Device=VID_0403&PID_6001,VID_0403&PID_6010
Converter=FTDIBUS
Serial=FTSER2K
InfFiles=FTDIBUS,FTDIPORT
Key=FTDICOMM

View File

@ -1,7 +0,0 @@
[DEFAULT]
BASEURL=http://www.ftdichip.com/Documents/InstallGuides.htm
[InternetShortcut]
URL=http://www.ftdichip.com/Documents/InstallGuides.htm
Modified=606147754AF7C50184
IconFile=C:\WINNT\system32\url.dll
IconIndex=0

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
build/windows/dist/drivers/FTDI USB Drivers/ftdibus.cat vendored Executable file → Normal file

Binary file not shown.

View File

@ -0,0 +1,153 @@
; FTDIBUS.INF
;
; Copyright <20> 2000-2011 Future Technology Devices International Limited
;
; USB serial converter driver installation file for Windows 2000, XP, Server 2003, Vista, Server 2008,
; Windows 7 and Server 2008 R2 (x86 and x64).
;
;
; THIS SOFTWARE IS PROVIDED BY FUTURE TECHNOLOGY DEVICES INTERNATIONAL LIMITED ``AS IS'' AND ANY EXPRESS
; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
; FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FUTURE TECHNOLOGY DEVICES INTERNATIONAL LIMITED
; BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
; THE POSSIBILITY OF SUCH DAMAGE.
; FTDI DRIVERS MAY BE USED ONLY IN CONJUNCTION WITH PRODUCTS BASED ON FTDI PARTS.
; FTDI DRIVERS MAY BE DISTRIBUTED IN ANY FORM AS LONG AS LICENSE INFORMATION IS NOT MODIFIED.
; IF A CUSTOM VENDOR ID AND/OR PRODUCT ID OR DESCRIPTION STRING ARE USED, IT IS THE RESPONSIBILITY OF
; THE PRODUCT MANUFACTURER TO MAINTAIN ANY CHANGES AND SUBSEQUENT WHQL RE-CERTIFICATION AS A RESULT OF
; MAKING THESE CHANGES.
;
[Version]
Signature="$Windows NT$"
DriverPackageType=PlugAndPlay
DriverPackageDisplayName=%DESC%
Class=USB
ClassGUID={36fc9e60-c465-11cf-8056-444553540000}
Provider=%FTDI%
CatalogFile=ftdibus.cat
DriverVer=03/18/2011,2.08.14
[SourceDisksNames]
1=%DriversDisk%,,,
[SourceDisksFiles]
ftdibus.sys = 1,i386
ftbusui.dll = 1,i386
ftd2xx.dll = 1,i386
FTLang.Dll = 1,i386
[SourceDisksFiles.amd64]
ftdibus.sys = 1,amd64
ftbusui.dll = 1,amd64
ftd2xx64.dll = 1,amd64
ftd2xx.dll = 1,i386
FTLang.Dll = 1,amd64
[DestinationDirs]
FtdiBus.NT.Copy = 10,system32\drivers
FtdiBus.NT.Copy2 = 10,system32
FtdiBus.NTamd64.Copy = 10,system32\drivers
FtdiBus.NTamd64.Copy2 = 10,system32
FtdiBus.NTamd64.Copy3 = 10,syswow64
[Manufacturer]
%Ftdi%=FtdiHw,NTamd64
[FtdiHw]
%USB\VID_0403&PID_6001.DeviceDesc%=FtdiBus.NT,USB\VID_0403&PID_6001
%USB\VID_0403&PID_6010&MI_00.DeviceDesc%=FtdiBus.NT,USB\VID_0403&PID_6010&MI_00
%USB\VID_0403&PID_6010&MI_01.DeviceDesc%=FtdiBus.NT,USB\VID_0403&PID_6010&MI_01
%USB\VID_0403&PID_6011&MI_00.DeviceDesc%=FtdiBus.NT,USB\VID_0403&PID_6011&MI_00
%USB\VID_0403&PID_6011&MI_01.DeviceDesc%=FtdiBus.NT,USB\VID_0403&PID_6011&MI_01
%USB\VID_0403&PID_6011&MI_02.DeviceDesc%=FtdiBus.NT,USB\VID_0403&PID_6011&MI_02
%USB\VID_0403&PID_6011&MI_03.DeviceDesc%=FtdiBus.NT,USB\VID_0403&PID_6011&MI_03
%USB\VID_0403&PID_6014.DeviceDesc%=FtdiBus.NT,USB\VID_0403&PID_6014
[FtdiHw.NTamd64]
%USB\VID_0403&PID_6001.DeviceDesc%=FtdiBus.NTamd64,USB\VID_0403&PID_6001
%USB\VID_0403&PID_6010&MI_00.DeviceDesc%=FtdiBus.NTamd64,USB\VID_0403&PID_6010&MI_00
%USB\VID_0403&PID_6010&MI_01.DeviceDesc%=FtdiBus.NTamd64,USB\VID_0403&PID_6010&MI_01
%USB\VID_0403&PID_6011&MI_00.DeviceDesc%=FtdiBus.NTamd64,USB\VID_0403&PID_6011&MI_00
%USB\VID_0403&PID_6011&MI_01.DeviceDesc%=FtdiBus.NTamd64,USB\VID_0403&PID_6011&MI_01
%USB\VID_0403&PID_6011&MI_02.DeviceDesc%=FtdiBus.NTamd64,USB\VID_0403&PID_6011&MI_02
%USB\VID_0403&PID_6011&MI_03.DeviceDesc%=FtdiBus.NTamd64,USB\VID_0403&PID_6011&MI_03
%USB\VID_0403&PID_6014.DeviceDesc%=FtdiBus.NTamd64,USB\VID_0403&PID_6014
[ControlFlags]
ExcludeFromSelect=*
[FtdiBus.NT]
CopyFiles=FtdiBus.NT.Copy,FtdiBus.NT.Copy2
AddReg=FtdiBus.NT.AddReg
[FtdiBus.NTamd64]
CopyFiles=FtdiBus.NTamd64.Copy,FtdiBus.NTamd64.Copy2,FtdiBus.NTamd64.Copy3
AddReg=FtdiBus.NT.AddReg
[FtdiBus.NT.Services]
AddService = FTDIBUS, 0x00000002, FtdiBus.NT.AddService
[FtdiBus.NTamd64.Services]
AddService = FTDIBUS, 0x00000002, FtdiBus.NT.AddService
[FtdiBus.NT.AddService]
DisplayName = %SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\system32\drivers\ftdibus.sys
LoadOrderGroup = Base
AddReg = FtdiBus.NT.AddService.AddReg
[FtdiBus.NT.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,ftdibus.sys
HKR,,EnumPropPages32,,"ftbusui.dll,FTBUSUIPropPageProvider"
[FtdiBus.NT.AddService.AddReg]
;HKR,Parameters,"LocIds",1,31,00,00,00,32,00,00,00,00
;HKR,Parameters,"RetryResetCount",0x10001,50
[FtdiBus.NT.Copy]
ftdibus.sys
[FtdiBus.NT.Copy2]
ftbusui.dll
ftd2xx.dll
FTLang.dll
[FtdiBus.NTamd64.Copy]
ftdibus.sys
[FtdiBus.NTamd64.Copy2]
ftbusui.dll
ftd2xx.dll,ftd2xx64.dll
FTLang.dll
[FtdiBus.NTamd64.Copy3]
ftd2xx.dll
[Strings]
Ftdi="FTDI"
DESC="CDM Driver Package - Bus/D2XX Driver"
DriversDisk="FTDI USB Drivers Disk"
USB\VID_0403&PID_6001.DeviceDesc="USB Serial Converter"
USB\VID_0403&PID_6010&MI_00.DeviceDesc="USB Serial Converter A"
USB\VID_0403&PID_6010&MI_01.DeviceDesc="USB Serial Converter B"
USB\VID_0403&PID_6011&MI_00.DeviceDesc="USB Serial Converter A"
USB\VID_0403&PID_6011&MI_01.DeviceDesc="USB Serial Converter B"
USB\VID_0403&PID_6011&MI_02.DeviceDesc="USB Serial Converter C"
USB\VID_0403&PID_6011&MI_03.DeviceDesc="USB Serial Converter D"
USB\VID_0403&PID_6014.DeviceDesc="USB Serial Converter"
SvcDesc="USB Serial Converter Driver"
ClassName="USB"

BIN
build/windows/dist/drivers/FTDI USB Drivers/ftdiport.cat vendored Executable file → Normal file

Binary file not shown.

View File

@ -0,0 +1,164 @@
; FTDIPORT.INF
;
; Copyright <20> 2000-2011 Future Technology Devices International Limited
;
; USB serial port driver installation file for Windows 2000, XP, Server 2003, Vista, Server 2008,
; Windows 7 and Server 2008 R2 (x86 and x64).
;
;
; THIS SOFTWARE IS PROVIDED BY FUTURE TECHNOLOGY DEVICES INTERNATIONAL LIMITED ``AS IS'' AND ANY EXPRESS
; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
; FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FUTURE TECHNOLOGY DEVICES INTERNATIONAL LIMITED
; BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
; THE POSSIBILITY OF SUCH DAMAGE.
; FTDI DRIVERS MAY BE USED ONLY IN CONJUNCTION WITH PRODUCTS BASED ON FTDI PARTS.
; FTDI DRIVERS MAY BE DISTRIBUTED IN ANY FORM AS LONG AS LICENSE INFORMATION IS NOT MODIFIED.
; IF A CUSTOM VENDOR ID AND/OR PRODUCT ID OR DESCRIPTION STRING ARE USED, IT IS THE RESPONSIBILITY OF
; THE PRODUCT MANUFACTURER TO MAINTAIN ANY CHANGES AND SUBSEQUENT WHQL RE-CERTIFICATION AS A RESULT OF
; MAKING THESE CHANGES.
;
[Version]
Signature="$Windows NT$"
DriverPackageType=PlugAndPlay
DriverPackageDisplayName=%DESC%
Class=Ports
ClassGUID={4d36e978-e325-11ce-bfc1-08002be10318}
Provider=%FTDI%
CatalogFile=ftdiport.cat
DriverVer=03/18/2011,2.08.14
[SourceDisksNames]
1=%DriversDisk%,,,
[SourceDisksFiles]
ftser2k.sys=1,i386
ftserui2.dll=1,i386
ftcserco.dll = 1,i386
[SourceDisksFiles.amd64]
ftser2k.sys=1,amd64
ftserui2.dll=1,amd64
ftcserco.dll = 1,amd64
[DestinationDirs]
FtdiPort.NT.Copy=10,system32\drivers
FtdiPort.NT.CopyUI=10,system32
FtdiPort.NT.CopyCoInst=10,system32
[ControlFlags]
ExcludeFromSelect=*
[Manufacturer]
%FTDI%=FtdiHw,NTamd64
[FtdiHw]
%VID_0403&PID_6001.DeviceDesc%=FtdiPort.NT,FTDIBUS\COMPORT&VID_0403&PID_6001
%VID_0403&PID_6010.DeviceDesc%=FtdiPort.NT,FTDIBUS\COMPORT&VID_0403&PID_6010
%VID_0403&PID_6011.DeviceDesc%=FtdiPort.NT,FTDIBUS\COMPORT&VID_0403&PID_6011
%VID_0403&PID_6014.DeviceDesc%=FtdiPort.NT,FTDIBUS\COMPORT&VID_0403&PID_6014
[FtdiHw.NTamd64]
%VID_0403&PID_6001.DeviceDesc%=FtdiPort.NTamd64,FTDIBUS\COMPORT&VID_0403&PID_6001
%VID_0403&PID_6010.DeviceDesc%=FtdiPort.NTamd64,FTDIBUS\COMPORT&VID_0403&PID_6010
%VID_0403&PID_6011.DeviceDesc%=FtdiPort.NTamd64,FTDIBUS\COMPORT&VID_0403&PID_6011
%VID_0403&PID_6014.DeviceDesc%=FtdiPort.NTamd64,FTDIBUS\COMPORT&VID_0403&PID_6014
[FtdiPort.NT.AddService]
DisplayName = %SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\system32\drivers\ftser2k.sys
LoadOrderGroup = Base
; -------------- Serenum Driver install section
[SerEnum_AddService]
DisplayName = %SerEnum.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\serenum.sys
LoadOrderGroup = PNP Filter
[FtdiPort.NT.AddReg]
HKR,,EnumPropPages32,,"ftserui2.dll,SerialPortPropPageProvider"
[FtdiPort.NT.Copy]
ftser2k.sys
[FtdiPort.NT.CopyUI]
ftserui2.dll
[FtdiPort.NT.CopyCoInst]
ftcserco.dll
[FtdiPort.NT]
CopyFiles=FtdiPort.NT.Copy,FtdiPort.NT.CopyUI
AddReg=FtdiPort.NT.AddReg
[FtdiPort.NTamd64]
CopyFiles=FtdiPort.NT.Copy,FtdiPort.NT.CopyUI
AddReg=FtdiPort.NT.AddReg
[FtdiPort.NT.HW]
AddReg=FtdiPort.NT.HW.AddReg
[FtdiPort.NTamd64.HW]
AddReg=FtdiPort.NT.HW.AddReg
[FtdiPort.NT.Services]
AddService = FTSER2K, 0x00000002, FtdiPort.NT.AddService
AddService = Serenum,,SerEnum_AddService
DelService = FTSERIAL
[FtdiPort.NTamd64.Services]
AddService = FTSER2K, 0x00000002, FtdiPort.NT.AddService
AddService = Serenum,,SerEnum_AddService
DelService = FTSERIAL
[FtdiPort.NT.HW.AddReg]
HKR,,"UpperFilters",0x00010000,"serenum"
HKR,,"ConfigData",1,11,00,3F,3F,10,27,00,00,88,13,00,00,C4,09,00,00,E2,04,00,00,71,02,00,00,38,41,00,00,9C,80,00,00,4E,C0,00,00,34,00,00,00,1A,00,00,00,0D,00,00,00,06,40,00,00,03,80,00,00,00,00,00,00,D0,80,00,00
HKR,,"MinReadTimeout",0x00010001,0
HKR,,"MinWriteTimeout",0x00010001,0
HKR,,"LatencyTimer",0x00010001,16
[FtdiPort.NT.CoInstallers]
AddReg=FtdiPort.NT.CoInstallers.AddReg
CopyFiles=FtdiPort.NT.CopyCoInst
[FtdiPort.NTamd64.CoInstallers]
AddReg=FtdiPort.NT.CoInstallers.AddReg
CopyFiles=FtdiPort.NT.CopyCoInst
[FtdiPort.NT.CoInstallers.AddReg]
HKR,,CoInstallers32,0x00010000,"ftcserco.Dll,FTCSERCoInstaller"
;---------------------------------------------------------------;
[Strings]
FTDI="FTDI"
DESC="CDM Driver Package - VCP Driver"
DriversDisk="FTDI USB Drivers Disk"
PortsClassName = "Ports (COM & LPT)"
VID_0403&PID_6001.DeviceDesc="USB Serial Port"
VID_0403&PID_6010.DeviceDesc="USB Serial Port"
VID_0403&PID_6011.DeviceDesc="USB Serial Port"
VID_0403&PID_6014.DeviceDesc="USB Serial Port"
SvcDesc="USB Serial Port Driver"
SerEnum.SvcDesc="Serenum Filter Driver"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 KiB

After

Width:  |  Height:  |  Size: 457 KiB

View File

@ -14,10 +14,11 @@ uno.bootloader.lock_bits=0x0F
uno.build.mcu=atmega328p uno.build.mcu=atmega328p
uno.build.f_cpu=16000000L uno.build.f_cpu=16000000L
uno.build.core=arduino uno.build.core=arduino
uno.build.variant=standard
############################################################## ##############################################################
atmega328.name=Arduino Duemilanove or Nano w/ ATmega328 atmega328.name=Arduino Duemilanove w/ ATmega328
atmega328.upload.protocol=stk500 atmega328.upload.protocol=stk500
atmega328.upload.maximum_size=30720 atmega328.upload.maximum_size=30720
@ -34,10 +35,11 @@ atmega328.bootloader.lock_bits=0x0F
atmega328.build.mcu=atmega328p atmega328.build.mcu=atmega328p
atmega328.build.f_cpu=16000000L atmega328.build.f_cpu=16000000L
atmega328.build.core=arduino atmega328.build.core=arduino
atmega328.build.variant=standard
############################################################## ##############################################################
diecimila.name=Arduino Diecimila, Duemilanove, or Nano w/ ATmega168 diecimila.name=Arduino Diecimila or Duemilanove w/ ATmega168
diecimila.upload.protocol=stk500 diecimila.upload.protocol=stk500
diecimila.upload.maximum_size=14336 diecimila.upload.maximum_size=14336
@ -54,6 +56,49 @@ diecimila.bootloader.lock_bits=0x0F
diecimila.build.mcu=atmega168 diecimila.build.mcu=atmega168
diecimila.build.f_cpu=16000000L diecimila.build.f_cpu=16000000L
diecimila.build.core=arduino diecimila.build.core=arduino
diecimila.build.variant=standard
##############################################################
nano328.name=Arduino Nano w/ ATmega328
nano328.upload.protocol=stk500
nano328.upload.maximum_size=30720
nano328.upload.speed=57600
nano328.bootloader.low_fuses=0xFF
nano328.bootloader.high_fuses=0xDA
nano328.bootloader.extended_fuses=0x05
nano328.bootloader.path=atmega
nano328.bootloader.file=ATmegaBOOT_168_atmega328.hex
nano328.bootloader.unlock_bits=0x3F
nano328.bootloader.lock_bits=0x0F
nano328.build.mcu=atmega328p
nano328.build.f_cpu=16000000L
nano328.build.core=arduino
nano328.build.variant=eightanaloginputs
##############################################################
nano.name=Arduino Nano w/ ATmega168
nano.upload.protocol=stk500
nano.upload.maximum_size=14336
nano.upload.speed=19200
nano.bootloader.low_fuses=0xff
nano.bootloader.high_fuses=0xdd
nano.bootloader.extended_fuses=0x00
nano.bootloader.path=atmega
nano.bootloader.file=ATmegaBOOT_168_diecimila.hex
nano.bootloader.unlock_bits=0x3F
nano.bootloader.lock_bits=0x0F
nano.build.mcu=atmega168
nano.build.f_cpu=16000000L
nano.build.core=arduino
nano.build.variant=eightanaloginputs
############################################################## ##############################################################
@ -74,6 +119,7 @@ mega2560.bootloader.lock_bits=0x0F
mega2560.build.mcu=atmega2560 mega2560.build.mcu=atmega2560
mega2560.build.f_cpu=16000000L mega2560.build.f_cpu=16000000L
mega2560.build.core=arduino mega2560.build.core=arduino
mega2560.build.variant=mega
############################################################## ##############################################################
@ -94,6 +140,7 @@ mega.bootloader.lock_bits=0x0F
mega.build.mcu=atmega1280 mega.build.mcu=atmega1280
mega.build.f_cpu=16000000L mega.build.f_cpu=16000000L
mega.build.core=arduino mega.build.core=arduino
mega.build.variant=mega
############################################################## ##############################################################
@ -114,6 +161,7 @@ mini.bootloader.lock_bits=0x0F
mini.build.mcu=atmega168 mini.build.mcu=atmega168
mini.build.f_cpu=16000000L mini.build.f_cpu=16000000L
mini.build.core=arduino mini.build.core=arduino
mini.build.variant=eightanaloginputs
############################################################## ##############################################################
@ -133,7 +181,8 @@ fio.bootloader.lock_bits=0x0F
fio.build.mcu=atmega328p fio.build.mcu=atmega328p
fio.build.f_cpu=8000000L fio.build.f_cpu=8000000L
fio.build.core=arduino:arduino fio.build.core=arduino
fio.build.variant=eightanaloginputs
############################################################## ##############################################################
@ -155,6 +204,7 @@ bt328.bootloader.lock_bits=0x0F
bt328.build.mcu=atmega328p bt328.build.mcu=atmega328p
bt328.build.f_cpu=16000000L bt328.build.f_cpu=16000000L
bt328.build.core=arduino bt328.build.core=arduino
bt328.build.variant=eightanaloginputs
############################################################## ##############################################################
@ -176,6 +226,7 @@ bt.bootloader.lock_bits=0x0F
bt.build.mcu=atmega168 bt.build.mcu=atmega168
bt.build.f_cpu=16000000L bt.build.f_cpu=16000000L
bt.build.core=arduino bt.build.core=arduino
bt.build.variant=eightanaloginputs
############################################################## ##############################################################
@ -196,6 +247,7 @@ lilypad328.bootloader.lock_bits=0x0F
lilypad328.build.mcu=atmega328p lilypad328.build.mcu=atmega328p
lilypad328.build.f_cpu=8000000L lilypad328.build.f_cpu=8000000L
lilypad328.build.core=arduino lilypad328.build.core=arduino
lilypad328.build.variant=standard
############################################################## ##############################################################
@ -216,6 +268,7 @@ lilypad.bootloader.lock_bits=0x0F
lilypad.build.mcu=atmega168 lilypad.build.mcu=atmega168
lilypad.build.f_cpu=8000000L lilypad.build.f_cpu=8000000L
lilypad.build.core=arduino lilypad.build.core=arduino
lilypad.build.variant=standard
############################################################## ##############################################################
@ -236,6 +289,7 @@ pro5v328.bootloader.lock_bits=0x0F
pro5v328.build.mcu=atmega328p pro5v328.build.mcu=atmega328p
pro5v328.build.f_cpu=16000000L pro5v328.build.f_cpu=16000000L
pro5v328.build.core=arduino pro5v328.build.core=arduino
pro5v328.build.variant=standard
############################################################## ##############################################################
@ -256,6 +310,7 @@ pro5v.bootloader.lock_bits=0x0F
pro5v.build.mcu=atmega168 pro5v.build.mcu=atmega168
pro5v.build.f_cpu=16000000L pro5v.build.f_cpu=16000000L
pro5v.build.core=arduino pro5v.build.core=arduino
pro5v.build.variant=standard
############################################################## ##############################################################
@ -276,6 +331,7 @@ pro328.bootloader.lock_bits=0x0F
pro328.build.mcu=atmega328p pro328.build.mcu=atmega328p
pro328.build.f_cpu=8000000L pro328.build.f_cpu=8000000L
pro328.build.core=arduino pro328.build.core=arduino
pro328.build.variant=standard
############################################################## ##############################################################
@ -296,6 +352,7 @@ pro.bootloader.lock_bits=0x0F
pro.build.mcu=atmega168 pro.build.mcu=atmega168
pro.build.f_cpu=8000000L pro.build.f_cpu=8000000L
pro.build.core=arduino pro.build.core=arduino
pro.build.variant=standard
############################################################## ##############################################################
@ -316,6 +373,7 @@ atmega168.bootloader.lock_bits=0x0F
atmega168.build.mcu=atmega168 atmega168.build.mcu=atmega168
atmega168.build.f_cpu=16000000L atmega168.build.f_cpu=16000000L
atmega168.build.core=arduino atmega168.build.core=arduino
atmega168.build.variant=standard
############################################################## ##############################################################
@ -335,4 +393,4 @@ atmega8.bootloader.lock_bits=0x0F
atmega8.build.mcu=atmega8 atmega8.build.mcu=atmega8
atmega8.build.f_cpu=16000000L atmega8.build.f_cpu=16000000L
atmega8.build.core=arduino atmega8.build.core=arduino
atmega8.build.variant=standard

View File

@ -213,7 +213,7 @@ int main(void) {
// If not, uncomment the following instructions: // If not, uncomment the following instructions:
// cli(); // cli();
// SP=RAMEND; // This is done by hardware reset // SP=RAMEND; // This is done by hardware reset
// asm volatile ("clr __zero_reg__"); asm volatile ("clr __zero_reg__");
uint8_t ch; uint8_t ch;

View File

@ -1,33 +1,33 @@
:107E000085E08093810082E08093C00088E18093C8 :107E0000112485E08093810082E08093C00088E1A6
:107E1000C10086E08093C20080E18093C40084B7F3 :107E10008093C10086E08093C20080E18093C4001B
:107E200014BE81FFD0D08DE0C8D0259A86E020E333 :107E200084B714BE81FFD0D08DE0C8D0259A86E0FB
:107E30003CEF91E0309385002093840096BBB09B8B :107E300020E33CEF91E0309385002093840096BBD3
:107E4000FECF1D9AA8958150A9F7DD24D394A5E013 :107E4000B09BFECF1D9AA8958150A9F7DD24D3944D
:107E5000EA2EF1E1FF2EA4D0813421F481E0BED0DE :107E5000A5E0EA2EF1E1FF2EA4D0813421F481E0E7
:107E600083E024C0823411F484E103C0853419F422 :107E6000BED083E024C0823411F484E103C08534A1
:107E700085E0B4D08AC08535A1F492D0082F10E0F7 :107E700019F485E0B4D08AC08535A1F492D0082FDA
:107E800010930102009300028BD090E0982F882776 :107E800010E010930102009300028BD090E0982F35
:107E9000802B912B880F991F9093010280930002F1 :107E90008827802B912B880F991F90930102809344
:107EA00073C0863529F484E099D080E071D06DC02C :107EA000000273C0863529F484E099D080E071D057
:107EB000843609F043C07CD0E0910002F0910102C9 :107EB0006DC0843609F043C07CD0E0910002F0919F
:107EC00083E080935700E895C0E0D1E069D08993C2 :107EC000010283E080935700E895C0E0D1E069D0DB
:107ED000809102028150809302028823B9F778D002 :107ED0008993809102028150809302028823B9F72E
:107EE00007B600FCFDCF4091000250910102A0E0D6 :107EE00078D007B600FCFDCF40910002509101020E
:107EF000B1E02C9130E011968C91119790E0982F81 :107EF000A0E0B1E02C9130E011968C91119790E0C8
:107F00008827822B932B1296FA010C01D0925700EE :107F0000982F8827822B932B1296FA010C01D0927E
:107F1000E89511244E5F5F4FF1E0A038BF0749F7A5 :107F10005700E89511244E5F5F4FF1E0A038BF078E
:107F2000E0910002F0910102E0925700E89507B657 :107F200049F7E0910002F0910102E0925700E895D4
:107F300000FCFDCFF0925700E89527C08437B9F4D4 :107F300007B600FCFDCFF0925700E89527C08437C4
:107F400037D046D0E0910002F09101023196F093D3 :107F4000B9F437D046D0E0910002F09101023196A9
:107F50000102E09300023197E4918E2F19D08091B5 :107F5000F0930102E09300023197E4918E2F19D043
:107F60000202815080930202882361F70EC0853798 :107F600080910202815080930202882361F70EC043
:107F700039F42ED08EE10CD085E90AD08FE096CF6F :107F7000853739F42ED08EE10CD085E90AD08FE018
:107F8000813511F488E019D023D080E101D063CF8E :107F800096CF813511F488E019D023D080E101D05B
:107F9000982F8091C00085FFFCCF9093C600089574 :107F900063CF982F8091C00085FFFCCF9093C600DF
:107FA000A8958091C00087FFFCCF8091C6000895FE :107FA0000895A8958091C00087FFFCCF8091C600FE
:107FB000F7DFF6DF80930202F3CFE0E6F0E098E12E :107FB0000895F7DFF6DF80930202F3CFE0E6F0E00A
:107FC00090838083089580E0F8DFEE27FF270994EF :107FC00098E190838083089580E0F8DFEE27FF2713
:107FD000E7DF803209F0F7DF84E1DACF1F93182F53 :107FD0000994E7DF803209F0F7DF84E1DACF1F93FD
:0C7FE000DFDF1150E9F7F4DF1F91089576 :0E7FE000182FDFDF1150E9F7F4DF1F9108952D
:0400000300007E007B :0400000300007E007B
:00000001FF :00000001FF

View File

@ -3,25 +3,25 @@ optiboot_atmega328.elf: file format elf32-avr
Sections: Sections:
Idx Name Size VMA LMA File off Algn Idx Name Size VMA LMA File off Algn
0 .text 000001ec 00007e00 00007e00 00000054 2**1 0 .text 000001ee 00007e00 00007e00 00000054 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .debug_aranges 00000028 00000000 00000000 00000240 2**0 1 .debug_aranges 00000028 00000000 00000000 00000242 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
2 .debug_pubnames 0000006a 00000000 00000000 00000268 2**0 2 .debug_pubnames 0000006a 00000000 00000000 0000026a 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
3 .debug_info 00000269 00000000 00000000 000002d2 2**0 3 .debug_info 00000269 00000000 00000000 000002d4 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
4 .debug_abbrev 00000196 00000000 00000000 0000053b 2**0 4 .debug_abbrev 00000196 00000000 00000000 0000053d 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
5 .debug_line 000003d3 00000000 00000000 000006d1 2**0 5 .debug_line 000003db 00000000 00000000 000006d3 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
6 .debug_frame 00000090 00000000 00000000 00000aa4 2**2 6 .debug_frame 00000090 00000000 00000000 00000ab0 2**2
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
7 .debug_str 00000135 00000000 00000000 00000b34 2**0 7 .debug_str 00000124 00000000 00000000 00000b40 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
8 .debug_loc 000001d1 00000000 00000000 00000c69 2**0 8 .debug_loc 000001d1 00000000 00000000 00000c64 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
9 .debug_ranges 00000068 00000000 00000000 00000e3a 2**0 9 .debug_ranges 00000068 00000000 00000000 00000e35 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
Disassembly of section .text: Disassembly of section .text:
@ -33,488 +33,492 @@ Disassembly of section .text:
#endif #endif
/* main program starts here */ /* main program starts here */
int main(void) { int main(void) {
7e00: 85 e0 ldi r24, 0x05 ; 5 7e00: 11 24 eor r1, r1
7e02: 80 93 81 00 sts 0x0081, r24
uint8_t ch;
#if LED_START_FLASHES > 0 #if LED_START_FLASHES > 0
// Set up Timer 1 for timeout counter // Set up Timer 1 for timeout counter
TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
7e02: 85 e0 ldi r24, 0x05 ; 5
7e04: 80 93 81 00 sts 0x0081, r24
#endif #endif
#ifndef SOFT_UART #ifndef SOFT_UART
UCSR0A = _BV(U2X0); //Double speed mode USART0 UCSR0A = _BV(U2X0); //Double speed mode USART0
7e06: 82 e0 ldi r24, 0x02 ; 2 7e08: 82 e0 ldi r24, 0x02 ; 2
7e08: 80 93 c0 00 sts 0x00C0, r24 7e0a: 80 93 c0 00 sts 0x00C0, r24
UCSR0B = _BV(RXEN0) | _BV(TXEN0); UCSR0B = _BV(RXEN0) | _BV(TXEN0);
7e0c: 88 e1 ldi r24, 0x18 ; 24 7e0e: 88 e1 ldi r24, 0x18 ; 24
7e0e: 80 93 c1 00 sts 0x00C1, r24 7e10: 80 93 c1 00 sts 0x00C1, r24
UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
7e12: 86 e0 ldi r24, 0x06 ; 6 7e14: 86 e0 ldi r24, 0x06 ; 6
7e14: 80 93 c2 00 sts 0x00C2, r24 7e16: 80 93 c2 00 sts 0x00C2, r24
UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
7e18: 80 e1 ldi r24, 0x10 ; 16 7e1a: 80 e1 ldi r24, 0x10 ; 16
7e1a: 80 93 c4 00 sts 0x00C4, r24 7e1c: 80 93 c4 00 sts 0x00C4, r24
#endif #endif
// Adaboot no-wait mod // Adaboot no-wait mod
ch = MCUSR; ch = MCUSR;
7e1e: 84 b7 in r24, 0x34 ; 52 7e20: 84 b7 in r24, 0x34 ; 52
MCUSR = 0; MCUSR = 0;
7e20: 14 be out 0x34, r1 ; 52 7e22: 14 be out 0x34, r1 ; 52
if (!(ch & _BV(EXTRF))) appStart(); if (!(ch & _BV(EXTRF))) appStart();
7e22: 81 ff sbrs r24, 1 7e24: 81 ff sbrs r24, 1
7e24: d0 d0 rcall .+416 ; 0x7fc6 <appStart> 7e26: d0 d0 rcall .+416 ; 0x7fc8 <appStart>
// Set up watchdog to trigger after 500ms // Set up watchdog to trigger after 500ms
watchdogConfig(WATCHDOG_500MS); watchdogConfig(WATCHDOG_500MS);
7e26: 8d e0 ldi r24, 0x0D ; 13 7e28: 8d e0 ldi r24, 0x0D ; 13
7e28: c8 d0 rcall .+400 ; 0x7fba <watchdogConfig> 7e2a: c8 d0 rcall .+400 ; 0x7fbc <watchdogConfig>
/* Set LED pin as output */ /* Set LED pin as output */
LED_DDR |= _BV(LED); LED_DDR |= _BV(LED);
7e2a: 25 9a sbi 0x04, 5 ; 4 7e2c: 25 9a sbi 0x04, 5 ; 4
7e2c: 86 e0 ldi r24, 0x06 ; 6 7e2e: 86 e0 ldi r24, 0x06 ; 6
} }
#if LED_START_FLASHES > 0 #if LED_START_FLASHES > 0
void flash_led(uint8_t count) { void flash_led(uint8_t count) {
do { do {
TCNT1 = -(F_CPU/(1024*16)); TCNT1 = -(F_CPU/(1024*16));
7e2e: 20 e3 ldi r18, 0x30 ; 48 7e30: 20 e3 ldi r18, 0x30 ; 48
7e30: 3c ef ldi r19, 0xFC ; 252 7e32: 3c ef ldi r19, 0xFC ; 252
TIFR1 = _BV(TOV1); TIFR1 = _BV(TOV1);
7e32: 91 e0 ldi r25, 0x01 ; 1 7e34: 91 e0 ldi r25, 0x01 ; 1
} }
#if LED_START_FLASHES > 0 #if LED_START_FLASHES > 0
void flash_led(uint8_t count) { void flash_led(uint8_t count) {
do { do {
TCNT1 = -(F_CPU/(1024*16)); TCNT1 = -(F_CPU/(1024*16));
7e34: 30 93 85 00 sts 0x0085, r19 7e36: 30 93 85 00 sts 0x0085, r19
7e38: 20 93 84 00 sts 0x0084, r18 7e3a: 20 93 84 00 sts 0x0084, r18
TIFR1 = _BV(TOV1); TIFR1 = _BV(TOV1);
7e3c: 96 bb out 0x16, r25 ; 22 7e3e: 96 bb out 0x16, r25 ; 22
while(!(TIFR1 & _BV(TOV1))); while(!(TIFR1 & _BV(TOV1)));
7e3e: b0 9b sbis 0x16, 0 ; 22 7e40: b0 9b sbis 0x16, 0 ; 22
7e40: fe cf rjmp .-4 ; 0x7e3e <main+0x3e> 7e42: fe cf rjmp .-4 ; 0x7e40 <main+0x40>
LED_PIN |= _BV(LED); LED_PIN |= _BV(LED);
7e42: 1d 9a sbi 0x03, 5 ; 3 7e44: 1d 9a sbi 0x03, 5 ; 3
return getch(); return getch();
} }
// Watchdog functions. These are only safe with interrupts turned off. // Watchdog functions. These are only safe with interrupts turned off.
void watchdogReset() { void watchdogReset() {
__asm__ __volatile__ ( __asm__ __volatile__ (
7e44: a8 95 wdr 7e46: a8 95 wdr
TCNT1 = -(F_CPU/(1024*16)); TCNT1 = -(F_CPU/(1024*16));
TIFR1 = _BV(TOV1); TIFR1 = _BV(TOV1);
while(!(TIFR1 & _BV(TOV1))); while(!(TIFR1 & _BV(TOV1)));
LED_PIN |= _BV(LED); LED_PIN |= _BV(LED);
watchdogReset(); watchdogReset();
} while (--count); } while (--count);
7e46: 81 50 subi r24, 0x01 ; 1 7e48: 81 50 subi r24, 0x01 ; 1
7e48: a9 f7 brne .-22 ; 0x7e34 <main+0x34> 7e4a: a9 f7 brne .-22 ; 0x7e36 <main+0x36>
/* get character from UART */ /* get character from UART */
ch = getch(); ch = getch();
if(ch == STK_GET_PARAMETER) { if(ch == STK_GET_PARAMETER) {
// GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
getNch(1); getNch(1);
7e4a: dd 24 eor r13, r13 7e4c: dd 24 eor r13, r13
7e4c: d3 94 inc r13 7e4e: d3 94 inc r13
boot_page_fill((uint16_t)(void*)addrPtr,a); boot_page_fill((uint16_t)(void*)addrPtr,a);
addrPtr += 2; addrPtr += 2;
} while (--ch); } while (--ch);
// Write from programming buffer // Write from programming buffer
boot_page_write((uint16_t)(void*)address); boot_page_write((uint16_t)(void*)address);
7e4e: a5 e0 ldi r26, 0x05 ; 5 7e50: a5 e0 ldi r26, 0x05 ; 5
7e50: ea 2e mov r14, r26 7e52: ea 2e mov r14, r26
boot_spm_busy_wait(); boot_spm_busy_wait();
#if defined(RWWSRE) #if defined(RWWSRE)
// Reenable read access to flash // Reenable read access to flash
boot_rww_enable(); boot_rww_enable();
7e52: f1 e1 ldi r31, 0x11 ; 17 7e54: f1 e1 ldi r31, 0x11 ; 17
7e54: ff 2e mov r15, r31 7e56: ff 2e mov r15, r31
#endif #endif
/* Forever loop */ /* Forever loop */
for (;;) { for (;;) {
/* get character from UART */ /* get character from UART */
ch = getch(); ch = getch();
7e56: a4 d0 rcall .+328 ; 0x7fa0 <getch> 7e58: a4 d0 rcall .+328 ; 0x7fa2 <getch>
if(ch == STK_GET_PARAMETER) { if(ch == STK_GET_PARAMETER) {
7e58: 81 34 cpi r24, 0x41 ; 65 7e5a: 81 34 cpi r24, 0x41 ; 65
7e5a: 21 f4 brne .+8 ; 0x7e64 <main+0x64> 7e5c: 21 f4 brne .+8 ; 0x7e66 <main+0x66>
// GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
getNch(1); getNch(1);
7e5c: 81 e0 ldi r24, 0x01 ; 1 7e5e: 81 e0 ldi r24, 0x01 ; 1
7e5e: be d0 rcall .+380 ; 0x7fdc <verifySpace+0xc> 7e60: be d0 rcall .+380 ; 0x7fde <verifySpace+0xc>
putch(0x03); putch(0x03);
7e60: 83 e0 ldi r24, 0x03 ; 3 7e62: 83 e0 ldi r24, 0x03 ; 3
7e62: 24 c0 rjmp .+72 ; 0x7eac <main+0xac> 7e64: 24 c0 rjmp .+72 ; 0x7eae <main+0xae>
} }
else if(ch == STK_SET_DEVICE) { else if(ch == STK_SET_DEVICE) {
7e64: 82 34 cpi r24, 0x42 ; 66 7e66: 82 34 cpi r24, 0x42 ; 66
7e66: 11 f4 brne .+4 ; 0x7e6c <main+0x6c> 7e68: 11 f4 brne .+4 ; 0x7e6e <main+0x6e>
// SET DEVICE is ignored // SET DEVICE is ignored
getNch(20); getNch(20);
7e68: 84 e1 ldi r24, 0x14 ; 20 7e6a: 84 e1 ldi r24, 0x14 ; 20
7e6a: 03 c0 rjmp .+6 ; 0x7e72 <main+0x72> 7e6c: 03 c0 rjmp .+6 ; 0x7e74 <main+0x74>
} }
else if(ch == STK_SET_DEVICE_EXT) { else if(ch == STK_SET_DEVICE_EXT) {
7e6c: 85 34 cpi r24, 0x45 ; 69 7e6e: 85 34 cpi r24, 0x45 ; 69
7e6e: 19 f4 brne .+6 ; 0x7e76 <main+0x76> 7e70: 19 f4 brne .+6 ; 0x7e78 <main+0x78>
// SET DEVICE EXT is ignored // SET DEVICE EXT is ignored
getNch(5); getNch(5);
7e70: 85 e0 ldi r24, 0x05 ; 5 7e72: 85 e0 ldi r24, 0x05 ; 5
7e72: b4 d0 rcall .+360 ; 0x7fdc <verifySpace+0xc> 7e74: b4 d0 rcall .+360 ; 0x7fde <verifySpace+0xc>
7e74: 8a c0 rjmp .+276 ; 0x7f8a <main+0x18a> 7e76: 8a c0 rjmp .+276 ; 0x7f8c <main+0x18c>
} }
else if(ch == STK_LOAD_ADDRESS) { else if(ch == STK_LOAD_ADDRESS) {
7e76: 85 35 cpi r24, 0x55 ; 85 7e78: 85 35 cpi r24, 0x55 ; 85
7e78: a1 f4 brne .+40 ; 0x7ea2 <main+0xa2> 7e7a: a1 f4 brne .+40 ; 0x7ea4 <main+0xa4>
// LOAD ADDRESS // LOAD ADDRESS
address = getch(); address = getch();
7e7a: 92 d0 rcall .+292 ; 0x7fa0 <getch> 7e7c: 92 d0 rcall .+292 ; 0x7fa2 <getch>
7e7c: 08 2f mov r16, r24 7e7e: 08 2f mov r16, r24
7e7e: 10 e0 ldi r17, 0x00 ; 0 7e80: 10 e0 ldi r17, 0x00 ; 0
7e80: 10 93 01 02 sts 0x0201, r17 7e82: 10 93 01 02 sts 0x0201, r17
7e84: 00 93 00 02 sts 0x0200, r16 7e86: 00 93 00 02 sts 0x0200, r16
address = (address & 0xff) | (getch() << 8); address = (address & 0xff) | (getch() << 8);
7e88: 8b d0 rcall .+278 ; 0x7fa0 <getch> 7e8a: 8b d0 rcall .+278 ; 0x7fa2 <getch>
7e8a: 90 e0 ldi r25, 0x00 ; 0 7e8c: 90 e0 ldi r25, 0x00 ; 0
7e8c: 98 2f mov r25, r24 7e8e: 98 2f mov r25, r24
7e8e: 88 27 eor r24, r24 7e90: 88 27 eor r24, r24
7e90: 80 2b or r24, r16 7e92: 80 2b or r24, r16
7e92: 91 2b or r25, r17 7e94: 91 2b or r25, r17
address += address; // Convert from word address to byte address address += address; // Convert from word address to byte address
7e94: 88 0f add r24, r24 7e96: 88 0f add r24, r24
7e96: 99 1f adc r25, r25 7e98: 99 1f adc r25, r25
7e98: 90 93 01 02 sts 0x0201, r25 7e9a: 90 93 01 02 sts 0x0201, r25
7e9c: 80 93 00 02 sts 0x0200, r24 7e9e: 80 93 00 02 sts 0x0200, r24
7ea0: 73 c0 rjmp .+230 ; 0x7f88 <main+0x188> 7ea2: 73 c0 rjmp .+230 ; 0x7f8a <main+0x18a>
verifySpace(); verifySpace();
} }
else if(ch == STK_UNIVERSAL) { else if(ch == STK_UNIVERSAL) {
7ea2: 86 35 cpi r24, 0x56 ; 86 7ea4: 86 35 cpi r24, 0x56 ; 86
7ea4: 29 f4 brne .+10 ; 0x7eb0 <main+0xb0> 7ea6: 29 f4 brne .+10 ; 0x7eb2 <main+0xb2>
// UNIVERSAL command is ignored // UNIVERSAL command is ignored
getNch(4); getNch(4);
7ea6: 84 e0 ldi r24, 0x04 ; 4 7ea8: 84 e0 ldi r24, 0x04 ; 4
7ea8: 99 d0 rcall .+306 ; 0x7fdc <verifySpace+0xc> 7eaa: 99 d0 rcall .+306 ; 0x7fde <verifySpace+0xc>
putch(0x00); putch(0x00);
7eaa: 80 e0 ldi r24, 0x00 ; 0 7eac: 80 e0 ldi r24, 0x00 ; 0
7eac: 71 d0 rcall .+226 ; 0x7f90 <putch> 7eae: 71 d0 rcall .+226 ; 0x7f92 <putch>
7eae: 6d c0 rjmp .+218 ; 0x7f8a <main+0x18a> 7eb0: 6d c0 rjmp .+218 ; 0x7f8c <main+0x18c>
} }
/* Write memory, length is big endian and is in bytes */ /* Write memory, length is big endian and is in bytes */
else if(ch == STK_PROG_PAGE) { else if(ch == STK_PROG_PAGE) {
7eb0: 84 36 cpi r24, 0x64 ; 100 7eb2: 84 36 cpi r24, 0x64 ; 100
7eb2: 09 f0 breq .+2 ; 0x7eb6 <main+0xb6> 7eb4: 09 f0 breq .+2 ; 0x7eb8 <main+0xb8>
7eb4: 43 c0 rjmp .+134 ; 0x7f3c <main+0x13c> 7eb6: 43 c0 rjmp .+134 ; 0x7f3e <main+0x13e>
// PROGRAM PAGE - we support flash programming only, not EEPROM // PROGRAM PAGE - we support flash programming only, not EEPROM
uint8_t *bufPtr; uint8_t *bufPtr;
uint16_t addrPtr; uint16_t addrPtr;
getLen(); getLen();
7eb6: 7c d0 rcall .+248 ; 0x7fb0 <getLen> 7eb8: 7c d0 rcall .+248 ; 0x7fb2 <getLen>
// Immediately start page erase - this will 4.5ms // Immediately start page erase - this will 4.5ms
boot_page_erase((uint16_t)(void*)address); boot_page_erase((uint16_t)(void*)address);
7eb8: e0 91 00 02 lds r30, 0x0200 7eba: e0 91 00 02 lds r30, 0x0200
7ebc: f0 91 01 02 lds r31, 0x0201 7ebe: f0 91 01 02 lds r31, 0x0201
7ec0: 83 e0 ldi r24, 0x03 ; 3 7ec2: 83 e0 ldi r24, 0x03 ; 3
7ec2: 80 93 57 00 sts 0x0057, r24 7ec4: 80 93 57 00 sts 0x0057, r24
7ec6: e8 95 spm 7ec8: e8 95 spm
7ec8: c0 e0 ldi r28, 0x00 ; 0 7eca: c0 e0 ldi r28, 0x00 ; 0
7eca: d1 e0 ldi r29, 0x01 ; 1 7ecc: d1 e0 ldi r29, 0x01 ; 1
// While that is going on, read in page contents // While that is going on, read in page contents
bufPtr = buff; bufPtr = buff;
do *bufPtr++ = getch(); do *bufPtr++ = getch();
7ecc: 69 d0 rcall .+210 ; 0x7fa0 <getch> 7ece: 69 d0 rcall .+210 ; 0x7fa2 <getch>
7ece: 89 93 st Y+, r24 7ed0: 89 93 st Y+, r24
while (--length); while (--length);
7ed0: 80 91 02 02 lds r24, 0x0202 7ed2: 80 91 02 02 lds r24, 0x0202
7ed4: 81 50 subi r24, 0x01 ; 1 7ed6: 81 50 subi r24, 0x01 ; 1
7ed6: 80 93 02 02 sts 0x0202, r24 7ed8: 80 93 02 02 sts 0x0202, r24
7eda: 88 23 and r24, r24 7edc: 88 23 and r24, r24
7edc: b9 f7 brne .-18 ; 0x7ecc <main+0xcc> 7ede: b9 f7 brne .-18 ; 0x7ece <main+0xce>
// Read command terminator, start reply // Read command terminator, start reply
verifySpace(); verifySpace();
7ede: 78 d0 rcall .+240 ; 0x7fd0 <verifySpace> 7ee0: 78 d0 rcall .+240 ; 0x7fd2 <verifySpace>
// If only a partial page is to be programmed, the erase might not be complete. // If only a partial page is to be programmed, the erase might not be complete.
// So check that here // So check that here
boot_spm_busy_wait(); boot_spm_busy_wait();
7ee0: 07 b6 in r0, 0x37 ; 55 7ee2: 07 b6 in r0, 0x37 ; 55
7ee2: 00 fc sbrc r0, 0 7ee4: 00 fc sbrc r0, 0
7ee4: fd cf rjmp .-6 ; 0x7ee0 <main+0xe0> 7ee6: fd cf rjmp .-6 ; 0x7ee2 <main+0xe2>
} }
#endif #endif
// Copy buffer into programming buffer // Copy buffer into programming buffer
bufPtr = buff; bufPtr = buff;
addrPtr = (uint16_t)(void*)address; addrPtr = (uint16_t)(void*)address;
7ee6: 40 91 00 02 lds r20, 0x0200 7ee8: 40 91 00 02 lds r20, 0x0200
7eea: 50 91 01 02 lds r21, 0x0201 7eec: 50 91 01 02 lds r21, 0x0201
7eee: a0 e0 ldi r26, 0x00 ; 0 7ef0: a0 e0 ldi r26, 0x00 ; 0
7ef0: b1 e0 ldi r27, 0x01 ; 1 7ef2: b1 e0 ldi r27, 0x01 ; 1
ch = SPM_PAGESIZE / 2; ch = SPM_PAGESIZE / 2;
do { do {
uint16_t a; uint16_t a;
a = *bufPtr++; a = *bufPtr++;
7ef2: 2c 91 ld r18, X 7ef4: 2c 91 ld r18, X
7ef4: 30 e0 ldi r19, 0x00 ; 0 7ef6: 30 e0 ldi r19, 0x00 ; 0
a |= (*bufPtr++) << 8; a |= (*bufPtr++) << 8;
7ef6: 11 96 adiw r26, 0x01 ; 1 7ef8: 11 96 adiw r26, 0x01 ; 1
7ef8: 8c 91 ld r24, X 7efa: 8c 91 ld r24, X
7efa: 11 97 sbiw r26, 0x01 ; 1 7efc: 11 97 sbiw r26, 0x01 ; 1
7efc: 90 e0 ldi r25, 0x00 ; 0 7efe: 90 e0 ldi r25, 0x00 ; 0
7efe: 98 2f mov r25, r24 7f00: 98 2f mov r25, r24
7f00: 88 27 eor r24, r24 7f02: 88 27 eor r24, r24
7f02: 82 2b or r24, r18 7f04: 82 2b or r24, r18
7f04: 93 2b or r25, r19 7f06: 93 2b or r25, r19
#ifdef VIRTUAL_BOOT_PARTITION #ifdef VIRTUAL_BOOT_PARTITION
#define rstVect (*(uint16_t*)(0x204)) #define rstVect (*(uint16_t*)(0x204))
#define wdtVect (*(uint16_t*)(0x206)) #define wdtVect (*(uint16_t*)(0x206))
#endif #endif
/* main program starts here */ /* main program starts here */
int main(void) { int main(void) {
7f06: 12 96 adiw r26, 0x02 ; 2 7f08: 12 96 adiw r26, 0x02 ; 2
ch = SPM_PAGESIZE / 2; ch = SPM_PAGESIZE / 2;
do { do {
uint16_t a; uint16_t a;
a = *bufPtr++; a = *bufPtr++;
a |= (*bufPtr++) << 8; a |= (*bufPtr++) << 8;
boot_page_fill((uint16_t)(void*)addrPtr,a); boot_page_fill((uint16_t)(void*)addrPtr,a);
7f08: fa 01 movw r30, r20 7f0a: fa 01 movw r30, r20
7f0a: 0c 01 movw r0, r24 7f0c: 0c 01 movw r0, r24
7f0c: d0 92 57 00 sts 0x0057, r13 7f0e: d0 92 57 00 sts 0x0057, r13
7f10: e8 95 spm 7f12: e8 95 spm
7f12: 11 24 eor r1, r1 7f14: 11 24 eor r1, r1
addrPtr += 2; addrPtr += 2;
7f14: 4e 5f subi r20, 0xFE ; 254 7f16: 4e 5f subi r20, 0xFE ; 254
7f16: 5f 4f sbci r21, 0xFF ; 255 7f18: 5f 4f sbci r21, 0xFF ; 255
} while (--ch); } while (--ch);
7f18: f1 e0 ldi r31, 0x01 ; 1 7f1a: f1 e0 ldi r31, 0x01 ; 1
7f1a: a0 38 cpi r26, 0x80 ; 128 7f1c: a0 38 cpi r26, 0x80 ; 128
7f1c: bf 07 cpc r27, r31 7f1e: bf 07 cpc r27, r31
7f1e: 49 f7 brne .-46 ; 0x7ef2 <main+0xf2> 7f20: 49 f7 brne .-46 ; 0x7ef4 <main+0xf4>
// Write from programming buffer // Write from programming buffer
boot_page_write((uint16_t)(void*)address); boot_page_write((uint16_t)(void*)address);
7f20: e0 91 00 02 lds r30, 0x0200 7f22: e0 91 00 02 lds r30, 0x0200
7f24: f0 91 01 02 lds r31, 0x0201 7f26: f0 91 01 02 lds r31, 0x0201
7f28: e0 92 57 00 sts 0x0057, r14 7f2a: e0 92 57 00 sts 0x0057, r14
7f2c: e8 95 spm 7f2e: e8 95 spm
boot_spm_busy_wait(); boot_spm_busy_wait();
7f2e: 07 b6 in r0, 0x37 ; 55 7f30: 07 b6 in r0, 0x37 ; 55
7f30: 00 fc sbrc r0, 0 7f32: 00 fc sbrc r0, 0
7f32: fd cf rjmp .-6 ; 0x7f2e <main+0x12e> 7f34: fd cf rjmp .-6 ; 0x7f30 <main+0x130>
#if defined(RWWSRE) #if defined(RWWSRE)
// Reenable read access to flash // Reenable read access to flash
boot_rww_enable(); boot_rww_enable();
7f34: f0 92 57 00 sts 0x0057, r15 7f36: f0 92 57 00 sts 0x0057, r15
7f38: e8 95 spm 7f3a: e8 95 spm
7f3a: 27 c0 rjmp .+78 ; 0x7f8a <main+0x18a> 7f3c: 27 c0 rjmp .+78 ; 0x7f8c <main+0x18c>
#endif #endif
} }
/* Read memory block mode, length is big endian. */ /* Read memory block mode, length is big endian. */
else if(ch == STK_READ_PAGE) { else if(ch == STK_READ_PAGE) {
7f3c: 84 37 cpi r24, 0x74 ; 116 7f3e: 84 37 cpi r24, 0x74 ; 116
7f3e: b9 f4 brne .+46 ; 0x7f6e <main+0x16e> 7f40: b9 f4 brne .+46 ; 0x7f70 <main+0x170>
// READ PAGE - we only read flash // READ PAGE - we only read flash
getLen(); getLen();
7f40: 37 d0 rcall .+110 ; 0x7fb0 <getLen> 7f42: 37 d0 rcall .+110 ; 0x7fb2 <getLen>
verifySpace(); verifySpace();
7f42: 46 d0 rcall .+140 ; 0x7fd0 <verifySpace> 7f44: 46 d0 rcall .+140 ; 0x7fd2 <verifySpace>
else ch = pgm_read_byte_near(address); else ch = pgm_read_byte_near(address);
address++; address++;
putch(ch); putch(ch);
} while (--length); } while (--length);
#else #else
do putch(pgm_read_byte_near(address++)); do putch(pgm_read_byte_near(address++));
7f44: e0 91 00 02 lds r30, 0x0200 7f46: e0 91 00 02 lds r30, 0x0200
7f48: f0 91 01 02 lds r31, 0x0201 7f4a: f0 91 01 02 lds r31, 0x0201
7f4c: 31 96 adiw r30, 0x01 ; 1 7f4e: 31 96 adiw r30, 0x01 ; 1
7f4e: f0 93 01 02 sts 0x0201, r31 7f50: f0 93 01 02 sts 0x0201, r31
7f52: e0 93 00 02 sts 0x0200, r30 7f54: e0 93 00 02 sts 0x0200, r30
7f56: 31 97 sbiw r30, 0x01 ; 1 7f58: 31 97 sbiw r30, 0x01 ; 1
7f58: e4 91 lpm r30, Z+ 7f5a: e4 91 lpm r30, Z+
7f5a: 8e 2f mov r24, r30 7f5c: 8e 2f mov r24, r30
7f5c: 19 d0 rcall .+50 ; 0x7f90 <putch> 7f5e: 19 d0 rcall .+50 ; 0x7f92 <putch>
while (--length); while (--length);
7f5e: 80 91 02 02 lds r24, 0x0202 7f60: 80 91 02 02 lds r24, 0x0202
7f62: 81 50 subi r24, 0x01 ; 1 7f64: 81 50 subi r24, 0x01 ; 1
7f64: 80 93 02 02 sts 0x0202, r24 7f66: 80 93 02 02 sts 0x0202, r24
7f68: 88 23 and r24, r24 7f6a: 88 23 and r24, r24
7f6a: 61 f7 brne .-40 ; 0x7f44 <main+0x144> 7f6c: 61 f7 brne .-40 ; 0x7f46 <main+0x146>
7f6c: 0e c0 rjmp .+28 ; 0x7f8a <main+0x18a> 7f6e: 0e c0 rjmp .+28 ; 0x7f8c <main+0x18c>
#endif #endif
} }
/* Get device signature bytes */ /* Get device signature bytes */
else if(ch == STK_READ_SIGN) { else if(ch == STK_READ_SIGN) {
7f6e: 85 37 cpi r24, 0x75 ; 117 7f70: 85 37 cpi r24, 0x75 ; 117
7f70: 39 f4 brne .+14 ; 0x7f80 <main+0x180> 7f72: 39 f4 brne .+14 ; 0x7f82 <main+0x182>
// READ SIGN - return what Avrdude wants to hear // READ SIGN - return what Avrdude wants to hear
verifySpace(); verifySpace();
7f72: 2e d0 rcall .+92 ; 0x7fd0 <verifySpace> 7f74: 2e d0 rcall .+92 ; 0x7fd2 <verifySpace>
putch(SIGNATURE_0); putch(SIGNATURE_0);
7f74: 8e e1 ldi r24, 0x1E ; 30 7f76: 8e e1 ldi r24, 0x1E ; 30
7f76: 0c d0 rcall .+24 ; 0x7f90 <putch> 7f78: 0c d0 rcall .+24 ; 0x7f92 <putch>
putch(SIGNATURE_1); putch(SIGNATURE_1);
7f78: 85 e9 ldi r24, 0x95 ; 149 7f7a: 85 e9 ldi r24, 0x95 ; 149
7f7a: 0a d0 rcall .+20 ; 0x7f90 <putch> 7f7c: 0a d0 rcall .+20 ; 0x7f92 <putch>
putch(SIGNATURE_2); putch(SIGNATURE_2);
7f7c: 8f e0 ldi r24, 0x0F ; 15 7f7e: 8f e0 ldi r24, 0x0F ; 15
7f7e: 96 cf rjmp .-212 ; 0x7eac <main+0xac> 7f80: 96 cf rjmp .-212 ; 0x7eae <main+0xae>
} }
else if (ch == 'Q') { else if (ch == 'Q') {
7f80: 81 35 cpi r24, 0x51 ; 81 7f82: 81 35 cpi r24, 0x51 ; 81
7f82: 11 f4 brne .+4 ; 0x7f88 <main+0x188> 7f84: 11 f4 brne .+4 ; 0x7f8a <main+0x18a>
// Adaboot no-wait mod // Adaboot no-wait mod
watchdogConfig(WATCHDOG_16MS); watchdogConfig(WATCHDOG_16MS);
7f84: 88 e0 ldi r24, 0x08 ; 8 7f86: 88 e0 ldi r24, 0x08 ; 8
7f86: 19 d0 rcall .+50 ; 0x7fba <watchdogConfig> 7f88: 19 d0 rcall .+50 ; 0x7fbc <watchdogConfig>
verifySpace(); verifySpace();
} }
else { else {
// This covers the response to commands like STK_ENTER_PROGMODE // This covers the response to commands like STK_ENTER_PROGMODE
verifySpace(); verifySpace();
7f88: 23 d0 rcall .+70 ; 0x7fd0 <verifySpace> 7f8a: 23 d0 rcall .+70 ; 0x7fd2 <verifySpace>
} }
putch(STK_OK); putch(STK_OK);
7f8a: 80 e1 ldi r24, 0x10 ; 16 7f8c: 80 e1 ldi r24, 0x10 ; 16
7f8c: 01 d0 rcall .+2 ; 0x7f90 <putch> 7f8e: 01 d0 rcall .+2 ; 0x7f92 <putch>
7f8e: 63 cf rjmp .-314 ; 0x7e56 <main+0x56> 7f90: 63 cf rjmp .-314 ; 0x7e58 <main+0x58>
00007f90 <putch>: 00007f92 <putch>:
} }
} }
void putch(char ch) { void putch(char ch) {
7f90: 98 2f mov r25, r24 7f92: 98 2f mov r25, r24
#ifndef SOFT_UART #ifndef SOFT_UART
while (!(UCSR0A & _BV(UDRE0))); while (!(UCSR0A & _BV(UDRE0)));
7f92: 80 91 c0 00 lds r24, 0x00C0 7f94: 80 91 c0 00 lds r24, 0x00C0
7f96: 85 ff sbrs r24, 5 7f98: 85 ff sbrs r24, 5
7f98: fc cf rjmp .-8 ; 0x7f92 <putch+0x2> 7f9a: fc cf rjmp .-8 ; 0x7f94 <putch+0x2>
UDR0 = ch; UDR0 = ch;
7f9a: 90 93 c6 00 sts 0x00C6, r25 7f9c: 90 93 c6 00 sts 0x00C6, r25
[uartBit] "I" (UART_TX_BIT) [uartBit] "I" (UART_TX_BIT)
: :
"r25" "r25"
); );
#endif #endif
} }
7f9e: 08 95 ret 7fa0: 08 95 ret
00007fa0 <getch>: 00007fa2 <getch>:
return getch(); return getch();
} }
// Watchdog functions. These are only safe with interrupts turned off. // Watchdog functions. These are only safe with interrupts turned off.
void watchdogReset() { void watchdogReset() {
__asm__ __volatile__ ( __asm__ __volatile__ (
7fa0: a8 95 wdr 7fa2: a8 95 wdr
[uartBit] "I" (UART_RX_BIT) [uartBit] "I" (UART_RX_BIT)
: :
"r25" "r25"
); );
#else #else
while(!(UCSR0A & _BV(RXC0))); while(!(UCSR0A & _BV(RXC0)));
7fa2: 80 91 c0 00 lds r24, 0x00C0 7fa4: 80 91 c0 00 lds r24, 0x00C0
7fa6: 87 ff sbrs r24, 7 7fa8: 87 ff sbrs r24, 7
7fa8: fc cf rjmp .-8 ; 0x7fa2 <getch+0x2> 7faa: fc cf rjmp .-8 ; 0x7fa4 <getch+0x2>
ch = UDR0; ch = UDR0;
7faa: 80 91 c6 00 lds r24, 0x00C6 7fac: 80 91 c6 00 lds r24, 0x00C6
#ifdef LED_DATA_FLASH #ifdef LED_DATA_FLASH
LED_PIN |= _BV(LED); LED_PIN |= _BV(LED);
#endif #endif
return ch; return ch;
} }
7fae: 08 95 ret 7fb0: 08 95 ret
00007fb0 <getLen>: 00007fb2 <getLen>:
} while (--count); } while (--count);
} }
#endif #endif
uint8_t getLen() { uint8_t getLen() {
getch(); getch();
7fb0: f7 df rcall .-18 ; 0x7fa0 <getch> 7fb2: f7 df rcall .-18 ; 0x7fa2 <getch>
length = getch(); length = getch();
7fb2: f6 df rcall .-20 ; 0x7fa0 <getch> 7fb4: f6 df rcall .-20 ; 0x7fa2 <getch>
7fb4: 80 93 02 02 sts 0x0202, r24 7fb6: 80 93 02 02 sts 0x0202, r24
return getch(); return getch();
} }
7fb8: f3 cf rjmp .-26 ; 0x7fa0 <getch> 7fba: f3 cf rjmp .-26 ; 0x7fa2 <getch>
00007fba <watchdogConfig>: 00007fbc <watchdogConfig>:
"wdr\n" "wdr\n"
); );
} }
void watchdogConfig(uint8_t x) { void watchdogConfig(uint8_t x) {
WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = _BV(WDCE) | _BV(WDE);
7fba: e0 e6 ldi r30, 0x60 ; 96 7fbc: e0 e6 ldi r30, 0x60 ; 96
7fbc: f0 e0 ldi r31, 0x00 ; 0 7fbe: f0 e0 ldi r31, 0x00 ; 0
7fbe: 98 e1 ldi r25, 0x18 ; 24 7fc0: 98 e1 ldi r25, 0x18 ; 24
7fc0: 90 83 st Z, r25 7fc2: 90 83 st Z, r25
WDTCSR = x; WDTCSR = x;
7fc2: 80 83 st Z, r24 7fc4: 80 83 st Z, r24
} }
7fc4: 08 95 ret 7fc6: 08 95 ret
00007fc6 <appStart>: 00007fc8 <appStart>:
void appStart() { void appStart() {
watchdogConfig(WATCHDOG_OFF); watchdogConfig(WATCHDOG_OFF);
7fc6: 80 e0 ldi r24, 0x00 ; 0 7fc8: 80 e0 ldi r24, 0x00 ; 0
7fc8: f8 df rcall .-16 ; 0x7fba <watchdogConfig> 7fca: f8 df rcall .-16 ; 0x7fbc <watchdogConfig>
__asm__ __volatile__ ( __asm__ __volatile__ (
7fca: ee 27 eor r30, r30 7fcc: ee 27 eor r30, r30
7fcc: ff 27 eor r31, r31 7fce: ff 27 eor r31, r31
7fce: 09 94 ijmp 7fd0: 09 94 ijmp
00007fd0 <verifySpace>: 00007fd2 <verifySpace>:
do getch(); while (--count); do getch(); while (--count);
verifySpace(); verifySpace();
} }
void verifySpace() { void verifySpace() {
if (getch() != CRC_EOP) appStart(); if (getch() != CRC_EOP) appStart();
7fd0: e7 df rcall .-50 ; 0x7fa0 <getch> 7fd2: e7 df rcall .-50 ; 0x7fa2 <getch>
7fd2: 80 32 cpi r24, 0x20 ; 32 7fd4: 80 32 cpi r24, 0x20 ; 32
7fd4: 09 f0 breq .+2 ; 0x7fd8 <verifySpace+0x8> 7fd6: 09 f0 breq .+2 ; 0x7fda <verifySpace+0x8>
7fd6: f7 df rcall .-18 ; 0x7fc6 <appStart> 7fd8: f7 df rcall .-18 ; 0x7fc8 <appStart>
putch(STK_INSYNC); putch(STK_INSYNC);
7fd8: 84 e1 ldi r24, 0x14 ; 20 7fda: 84 e1 ldi r24, 0x14 ; 20
} }
7fda: da cf rjmp .-76 ; 0x7f90 <putch> 7fdc: da cf rjmp .-76 ; 0x7f92 <putch>
::[count] "M" (UART_B_VALUE) ::[count] "M" (UART_B_VALUE)
); );
} }
#endif #endif
void getNch(uint8_t count) { void getNch(uint8_t count) {
7fdc: 1f 93 push r17 7fde: 1f 93 push r17
7fde: 18 2f mov r17, r24 7fe0: 18 2f mov r17, r24
00007fe0 <getNch>: 00007fe2 <getNch>:
do getch(); while (--count); do getch(); while (--count);
7fe0: df df rcall .-66 ; 0x7fa0 <getch> 7fe2: df df rcall .-66 ; 0x7fa2 <getch>
7fe2: 11 50 subi r17, 0x01 ; 1 7fe4: 11 50 subi r17, 0x01 ; 1
7fe4: e9 f7 brne .-6 ; 0x7fe0 <getNch> 7fe6: e9 f7 brne .-6 ; 0x7fe2 <getNch>
verifySpace(); verifySpace();
7fe6: f4 df rcall .-24 ; 0x7fd0 <verifySpace> 7fe8: f4 df rcall .-24 ; 0x7fd2 <verifySpace>
} }
7fe8: 1f 91 pop r17 7fea: 1f 91 pop r17
7fea: 08 95 ret 7fec: 08 95 ret

View File

@ -0,0 +1,205 @@
#ifndef Arduino_h
#define Arduino_h
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <avr/pgmspace.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include "binary.h"
#ifdef __cplusplus
extern "C"{
#endif
#define HIGH 0x1
#define LOW 0x0
#define INPUT 0x0
#define OUTPUT 0x1
#define true 0x1
#define false 0x0
#define PI 3.1415926535897932384626433832795
#define HALF_PI 1.5707963267948966192313216916398
#define TWO_PI 6.283185307179586476925286766559
#define DEG_TO_RAD 0.017453292519943295769236907684886
#define RAD_TO_DEG 57.295779513082320876798154814105
#define SERIAL 0x0
#define DISPLAY 0x1
#define LSBFIRST 0
#define MSBFIRST 1
#define CHANGE 1
#define FALLING 2
#define RISING 3
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define INTERNAL1V1 2
#define INTERNAL2V56 3
#else
#define INTERNAL 3
#endif
#define DEFAULT 1
#define EXTERNAL 0
// undefine stdlib's abs if encountered
#ifdef abs
#undef abs
#endif
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(x) ((x)>0?(x):-(x))
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)
#define sq(x) ((x)*(x))
#define interrupts() sei()
#define noInterrupts() cli()
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (F_CPU / 1000L) )
#define microsecondsToClockCycles(a) ( ((a) * (F_CPU / 1000L)) / 1000L )
#define lowByte(w) ((uint8_t) ((w) & 0xff))
#define highByte(w) ((uint8_t) ((w) >> 8))
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
typedef unsigned int word;
#define bit(b) (1UL << (b))
typedef uint8_t boolean;
typedef uint8_t byte;
void init(void);
void pinMode(uint8_t, uint8_t);
void digitalWrite(uint8_t, uint8_t);
int digitalRead(uint8_t);
int analogRead(uint8_t);
void analogReference(uint8_t mode);
void analogWrite(uint8_t, int);
unsigned long millis(void);
unsigned long micros(void);
void delay(unsigned long);
void delayMicroseconds(unsigned int us);
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
void attachInterrupt(uint8_t, void (*)(void), int mode);
void detachInterrupt(uint8_t);
void setup(void);
void loop(void);
// Get the bit location within the hardware port of the given virtual pin.
// This comes from the pins_*.c file for the active board configuration.
#define analogInPinToBit(P) (P)
// On the ATmega1280, the addresses of some of the port registers are
// greater than 255, so we can't store them in uint8_t's.
extern const uint16_t PROGMEM port_to_mode_PGM[];
extern const uint16_t PROGMEM port_to_input_PGM[];
extern const uint16_t PROGMEM port_to_output_PGM[];
extern const uint8_t PROGMEM digital_pin_to_port_PGM[];
// extern const uint8_t PROGMEM digital_pin_to_bit_PGM[];
extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[];
extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
// Get the bit location within the hardware port of the given virtual pin.
// This comes from the pins_*.c file for the active board configuration.
//
// These perform slightly better as macros compared to inline functions
//
#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) )
#define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) )
#define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) )
#define analogInPinToBit(P) (P)
#define portOutputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_output_PGM + (P))) )
#define portInputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_input_PGM + (P))) )
#define portModeRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_mode_PGM + (P))) )
#define NOT_A_PIN 0
#define NOT_A_PORT 0
#define PA 1
#define PB 2
#define PC 3
#define PD 4
#define PE 5
#define PF 6
#define PG 7
#define PH 8
#define PJ 10
#define PK 11
#define PL 12
#define NOT_ON_TIMER 0
#define TIMER0A 1
#define TIMER0B 2
#define TIMER1A 3
#define TIMER1B 4
#define TIMER2 5
#define TIMER2A 6
#define TIMER2B 7
#define TIMER3A 8
#define TIMER3B 9
#define TIMER3C 10
#define TIMER4A 11
#define TIMER4B 12
#define TIMER4C 13
#define TIMER5A 14
#define TIMER5B 15
#define TIMER5C 16
#ifdef __cplusplus
} // extern "C"
#endif
#ifdef __cplusplus
#include "WCharacter.h"
#include "WString.h"
#include "HardwareSerial.h"
uint16_t makeWord(uint16_t w);
uint16_t makeWord(byte h, byte l);
#define word(...) makeWord(__VA_ARGS__)
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
void noTone(uint8_t _pin);
// WMath prototypes
long random(long);
long random(long, long);
void randomSeed(unsigned int);
long map(long, long, long, long, long);
#endif
#include "pins_arduino.h"
#endif

View File

@ -24,7 +24,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#include "wiring.h" #include "Arduino.h"
#include "wiring_private.h" #include "wiring_private.h"
// this next line disables the entire HardwareSerial.cpp, // this next line disables the entire HardwareSerial.cpp,
@ -34,149 +34,223 @@
#include "HardwareSerial.h" #include "HardwareSerial.h"
// Define constants and variables for buffering incoming serial data. We're // Define constants and variables for buffering incoming serial data. We're
// using a ring buffer (I think), in which rx_buffer_head is the index of the // using a ring buffer (I think), in which head is the index of the location
// location to which to write the next incoming character and rx_buffer_tail // to which to write the next incoming character and tail is the index of the
// is the index of the location from which to read. // location from which to read.
#if (RAMEND < 1000) #if (RAMEND < 1000)
#define RX_BUFFER_SIZE 32 #define SERIAL_BUFFER_SIZE 16
#else #else
#define RX_BUFFER_SIZE 128 #define SERIAL_BUFFER_SIZE 64
#endif #endif
struct ring_buffer struct ring_buffer
{ {
unsigned char buffer[RX_BUFFER_SIZE]; unsigned char buffer[SERIAL_BUFFER_SIZE];
int head; volatile int head;
int tail; volatile int tail;
}; };
#if defined(UBRRH) || defined(UBRR0H) #if defined(UBRRH) || defined(UBRR0H)
ring_buffer rx_buffer = { { 0 }, 0, 0 }; ring_buffer rx_buffer = { { 0 }, 0, 0 };
ring_buffer tx_buffer = { { 0 }, 0, 0 };
#endif #endif
#if defined(UBRR1H) #if defined(UBRR1H)
ring_buffer rx_buffer1 = { { 0 }, 0, 0 }; ring_buffer rx_buffer1 = { { 0 }, 0, 0 };
ring_buffer tx_buffer1 = { { 0 }, 0, 0 };
#endif #endif
#if defined(UBRR2H) #if defined(UBRR2H)
ring_buffer rx_buffer2 = { { 0 }, 0, 0 }; ring_buffer rx_buffer2 = { { 0 }, 0, 0 };
ring_buffer tx_buffer2 = { { 0 }, 0, 0 };
#endif #endif
#if defined(UBRR3H) #if defined(UBRR3H)
ring_buffer rx_buffer3 = { { 0 }, 0, 0 }; ring_buffer rx_buffer3 = { { 0 }, 0, 0 };
ring_buffer tx_buffer3 = { { 0 }, 0, 0 };
#endif #endif
inline void store_char(unsigned char c, ring_buffer *rx_buffer) inline void store_char(unsigned char c, ring_buffer *buffer)
{ {
int i = (unsigned int)(rx_buffer->head + 1) % RX_BUFFER_SIZE; int i = (unsigned int)(buffer->head + 1) % SERIAL_BUFFER_SIZE;
// if we should be storing the received character into the location // if we should be storing the received character into the location
// just before the tail (meaning that the head would advance to the // just before the tail (meaning that the head would advance to the
// current location of the tail), we're about to overflow the buffer // current location of the tail), we're about to overflow the buffer
// and so we don't write the character or advance the head. // and so we don't write the character or advance the head.
if (i != rx_buffer->tail) { if (i != buffer->tail) {
rx_buffer->buffer[rx_buffer->head] = c; buffer->buffer[buffer->head] = c;
rx_buffer->head = i; buffer->head = i;
} }
} }
#if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \
!defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \
!defined(SIG_UART_RECV)
#error Don't know what the Data Received vector is called for the first UART
#else
void serialEvent() __attribute__((weak));
void serialEvent() {}
#if defined(USART_RX_vect) #if defined(USART_RX_vect)
SIGNAL(USART_RX_vect) SIGNAL(USART_RX_vect)
{ #elif defined(SIG_USART0_RECV)
#if defined(UDR0)
unsigned char c = UDR0;
#elif defined(UDR)
unsigned char c = UDR; // atmega8535
#else
#error UDR not defined
#endif
store_char(c, &rx_buffer);
}
#elif defined(SIG_USART0_RECV) && defined(UDR0)
SIGNAL(SIG_USART0_RECV) SIGNAL(SIG_USART0_RECV)
{ #elif defined(SIG_UART0_RECV)
unsigned char c = UDR0;
store_char(c, &rx_buffer);
}
#elif defined(SIG_UART0_RECV) && defined(UDR0)
SIGNAL(SIG_UART0_RECV) SIGNAL(SIG_UART0_RECV)
{
unsigned char c = UDR0;
store_char(c, &rx_buffer);
}
//#elif defined(SIG_USART_RECV)
#elif defined(USART0_RX_vect) #elif defined(USART0_RX_vect)
// fixed by Mark Sproul this is on the 644/644p
//SIGNAL(SIG_USART_RECV)
SIGNAL(USART0_RX_vect) SIGNAL(USART0_RX_vect)
#elif defined(SIG_UART_RECV)
SIGNAL(SIG_UART_RECV)
#endif
{ {
#if defined(UDR0) #if defined(UDR0)
unsigned char c = UDR0; unsigned char c = UDR0;
#elif defined(UDR) #elif defined(UDR)
unsigned char c = UDR; // atmega8, atmega32 unsigned char c = UDR;
#else #else
#error UDR not defined #error UDR not defined
#endif #endif
store_char(c, &rx_buffer); store_char(c, &rx_buffer);
serialEvent();
} }
#elif defined(SIG_UART_RECV)
// this is for atmega8
SIGNAL(SIG_UART_RECV)
{
#if defined(UDR0)
unsigned char c = UDR0; // atmega645
#elif defined(UDR)
unsigned char c = UDR; // atmega8
#endif
store_char(c, &rx_buffer);
}
#elif defined(USBCON)
#warning No interrupt handler for usart 0
#warning Serial(0) is on USB interface
#else
#error No interrupt handler for usart 0
#endif #endif
//#if defined(SIG_USART1_RECV)
#if defined(USART1_RX_vect) #if defined(USART1_RX_vect)
//SIGNAL(SIG_USART1_RECV) void serialEvent1() __attribute__((weak));
void serialEvent1() {}
SIGNAL(USART1_RX_vect) SIGNAL(USART1_RX_vect)
{ {
unsigned char c = UDR1; unsigned char c = UDR1;
store_char(c, &rx_buffer1); store_char(c, &rx_buffer1);
serialEvent1();
} }
#elif defined(SIG_USART1_RECV) #elif defined(SIG_USART1_RECV)
#error SIG_USART1_RECV #error SIG_USART1_RECV
#endif #endif
#if defined(USART2_RX_vect) && defined(UDR2) #if defined(USART2_RX_vect) && defined(UDR2)
void serialEvent2() __attribute__((weak));
void serialEvent2() {}
SIGNAL(USART2_RX_vect) SIGNAL(USART2_RX_vect)
{ {
unsigned char c = UDR2; unsigned char c = UDR2;
store_char(c, &rx_buffer2); store_char(c, &rx_buffer2);
serialEvent2();
} }
#elif defined(SIG_USART2_RECV) #elif defined(SIG_USART2_RECV)
#error SIG_USART2_RECV #error SIG_USART2_RECV
#endif #endif
#if defined(USART3_RX_vect) && defined(UDR3) #if defined(USART3_RX_vect) && defined(UDR3)
void serialEvent3() __attribute__((weak));
void serialEvent3() {}
SIGNAL(USART3_RX_vect) SIGNAL(USART3_RX_vect)
{ {
unsigned char c = UDR3; unsigned char c = UDR3;
store_char(c, &rx_buffer3); store_char(c, &rx_buffer3);
serialEvent3();
} }
#elif defined(SIG_USART3_RECV) #elif defined(SIG_USART3_RECV)
#error SIG_USART3_RECV #error SIG_USART3_RECV
#endif #endif
#if !defined(UART0_UDRE_vect) && !defined(UART_UDRE_vect) && !defined(USART0_UDRE_vect) && !defined(USART_UDRE_vect)
#error Don't know what the Data Register Empty vector is called for the first UART
#else
#if defined(UART0_UDRE_vect)
ISR(UART0_UDRE_vect)
#elif defined(UART_UDRE_vect)
ISR(UART_UDRE_vect)
#elif defined(USART0_UDRE_vect)
ISR(USART0_UDRE_vect)
#elif defined(USART_UDRE_vect)
ISR(USART_UDRE_vect)
#endif
{
if (tx_buffer.head == tx_buffer.tail) {
// Buffer empty, so disable interrupts
#if defined(UCSR0B)
cbi(UCSR0B, UDRIE0);
#else
cbi(UCSRB, UDRIE);
#endif
}
else {
// There is more data in the output buffer. Send the next byte
unsigned char c = tx_buffer.buffer[tx_buffer.tail];
tx_buffer.tail = (tx_buffer.tail + 1) % SERIAL_BUFFER_SIZE;
#if defined(UDR0)
UDR0 = c;
#elif defined(UDR)
UDR = c;
#else
#error UDR not defined
#endif
}
}
#endif
#ifdef USART1_UDRE_vect
ISR(USART1_UDRE_vect)
{
if (tx_buffer1.head == tx_buffer1.tail) {
// Buffer empty, so disable interrupts
cbi(UCSR1B, UDRIE1);
}
else {
// There is more data in the output buffer. Send the next byte
unsigned char c = tx_buffer1.buffer[tx_buffer1.tail];
tx_buffer1.tail = (tx_buffer1.tail + 1) % SERIAL_BUFFER_SIZE;
UDR1 = c;
}
}
#endif
#ifdef USART2_UDRE_vect
ISR(USART2_UDRE_vect)
{
if (tx_buffer2.head == tx_buffer2.tail) {
// Buffer empty, so disable interrupts
cbi(UCSR2B, UDRIE2);
}
else {
// There is more data in the output buffer. Send the next byte
unsigned char c = tx_buffer2.buffer[tx_buffer2.tail];
tx_buffer2.tail = (tx_buffer2.tail + 1) % SERIAL_BUFFER_SIZE;
UDR2 = c;
}
}
#endif
#ifdef USART3_UDRE_vect
ISR(USART3_UDRE_vect)
{
if (tx_buffer3.head == tx_buffer3.tail) {
// Buffer empty, so disable interrupts
cbi(UCSR3B, UDRIE3);
}
else {
// There is more data in the output buffer. Send the next byte
unsigned char c = tx_buffer3.buffer[tx_buffer3.tail];
tx_buffer3.tail = (tx_buffer3.tail + 1) % SERIAL_BUFFER_SIZE;
UDR3 = c;
}
}
#endif
// Constructors //////////////////////////////////////////////////////////////// // Constructors ////////////////////////////////////////////////////////////////
HardwareSerial::HardwareSerial(ring_buffer *rx_buffer, HardwareSerial::HardwareSerial(ring_buffer *rx_buffer, ring_buffer *tx_buffer,
volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
volatile uint8_t *ucsra, volatile uint8_t *ucsrb, volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
volatile uint8_t *udr, volatile uint8_t *udr,
uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x) uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udrie, uint8_t u2x)
{ {
_rx_buffer = rx_buffer; _rx_buffer = rx_buffer;
_tx_buffer = tx_buffer;
_ubrrh = ubrrh; _ubrrh = ubrrh;
_ubrrl = ubrrl; _ubrrl = ubrrl;
_ucsra = ucsra; _ucsra = ucsra;
@ -185,13 +259,13 @@ HardwareSerial::HardwareSerial(ring_buffer *rx_buffer,
_rxen = rxen; _rxen = rxen;
_txen = txen; _txen = txen;
_rxcie = rxcie; _rxcie = rxcie;
_udre = udre; _udrie = udrie;
_u2x = u2x; _u2x = u2x;
} }
// Public Methods ////////////////////////////////////////////////////////////// // Public Methods //////////////////////////////////////////////////////////////
void HardwareSerial::begin(long baud) void HardwareSerial::begin(unsigned long baud)
{ {
uint16_t baud_setting; uint16_t baud_setting;
bool use_u2x = true; bool use_u2x = true;
@ -205,6 +279,8 @@ void HardwareSerial::begin(long baud)
} }
#endif #endif
try_again:
if (use_u2x) { if (use_u2x) {
*_ucsra = 1 << _u2x; *_ucsra = 1 << _u2x;
baud_setting = (F_CPU / 4 / baud - 1) / 2; baud_setting = (F_CPU / 4 / baud - 1) / 2;
@ -213,6 +289,12 @@ void HardwareSerial::begin(long baud)
baud_setting = (F_CPU / 8 / baud - 1) / 2; baud_setting = (F_CPU / 8 / baud - 1) / 2;
} }
if ((baud_setting > 4095) && use_u2x)
{
use_u2x = false;
goto try_again;
}
// assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register) // assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
*_ubrrh = baud_setting >> 8; *_ubrrh = baud_setting >> 8;
*_ubrrl = baud_setting; *_ubrrl = baud_setting;
@ -220,18 +302,27 @@ void HardwareSerial::begin(long baud)
sbi(*_ucsrb, _rxen); sbi(*_ucsrb, _rxen);
sbi(*_ucsrb, _txen); sbi(*_ucsrb, _txen);
sbi(*_ucsrb, _rxcie); sbi(*_ucsrb, _rxcie);
cbi(*_ucsrb, _udrie);
} }
void HardwareSerial::end() void HardwareSerial::end()
{ {
// wait for transmission of outgoing data
while (_tx_buffer->head != _tx_buffer->tail)
;
cbi(*_ucsrb, _rxen); cbi(*_ucsrb, _rxen);
cbi(*_ucsrb, _txen); cbi(*_ucsrb, _txen);
cbi(*_ucsrb, _rxcie); cbi(*_ucsrb, _rxcie);
cbi(*_ucsrb, _udrie);
// clear any received data
_rx_buffer->head = _rx_buffer->tail;
} }
int HardwareSerial::available(void) int HardwareSerial::available(void)
{ {
return (unsigned int)(RX_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail) % RX_BUFFER_SIZE; return (unsigned int)(SERIAL_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail) % SERIAL_BUFFER_SIZE;
} }
int HardwareSerial::peek(void) int HardwareSerial::peek(void)
@ -250,39 +341,41 @@ int HardwareSerial::read(void)
return -1; return -1;
} else { } else {
unsigned char c = _rx_buffer->buffer[_rx_buffer->tail]; unsigned char c = _rx_buffer->buffer[_rx_buffer->tail];
_rx_buffer->tail = (unsigned int)(_rx_buffer->tail + 1) % RX_BUFFER_SIZE; _rx_buffer->tail = (unsigned int)(_rx_buffer->tail + 1) % SERIAL_BUFFER_SIZE;
return c; return c;
} }
} }
void HardwareSerial::flush() void HardwareSerial::flush()
{ {
// don't reverse this or there may be problems if the RX interrupt while (_tx_buffer->head != _tx_buffer->tail)
// occurs after reading the value of rx_buffer_head but before writing ;
// the value to rx_buffer_tail; the previous value of rx_buffer_head
// may be written to rx_buffer_tail, making it appear as if the buffer
// don't reverse this or there may be problems if the RX interrupt
// occurs after reading the value of rx_buffer_head but before writing
// the value to rx_buffer_tail; the previous value of rx_buffer_head
// may be written to rx_buffer_tail, making it appear as if the buffer
// were full, not empty.
_rx_buffer->head = _rx_buffer->tail;
} }
void HardwareSerial::write(uint8_t c) size_t HardwareSerial::write(uint8_t c)
{ {
while (!((*_ucsra) & (1 << _udre))) int i = (_tx_buffer->head + 1) % SERIAL_BUFFER_SIZE;
// If the output buffer is full, there's nothing for it other than to
// wait for the interrupt handler to empty it a bit
// ???: return 0 here instead?
while (i == _tx_buffer->tail)
; ;
*_udr = c; _tx_buffer->buffer[_tx_buffer->head] = c;
_tx_buffer->head = i;
sbi(*_ucsrb, _udrie);
return 1;
} }
// Preinstantiate Objects ////////////////////////////////////////////////////// // Preinstantiate Objects //////////////////////////////////////////////////////
#if defined(UBRRH) && defined(UBRRL) #if defined(UBRRH) && defined(UBRRL)
HardwareSerial Serial(&rx_buffer, &UBRRH, &UBRRL, &UCSRA, &UCSRB, &UDR, RXEN, TXEN, RXCIE, UDRE, U2X); HardwareSerial Serial(&rx_buffer, &tx_buffer, &UBRRH, &UBRRL, &UCSRA, &UCSRB, &UDR, RXEN, TXEN, RXCIE, UDRIE, U2X);
#elif defined(UBRR0H) && defined(UBRR0L) #elif defined(UBRR0H) && defined(UBRR0L)
HardwareSerial Serial(&rx_buffer, &UBRR0H, &UBRR0L, &UCSR0A, &UCSR0B, &UDR0, RXEN0, TXEN0, RXCIE0, UDRE0, U2X0); HardwareSerial Serial(&rx_buffer, &tx_buffer, &UBRR0H, &UBRR0L, &UCSR0A, &UCSR0B, &UDR0, RXEN0, TXEN0, RXCIE0, UDRIE0, U2X0);
#elif defined(USBCON) #elif defined(USBCON)
#warning no serial port defined (port 0) #warning no serial port defined (port 0)
#else #else
@ -290,13 +383,13 @@ void HardwareSerial::write(uint8_t c)
#endif #endif
#if defined(UBRR1H) #if defined(UBRR1H)
HardwareSerial Serial1(&rx_buffer1, &UBRR1H, &UBRR1L, &UCSR1A, &UCSR1B, &UDR1, RXEN1, TXEN1, RXCIE1, UDRE1, U2X1); HardwareSerial Serial1(&rx_buffer1, &tx_buffer1, &UBRR1H, &UBRR1L, &UCSR1A, &UCSR1B, &UDR1, RXEN1, TXEN1, RXCIE1, UDRIE1, U2X1);
#endif #endif
#if defined(UBRR2H) #if defined(UBRR2H)
HardwareSerial Serial2(&rx_buffer2, &UBRR2H, &UBRR2L, &UCSR2A, &UCSR2B, &UDR2, RXEN2, TXEN2, RXCIE2, UDRE2, U2X2); HardwareSerial Serial2(&rx_buffer2, &tx_buffer2, &UBRR2H, &UBRR2L, &UCSR2A, &UCSR2B, &UDR2, RXEN2, TXEN2, RXCIE2, UDRIE2, U2X2);
#endif #endif
#if defined(UBRR3H) #if defined(UBRR3H)
HardwareSerial Serial3(&rx_buffer3, &UBRR3H, &UBRR3L, &UCSR3A, &UCSR3B, &UDR3, RXEN3, TXEN3, RXCIE3, UDRE3, U2X3); HardwareSerial Serial3(&rx_buffer3, &tx_buffer3, &UBRR3H, &UBRR3L, &UCSR3A, &UCSR3B, &UDR3, RXEN3, TXEN3, RXCIE3, UDRIE3, U2X3);
#endif #endif
#endif // whole file #endif // whole file

View File

@ -32,6 +32,7 @@ class HardwareSerial : public Stream
{ {
private: private:
ring_buffer *_rx_buffer; ring_buffer *_rx_buffer;
ring_buffer *_tx_buffer;
volatile uint8_t *_ubrrh; volatile uint8_t *_ubrrh;
volatile uint8_t *_ubrrl; volatile uint8_t *_ubrrl;
volatile uint8_t *_ucsra; volatile uint8_t *_ucsra;
@ -40,21 +41,21 @@ class HardwareSerial : public Stream
uint8_t _rxen; uint8_t _rxen;
uint8_t _txen; uint8_t _txen;
uint8_t _rxcie; uint8_t _rxcie;
uint8_t _udre; uint8_t _udrie;
uint8_t _u2x; uint8_t _u2x;
public: public:
HardwareSerial(ring_buffer *rx_buffer, HardwareSerial(ring_buffer *rx_buffer, ring_buffer *tx_buffer,
volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
volatile uint8_t *ucsra, volatile uint8_t *ucsrb, volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
volatile uint8_t *udr, volatile uint8_t *udr,
uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x); uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udrie, uint8_t u2x);
void begin(long); void begin(unsigned long);
void end(); void end();
virtual int available(void); virtual int available(void);
virtual int peek(void); virtual int peek(void);
virtual int read(void); virtual int read(void);
virtual void flush(void); virtual void flush(void);
virtual void write(uint8_t); virtual size_t write(uint8_t);
using Print::write; // pull in write(str) and write(buf, size) from Print using Print::write; // pull in write(str) and write(buf, size) from Print
}; };

View File

@ -1,5 +1,5 @@
#include <WProgram.h> #include <Arduino.h>
#include <IPAddress.h> #include <IPAddress.h>
IPAddress::IPAddress() IPAddress::IPAddress()
@ -42,3 +42,15 @@ bool IPAddress::operator==(const uint8_t* addr)
return memcmp(addr, _address, sizeof(_address)) == 0; return memcmp(addr, _address, sizeof(_address)) == 0;
} }
size_t IPAddress::printTo(Print& p) const
{
size_t n = 0;
for (int i =0; i < 3; i++)
{
n += p.print(_address[i], DEC);
n += p.print('.');
}
n += p.print(_address[3], DEC);
return n;
}

View File

@ -26,9 +26,11 @@
#ifndef IPAddress_h #ifndef IPAddress_h
#define IPAddress_h #define IPAddress_h
#include <Printable.h>
// A class to make it easier to handle and pass around IP addresses // A class to make it easier to handle and pass around IP addresses
class IPAddress { class IPAddress : public Printable {
private: private:
uint8_t _address[4]; // IPv4 address uint8_t _address[4]; // IPv4 address
// Access the raw byte array containing the address. Because this returns a pointer // Access the raw byte array containing the address. Because this returns a pointer
@ -58,6 +60,8 @@ public:
IPAddress& operator=(const uint8_t *address); IPAddress& operator=(const uint8_t *address);
IPAddress& operator=(uint32_t address); IPAddress& operator=(uint32_t address);
virtual size_t printTo(Print& p) const;
friend class EthernetClass; friend class EthernetClass;
friend class UDP; friend class UDP;
friend class Client; friend class Client;

View File

@ -23,173 +23,223 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "wiring.h" #include "Arduino.h"
#include "Print.h" #include "Print.h"
// Public Methods ////////////////////////////////////////////////////////////// // Public Methods //////////////////////////////////////////////////////////////
/* default implementation: may be overridden */ /* default implementation: may be overridden */
void Print::write(const char *str) size_t Print::write(const char *str)
{ {
while (*str) size_t n = 0;
write(*str++); while (*str) {
n += write(*str++);
}
return n;
} }
/* default implementation: may be overridden */ /* default implementation: may be overridden */
void Print::write(const uint8_t *buffer, size_t size) size_t Print::write(const uint8_t *buffer, size_t size)
{ {
while (size--) size_t n = 0;
write(*buffer++); while (size--) {
} n += write(*buffer++);
void Print::print(const String &s)
{
for (int i = 0; i < s.length(); i++) {
write(s[i]);
} }
return n;
} }
void Print::print(const char str[]) size_t Print::print(const __FlashStringHelper *ifsh)
{ {
write(str); const prog_char *p = (const prog_char *)ifsh;
size_t n = 0;
while (1) {
unsigned char c = pgm_read_byte(p++);
if (c == 0) break;
n += write(c);
}
return n;
} }
void Print::print(char c, int base) size_t Print::print(const String &s)
{ {
print((long) c, base); size_t n = 0;
for (int i = 0; i < s.length(); i++) {
n += write(s[i]);
}
return n;
} }
void Print::print(unsigned char b, int base) size_t Print::print(const char str[])
{ {
print((unsigned long) b, base); return write(str);
} }
void Print::print(int n, int base) size_t Print::print(char c)
{ {
print((long) n, base); return write(c);
} }
void Print::print(unsigned int n, int base) size_t Print::print(unsigned char b, int base)
{ {
print((unsigned long) n, base); return print((unsigned long) b, base);
} }
void Print::print(long n, int base) size_t Print::print(int n, int base)
{
return print((long) n, base);
}
size_t Print::print(unsigned int n, int base)
{
return print((unsigned long) n, base);
}
size_t Print::print(long n, int base)
{ {
if (base == 0) { if (base == 0) {
write(n); return write(n);
} else if (base == 10) { } else if (base == 10) {
if (n < 0) { if (n < 0) {
print('-'); int t = print('-');
n = -n; n = -n;
return printNumber(n, 10) + t;
} }
printNumber(n, 10); return printNumber(n, 10);
} else { } else {
printNumber(n, base); return printNumber(n, base);
} }
} }
void Print::print(unsigned long n, int base) size_t Print::print(unsigned long n, int base)
{ {
if (base == 0) write(n); if (base == 0) return write(n);
else printNumber(n, base); else return printNumber(n, base);
} }
void Print::print(double n, int digits) size_t Print::print(double n, int digits)
{ {
printFloat(n, digits); return printFloat(n, digits);
} }
void Print::println(void) size_t Print::println(const __FlashStringHelper *ifsh)
{ {
print('\r'); size_t n = print(ifsh);
print('\n'); n += println();
return n;
} }
void Print::println(const String &s) size_t Print::print(const Printable& x)
{ {
print(s); return x.printTo(*this);
println();
} }
void Print::println(const char c[]) size_t Print::println(void)
{ {
print(c); size_t n = print('\r');
println(); n += print('\n');
return n;
} }
void Print::println(char c, int base) size_t Print::println(const String &s)
{ {
print(c, base); size_t n = print(s);
println(); n += println();
return n;
} }
void Print::println(unsigned char b, int base) size_t Print::println(const char c[])
{ {
print(b, base); size_t n = print(c);
println(); n += println();
return n;
} }
void Print::println(int n, int base) size_t Print::println(char c)
{ {
print(n, base); size_t n = print(c);
println(); n += println();
return n;
} }
void Print::println(unsigned int n, int base) size_t Print::println(unsigned char b, int base)
{ {
print(n, base); size_t n = print(b, base);
println(); n += println();
return n;
} }
void Print::println(long n, int base) size_t Print::println(int num, int base)
{ {
print(n, base); size_t n = print(num, base);
println(); n += println();
return n;
} }
void Print::println(unsigned long n, int base) size_t Print::println(unsigned int num, int base)
{ {
print(n, base); size_t n = print(num, base);
println(); n += println();
return n;
} }
void Print::println(double n, int digits) size_t Print::println(long num, int base)
{ {
print(n, digits); size_t n = print(num, base);
println(); n += println();
return n;
}
size_t Print::println(unsigned long num, int base)
{
size_t n = print(num, base);
n += println();
return n;
}
size_t Print::println(double num, int digits)
{
size_t n = print(num, digits);
n += println();
return n;
}
size_t Print::println(const Printable& x)
{
size_t n = print(x);
n += println();
return n;
} }
// Private Methods ///////////////////////////////////////////////////////////// // Private Methods /////////////////////////////////////////////////////////////
void Print::printNumber(unsigned long n, uint8_t base) size_t Print::printNumber(unsigned long n, uint8_t base) {
{ char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte.
unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars. char *str = &buf[sizeof(buf) - 1];
unsigned long i = 0;
if (n == 0) { *str = '\0';
print('0');
return;
}
while (n > 0) { // prevent crash if called with base == 1
buf[i++] = n % base; if (base < 2) base = 10;
do {
unsigned long m = n;
n /= base; n /= base;
} char c = m - base * n;
*--str = c < 10 ? c + '0' : c + 'A' - 10;
} while(n);
for (; i > 0; i--) return write(str);
print((char) (buf[i - 1] < 10 ?
'0' + buf[i - 1] :
'A' + buf[i - 1] - 10));
} }
void Print::printFloat(double number, uint8_t digits) size_t Print::printFloat(double number, uint8_t digits)
{ {
size_t n = 0;
// Handle negative numbers // Handle negative numbers
if (number < 0.0) if (number < 0.0)
{ {
print('-'); n += print('-');
number = -number; number = -number;
} }
@ -203,18 +253,21 @@ void Print::printFloat(double number, uint8_t digits)
// Extract the integer part of the number and print it // Extract the integer part of the number and print it
unsigned long int_part = (unsigned long)number; unsigned long int_part = (unsigned long)number;
double remainder = number - (double)int_part; double remainder = number - (double)int_part;
print(int_part); n += print(int_part);
// Print the decimal point, but only if there are digits beyond // Print the decimal point, but only if there are digits beyond
if (digits > 0) if (digits > 0) {
print("."); n += print(".");
}
// Extract digits from the remainder one at a time // Extract digits from the remainder one at a time
while (digits-- > 0) while (digits-- > 0)
{ {
remainder *= 10.0; remainder *= 10.0;
int toPrint = int(remainder); int toPrint = int(remainder);
print(toPrint); n += print(toPrint);
remainder -= toPrint; remainder -= toPrint;
} }
return n;
} }

Some files were not shown because too many files have changed in this diff Show More