rpi_gpio 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +36 -0
- data/README.md +137 -122
- data/ext/new/c_gpio.c +237 -0
- data/ext/new/c_gpio.h +49 -0
- data/ext/new/common.c +87 -0
- data/ext/new/common.h +43 -0
- data/ext/new/constants.c +84 -0
- data/ext/new/constants.h +45 -0
- data/ext/new/cpuinfo.c +149 -0
- data/ext/new/cpuinfo.h +36 -0
- data/ext/new/event_gpio.c +550 -0
- data/ext/new/event_gpio.h +36 -0
- data/ext/new/py_gpio.c +1048 -0
- data/ext/new/py_pwm.c +199 -0
- data/ext/new/py_pwm.h +24 -0
- data/ext/new/soft_pwm.c +214 -0
- data/ext/new/soft_pwm.h +28 -0
- data/ext/rpi_gpio/c_gpio.c +253 -233
- data/ext/rpi_gpio/c_gpio.h +53 -50
- data/ext/rpi_gpio/common.c +101 -100
- data/ext/rpi_gpio/common.h +47 -46
- data/ext/rpi_gpio/cpuinfo.c +159 -88
- data/ext/rpi_gpio/cpuinfo.h +40 -27
- data/ext/rpi_gpio/event_gpio.c +561 -561
- data/ext/rpi_gpio/rb_gpio.c +399 -389
- data/ext/rpi_gpio/rb_gpio.h +48 -47
- data/ext/rpi_gpio/rb_pwm.c +141 -131
- data/ext/rpi_gpio/rb_pwm.h +41 -40
- data/lib/rpi_gpio.so +0 -0
- metadata +34 -3
data/ext/rpi_gpio/rb_gpio.h
CHANGED
@@ -1,47 +1,48 @@
|
|
1
|
-
/*
|
2
|
-
Original code by Ben Croston modified for Ruby by Nick Lowery
|
3
|
-
(github.com/clockvapor)
|
4
|
-
Copyright (c) 2014-2015 Nick Lowery
|
5
|
-
|
6
|
-
Copyright (c) 2013-2014 Ben Croston
|
7
|
-
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
9
|
-
this software and associated documentation files (the "Software"), to deal in
|
10
|
-
the Software without restriction, including without limitation the rights to
|
11
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
12
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
13
|
-
so, subject to the following conditions:
|
14
|
-
|
15
|
-
The above copyright notice and this permission notice shall be included in all
|
16
|
-
copies or substantial portions of the Software.
|
17
|
-
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
24
|
-
SOFTWARE.
|
25
|
-
*/
|
26
|
-
|
27
|
-
#include "ruby.h"
|
28
|
-
#include "c_gpio.h"
|
29
|
-
#include "event_gpio.h"
|
30
|
-
#include "cpuinfo.h"
|
31
|
-
#include "common.h"
|
32
|
-
#include "rb_pwm.h"
|
33
|
-
|
34
|
-
void define_gpio_module_stuff(void);
|
35
|
-
int mmap_gpio_mem(void);
|
36
|
-
int is_gpio_input(unsigned int gpio);
|
37
|
-
int is_gpio_output(unsigned int gpio);
|
38
|
-
int is_rpi(void);
|
39
|
-
VALUE GPIO_clean_up(int argc, VALUE *argv, VALUE self);
|
40
|
-
VALUE
|
41
|
-
VALUE
|
42
|
-
VALUE
|
43
|
-
VALUE
|
44
|
-
VALUE
|
45
|
-
VALUE
|
46
|
-
VALUE
|
47
|
-
|
1
|
+
/*
|
2
|
+
Original code by Ben Croston modified for Ruby by Nick Lowery
|
3
|
+
(github.com/clockvapor)
|
4
|
+
Copyright (c) 2014-2015 Nick Lowery
|
5
|
+
|
6
|
+
Copyright (c) 2013-2014 Ben Croston
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
9
|
+
this software and associated documentation files (the "Software"), to deal in
|
10
|
+
the Software without restriction, including without limitation the rights to
|
11
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
12
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
13
|
+
so, subject to the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
16
|
+
copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
24
|
+
SOFTWARE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#include "ruby.h"
|
28
|
+
#include "c_gpio.h"
|
29
|
+
#include "event_gpio.h"
|
30
|
+
#include "cpuinfo.h"
|
31
|
+
#include "common.h"
|
32
|
+
#include "rb_pwm.h"
|
33
|
+
|
34
|
+
void define_gpio_module_stuff(void);
|
35
|
+
int mmap_gpio_mem(void);
|
36
|
+
int is_gpio_input(unsigned int gpio);
|
37
|
+
int is_gpio_output(unsigned int gpio);
|
38
|
+
int is_rpi(void);
|
39
|
+
VALUE GPIO_clean_up(int argc, VALUE *argv, VALUE self);
|
40
|
+
VALUE GPIO_reset(VALUE self);
|
41
|
+
VALUE GPIO_setup(VALUE self, VALUE channel, VALUE hash);
|
42
|
+
VALUE GPIO_set_numbering(VALUE self, VALUE mode);
|
43
|
+
VALUE GPIO_set_high(VALUE self, VALUE channel);
|
44
|
+
VALUE GPIO_set_low(VALUE self, VALUE channel);
|
45
|
+
VALUE GPIO_test_high(VALUE self, VALUE channel);
|
46
|
+
VALUE GPIO_test_low(VALUE self, VALUE channel);
|
47
|
+
VALUE GPIO_set_warnings(VALUE self, VALUE setting);
|
48
|
+
|
data/ext/rpi_gpio/rb_pwm.c
CHANGED
@@ -1,131 +1,141 @@
|
|
1
|
-
/*
|
2
|
-
Original code by Ben Croston modified for Ruby by Nick Lowery
|
3
|
-
(github.com/clockvapor)
|
4
|
-
Copyright (c) 2014-2015 Nick Lowery
|
5
|
-
|
6
|
-
Copyright (c) 2013-2014 Ben Croston
|
7
|
-
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
9
|
-
this software and associated documentation files (the "Software"), to deal in
|
10
|
-
the Software without restriction, including without limitation the rights to
|
11
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
12
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
13
|
-
so, subject to the following conditions:
|
14
|
-
|
15
|
-
The above copyright notice and this permission notice shall be included in all
|
16
|
-
copies or substantial portions of the Software.
|
17
|
-
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
24
|
-
SOFTWARE.
|
25
|
-
*/
|
26
|
-
|
27
|
-
#include "rb_pwm.h"
|
28
|
-
|
29
|
-
extern VALUE m_GPIO;
|
30
|
-
VALUE c_PWM = Qnil;
|
31
|
-
|
32
|
-
void define_pwm_class_stuff(void)
|
33
|
-
{
|
34
|
-
c_PWM = rb_define_class_under(m_GPIO, "PWM", rb_cObject);
|
35
|
-
rb_define_method(c_PWM, "initialize", PWM_initialize, 2);
|
36
|
-
rb_define_method(c_PWM, "start", PWM_start, 1);
|
37
|
-
rb_define_method(c_PWM, "
|
38
|
-
rb_define_method(c_PWM, "duty_cycle", PWM_get_duty_cycle, 0);
|
39
|
-
rb_define_method(c_PWM, "duty_cycle=", PWM_set_duty_cycle, 1);
|
40
|
-
rb_define_method(c_PWM, "frequency", PWM_get_frequency, 0);
|
41
|
-
rb_define_method(c_PWM, "frequency=", PWM_set_frequency, 1);
|
42
|
-
rb_define_method(c_PWM, "stop", PWM_stop, 0);
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
1
|
+
/*
|
2
|
+
Original code by Ben Croston modified for Ruby by Nick Lowery
|
3
|
+
(github.com/clockvapor)
|
4
|
+
Copyright (c) 2014-2015 Nick Lowery
|
5
|
+
|
6
|
+
Copyright (c) 2013-2014 Ben Croston
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
9
|
+
this software and associated documentation files (the "Software"), to deal in
|
10
|
+
the Software without restriction, including without limitation the rights to
|
11
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
12
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
13
|
+
so, subject to the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
16
|
+
copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
24
|
+
SOFTWARE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#include "rb_pwm.h"
|
28
|
+
|
29
|
+
extern VALUE m_GPIO;
|
30
|
+
VALUE c_PWM = Qnil;
|
31
|
+
|
32
|
+
void define_pwm_class_stuff(void)
|
33
|
+
{
|
34
|
+
c_PWM = rb_define_class_under(m_GPIO, "PWM", rb_cObject);
|
35
|
+
rb_define_method(c_PWM, "initialize", PWM_initialize, 2);
|
36
|
+
rb_define_method(c_PWM, "start", PWM_start, 1);
|
37
|
+
rb_define_method(c_PWM, "gpio", PWM_get_gpio, 0);
|
38
|
+
rb_define_method(c_PWM, "duty_cycle", PWM_get_duty_cycle, 0);
|
39
|
+
rb_define_method(c_PWM, "duty_cycle=", PWM_set_duty_cycle, 1);
|
40
|
+
rb_define_method(c_PWM, "frequency", PWM_get_frequency, 0);
|
41
|
+
rb_define_method(c_PWM, "frequency=", PWM_set_frequency, 1);
|
42
|
+
rb_define_method(c_PWM, "stop", PWM_stop, 0);
|
43
|
+
rb_define_method(c_PWM, "running?", PWM_get_running, 0);
|
44
|
+
}
|
45
|
+
|
46
|
+
// RPi::GPIO::PWM#initialize
|
47
|
+
VALUE PWM_initialize(VALUE self, VALUE channel, VALUE frequency)
|
48
|
+
{
|
49
|
+
int chan;
|
50
|
+
unsigned int gpio;
|
51
|
+
|
52
|
+
chan = NUM2INT(channel);
|
53
|
+
|
54
|
+
// convert channel to gpio
|
55
|
+
if (get_gpio_number(chan, &gpio))
|
56
|
+
return Qnil;
|
57
|
+
|
58
|
+
// ensure channel is set as output
|
59
|
+
if (gpio_direction[gpio] != OUTPUT)
|
60
|
+
{
|
61
|
+
rb_raise(rb_eRuntimeError, "you must setup the GPIO channel as output "
|
62
|
+
"first with RPi::GPIO.setup CHANNEL, :as => :output");
|
63
|
+
return Qnil;
|
64
|
+
}
|
65
|
+
|
66
|
+
rb_iv_set(self, "@gpio", UINT2NUM(gpio));
|
67
|
+
rb_iv_set(self, "@running", Qfalse);
|
68
|
+
PWM_set_frequency(self, frequency);
|
69
|
+
return self;
|
70
|
+
}
|
71
|
+
|
72
|
+
// RPi::GPIO::PWM#start
|
73
|
+
VALUE PWM_start(VALUE self, VALUE duty_cycle)
|
74
|
+
{
|
75
|
+
pwm_start(NUM2UINT(rb_iv_get(self, "@gpio")));
|
76
|
+
PWM_set_duty_cycle(self, duty_cycle);
|
77
|
+
rb_iv_set(self, "@running", Qtrue);
|
78
|
+
return self;
|
79
|
+
}
|
80
|
+
|
81
|
+
// RPi::GPIO::PWM#gpio
|
82
|
+
VALUE PWM_get_gpio(VALUE self)
|
83
|
+
{
|
84
|
+
return rb_iv_get(self, "@gpio");
|
85
|
+
}
|
86
|
+
|
87
|
+
// RPi::GPIO::PWM#duty_cycle
|
88
|
+
VALUE PWM_get_duty_cycle(VALUE self)
|
89
|
+
{
|
90
|
+
return rb_iv_get(self, "@duty_cycle");
|
91
|
+
}
|
92
|
+
|
93
|
+
// RPi::GPIO::PWM#duty_cycle=
|
94
|
+
VALUE PWM_set_duty_cycle(VALUE self, VALUE duty_cycle)
|
95
|
+
{
|
96
|
+
float dc = (float) NUM2DBL(duty_cycle);
|
97
|
+
if (dc < 0.0f || dc > 100.0f)
|
98
|
+
{
|
99
|
+
rb_raise(rb_eArgError, "duty cycle must be between 0.0 and 100.0");
|
100
|
+
return Qnil;
|
101
|
+
}
|
102
|
+
|
103
|
+
rb_iv_set(self, "@duty_cycle", duty_cycle);
|
104
|
+
pwm_set_duty_cycle(NUM2UINT(rb_iv_get(self, "@gpio")), dc);
|
105
|
+
return self;
|
106
|
+
}
|
107
|
+
|
108
|
+
// RPi::GPIO::PWM#frequency
|
109
|
+
VALUE PWM_get_frequency(VALUE self)
|
110
|
+
{
|
111
|
+
return rb_iv_get(self, "@frequency");
|
112
|
+
}
|
113
|
+
|
114
|
+
// RPi::GPIO::PWM#frequency=
|
115
|
+
VALUE PWM_set_frequency(VALUE self, VALUE frequency)
|
116
|
+
{
|
117
|
+
float freq = (float) NUM2DBL(frequency);
|
118
|
+
if (freq <= 0.0f)
|
119
|
+
{
|
120
|
+
rb_raise(rb_eArgError, "frequency must be greater than 0.0");
|
121
|
+
return Qnil;
|
122
|
+
}
|
123
|
+
|
124
|
+
rb_iv_set(self, "@frequency", frequency);
|
125
|
+
pwm_set_frequency(NUM2UINT(rb_iv_get(self, "@gpio")), freq);
|
126
|
+
return self;
|
127
|
+
}
|
128
|
+
|
129
|
+
// RPi::GPIO::PWM#stop
|
130
|
+
VALUE PWM_stop(VALUE self)
|
131
|
+
{
|
132
|
+
pwm_stop(NUM2UINT(rb_iv_get(self, "@gpio")));
|
133
|
+
rb_iv_set(self, "@running", Qfalse);
|
134
|
+
return self;
|
135
|
+
}
|
136
|
+
|
137
|
+
// RPi::GPIO::PWM#running?
|
138
|
+
VALUE PWM_get_running(VALUE self)
|
139
|
+
{
|
140
|
+
return rb_iv_get(self, "@running");
|
141
|
+
}
|
data/ext/rpi_gpio/rb_pwm.h
CHANGED
@@ -1,40 +1,41 @@
|
|
1
|
-
/*
|
2
|
-
Original code by Ben Croston modified for Ruby by Nick Lowery
|
3
|
-
(github.com/clockvapor)
|
4
|
-
Copyright (c) 2014-2015 Nick Lowery
|
5
|
-
|
6
|
-
Copyright (c) 2013-2014 Ben Croston
|
7
|
-
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
9
|
-
this software and associated documentation files (the "Software"), to deal in
|
10
|
-
the Software without restriction, including without limitation the rights to
|
11
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
12
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
13
|
-
so, subject to the following conditions:
|
14
|
-
|
15
|
-
The above copyright notice and this permission notice shall be included in all
|
16
|
-
copies or substantial portions of the Software.
|
17
|
-
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
24
|
-
SOFTWARE.
|
25
|
-
*/
|
26
|
-
|
27
|
-
#include "ruby.h"
|
28
|
-
#include "soft_pwm.h"
|
29
|
-
#include "common.h"
|
30
|
-
#include "c_gpio.h"
|
31
|
-
|
32
|
-
void define_pwm_class_stuff(void);
|
33
|
-
VALUE PWM_initialize(VALUE self, VALUE channel, VALUE frequency);
|
34
|
-
VALUE PWM_start(VALUE self, VALUE duty_cycle);
|
35
|
-
VALUE
|
36
|
-
VALUE PWM_get_duty_cycle(VALUE self);
|
37
|
-
VALUE PWM_set_duty_cycle(VALUE self, VALUE duty_cycle);
|
38
|
-
VALUE PWM_get_frequency(VALUE self);
|
39
|
-
VALUE PWM_set_frequency(VALUE self, VALUE frequency);
|
40
|
-
VALUE PWM_stop(VALUE self);
|
1
|
+
/*
|
2
|
+
Original code by Ben Croston modified for Ruby by Nick Lowery
|
3
|
+
(github.com/clockvapor)
|
4
|
+
Copyright (c) 2014-2015 Nick Lowery
|
5
|
+
|
6
|
+
Copyright (c) 2013-2014 Ben Croston
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
9
|
+
this software and associated documentation files (the "Software"), to deal in
|
10
|
+
the Software without restriction, including without limitation the rights to
|
11
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
12
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
13
|
+
so, subject to the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
16
|
+
copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
24
|
+
SOFTWARE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#include "ruby.h"
|
28
|
+
#include "soft_pwm.h"
|
29
|
+
#include "common.h"
|
30
|
+
#include "c_gpio.h"
|
31
|
+
|
32
|
+
void define_pwm_class_stuff(void);
|
33
|
+
VALUE PWM_initialize(VALUE self, VALUE channel, VALUE frequency);
|
34
|
+
VALUE PWM_start(VALUE self, VALUE duty_cycle);
|
35
|
+
VALUE PWM_get_gpio(VALUE self);
|
36
|
+
VALUE PWM_get_duty_cycle(VALUE self);
|
37
|
+
VALUE PWM_set_duty_cycle(VALUE self, VALUE duty_cycle);
|
38
|
+
VALUE PWM_get_frequency(VALUE self);
|
39
|
+
VALUE PWM_set_frequency(VALUE self, VALUE frequency);
|
40
|
+
VALUE PWM_stop(VALUE self);
|
41
|
+
VALUE PWM_get_running(VALUE self);
|
data/lib/rpi_gpio.so
ADDED
Binary file
|