Created
September 29, 2012 12:07
-
-
Save jsmpereira/3803817 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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