Skip to content

Commit 93519dc

Browse files
committed
Merge branch 'master' into demo for deployment to the Demo stack
2 parents 0a58486 + 81be14b commit 93519dc

33 files changed

+1537
-6513
lines changed

Learn/Examples/Robots/S3/Test libS3 for Basic Functionality.c

Lines changed: 0 additions & 26 deletions
This file was deleted.

Learn/Examples/Robots/S3/Test libS3 for Basic Functionality.side

Lines changed: 0 additions & 9 deletions
This file was deleted.

Learn/Simple Libraries Index.html

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ <h3 style="font-family:verdana;">Text Devices</h3>
6565

6666
<h3 style="font-family:verdana;">Audio</h3>
6767

68+
<p>
69+
<blockquote>
70+
<a href="Simple%20Libraries/Audio/libsound/Documentation%20sound%20Library.html" target="_blank">sound.h</a> - Functions for generating audio and musical notes.
71+
Mix up to three waveforms, with sine, square, triangle, saw, and noise options.
72+
</blockquote>
73+
</p>
74+
75+
76+
<p>
77+
<blockquote>
78+
<a href="Simple%20Libraries/Audio/libtext2speech/Documentation%20text2speech%20Library.html" target="_blank">text2speech.h</a> - Functions for pronouncing words spelled out phonemically.
79+
</blockquote>
80+
</p>
81+
82+
6883
<p>
6984
<blockquote>
7085
<a href="Simple%20Libraries/Audio/libwavplayer/Documentation%20wavplayer%20Library.html" target="_blank">wavplayer.h</a> - Plays 16-bit, 32 ksps, mono .wav files (Propeller Activity Board/Propeller BOE).
@@ -103,6 +118,13 @@ <h3 style="font-family:verdana;">Convert</h3>
103118

104119
<h3 style="font-family:verdana;">Display</h3>
105120

121+
<p>
122+
<blockquote>
123+
<a href="Simple%20Libraries/Display/liboledc/Documentation%20oledc%20Library.html" target="_blank">oledc.h</a> - Functions for controlling the 96 x 64 Color oLED Display Module.
124+
</blockquote>
125+
</p>
126+
127+
106128
<p>
107129
<blockquote>
108130
<a href="Simple%20Libraries/Display/libvgatext/Documentation%20vgatext%20Library.html" target="_blank">vgatext.h</a> - Display text with a VGA Monitor.
@@ -111,6 +133,16 @@ <h3 style="font-family:verdana;">Display</h3>
111133

112134

113135

136+
<h3 style="font-family:verdana;">Light</h3>
137+
138+
<p>
139+
<blockquote>
140+
<a href="Simple%20Libraries/Light/libws2812/Documentation%20ws2812%20Library.html" target="_blank">ws2812.h</a> - Driver for WS2812 and WS2812B RGB LEDs.
141+
</blockquote>
142+
</p>
143+
144+
145+
114146
<h3 style="font-family:verdana;">Misc</h3>
115147

116148
<p>
@@ -201,13 +233,13 @@ <h3 style="font-family:verdana;">Robotics</h3>
201233

202234
<p>
203235
<blockquote>
204-
<a href="Simple%20Libraries/Robotics/ActivityBot/Documentation%20abdrive%20Library.html" target="_blank">abdrive.h</a> - Tools for ActivityBot navigation with encoders + servos.
236+
<a href="Simple%20Libraries/Robotics/ActivityBot/libabdrive/Documentation%20abdrive%20Library.html" target="_blank">abdrive.h</a> - Tools for ActivityBot navigation with encoders + servos.
205237
</blockquote>
206238
</p>
207239

208240
<p>
209241
<blockquote>
210-
<a href="Simple%20Libraries/Robotics/ActivityBot/Documentation%20abcalibrate%20Library.html" target="_blank">abcalibrate.h</a> - Self-calibration functions for the ActivityBot.
242+
<a href="Simple%20Libraries/Robotics/ActivityBot/libabcalibrate/Documentation%20abcalibrate%20Library.html" target="_blank">abcalibrate.h</a> - Self-calibration functions for the ActivityBot.
211243
</blockquote>
212244
</p>
213245

@@ -236,6 +268,14 @@ <h3 style="font-family:verdana;">Sensor</h3>
236268
</p>
237269

238270

271+
<p>
272+
<blockquote>
273+
<a href="Simple%20Libraries/Sensor/liblsm9ds1/Documentation%20lsm9ds1%20Library.html" target="_blank">lsm9ds1.h</a> - For measuring 3D accelerometer, gyroscope, and magnetometer
274+
with the LSM9DS1.
275+
</blockquote>
276+
</p>
277+
278+
239279
<p>
240280
<blockquote>
241281
<a href="Simple%20Libraries/Sensor/libmx2125/Documentation%20mx2125%20Library.html" target="_blank">mx2125.h</a> - For measurements with the 2-axis mx2125 accelerometer.
@@ -272,6 +312,30 @@ <h3 style="font-family:verdana;">Sensor</h3>
272312

273313

274314

315+
<h3 style="font-family:verdana;">Social</h3>
316+
317+
<p>
318+
<blockquote>
319+
<a href="Simple%20Libraries/Social/libbadgetools/Documentation%20badgetools%20Library.html" target="_blank">badgetools.h</a> - Functions for all Parallax Hackable Electronic Badge
320+
components, including: 128 x 64 oLED display, 3-axis accelerometer, two-way infrared
321+
communication, tri-color LEDs, passive touch buttons, touch button LEDs, audio out,
322+
and battery.
323+
</blockquote>
324+
</p>
325+
326+
327+
328+
<h3 style="font-family:verdana;">Time</h3>
329+
330+
<p>
331+
<blockquote>
332+
<a href="Simple%20Libraries/Time/libdatetime/Documentation%20datetime%20Library.html" target="_blank">datetime.h</a> - Functions for tracking date and time.
333+
</blockquote>
334+
</p>
335+
336+
337+
338+
275339
<p>
276340
<br>
277341
Typos, comments, or suggestions? Email: <a href="mailto:editor@parallax.com">
382 Bytes
Binary file not shown.
2.17 KB
Binary file not shown.

Learn/Simple Libraries/Display/liboledc/oledc_clear.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,14 @@ void oledc_clear(int x0, int y0, int w, int h)
5454
}
5555

5656
// Boundary check
57-
if ((y0 >= TFTHEIGHT) && (y1 >= TFTHEIGHT))
57+
if ((y0 >= TFTHEIGHT) || (y1 < 0) || (x0 >= TFTWIDTH) || (x1 < 0)) {
58+
oledc_screenLockClr();
5859
return;
59-
if ((x0 >= TFTWIDTH) && (x1 >= TFTWIDTH))
60-
return;
61-
if (x0 >= TFTWIDTH)
62-
x0 = TFTWIDTH - 1;
63-
if (y0 >= TFTHEIGHT)
64-
y0 = TFTHEIGHT - 1;
65-
if (x1 >= TFTWIDTH)
66-
x1 = TFTWIDTH - 1;
67-
if (y1 >= TFTHEIGHT)
68-
y1 = TFTHEIGHT - 1;
60+
}
61+
if (x0 < 0) x0 = 0;
62+
if (y0 < 0) y0 = 0;
63+
if (x1 >= TFTWIDTH) x1 = TFTWIDTH - 1;
64+
if (y1 >= TFTHEIGHT) y1 = TFTHEIGHT - 1;
6965

7066
oledc_writeCommand(SSD1331_CMD_CLEAR, 0);
7167
oledc_writeCommand(x0, 0);

Learn/Simple Libraries/Display/liboledc/oledc_copy.c

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "oledc.h"
1818

1919
char TFTROTATION;
20+
int _width, _height;
2021

2122
void oledc_copy(int x0, int y0, int w, int h, int x2, int y2)
2223
{
@@ -25,15 +26,67 @@ void oledc_copy(int x0, int y0, int w, int h, int x2, int y2)
2526

2627
int x1 = x0 + w - 1;
2728
int y1 = y0 + h - 1;
29+
30+
int x3 = x2 + w - 1;
31+
int y3 = y2 + h - 1;
32+
33+
if (x0 >= _width || y0 >= _height || x1 < 0 || y1 < 0 || w <= 0 || h <= 0 ||
34+
x2 >= _width || y2 >= _height || x3 < 0 || y3 < 0)
35+
{
36+
oledc_screenLockClr();
37+
return;
38+
}
39+
40+
if (x1 >= _width)
41+
{
42+
x1 = _width - 1;
43+
w = x1 - x0 + 1;
44+
}
45+
if (y1 >= _height)
46+
{
47+
y1 = _height - 1;
48+
h = y1 - y0 + 1;
49+
}
50+
51+
if (x0 < 0)
52+
{
53+
x2 = x2 - x0;
54+
x0 = 0;
55+
}
56+
if (y0 < 0)
57+
{
58+
y2 = y2 - y0;
59+
y0 = 0;
60+
}
61+
62+
x3 = x2 + w - 1;
63+
y3 = y2 + h - 1;
64+
65+
if(x3 >= _width)
66+
{
67+
x3 = _width - 1;
68+
w = x3 - x2 + 1;
69+
x1 = x0 + w - 1;
70+
}
71+
if(y3 >= _height)
72+
{
73+
y3 = _height - 1;
74+
h = y3 - y2 + 1;
75+
y1 = y0 + h - 1;
76+
}
77+
2878

2979
// check rotation, move pixel around if necessary
3080
switch (TFTROTATION) {
3181
case 1:
3282
gfx_swap(x0, y0);
3383
gfx_swap(x1, y1);
84+
gfx_swap(x2, y2);
85+
gfx_swap(x3, y3);
3486
x0 = TFTWIDTH - x0 - 1;
3587
x1 = TFTWIDTH - x1 - 1;
3688
x2 = TFTWIDTH - x2 - 1;
89+
x3 = TFTWIDTH - x3 - 1;
3790
break;
3891
case 2:
3992
x0 = TFTWIDTH - x0 - 1;
@@ -42,35 +95,26 @@ void oledc_copy(int x0, int y0, int w, int h, int x2, int y2)
4295
y1 = TFTHEIGHT - y1 - 1;
4396
x2 = TFTWIDTH - x2 - 1;
4497
y2 = TFTHEIGHT - y2 - 1;
98+
x3 = TFTWIDTH - x3 - 1;
99+
y3 = TFTHEIGHT - y3 - 1;
45100
gfx_swap(x0, x1);
46101
gfx_swap(y0, y1);
102+
gfx_swap(x2, x3);
103+
gfx_swap(y2, y3);
47104
break;
48105
case 3:
49106
gfx_swap(x0, y0);
50107
gfx_swap(x1, y1);
108+
gfx_swap(x2, y2);
109+
gfx_swap(x3, y3);
51110
y0 = TFTHEIGHT - y0 - 1;
52111
y1 = TFTHEIGHT - y1 - 1;
53112
y2 = TFTHEIGHT - y2 - 1;
113+
y3 = TFTHEIGHT - y3 - 1;
54114
break;
55115
}
56116

57-
// Boundary check
58-
if ((y0 >= TFTHEIGHT) && (y1 >= TFTHEIGHT))
59-
return;
60-
if ((x0 >= TFTWIDTH) && (x1 >= TFTWIDTH))
61-
return;
62-
if (x0 >= TFTWIDTH)
63-
x0 = TFTWIDTH - 1;
64-
if (y0 >= TFTHEIGHT)
65-
y0 = TFTHEIGHT - 1;
66-
if (x1 >= TFTWIDTH)
67-
x1 = TFTWIDTH - 1;
68-
if (y1 >= TFTHEIGHT)
69-
y1 = TFTHEIGHT - 1;
70-
if (x2 >= TFTWIDTH)
71-
x2 = TFTWIDTH - 1;
72-
if (y2 >= TFTHEIGHT)
73-
y2 = TFTHEIGHT - 1;
117+
74118

75119
oledc_writeCommand(SSD1331_CMD_COPY, 0);
76120
oledc_writeCommand(x0, 0);

Learn/Simple Libraries/Display/liboledc/oledc_fillRect.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,17 @@ int _width, _height;
2222

2323
void oledc_fillRectPrimative(int x0, int y0, int w, int h, unsigned int color)
2424
{
25-
if (w < 0 || h < 0) return;
26-
25+
int x1 = x0 + w - 1;
26+
int y1 = y0 + h - 1;
27+
28+
if (x0 >= _width || y0 >= _height || x1 < 0 || y1 < 0 || w <= 0 || h <= 0) return;
29+
30+
if (x1 >= _width) x1 = _width - 1;
31+
if (y1 >= _height) y1 = _height - 1;
32+
2733
if (x0 < 0) x0 = 0;
28-
if (x0 >= _width) x0 = (_width-1);
2934
if (y0 < 0) y0 = 0;
30-
if (y0 >= _height) y0 = (_height-1);
31-
32-
if (x0 + w >= _width) w = (_width - x0);
33-
if (y0 + h >= _height) h = (_height - y0);
3435

35-
int x1 = x0 + w - 1;
36-
int y1 = y0 + h - 1;
3736

3837
switch (TFTROTATION) {
3938
case 1:
-41.1 KB
Binary file not shown.

Learn/Simple Libraries/Robotics/S3/libs3/libs3.c

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)