pixel_pi 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/README.md +85 -0
- data/Rakefile +16 -0
- data/examples/strandtest.rb +186 -0
- data/ext/pixel_pi/extconf.rb +18 -0
- data/ext/pixel_pi/leds.c +464 -0
- data/ext/ws2811/LICENSE +24 -0
- data/ext/ws2811/clk.h +60 -0
- data/ext/ws2811/dma.c +192 -0
- data/ext/ws2811/dma.h +146 -0
- data/ext/ws2811/gpio.h +108 -0
- data/ext/ws2811/pwm.c +112 -0
- data/ext/ws2811/pwm.h +122 -0
- data/ext/ws2811/ws2811.c +757 -0
- data/ext/ws2811/ws2811.h +68 -0
- data/lib/pixel_pi/version.rb +3 -0
- data/lib/pixel_pi.rb +2 -0
- data/pixel_pi.gemspec +23 -0
- metadata +77 -0
data/ext/ws2811/ws2811.h
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
/*
|
2
|
+
* ws2811.h
|
3
|
+
*
|
4
|
+
* Copyright (c) 2014 Jeremy Garff <jer @ jers.net>
|
5
|
+
*
|
6
|
+
* All rights reserved.
|
7
|
+
*
|
8
|
+
* Redistribution and use in source and binary forms, with or without modification, are permitted
|
9
|
+
* provided that the following conditions are met:
|
10
|
+
*
|
11
|
+
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
12
|
+
* conditions and the following disclaimer.
|
13
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
14
|
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
15
|
+
* provided with the distribution.
|
16
|
+
* 3. Neither the name of the owner nor the names of its contributors may be used to endorse
|
17
|
+
* or promote products derived from this software without specific prior written permission.
|
18
|
+
*
|
19
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
20
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
|
22
|
+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
24
|
+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
26
|
+
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
*
|
28
|
+
*/
|
29
|
+
|
30
|
+
|
31
|
+
#ifndef __WS2811_H__
|
32
|
+
#define __WS2811_H__
|
33
|
+
|
34
|
+
|
35
|
+
#include "pwm.h"
|
36
|
+
|
37
|
+
|
38
|
+
#define WS2811_TARGET_FREQ 800000 // Can go as low as 400000
|
39
|
+
|
40
|
+
struct ws2811_device;
|
41
|
+
|
42
|
+
typedef uint32_t ws2811_led_t; //< 0x00RRGGBB
|
43
|
+
typedef struct
|
44
|
+
{
|
45
|
+
int gpionum; //< GPIO Pin with PWM alternate function, 0 if unused
|
46
|
+
int invert; //< Invert output signal
|
47
|
+
int count; //< Number of LEDs, 0 if channel is unused
|
48
|
+
int brightness; //< Brightness value between 0 and 255
|
49
|
+
ws2811_led_t *leds; //< LED buffers, allocated by driver based on count
|
50
|
+
} ws2811_channel_t;
|
51
|
+
|
52
|
+
typedef struct
|
53
|
+
{
|
54
|
+
struct ws2811_device *device; //< Private data for driver use
|
55
|
+
uint32_t freq; //< Required output frequency
|
56
|
+
int dmanum; //< DMA number _not_ already in use
|
57
|
+
ws2811_channel_t channel[RPI_PWM_CHANNELS];
|
58
|
+
} ws2811_t;
|
59
|
+
|
60
|
+
|
61
|
+
int ws2811_init(ws2811_t *ws2811); //< Initialize buffers/hardware
|
62
|
+
void ws2811_fini(ws2811_t *ws2811); //< Tear it all down
|
63
|
+
int ws2811_render(ws2811_t *ws2811); //< Send LEDs off to hardware
|
64
|
+
int ws2811_wait(ws2811_t *ws2811); //< Wait for DMA completion
|
65
|
+
|
66
|
+
|
67
|
+
#endif /* __WS2811_H__ */
|
68
|
+
|
data/lib/pixel_pi.rb
ADDED
data/pixel_pi.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pixel_pi/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "pixel_pi"
|
8
|
+
spec.version = PixelPi::VERSION
|
9
|
+
spec.authors = ["Tim Pease"]
|
10
|
+
spec.email = ["tim.pease@gmail.com"]
|
11
|
+
spec.summary = %q{A library for controlling NeoPixels via Ruby on the RaspberryPi}
|
12
|
+
spec.description = %q{NeoPixels are fun! Ruby is fun! RaspberryPi is fun! FUN^3}
|
13
|
+
spec.homepage = "https://github.com/TwP/pixel_pi"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.extensions = spec.files.grep(%r{/extconf\.rb$})
|
19
|
+
spec.require_paths = %w{lib}
|
20
|
+
|
21
|
+
spec.add_development_dependency "rake-compiler", "~> 0.9"
|
22
|
+
end
|
23
|
+
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pixel_pi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tim Pease
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake-compiler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.9'
|
27
|
+
description: NeoPixels are fun! Ruby is fun! RaspberryPi is fun! FUN^3
|
28
|
+
email:
|
29
|
+
- tim.pease@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions:
|
32
|
+
- ext/pixel_pi/extconf.rb
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- ".gitignore"
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- examples/strandtest.rb
|
39
|
+
- ext/pixel_pi/extconf.rb
|
40
|
+
- ext/pixel_pi/leds.c
|
41
|
+
- ext/ws2811/LICENSE
|
42
|
+
- ext/ws2811/clk.h
|
43
|
+
- ext/ws2811/dma.c
|
44
|
+
- ext/ws2811/dma.h
|
45
|
+
- ext/ws2811/gpio.h
|
46
|
+
- ext/ws2811/pwm.c
|
47
|
+
- ext/ws2811/pwm.h
|
48
|
+
- ext/ws2811/ws2811.c
|
49
|
+
- ext/ws2811/ws2811.h
|
50
|
+
- lib/pixel_pi.rb
|
51
|
+
- lib/pixel_pi/version.rb
|
52
|
+
- pixel_pi.gemspec
|
53
|
+
homepage: https://github.com/TwP/pixel_pi
|
54
|
+
licenses:
|
55
|
+
- MIT
|
56
|
+
metadata: {}
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 2.2.2
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: A library for controlling NeoPixels via Ruby on the RaspberryPi
|
77
|
+
test_files: []
|