 
 (defn open-channel-port
   "Opens a port which can be used for listening to value changes.  In addition to the
-  options map for a basic port, the following are available:
+  options map for [[open-port]], the following are available:
   * :event-buffer-size - the size of the change events buffer.  Defaults to 1
   * :timeout - sets a timeout for the OS polling wait time.  Defaults to -1, which waits indefinitely
   * :edge - sets the edge value- :rising, :falling, or :both"

      gpio-port
      (catch Exception e
        (close! gpio-port)
        (throw e)))

))

(defn- tap-and-wrap-chan [mult-ch out-ch]
  (a/tap mult-ch out-ch)

          "0"   \0
          value)))

(defn- do-format 
  [raw-value high low]
  (if  (= \1 raw-value) high low))

(defmulti format-raw-digital 
  "Formats the raw values received from digital reads of pin state,
      or digital events.
      
        The type specified is a keyword."
  (fn [type _] type))

(defmethod format-raw-digital :keyword 
  [_ raw-value]
  (do-format raw-value :high :low))

(defmethod format-raw-digital :boolean
  [_ raw-value]
  (= \1 raw-value))

(defmethod format-raw-digital :symbol
  [_ raw-value]
  (do-format raw-value 'high 'low))

(defmethod format-raw-digital :integer
  [_ raw-value]
  (do-format raw-value 1 0))

(defmethod format-raw-digital :char
  [_ raw-value]
  raw-value)

(defmethod format-raw-digital :default
  [_ raw-value]
  raw-value)

(defprotocol Closeable
  (close! [self] "Closes this object"))

