Skip to content

Commit

Permalink
Only print descriptions when they exist.
Browse files Browse the repository at this point in the history
Thanks @osterwood for noticing this #6
  • Loading branch information
lynaghk committed Oct 25, 2021
1 parent a07cad5 commit b0551c8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions generate_registers.clj
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

;;comment
(println (->comment (str name " [" lsb ":" msb "]")))
(println (->comment description))
(when description (println (->comment description)))

;;emit anon struct of values or raw integer for field.
;;both must have defaults so the user doesn't need to specify all fields every time they write to a register
Expand All @@ -113,7 +113,7 @@
(println "{")

(doseq [{:keys [name description value]} enums]
(println (->comment description))
(when description (println (->comment description)))
(println (->identifier name) "=" value ","))

(when-not default-enum
Expand Down Expand Up @@ -147,7 +147,7 @@
[p]
(with-out-str
(let [{:keys [name description baseAddress registers]} p]
(println (->comment description))
(when description (println (->comment description)))
(println "pub const" (->identifier name) "= struct{")

(doseq [{:keys [name description addressOffset resetValue access fields dim dimIncrement] :as register} registers]
Expand Down Expand Up @@ -182,7 +182,7 @@
;;;;;;;;;;;;;;
;;Register

(println (->comment description))
(when description (println (->comment description)))
(println "pub const" register-name "="

(cond
Expand Down

0 comments on commit b0551c8

Please sign in to comment.