Skip to content

Commit dedeb27

Browse files
committed
Updates to examples to support pinselect variant.
1 parent 227a033 commit dedeb27

File tree

7 files changed

+438
-34
lines changed

7 files changed

+438
-34
lines changed

Diff for: hardware/zpuino/zpu/libraries/VGA/examples/Bricks_Example/Bricks_Example.ino

+71-15
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
http://papilio.cc/index.php?n=Papilio.VGAWingIntroduction
77
88
Hardware:
9-
* Connect a 3-bit VGA Wing to AL
10-
or
11-
* Connect an Arcade MegaWing
9+
If using an Arcade MegaWing or a LogicStart MegaWing then select the appropriate "Hyperion" board type in the ZAP IDE.
10+
If using a VGA Wing or some other device then use the "Hyperion" pinselect board type in the ZAP IDE and be sure to uncomment "setup_pin_select" in setup.
11+
12+
ZPUino Variant:
13+
Hyperion "The Lord of Light" with HQVGA adapter is needed for this example sketch
1214
1315
created 2012
1416
by Alvaro Lopes
@@ -27,6 +29,72 @@ unsigned char blocks[8][4]; /* 20 h, 4 v */
2729

2830
typedef volatile unsigned char *vgaptr_t;
2931

32+
#define HSync WING_A_1
33+
#define VSync WING_A_0
34+
#define Red0 WING_A_7
35+
#define Red1 WING_A_5
36+
#define Green0 WING_A_6
37+
#define Green1 WING_A_4
38+
#define Blue0 WING_A_2
39+
#define Blue1 WING_A_3
40+
41+
void setup_pin_select() {
42+
pinMode(HSync,OUTPUT);
43+
digitalWrite(HSync,HIGH);
44+
outputPinForFunction(HSync, 15);
45+
pinModePPS(HSync, HIGH);
46+
47+
pinMode(VSync,OUTPUT);
48+
digitalWrite(VSync,HIGH);
49+
outputPinForFunction(VSync, 14);
50+
pinModePPS(VSync, HIGH);
51+
52+
pinMode(Red0,OUTPUT);
53+
digitalWrite(Red0,HIGH);
54+
outputPinForFunction(Red0, 9);
55+
pinModePPS(Red0, HIGH);
56+
57+
pinMode(Red1,OUTPUT);
58+
digitalWrite(Red1,HIGH);
59+
outputPinForFunction(Red1, 8);
60+
pinModePPS(Red1, HIGH);
61+
62+
pinMode(Green0,OUTPUT);
63+
digitalWrite(Green0,HIGH);
64+
outputPinForFunction(Green0, 11);
65+
pinModePPS(Green0, HIGH);
66+
67+
pinMode(Green1,OUTPUT);
68+
digitalWrite(Green1,HIGH);
69+
outputPinForFunction(Green1, 10);
70+
pinModePPS(Green1, HIGH);
71+
72+
pinMode(Blue0,OUTPUT);
73+
digitalWrite(Blue0,HIGH);
74+
outputPinForFunction(Blue0, 13);
75+
pinModePPS(Blue0, HIGH);
76+
77+
pinMode(Blue1,OUTPUT);
78+
digitalWrite(Blue1,HIGH);
79+
outputPinForFunction(Blue1, 12);
80+
pinModePPS(Blue1, HIGH);
81+
}
82+
83+
void setup() {
84+
85+
//Uncomment this if you are using the pinselect variant
86+
//setup_pin_select();
87+
88+
/* For simulation, test only */
89+
clear();
90+
test();
91+
92+
printtext(20,100,"This is a demo",0xf0,0x00);
93+
94+
init_blocks();
95+
draw_blocks();
96+
}
97+
3098
void test()
3199
{
32100
volatile unsigned int *vmem = &VGAPTR;
@@ -218,18 +286,6 @@ void printtext(unsigned x, unsigned y, const char *text, unsigned fg,unsigned bg
218286
}
219287
}
220288

221-
void setup()
222-
{
223-
/* For simulation, test only */
224-
clear();
225-
test();
226-
227-
printtext(20,100,"This is a demo",0xf0,0x00);
228-
229-
init_blocks();
230-
draw_blocks();
231-
}
232-
233289
int bx=0,by=VSIZE-8-8;
234290
int deltax=1,deltay=-1;
235291

Diff for: hardware/zpuino/zpu/libraries/VGA/examples/Color_Bar/Color_Bar.ino

+60-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
http://papilio.cc/index.php?n=Papilio.VGAWingIntroduction
77
88
Hardware:
9-
* Connect a 3-bit VGA Wing to AL
10-
or
11-
* Connect an Arcade MegaWing
9+
If using an Arcade MegaWing or a LogicStart MegaWing then select the appropriate "Hyperion" board type in the ZAP IDE.
10+
If using a VGA Wing or some other device then use the "Hyperion" pinselect board type in the ZAP IDE and be sure to uncomment "setup_pin_select" in setup.
11+
12+
ZPUino Variant:
13+
Hyperion "The Lord of Light" with HQVGA adapter is needed for this example sketch
1214
1315
created 2012
1416
by Jack Gassett
@@ -21,7 +23,62 @@ or
2123
int textarea = 20;
2224
int colors[] = {RED,GREEN,BLUE,YELLOW,PURPLE,CYAN,WHITE,BLACK};
2325

26+
#define HSync WING_A_1
27+
#define VSync WING_A_0
28+
#define Red0 WING_A_7
29+
#define Red1 WING_A_5
30+
#define Green0 WING_A_6
31+
#define Green1 WING_A_4
32+
#define Blue0 WING_A_2
33+
#define Blue1 WING_A_3
34+
35+
void setup_pin_select() {
36+
pinMode(HSync,OUTPUT);
37+
digitalWrite(HSync,HIGH);
38+
outputPinForFunction(HSync, 15);
39+
pinModePPS(HSync, HIGH);
40+
41+
pinMode(VSync,OUTPUT);
42+
digitalWrite(VSync,HIGH);
43+
outputPinForFunction(VSync, 14);
44+
pinModePPS(VSync, HIGH);
45+
46+
pinMode(Red0,OUTPUT);
47+
digitalWrite(Red0,HIGH);
48+
outputPinForFunction(Red0, 9);
49+
pinModePPS(Red0, HIGH);
50+
51+
pinMode(Red1,OUTPUT);
52+
digitalWrite(Red1,HIGH);
53+
outputPinForFunction(Red1, 8);
54+
pinModePPS(Red1, HIGH);
55+
56+
pinMode(Green0,OUTPUT);
57+
digitalWrite(Green0,HIGH);
58+
outputPinForFunction(Green0, 11);
59+
pinModePPS(Green0, HIGH);
60+
61+
pinMode(Green1,OUTPUT);
62+
digitalWrite(Green1,HIGH);
63+
outputPinForFunction(Green1, 10);
64+
pinModePPS(Green1, HIGH);
65+
66+
pinMode(Blue0,OUTPUT);
67+
digitalWrite(Blue0,HIGH);
68+
outputPinForFunction(Blue0, 13);
69+
pinModePPS(Blue0, HIGH);
70+
71+
pinMode(Blue1,OUTPUT);
72+
digitalWrite(Blue1,HIGH);
73+
outputPinForFunction(Blue1, 12);
74+
pinModePPS(Blue1, HIGH);
75+
}
76+
2477
void setup() {
78+
79+
//Uncomment this if you are using the pinselect variant
80+
//setup_pin_select();
81+
2582
int width = VGA.getHSize();
2683
int height = VGA.getVSize();
2784
int column = width/8;

Diff for: hardware/zpuino/zpu/libraries/VGA/examples/Hello_World/Hello_World.ino

+59-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
http://papilio.cc/index.php?n=Papilio.VGAWingIntroduction
77
88
Hardware:
9-
* Connect a 3-bit VGA Wing to AL
10-
or
11-
* Connect an Arcade MegaWing
9+
If using an Arcade MegaWing or a LogicStart MegaWing then select the appropriate "Hyperion" board type in the ZAP IDE.
10+
If using a VGA Wing or some other device then use the "Hyperion" pinselect board type in the ZAP IDE and be sure to uncomment "setup_pin_select" in setup.
11+
12+
ZPUino Variant:
13+
Hyperion "The Lord of Light" with HQVGA adapter is needed for this example sketch
1214
1315
created 2012
1416
by Jack Gassett
@@ -18,7 +20,61 @@ or
1820
*/
1921
#include "VGA.h"
2022

23+
#define HSync WING_A_1
24+
#define VSync WING_A_0
25+
#define Red0 WING_A_7
26+
#define Red1 WING_A_5
27+
#define Green0 WING_A_6
28+
#define Green1 WING_A_4
29+
#define Blue0 WING_A_2
30+
#define Blue1 WING_A_3
31+
32+
void setup_pin_select() {
33+
pinMode(HSync,OUTPUT);
34+
digitalWrite(HSync,HIGH);
35+
outputPinForFunction(HSync, 15);
36+
pinModePPS(HSync, HIGH);
37+
38+
pinMode(VSync,OUTPUT);
39+
digitalWrite(VSync,HIGH);
40+
outputPinForFunction(VSync, 14);
41+
pinModePPS(VSync, HIGH);
42+
43+
pinMode(Red0,OUTPUT);
44+
digitalWrite(Red0,HIGH);
45+
outputPinForFunction(Red0, 9);
46+
pinModePPS(Red0, HIGH);
47+
48+
pinMode(Red1,OUTPUT);
49+
digitalWrite(Red1,HIGH);
50+
outputPinForFunction(Red1, 8);
51+
pinModePPS(Red1, HIGH);
52+
53+
pinMode(Green0,OUTPUT);
54+
digitalWrite(Green0,HIGH);
55+
outputPinForFunction(Green0, 11);
56+
pinModePPS(Green0, HIGH);
57+
58+
pinMode(Green1,OUTPUT);
59+
digitalWrite(Green1,HIGH);
60+
outputPinForFunction(Green1, 10);
61+
pinModePPS(Green1, HIGH);
62+
63+
pinMode(Blue0,OUTPUT);
64+
digitalWrite(Blue0,HIGH);
65+
outputPinForFunction(Blue0, 13);
66+
pinModePPS(Blue0, HIGH);
67+
68+
pinMode(Blue1,OUTPUT);
69+
digitalWrite(Blue1,HIGH);
70+
outputPinForFunction(Blue1, 12);
71+
pinModePPS(Blue1, HIGH);
72+
}
73+
2174
void setup() {
75+
76+
//Uncomment this if you are using the pinselect variant
77+
//setup_pin_select();
2278

2379
VGA.clear();
2480
VGA.setBackgroundColor(BLACK);

Diff for: hardware/zpuino/zpu/libraries/VGA/examples/Load_Image/Load_Image.ino

+67-10
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
http://papilio.cc/index.php?n=Papilio.VGAWingIntroduction
77
88
Hardware:
9-
* Connect a 3-bit VGA Wing to AL
10-
or
11-
* Connect an Arcade MegaWing
9+
If using an Arcade MegaWing or a LogicStart MegaWing then select the appropriate "Hyperion" board type in the ZAP IDE.
10+
If using a VGA Wing or some other device then use the "Hyperion" pinselect board type in the ZAP IDE and be sure to uncomment "setup_pin_select" in setup.
11+
12+
ZPUino Variant:
13+
Hyperion "The Lord of Light" with HQVGA adapter is needed for this example sketch
1214
1315
created 2012
1416
by Jack Gassett
@@ -19,17 +21,62 @@ or
1921
#include "VGA.h"
2022
#include "SmallFS.h"
2123

22-
void blitImage(const char *name)
23-
{
24-
VGA.blitStreamInit(0, 0, VGA.getHSize());
24+
#define HSync WING_A_1
25+
#define VSync WING_A_0
26+
#define Red0 WING_A_7
27+
#define Red1 WING_A_5
28+
#define Green0 WING_A_6
29+
#define Green1 WING_A_4
30+
#define Blue0 WING_A_2
31+
#define Blue1 WING_A_3
2532

26-
SmallFSFile entry = SmallFS.open(name);
27-
if (entry.valid()) {
28-
entry.readCallback( entry.size(), &VGA.blitStream, (void*)&VGA );
29-
}
33+
void setup_pin_select() {
34+
pinMode(HSync,OUTPUT);
35+
digitalWrite(HSync,HIGH);
36+
outputPinForFunction(HSync, 15);
37+
pinModePPS(HSync, HIGH);
38+
39+
pinMode(VSync,OUTPUT);
40+
digitalWrite(VSync,HIGH);
41+
outputPinForFunction(VSync, 14);
42+
pinModePPS(VSync, HIGH);
43+
44+
pinMode(Red0,OUTPUT);
45+
digitalWrite(Red0,HIGH);
46+
outputPinForFunction(Red0, 9);
47+
pinModePPS(Red0, HIGH);
48+
49+
pinMode(Red1,OUTPUT);
50+
digitalWrite(Red1,HIGH);
51+
outputPinForFunction(Red1, 8);
52+
pinModePPS(Red1, HIGH);
53+
54+
pinMode(Green0,OUTPUT);
55+
digitalWrite(Green0,HIGH);
56+
outputPinForFunction(Green0, 11);
57+
pinModePPS(Green0, HIGH);
58+
59+
pinMode(Green1,OUTPUT);
60+
digitalWrite(Green1,HIGH);
61+
outputPinForFunction(Green1, 10);
62+
pinModePPS(Green1, HIGH);
63+
64+
pinMode(Blue0,OUTPUT);
65+
digitalWrite(Blue0,HIGH);
66+
outputPinForFunction(Blue0, 13);
67+
pinModePPS(Blue0, HIGH);
68+
69+
pinMode(Blue1,OUTPUT);
70+
digitalWrite(Blue1,HIGH);
71+
outputPinForFunction(Blue1, 12);
72+
pinModePPS(Blue1, HIGH);
3073
}
3174

3275
void setup() {
76+
77+
//Uncomment this if you are using the pinselect variant
78+
//setup_pin_select();
79+
3380
VGA.clear();
3481

3582
if (SmallFS.begin()<0) {
@@ -40,6 +87,16 @@ void setup() {
4087
blitImage("PapilioImage.dat");
4188
}
4289

90+
void blitImage(const char *name)
91+
{
92+
VGA.blitStreamInit(0, 0, VGA.getHSize());
93+
94+
SmallFSFile entry = SmallFS.open(name);
95+
if (entry.valid()) {
96+
entry.readCallback( entry.size(), &VGA.blitStream, (void*)&VGA );
97+
}
98+
}
99+
43100
void loop() {
44101

45102
}

0 commit comments

Comments
 (0)