raspi_lcd 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/RaspiLCD-V0.9.0/bcm2835.c +715 -0
- data/ext/RaspiLCD-V0.9.0/bcm2835.h +801 -0
- data/ext/RaspiLCD-V0.9.0/bmp_men.inc +89 -0
- data/ext/RaspiLCD-V0.9.0/bmp_raspi.inc +42 -0
- data/ext/RaspiLCD-V0.9.0/font_fixedsys_8x15.inc +913 -0
- data/ext/RaspiLCD-V0.9.0/font_lucida_10x16.inc +1137 -0
- data/ext/RaspiLCD-V0.9.0/font_terminal_12x16.inc +1137 -0
- data/ext/RaspiLCD-V0.9.0/font_terminal_6x8.inc +689 -0
- data/ext/RaspiLCD-V0.9.0/lcd.c +536 -0
- data/ext/RaspiLCD-V0.9.0/lcd.h +80 -0
- data/ext/RaspiLCD-V0.9.0/main.c +309 -0
- data/ext/RaspiLCD-V0.9.0/raspilcd.c +230 -0
- data/ext/RaspiLCD-V0.9.0/raspilcd.h +104 -0
- data/ext/RaspiLCD-V0.9.0/resource_bmp.inc +324 -0
- data/ext/RaspiLCD-V0.9.0/resource_font_6x8.inc +354 -0
- data/ext/RaspiLCD-V0.9.0/std_c.h +55 -0
- data/ext/raspi_lcd/extconf.rb +2 -0
- data/ext/raspi_lcd/raspi_lcd.c +137 -0
- data/ext/raspi_lcd/test.rb +31 -0
- data/lib/raspi_lcd.rb +5 -0
- metadata +66 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
//------------------------------------------------------------------------------
|
2
|
+
// _ _
|
3
|
+
// | | | |
|
4
|
+
// ___ _ __ ___ ___ _ _ ___| |_ ___ ___| |__
|
5
|
+
// / _ \ '_ ` _ \/ __| | | / __| __/ _ \/ __| '_ \.
|
6
|
+
// | __/ | | | | \__ \ |_| \__ \ || __/ (__| | | |
|
7
|
+
// \___|_| |_| |_|___/\__, |___/\__\___|\___|_| |_|
|
8
|
+
// __/ |
|
9
|
+
// |___/ Engineering
|
10
|
+
//
|
11
|
+
// File: std_c.h
|
12
|
+
// Description: Basic typedefinitions for portable C-Code
|
13
|
+
//
|
14
|
+
// Author: Martin Steppuhn
|
15
|
+
// History: 01.01.2006 Initial version
|
16
|
+
//------------------------------------------------------------------------------
|
17
|
+
|
18
|
+
#ifndef STD_C_H
|
19
|
+
#define STD_C_H
|
20
|
+
|
21
|
+
/**** Includes ****************************************************************/
|
22
|
+
|
23
|
+
/**** Preprocessing directives (#define) **************************************/
|
24
|
+
|
25
|
+
// Boolean values
|
26
|
+
|
27
|
+
#define TRUE 1
|
28
|
+
#define FALSE 0
|
29
|
+
|
30
|
+
#define true 1
|
31
|
+
#define false 0
|
32
|
+
|
33
|
+
/**** Type definitions (typedef) **********************************************/
|
34
|
+
|
35
|
+
// Standard types
|
36
|
+
|
37
|
+
typedef unsigned char uint8;
|
38
|
+
typedef unsigned short uint16;
|
39
|
+
typedef unsigned long uint32;
|
40
|
+
|
41
|
+
typedef unsigned long ulong;
|
42
|
+
|
43
|
+
typedef unsigned char bool;
|
44
|
+
|
45
|
+
typedef signed char int8;
|
46
|
+
typedef signed short int16;
|
47
|
+
typedef signed long int32;
|
48
|
+
|
49
|
+
/**** Global constants (extern) ***********************************************/
|
50
|
+
|
51
|
+
/**** Global variables (extern) ***********************************************/
|
52
|
+
|
53
|
+
/**** Global function prototypes **********************************************/
|
54
|
+
|
55
|
+
#endif
|
@@ -0,0 +1,137 @@
|
|
1
|
+
/*
|
2
|
+
* Ruby bindings for raspi-LCD
|
3
|
+
*/
|
4
|
+
|
5
|
+
#include <ruby.h>
|
6
|
+
/* include lcd controller with code,
|
7
|
+
since we want to include it in the library */
|
8
|
+
#include <../RaspiLCD-V0.9.0/lcd.h>
|
9
|
+
#include <../RaspiLCD-V0.9.0/lcd.c>
|
10
|
+
#include <../RaspiLCD-V0.9.0/bcm2835.h>
|
11
|
+
#include <../RaspiLCD-V0.9.0/bcm2835.c>
|
12
|
+
#include <../RaspiLCD-V0.9.0/raspilcd.h>
|
13
|
+
#include <../RaspiLCD-V0.9.0/raspilcd.c>
|
14
|
+
|
15
|
+
|
16
|
+
static VALUE r_LCD_ClearScreen(VALUE self)
|
17
|
+
{
|
18
|
+
LCD_ClearScreen();
|
19
|
+
return Qnil;
|
20
|
+
}
|
21
|
+
static VALUE r_LCD_SetPenColor(VALUE self, VALUE c)
|
22
|
+
{
|
23
|
+
LCD_SetPenColor(FIX2INT(c));
|
24
|
+
return Qnil;
|
25
|
+
}
|
26
|
+
|
27
|
+
static VALUE r_LCD_SetFillColor(VALUE self, VALUE c)
|
28
|
+
{
|
29
|
+
LCD_SetFillColor(FIX2INT(c));
|
30
|
+
return Qnil;
|
31
|
+
}
|
32
|
+
|
33
|
+
static VALUE r_LCD_SetFont(VALUE self, VALUE f)
|
34
|
+
{
|
35
|
+
LCD_SetFont(FIX2INT(f));
|
36
|
+
return Qnil;
|
37
|
+
}
|
38
|
+
|
39
|
+
static VALUE r_LCD_SetContrast(VALUE self, VALUE contrast)
|
40
|
+
{
|
41
|
+
LCD_SetContrast(FIX2INT(contrast));
|
42
|
+
return Qnil;
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
static VALUE r_LCD_PutPixel(VALUE self, VALUE x,VALUE y,VALUE color)
|
47
|
+
{
|
48
|
+
LCD_PutPixel(FIX2INT(x),FIX2INT(y),FIX2INT(color));
|
49
|
+
return Qnil;
|
50
|
+
}
|
51
|
+
|
52
|
+
static VALUE r_LCD_DrawLine(VALUE self, VALUE x0,VALUE y0,VALUE x1,VALUE y1)
|
53
|
+
{
|
54
|
+
LCD_DrawLine(FIX2INT(x0),FIX2INT(y0),FIX2INT(x1),FIX2INT(y1));
|
55
|
+
return Qnil;
|
56
|
+
}
|
57
|
+
|
58
|
+
static VALUE r_LCD_DrawCircle(VALUE self, VALUE x0,VALUE y0,VALUE radius)
|
59
|
+
{
|
60
|
+
LCD_DrawCircle(FIX2INT(x0),FIX2INT(y0),FIX2INT(radius));
|
61
|
+
return Qnil;
|
62
|
+
}
|
63
|
+
|
64
|
+
/* void LCD_DrawEllipse(int xm, int ym, int a, int b); */
|
65
|
+
static VALUE r_LCD_DrawEllipse(VALUE self, VALUE xm, VALUE ym, VALUE a, VALUE b)
|
66
|
+
{
|
67
|
+
LCD_DrawEllipse(FIX2INT(xm),FIX2INT(ym),FIX2INT(a),FIX2INT(b));
|
68
|
+
return Qnil;
|
69
|
+
}
|
70
|
+
|
71
|
+
static VALUE r_LCD_DrawRect(VALUE self, VALUE x0,VALUE y0,VALUE x1,VALUE y1,VALUE line)
|
72
|
+
{
|
73
|
+
LCD_DrawRect(FIX2INT(x0),FIX2INT(y0),FIX2INT(x1),FIX2INT(y1),FIX2INT(line));
|
74
|
+
return Qnil;
|
75
|
+
}
|
76
|
+
|
77
|
+
static VALUE r_LCD_PrintXY(VALUE self, VALUE x, VALUE y, VALUE s)
|
78
|
+
{
|
79
|
+
char *p;
|
80
|
+
|
81
|
+
VALUE str = StringValue(s);
|
82
|
+
p = RSTRING_PTR(str);
|
83
|
+
LCD_PrintXY(FIX2INT(x),FIX2INT(y),p);
|
84
|
+
return Qnil;
|
85
|
+
}
|
86
|
+
|
87
|
+
/* void LCD_DrawBitmap(uint8 x0,uint8 y0,const uint8 *bmp); */
|
88
|
+
static VALUE r_LCD_DrawBitmap(VALUE self, VALUE x0,VALUE y0,VALUE bmp)
|
89
|
+
{
|
90
|
+
uint8 *b;
|
91
|
+
|
92
|
+
VALUE str = StringValue(bmp); /* fixme: does this work with uint8? */
|
93
|
+
b = RSTRING_PTR(str);
|
94
|
+
LCD_PrintXY(FIX2INT(x0),FIX2INT(y0),b);
|
95
|
+
|
96
|
+
return Qnil;
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
static VALUE r_LCD_Init(VALUE self)
|
101
|
+
{
|
102
|
+
LCD_Init;
|
103
|
+
return Qnil;
|
104
|
+
}
|
105
|
+
|
106
|
+
static VALUE r_LCD_WriteFramebuffer(VALUE self)
|
107
|
+
{
|
108
|
+
LCD_WriteFramebuffer();
|
109
|
+
return Qnil;
|
110
|
+
}
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
/*
|
115
|
+
* Module raspi_lcd
|
116
|
+
*/
|
117
|
+
VALUE m;
|
118
|
+
void Init_raspi_lcd() {
|
119
|
+
m = rb_define_module("RaspiLCD");
|
120
|
+
rb_define_module_function(m,"clear_screen",r_LCD_ClearScreen, 0);
|
121
|
+
rb_define_module_function(m,"set_pen_color",r_LCD_SetPenColor, 1);
|
122
|
+
rb_define_module_function(m,"set_fill_color",r_LCD_SetFillColor, 1);
|
123
|
+
rb_define_module_function(m,"set_font",r_LCD_SetFont, 1);
|
124
|
+
rb_define_module_function(m,"set_contrast",r_LCD_SetContrast, 1);
|
125
|
+
|
126
|
+
rb_define_module_function(m,"put_pixel",r_LCD_PutPixel, 3);
|
127
|
+
rb_define_module_function(m,"draw_line",r_LCD_DrawLine, 4);
|
128
|
+
rb_define_module_function(m,"draw_circle",r_LCD_DrawCircle, 3);
|
129
|
+
rb_define_module_function(m,"draw_ellipse",r_LCD_DrawEllipse, 4);
|
130
|
+
rb_define_module_function(m,"draw_rect",r_LCD_DrawRect, 5);
|
131
|
+
rb_define_module_function(m,"print_xy",r_LCD_PrintXY, 3);
|
132
|
+
rb_define_module_function(m,"draw_bitmap",r_LCD_DrawBitmap, 3);
|
133
|
+
|
134
|
+
rb_define_module_function(m,"init",r_LCD_Init, 0);
|
135
|
+
rb_define_module_function(m,"write_framebuffer",r_LCD_WriteFramebuffer, 0);
|
136
|
+
}
|
137
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'raspi_lcd_ruby'
|
2
|
+
|
3
|
+
include RaspiLCDRuby
|
4
|
+
puts "1"
|
5
|
+
LCD_ClearScreen()
|
6
|
+
puts "2"
|
7
|
+
LCD_SetPenColor(1)
|
8
|
+
puts "3"
|
9
|
+
LCD_SetFillColor(1)
|
10
|
+
puts "4"
|
11
|
+
LCD_SetFont(1)
|
12
|
+
puts "5"
|
13
|
+
LCD_SetContrast(1)
|
14
|
+
|
15
|
+
puts "6"
|
16
|
+
LCD_PutPixel(1,1,2)
|
17
|
+
puts "7"
|
18
|
+
LCD_DrawLine(1,1,10,10)
|
19
|
+
puts "8"
|
20
|
+
LCD_DrawCircle(5,5,3)
|
21
|
+
puts "9"
|
22
|
+
LCD_DrawEllipse(2,3,3,4)
|
23
|
+
puts "10"
|
24
|
+
LCD_DrawRect(1,1,10,10,5)
|
25
|
+
puts "11"
|
26
|
+
LCD_PrintXY(3,3,"Hallo")
|
27
|
+
#LCD_DrawBitmap(3,3,bitmap)
|
28
|
+
|
29
|
+
puts "12"
|
30
|
+
LCD_Init()
|
31
|
+
#LCD_WriteFramebuffer()
|
data/lib/raspi_lcd.rb
ADDED
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: raspi_lcd
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Till Mossakowski
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Ruby bindings for the Raspberry Pi LCD interface
|
15
|
+
email: till@communtu.org
|
16
|
+
executables: []
|
17
|
+
extensions:
|
18
|
+
- ext/raspi_lcd/extconf.rb
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/raspi_lcd.rb
|
22
|
+
- ext/RaspiLCD-V0.9.0/lcd.c
|
23
|
+
- ext/RaspiLCD-V0.9.0/bcm2835.c
|
24
|
+
- ext/RaspiLCD-V0.9.0/main.c
|
25
|
+
- ext/RaspiLCD-V0.9.0/raspilcd.c
|
26
|
+
- ext/raspi_lcd/raspi_lcd.c
|
27
|
+
- ext/RaspiLCD-V0.9.0/bcm2835.h
|
28
|
+
- ext/RaspiLCD-V0.9.0/raspilcd.h
|
29
|
+
- ext/RaspiLCD-V0.9.0/std_c.h
|
30
|
+
- ext/RaspiLCD-V0.9.0/lcd.h
|
31
|
+
- ext/raspi_lcd/extconf.rb
|
32
|
+
- ext/raspi_lcd/test.rb
|
33
|
+
- ext/RaspiLCD-V0.9.0/resource_font_6x8.inc
|
34
|
+
- ext/RaspiLCD-V0.9.0/resource_bmp.inc
|
35
|
+
- ext/RaspiLCD-V0.9.0/font_terminal_12x16.inc
|
36
|
+
- ext/RaspiLCD-V0.9.0/font_terminal_6x8.inc
|
37
|
+
- ext/RaspiLCD-V0.9.0/font_fixedsys_8x15.inc
|
38
|
+
- ext/RaspiLCD-V0.9.0/font_lucida_10x16.inc
|
39
|
+
- ext/RaspiLCD-V0.9.0/bmp_raspi.inc
|
40
|
+
- ext/RaspiLCD-V0.9.0/bmp_men.inc
|
41
|
+
homepage: https://github.com/tillmo/raspi_lcd
|
42
|
+
licenses: []
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 1.8.24
|
62
|
+
signing_key:
|
63
|
+
specification_version: 3
|
64
|
+
summary: Ruby bindings for the Raspberry Pi LCD interface
|
65
|
+
test_files: []
|
66
|
+
has_rdoc:
|