diff --git a/.gitignore b/.gitignore index fc8b473..e094556 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ pom.xml.asc # Intellij .idea *.iml + +# Sublime Text +*.sublime-* diff --git a/README.md b/README.md index 1dacd5b..faaacbc 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Add the following to your `project.clj` - [clj-firmata 1.1.0] + [clj-firmata 1.1.1] ### Connect to a Board diff --git a/project.clj b/project.clj index 83aa892..7167f35 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject clj-firmata "1.1.1-SNAPSHOT" +(defproject clj-firmata "1.1.1" :description "clj-firmata provides access to Standard Firmata (http://firmata.org/) commands via clojure" :url "https://github.com/peterschwarz/clj-firmata" :license {:name "Eclipse Public License" diff --git a/src/firmata/core.clj b/src/firmata/core.clj index a19df2a..9147948 100644 --- a/src/firmata/core.clj +++ b/src/firmata/core.clj @@ -178,7 +178,17 @@ [in] (str (.read in) "." (.read in))) -(defmulti ^{:private true} read-sysex-event +(defmulti read-sysex-event + "Reads a sysex message. + + Returns a map with, at a minimum, the key :type. This should + indicates what sort of sysex message is being received. + + For example, the result of a REPORT_FIRMWARE message is + + { :type :firmaware-report + :version \"2.3\" + :name \"StandardFirmata\" }" (fn [in] (.read in))) (defmethod read-sysex-event REPORT_FIRMWARE @@ -242,6 +252,12 @@ {:type :analog-mappings :mappings mappings})) +(defmethod read-sysex-event STRING_DATA + [in] + (let [data (consume-sysex in "" #(str %1 (char %2)))] + {:type :string-data + :data data})) + (defmethod read-sysex-event :default [in] (let [values (consume-sysex in '[] #(conj %1 %2))] @@ -448,6 +464,11 @@ [this] publisher) + + Object + + (toString [this] (format "(#Firmata :port-name \"%s\")" port-name)) + ))) (defn send-i2c-request diff --git a/test/firmata/test/core.clj b/test/firmata/test/core.clj index 4cc3884..ce3d8e6 100644 --- a/test/firmata/test/core.clj +++ b/test/firmata/test/core.clj @@ -1,6 +1,6 @@ (ns firmata.test.core (:require [clojure.test :refer :all] - [clojure.core.async :refer [go