Skip to content

Instantly share code, notes, and snippets.

@jsmpereira
Created September 29, 2012 12:07
Show Gist options
  • Save jsmpereira/3803817 to your computer and use it in GitHub Desktop.
Save jsmpereira/3803817 to your computer and use it in GitHub Desktop.
;; DISCONNECT_REQ
(defun disconnect-req ()
(with-buffer (make-buffer)
(serialize* :uint8 27
:uint16 8
:uint16 32865
:uint16 29
:uint16 7))) ;; command code
;; CONNECT_REQ
(defun connect-req ()
(with-buffer (make-buffer)
(serialize* :uint8 27 ;; sync char
:uint16 10 ;; length
:uint16 32865 ;; destination
:uint16 10 ;; origin (any 10+ integer)
:uint16 1 ;; command code
:uint16 0))) ;; tick
(defun send-message (buffer &optional (stream "/dev/cu.PL2303-0000101D"))
(with-open-file (s stream
:direction :io
:if-exists :overwrite
:external-format :ascii
:element-type '(unsigned-byte 8))
(write-sequence buffer s)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment