artoo-digispark 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e085336f2640136c5107b73fe182c2f5f5381100
4
+ data.tar.gz: 7218df0739883144cdef4d2304697558cc908ce1
5
+ SHA512:
6
+ metadata.gz: c8a875ac564eb3cb9ab93c0ac03990df5f1077c20c282aae125040d283f0cbf4fab17632f16294f9af446c691dcf881b1aced1895403827f061f329cde38192d
7
+ data.tar.gz: 77d3c4f6499b8b37756105567595957387682aab386cca57e93200c661f6af77220be751407350dc939b6f027ab1693d4ee051aed2ccf9a20396e94ecbb81f36
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - jruby-19mode
6
+ - rbx-19mode
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in artoo-digispark.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,74 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ artoo-digispark (0.2.0)
5
+ artoo (~> 1.2.0)
6
+ artoo-gpio
7
+ artoo-i2c
8
+ littlewire (~> 0.9.10)
9
+
10
+ GEM
11
+ remote: http://rubygems.org/
12
+ specs:
13
+ artoo (1.2.0)
14
+ celluloid (~> 0.15.0)
15
+ celluloid-io (~> 0.15.0)
16
+ multi_json (~> 1.6)
17
+ pry (~> 0.9)
18
+ rake (~> 10.0)
19
+ reel (~> 0.4.0)
20
+ thor (~> 0.18.1)
21
+ artoo-gpio (0.2.0)
22
+ artoo (~> 1.2.0)
23
+ artoo-i2c (0.2.0)
24
+ artoo (~> 1.2.0)
25
+ celluloid (0.15.1)
26
+ timers (~> 1.1.0)
27
+ celluloid-io (0.15.0)
28
+ celluloid (>= 0.15.0)
29
+ nio4r (>= 0.5.0)
30
+ coderay (1.0.9)
31
+ colorist (0.0.2)
32
+ ffi (1.9.0)
33
+ http (0.5.0)
34
+ http_parser.rb
35
+ http_parser.rb (0.6.0.beta.2)
36
+ libusb (0.3.4)
37
+ ffi (>= 1.0)
38
+ littlewire (0.9.10)
39
+ colorist (>= 0.0.2)
40
+ libusb (>= 0.2.0)
41
+ thor (>= 0.18.1)
42
+ metaclass (0.0.1)
43
+ method_source (0.8.2)
44
+ minitest (5.0.7)
45
+ minitest-happy (1.0.0)
46
+ mocha (0.14.0)
47
+ metaclass (~> 0.0.1)
48
+ multi_json (1.8.0)
49
+ nio4r (0.5.0)
50
+ pry (0.9.12.2)
51
+ coderay (~> 1.0.5)
52
+ method_source (~> 0.8)
53
+ slop (~> 3.4)
54
+ rake (10.1.0)
55
+ reel (0.4.0)
56
+ celluloid (>= 0.15.1)
57
+ celluloid-io (>= 0.15.0)
58
+ http (>= 0.5.0)
59
+ http_parser.rb (>= 0.6.0.beta.2)
60
+ websocket_parser (>= 0.1.4)
61
+ slop (3.4.6)
62
+ thor (0.18.1)
63
+ timers (1.1.0)
64
+ websocket_parser (0.1.4)
65
+ http
66
+
67
+ PLATFORMS
68
+ ruby
69
+
70
+ DEPENDENCIES
71
+ artoo-digispark!
72
+ minitest (~> 5.0)
73
+ minitest-happy
74
+ mocha (~> 0.14.0)
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2013 The Hybrid Group
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,114 @@
1
+ # Artoo Adaptor For Digispark
2
+
3
+ This repository contains the Artoo (http://artoo.io/) adaptor for the Digispark (http://www.kickstarter.com/projects/digistump/digispark-the-tiny-arduino-enabled-usb-dev-board) ATTiny-based USB development board with the Little Wire (http://littlewire.cc/) protocol firmware installed.
4
+
5
+ Artoo is a open source micro-framework for robotics using Ruby.
6
+
7
+ For more information abut Artoo, check out our repo at https://github.com/hybridgroup/artoo
8
+
9
+ [![Code Climate](https://codeclimate.com/github/hybridgroup/artoo-digispark.png)](https://codeclimate.com/github/hybridgroup/artoo-digispark) [![Build Status](https://travis-ci.org/hybridgroup/artoo-digispark.png?branch=master)](https://travis-ci.org/hybridgroup/artoo-digispark)
10
+
11
+ This gem makes extensive use of the littlewire.rb gem (https://github.com/Bluebie/littlewire.rb) thanks to [@Bluebie](https://github.com/Bluebie)
12
+
13
+ ## Installing
14
+
15
+ ```
16
+ gem install artoo-digispark
17
+ ```
18
+
19
+ ## Using
20
+
21
+ ```ruby
22
+ connection :digispark, :adaptor => :littlewire, :vendor => 0x1781, :product => 0x0c9f
23
+ device :board, :driver => :device_info
24
+ device :led, :driver => :led, :pin => 1
25
+
26
+ work do
27
+ puts "Firmware name: #{board.firmware_name}"
28
+ puts "Firmware version: #{board.version}"
29
+
30
+ every 1.second do
31
+ led.toggle
32
+ end
33
+ end
34
+ ```
35
+
36
+ ## Devices supported
37
+
38
+ The following hardware devices have driver support, via the artoo-gpio gem:
39
+ - Button
40
+ - LED
41
+ - Maxbotix ultrasonic range finder
42
+ - Analog sensor
43
+ - Motor (DC)
44
+ - Servo
45
+
46
+ The following hardware devices have driver support, via the artoo-i2c gem:
47
+ - Wiichuck controller
48
+ - Wiiclassic controller
49
+
50
+ ## Connecting to Digispark
51
+
52
+ If your Digispark (http://www.kickstarter.com/projects/digistump/digispark-the-tiny-arduino-enabled-usb-dev-board) ATTiny-based USB development board already has the Little Wire (http://littlewire.cc/) protocol firmware installed, you can connect right away with Artoo.
53
+
54
+ Otherwise, for instructions on how to install Little Wire on a Digispark check out http://digistump.com/board/index.php/topic,160.0.html
55
+
56
+ ### OSX
57
+
58
+ The main steps are:
59
+ - Plug in the Digispark to the USB port
60
+ - Connect to the device via Artoo
61
+
62
+ First plug the Digispark into your computer via the USB port. Then... (directions go here)
63
+
64
+ ### Ubuntu
65
+
66
+ The main steps are:
67
+ - Add a udev rule to allow access to the Digispark device
68
+ - Plug in the Digispark to the USB port
69
+ - Connect to the device via Artoo
70
+
71
+ First, you must add a udev rule, so that Artoo can communicate with the USB device. Ubuntu and other modern Linux distibutions use udev to manage device files when USB devices are added and removed. By default, udev will create a device with read-only permission which will not allow to you download code. You must place the udev rules below into a file named /etc/udev/rules.d/49-micronucleus.rules.
72
+
73
+ ```
74
+ # UDEV Rules for Micronucleus boards including the Digispark.
75
+ # This file must be placed at:
76
+ #
77
+ # /etc/udev/rules.d/49-micronucleus.rules (preferred location)
78
+ # or
79
+ # /lib/udev/rules.d/49-micronucleus.rules (req'd on some broken systems)
80
+ #
81
+ # After this file is copied, physically unplug and reconnect the board.
82
+ #
83
+ SUBSYSTEMS=="usb", ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c9f", MODE:="0666"
84
+ KERNEL=="ttyACM*", ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c9f", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
85
+ #
86
+ # If you share your linux system with other users, or just don't like the
87
+ # idea of write permission for everybody, you can replace MODE:="0666" with
88
+ # OWNER:="yourusername" to create the device owned by you, or with
89
+ # GROUP:="somegroupname" and mange access using standard unix groups.
90
+ ```
91
+
92
+ Thanks to [@bluebie](https://github.com/Bluebie) for these instructions! (https://github.com/Bluebie/micronucleus-t85/wiki/Ubuntu-Linux)
93
+
94
+ Now plug the Digispark into your computer via the USB port.
95
+
96
+ Once plugged in, use the `artoo connect scan` command with the `-t usb` option to verify your connection info:
97
+
98
+ ```
99
+ $ artoo connect scan -t usb
100
+ ```
101
+
102
+ Now use the `ID` info returned to find the `product` and `vendor` ID's for the connection info Digispark in your Artoo code.
103
+
104
+ ### Windows
105
+
106
+ Someone please fill in the blanks here...
107
+
108
+ ## Contributing
109
+
110
+ 1. Fork it
111
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
112
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
113
+ 4. Push to the branch (`git push origin my-new-feature`)
114
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.pattern = "test/**/*_test.rb"
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "artoo-digispark/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "artoo-digispark"
7
+ s.version = Artoo::Digispark::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Ron Evans"]
10
+ s.email = ["artoo@hybridgroup.com"]
11
+ s.homepage = "https://github.com/hybridgroup/artoo-digispark"
12
+ s.summary = %q{Artoo adaptor for Digispark}
13
+ s.description = %q{Artoo adaptor for Digispark USB development board}
14
+ s.license = 'Apache 2.0'
15
+
16
+ s.rubyforge_project = "artoo-digispark"
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+ s.extensions = ["ext/Rakefile"]
23
+
24
+ s.add_runtime_dependency 'artoo', '~> 1.2.0'
25
+ s.add_runtime_dependency 'artoo-gpio'
26
+ s.add_runtime_dependency 'artoo-i2c'
27
+ s.add_runtime_dependency 'littlewire', '~> 0.9.10'
28
+ s.add_development_dependency 'minitest', '~> 5.0'
29
+ s.add_development_dependency 'minitest-happy'
30
+ s.add_development_dependency 'mocha', '~> 0.14.0'
31
+ end
data/examples/blink.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'artoo'
2
+
3
+ # Uses Digispark USB board (http://digistump.com/products/1)
4
+ # with Little Wire protocol (http://littlewire.cc)
5
+
6
+ connection :digispark, :adaptor => :littlewire, :vendor => 0x1781, :product => 0x0c9f
7
+ device :board, :driver => :device_info
8
+ device :led, :driver => :led, :pin => 1
9
+
10
+ work do
11
+ puts "Firmware name: #{board.firmware_name}"
12
+ puts "Firmware version: #{board.version}"
13
+
14
+ every 1.second do
15
+ led.toggle
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ require 'artoo'
2
+
3
+ # Circuit and schematic here: http://arduino.cc/en/tutorial/button
4
+
5
+ connection :digispark, :adaptor => :littlewire, :vendor => 0x1781, :product => 0x0c9f
6
+ device :board, :driver => :device_info
7
+ device :led, :driver => :led, :pin => 1
8
+ device :button, :driver => :button, :pin => 0, :interval => 0.01
9
+
10
+ work do
11
+ puts "Firmware name: #{board.firmware_name}"
12
+ puts "Firmware version: #{board.version}"
13
+ puts "Press the button connected on pin #{button.pin}..."
14
+
15
+ on button, :push => proc { led.toggle }
16
+ end
@@ -0,0 +1,31 @@
1
+ require 'artoo'
2
+
3
+ #Circuit's breadboard layout here: http://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/breadboard-layout
4
+
5
+ connection :digispark, :adaptor => :littlewire, :vendor => 0x1781, :product => 0x0c9f
6
+ device :board, :driver => :device_info
7
+ device :motor, :driver => :motor, :speed_pin => 1 # Use a PWM pin
8
+
9
+ work do
10
+ puts "Firmware name: #{board.firmware_name}"
11
+ puts "Firmata version: #{board.version}"
12
+ puts "Stopping motor..."
13
+ motor.min # same as 'motor.stop' or 'motor.speed(0)'
14
+ sleep 3
15
+ puts "Setting to maximum speed..."
16
+ motor.max # same as 'motor.start'
17
+ sleep 3
18
+
19
+ speed = 0
20
+ step = 50
21
+
22
+ every 3.seconds do
23
+ motor.speed(speed)
24
+ puts "Current speed: #{motor.current_speed}"
25
+ speed += step
26
+ if [0, 250].include?(speed)
27
+ step = -step
28
+ end
29
+ end
30
+ end
31
+
@@ -0,0 +1,19 @@
1
+ require 'artoo'
2
+
3
+ # Circuit and schematic here: http://www.electrojoystick.com/tutorial/?page_id=285
4
+
5
+ connection :digispark, :adaptor => :littlewire, :vendor => 0x1781, :product => 0x0c9f
6
+ device :sonar, :driver => :maxbotix, :pin => 5, :interval => 0.5
7
+ device :board, :driver => :device_info
8
+
9
+ work do
10
+ on sonar, :range => :sonar_reading
11
+
12
+ puts "Firmware name: #{board.firmware_name}"
13
+ puts "Firmata version: #{board.version}"
14
+ puts "starting sonar..."
15
+ end
16
+
17
+ def sonar_reading(*args)
18
+ puts args[1]
19
+ end
@@ -0,0 +1,56 @@
1
+ require 'artoo'
2
+
3
+ # Uses Digispark USB board (http://digistump.com/products/1)
4
+ # and Digispark RGB shield (http://digistump.com/products/3)
5
+ # with Little Wire protocol (http://littlewire.cc)
6
+
7
+ connection :digispark, :adaptor => :littlewire, :vendor => 0x1781, :product => 0x0c9f
8
+ device :board, :driver => :device_info
9
+ device :red_led, :driver => :led, :pin => 0
10
+ device :green_led, :driver => :led, :pin => 1
11
+ device :blue_led, :driver => :led, :pin => 2
12
+
13
+ work do
14
+ puts "Firmware name: #{board.firmware_name}"
15
+ puts "Firmware version: #{board.version}"
16
+
17
+ @count = 0
18
+
19
+ every 1.second do
20
+ case @count % 4
21
+ when 0
22
+ green
23
+ when 1
24
+ red
25
+ when 2
26
+ blue
27
+ when 3
28
+ off
29
+ end
30
+ @count += 1
31
+ end
32
+
33
+ def red
34
+ red_led.on
35
+ green_led.off
36
+ blue_led.off
37
+ end
38
+
39
+ def green
40
+ red_led.off
41
+ green_led.on
42
+ blue_led.off
43
+ end
44
+
45
+ def blue
46
+ red_led.off
47
+ green_led.off
48
+ blue_led.on
49
+ end
50
+
51
+ def off
52
+ red_led.off
53
+ green_led.off
54
+ blue_led.off
55
+ end
56
+ end
@@ -0,0 +1,17 @@
1
+ require 'artoo'
2
+
3
+ connection :digispark, :adaptor => :littlewire, :vendor => 0x1781, :product => 0x0c9f
4
+ device :board, :driver => :device_info
5
+ device :wiichuck, :driver => :wiichuck, :connection => :arduino, :interval => 0.1
6
+
7
+ work do
8
+ on wiichuck, :c_button => proc { puts "c button pressed!" }
9
+ on wiichuck, :z_button => proc { puts "z button pressed!" }
10
+ on wiichuck, :joystick => proc { |*value|
11
+ puts "joystick x: #{value[1][:x]}, y: #{value[1][:y]}"
12
+ }
13
+
14
+ puts "Firmware name: #{board.firmware_name}"
15
+ puts "Firmware version: #{board.version}"
16
+ end
17
+
data/ext/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'artoo/commands/install'
2
+
3
+ task :default => :install_commands
4
+
5
+ task :install_commands do
6
+ @install = Artoo::Commands::Install.new
7
+ @install.command(File.expand_path(File.dirname(__FILE__) + "/../lib/artoo/commands/digispark.rb"))
8
+ end
@@ -0,0 +1,118 @@
1
+ require 'artoo/adaptors/adaptor'
2
+
3
+ module Artoo
4
+ module Adaptors
5
+ # Connect to Digispark or Littlewire device using Little Wire protocol
6
+ # @see http://littlewire.cc/
7
+ class Littlewire < Adaptor
8
+ attr_reader :littlewire, :vendor, :product, :usb, :firmware_version
9
+
10
+ def initialize(params={})
11
+ super
12
+
13
+ params[:additional_params] ||= {}
14
+ @vendor = params[:additional_params][:vendor] || 0x1781
15
+ @product = params[:additional_params][:product] || 0x0c9f
16
+ end
17
+
18
+ # Creates connection with littlewire board
19
+ # @return [Boolean]
20
+ def connect
21
+ require 'littlewire' unless defined?(::LittleWire)
22
+ @littlewire = ::LittleWire.new(connect_to_usb)
23
+ super
24
+ return true
25
+ end
26
+
27
+ # Closes connection with littlewire board
28
+ # @return [Boolean]
29
+ def disconnect
30
+ littlewire.finished
31
+ super
32
+ end
33
+
34
+ # Returns name of littlewire board
35
+ # @return [String]
36
+ def firmware_name
37
+ "Little Wire"
38
+ end
39
+
40
+ # Returns version of littlewire board
41
+ # @return [String]
42
+ def version
43
+ @firmware_version ||= littlewire.version
44
+ end
45
+
46
+ # GPIO - digital interface
47
+ def digital_read(pin)
48
+ littlewire.digital_write(pin, true)
49
+ littlewire.digital_read(pin)
50
+ end
51
+
52
+ def digital_write(pin, val)
53
+ littlewire.pin_mode(pin, :output)
54
+ littlewire.digital_write(pin, val)
55
+ end
56
+
57
+ # GPIO - analog interface
58
+ def analog_read(pin)
59
+ littlewire.analog_read(analog_pin(pin)) * 1000.0
60
+ end
61
+
62
+ # GPIO - PWM interface
63
+ def pwm_write(pin, level)
64
+ littlewire.hardware_pwm_write(pin, level)
65
+ end
66
+
67
+ # GPIO - servo interface
68
+ def servo_write(pin, level)
69
+ littlewire.servo_write(pin, level - 90)
70
+ end
71
+
72
+ # i2c interface
73
+ def i2c_start(address)
74
+ raise "i2c support requires version 1.3+ of littlewire" unless version >= "1.3"
75
+ @i2c_address = address
76
+ littlewire.i2c.delay = 10
77
+ end
78
+
79
+ def i2c_end
80
+ end
81
+
82
+ def i2c_read(size)
83
+ littlewire.i2c.start(@i2c_address, :read)
84
+ val = littlewire.i2c.read(size, true)
85
+ val
86
+ end
87
+
88
+ def i2c_write(*data)
89
+ littlewire.i2c.start(@i2c_address, :write)
90
+ littlewire.i2c.write(data.to_a, true)
91
+ end
92
+
93
+ def connect_to_usb
94
+ @usb = LIBUSB::Context.new.devices(
95
+ :idVendor => vendor,
96
+ :idProduct => product
97
+ ).first
98
+ end
99
+
100
+ def analog_pin(pin)
101
+ case pin
102
+ when 5
103
+ 0
104
+ when 2
105
+ 1
106
+ else
107
+ raise "Invalid pin" # TODO: raise exception class
108
+ end
109
+ end
110
+
111
+ # Uses method missing to call Littlewire methods
112
+ # @see https://github.com/Bluebie/littlewire.rb
113
+ def method_missing(method_name, *arguments, &block)
114
+ littlewire.send(method_name, *arguments, &block)
115
+ end
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,21 @@
1
+ require 'artoo/commands/install'
2
+
3
+ module Artoo
4
+ module Commands
5
+ class Install < Commands
6
+ desc "digispark", "Installs firmware on Digispark devices"
7
+ option :version, :aliases => "-v", :default => "1.2", :desc => "Version of firmware to install"
8
+ def digispark
9
+ case os
10
+ when :linux
11
+ # TODO: install the udev rules file
12
+ run("littlewire.rb install #{options[:version]}")
13
+ when :macosx
14
+ run("littlewire.rb install #{options[:version]}")
15
+ else
16
+ say "OS not yet supported..."
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,28 @@
1
+ require 'artoo/drivers/driver'
2
+
3
+ module Artoo
4
+ module Drivers
5
+ # The digispark driver behaviors
6
+ class Digispark < Driver
7
+
8
+ # Start driver and any required connections
9
+ def start_driver
10
+ begin
11
+ every(interval) do
12
+ handle_message_events
13
+ end
14
+
15
+ super
16
+ rescue Exception => e
17
+ Logger.error "Error starting Digispark driver!"
18
+ Logger.error e.message
19
+ Logger.error e.backtrace.inspect
20
+ end
21
+ end
22
+
23
+ def handle_message_events
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ module Artoo
2
+ module Digispark
3
+ VERSION = '0.2.0'
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ require 'lib/artoo/adaptors/digispark'
2
+ require 'lib/artoo/drivers/digispark'
3
+ require 'lib/artoo-digispark/version'
@@ -0,0 +1,55 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
2
+ require 'artoo/adaptors/littlewire'
3
+ require 'littlewire'
4
+
5
+ describe Artoo::Adaptors::Littlewire do
6
+ before do
7
+ @port = Artoo::Port.new('/dev/awesome')
8
+ @adaptor = Artoo::Adaptors::Littlewire.new(:port => @port)
9
+ @adaptor.expects(:connect_to_usb)
10
+ @littlewire = mock('littlewire')
11
+ LittleWire.expects(:new).returns(@littlewire)
12
+ end
13
+
14
+ it 'Artoo::Adaptors::Littlewire#connect' do
15
+ @adaptor.connect.must_equal true
16
+ end
17
+
18
+ it 'Artoo::Adaptors::Littlewire#disconnect' do
19
+ @littlewire.expects(:finished)
20
+ @adaptor.connect
21
+ @adaptor.disconnect
22
+
23
+ @adaptor.connected?.must_equal false
24
+ end
25
+
26
+ describe "device info interface" do
27
+ it "#firmware_name"
28
+ it "#version"
29
+ end
30
+
31
+ describe "digital GPIO interface" do
32
+ it "#digital_read"
33
+ it "#digital_write"
34
+ end
35
+
36
+ describe "analog GPIO interface" do
37
+ it "#analog_read"
38
+ it "#analog_write"
39
+ end
40
+
41
+ describe "PWM GPIO interface" do
42
+ it "#pwm_write"
43
+ end
44
+
45
+ describe "servo GPIO interface" do
46
+ it "#servo_write"
47
+ end
48
+
49
+ describe "i2c interface" do
50
+ it "#i2c_start"
51
+ it "#i2c_end"
52
+ it "#i2c_read"
53
+ it "#i2c_write"
54
+ end
55
+ end
@@ -0,0 +1,4 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
2
+ require 'artoo/drivers/digispark'
3
+
4
+ # TODO: test for your driver goes here...
@@ -0,0 +1,10 @@
1
+ require 'minitest/autorun'
2
+ require 'mocha/setup'
3
+ require 'artoo/robot'
4
+
5
+ Celluloid.logger = nil
6
+
7
+ MiniTest::Spec.before do
8
+ Celluloid.shutdown
9
+ Celluloid.boot
10
+ end
metadata ADDED
@@ -0,0 +1,165 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: artoo-digispark
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Ron Evans
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: artoo
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 1.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 1.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: artoo-gpio
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: artoo-i2c
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: littlewire
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.9.10
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 0.9.10
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '5.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '5.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest-happy
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: mocha
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 0.14.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 0.14.0
111
+ description: Artoo adaptor for Digispark USB development board
112
+ email:
113
+ - artoo@hybridgroup.com
114
+ executables: []
115
+ extensions:
116
+ - ext/Rakefile
117
+ extra_rdoc_files: []
118
+ files:
119
+ - .travis.yml
120
+ - Gemfile
121
+ - Gemfile.lock
122
+ - LICENSE
123
+ - README.md
124
+ - Rakefile
125
+ - artoo-digispark.gemspec
126
+ - examples/blink.rb
127
+ - examples/button_and_led.rb
128
+ - examples/dc_motor.rb
129
+ - examples/maxbotix.rb
130
+ - examples/rgb_shield.rb
131
+ - examples/wiichuck.rb
132
+ - ext/Rakefile
133
+ - lib/artoo-digispark.rb
134
+ - lib/artoo-digispark/version.rb
135
+ - lib/artoo/adaptors/littlewire.rb
136
+ - lib/artoo/commands/digispark.rb
137
+ - lib/artoo/drivers/digispark.rb
138
+ - test/adaptors/littlewire_test.rb
139
+ - test/drivers/digispark_driver_test.rb
140
+ - test/test_helper.rb
141
+ homepage: https://github.com/hybridgroup/artoo-digispark
142
+ licenses:
143
+ - Apache 2.0
144
+ metadata: {}
145
+ post_install_message:
146
+ rdoc_options: []
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - '>='
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ required_rubygems_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - '>='
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ requirements: []
160
+ rubyforge_project: artoo-digispark
161
+ rubygems_version: 2.0.3
162
+ signing_key:
163
+ specification_version: 4
164
+ summary: Artoo adaptor for Digispark
165
+ test_files: []