    82 :R
    88 :X
    89 :Y})
+
+
+(def ^:private axis-keys
+  #{:up :down :left :right})
 
 
 (defn- key-handler

;;;;; PROCESSING DISPLAY ;;;;;

(defrecord ProcessingDisplay
  [size dome layout colors event-channel])

(extend-type ProcessingDisplay
  component/Lifecycle

  (start

              dt (if last-press (- now last-press) 0)]
          (println (format "Key pressed: %d %s -- %d ms since %s"
                           code new-key dt old-key))
          (when-let [event
                     ; TODO: extract into function
                     (if (and (= new-key old-key) (< dt 100))
                       (case new-key
                         :left  {:type :button/repeat, :button :x-axis, :value -1.0, :elapsed dt}
                         :right {:type :button/repeat, :button :x-axis, :value  1.0, :elapsed dt}
                         :down  {:type :button/repeat, :button :y-axis, :value -1.0, :elapsed dt}
                         :up    {:type :button/repeat, :button :y-axis, :value  1.0, :elapsed dt}
                         nil)
                       (when (and new-key (not (axis-keys new-key)))
                         (let [button (case new-key
                                        :enter :start
                                        :space :select
                                        new-key)]
                           {:type :button/press, :button button})))]
            (>!! channel event))
          ; TODO: need timers to handle button/release events
          (swap! state assoc :old-key new-key :last-press now))))))

