     (log/warn
       (str "Incomplete data read from SNES controller: "
            (apply str (map (partial format "%02X") (take len buffer)))))
+    ; TODO: virtual d-pad buttons
     (assoc
       (read-buttons snes-bits buffer)
       :x-axis (byte-axis (aget buffer 0))

  [old-state new-state elapsed]
  (remove nil?
    (concat
      (repeat-events snes-defaults old-state elapsed)
      (button-events snes-defaults old-state new-state))))


(defn snes

(def ^:const snes-vendor-id  0x12bd)
(def ^:const snes-product-id 0xd015)

(def ^:private snes-axes
  {:x-axis 0.0
   :y-axis 0.0})

(def ^:private snes-buttons
  #{:X :A :B :Y :L :R :select :start})

(def ^:private snes-bits
  {:X      [3 0]
