Permalink
Browse files

restructured code to be asdf loadable.

  • Loading branch information...
1 parent f8ffe78 commit 01c9aef880714e6282cbacd806473ad609a8f9c8 @ryepup committed Jul 25, 2010
Showing with 49 additions and 16 deletions.
  1. +39 −0 cl-arduino.asd
  2. +4 −8 cl-arduino/cl-arduino.lisp → src/arduino.lisp
  3. +5 −0 src/package.lisp
  4. +1 −8 {serial-repeater → src}/serial.lisp
View
@@ -0,0 +1,39 @@
+;;;;
+;;;; Copyright (c) 2010 Ryan Davis, All Rights Reserved
+;;;;
+;;;; Redistribution and use in source and binary forms, with or without
+;;;; modification, are permitted provided that the following conditions
+;;;; are met:
+;;;;
+;;;; * Redistributions of source code must retain the above copyright
+;;;; notice, this list of conditions and the following disclaimer.
+;;;;
+;;;; * Redistributions in binary form must reproduce the above
+;;;; copyright notice, this list of conditions and the following
+;;;; disclaimer in the documentation and/or other materials
+;;;; provided with the distribution.
+;;;;
+;;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+;;;;
+;;;; cl-arduino.asd
+
+(asdf:defsystem #:cl-arduino
+ :depends-on (#:alexandria
+ #:iterate)
+ :version "0.1"
+ :serial t
+ :components ((:module :src
+ :components
+ ((:file "package")
+ (:file "serial")
+ (:file "arduino")))))
@@ -1,8 +1,4 @@
;;;; cl-arduino.lisp
-
-(defpackage #:cl-arduino
- (:use #:cl #:iterate))
-
(in-package #:cl-arduino)
@@ -12,7 +8,7 @@
(defvar *device-path* "/dev/ttyUSB0")
(defmacro with-serial-io ((stream) &body body)
- `(serial:with-serial-port (,stream *device-path*
+ `(with-serial-port (,stream *device-path*
:speed 9600
:timeout 1)
(let ((*default-serial-stream* ,stream))
@@ -44,13 +40,13 @@
(defmethod initialize-instance :after ((obj arduino) &key &allow-other-keys)
(setf (serial-stream obj)
- (serial::open-serial-port-stream *device-path*))
+ (open-serial-port-stream *device-path*))
- (serial::set-serial-port-raw-mode (serial-stream obj)
+ (set-serial-port-raw-mode (serial-stream obj)
:speed 9600 :parity :n))
(defmethod disconnect ((ar arduino))
- (serial::close-serial-port-stream (serial-stream ar)))
+ (close-serial-port-stream (serial-stream ar)))
(defmacro with-serial-ack ((stream-var arduino) &body body)
`(let ((,stream-var (serial-stream ,arduino)))
View
@@ -0,0 +1,5 @@
+(defpackage #:cl-arduino
+ (:use #:cl #:iterate)
+ (:export
+ #:arduino #:disconnect #:analog #:digital
+ #:ir-read #:shutdown #:blink))
@@ -1,12 +1,5 @@
;;;; serial.lisp
-(require 'alexandria)
-
-(defpackage #:serial
- (:use #:cl)
- (:export with-serial-port
- with-serial-ports*))
-
-(in-package #:serial)
+(in-package #:cl-arduino)
(defvar *open-tty-streams* (make-hash-table)
"Hash table of open ttys for signal handlers")

0 comments on commit 01c9aef

Please sign in to comment.