Skip to content

Commit a520526

Browse files
committed
update to latest release of driver
1 parent 76f8289 commit a520526

12 files changed

+329
-776
lines changed

libraries/community/p2/All/isp_hub75_matrix/isp_hub75_color.spin2

Lines changed: 11 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
'' -- Copyright (c) 2020 Iron Sheep Productions, LLC
77
'' -- see below for terms of use
88
'' E-mail..... stephen@ironsheep.biz
9-
'' Started.... Oct 2020
9+
'' Started.... Oct 2020
1010
'' Updated.... 24 Oct 2020
1111
''
1212
'' =================================================================================================
1313

1414
CON { test colorset }
15-
15+
1616
cBlack = $000000
1717
cWhite = $FFFFFF
1818
cRed = $FF0000
@@ -32,7 +32,7 @@ CON { test colorset }
3232
cDarkGreen = $006400
3333
cOrange = $FFA500
3434
cBlueViolet = $8A2BE2
35-
35+
3636
' SPECIAL non-colors - invoke alforithm to gerate actual color used'
3737
cRedWhtBlu = $deadf0
3838
cRainbow = $deadf1
@@ -61,15 +61,15 @@ PUB getBrightness() : brightness
6161
brightness := defaultBrightness
6262

6363
PUB correctedColor(color) : adjustedColor
64-
'' correct a color using generic gamma
64+
'' Correct a color using generic gamma
6565
adjustedColor := color
6666
'return
6767
'adjustedColor := ((color * defaultBrightness) >> 8) & $ff
6868
adjustedColor := byte[@gamma][adjustedColor]
6969
adjustedColor := dutyCycleForIntensity(adjustedColor)
7070

7171
PUB gammaPeek(color) : adjustedColor | gammmaIndex, lowColor, highColor
72-
'' return index of nearest matching value in gamma table
72+
'' Return index of nearest matching value in gamma table
7373
if bGammaEnable
7474
adjustedColor := byte[@gamma][color]
7575
repeat gammmaIndex from 0 to 255
@@ -92,7 +92,7 @@ PUB gammaPeek(color) : adjustedColor | gammmaIndex, lowColor, highColor
9292
adjustedColor := color
9393

9494
PUB correctedSingleColor(led, colorValue) : adjustedColor | pGammaTable
95-
'' correct the color for a specific LED (R, G, or B)
95+
'' Correct the color for a specific LED (R, G, or B)
9696
adjustedColor := colorValue
9797
'adjustedColor := ((adjustedColor * defaultBrightness) >> 8) & $ff
9898
case led
@@ -130,30 +130,10 @@ PUB rgbColorFromDegrees(degrees) : rcbColor | offset60, fract60, red, green, blu
130130
elseif degrees >= 60
131131
green := 255
132132
red := ((59 - offset60) * fract60) / 100
133-
else
133+
else
134134
red := 255
135135
green := (offset60 * fract60) / 100
136-
{
137-
fract60 := 4.25 ' float(255 / 60) ' 4.25 ' 255 / 60
138-
if degrees >= 300
139-
red := 255
140-
blue := (59 - offset60) * fract60
141-
elseif degrees >= 240
142-
blue := 255
143-
red := offset60 * fract60
144-
elseif degrees >= 180
145-
blue := 255
146-
green := (59 - offset60) * fract60
147-
elseif degrees >= 120
148-
green := 255
149-
blue := offset60 * fract60
150-
elseif degrees >= 60
151-
green := 255
152-
red := (59 - offset60) * fract60
153-
else
154-
red := 255
155-
green := offset60 * fract60
156-
}
136+
157137
rcbColor := cValueForRGB(red, green, blue)
158138
'debug("- degrees=", udec_(degrees), ", color=", uhex_long_(rcbColor), " RGB=", udec_(red), ", ", udec_(green), ", ", udec_(blue), ")" )
159139

@@ -168,46 +148,8 @@ PUB cValueForRGB(red, green, blue) : combinedValue
168148
'' CONVERT: r,g,b to combined value
169149
combinedValue := ((red & $ff) << 16) | ((green & $ff) << 8) | (blue & $ff)
170150

171-
PRI dutyCycleForIntensityOld1(hex8bit) : pwmBits
172-
' CALCULATE: proper duty cycle for intensity of 0-255
173-
' --- VERSION 1 - Bits spread throughout ---
174-
if hex8bit == 255
175-
pwmBits := $ff
176-
elseif hex8bit == 0
177-
pwmBits := $00
178-
else
179-
pwmBits := (hex8bit / screen.MAX_PWM_FRAMES - 1) + 1
180-
181-
PRI dutyCycleForIntensityOld2(hex8bit) : pwmBits | segmentSize
182-
' CALCULATE: proper duty cycle for intensity of 0-255
183-
' --- VERSION 2 - 3/4 high, 1/4 off, rest spread throughout ---
184-
segmentSize := (256 / (screen.MAX_PWM_FRAMES + 1)) / 8
185-
if hex8bit >= 255 - ((segmentSize * 6) - 1)
186-
pwmBits := $ff
187-
elseif hex8bit <= (segmentSize * 2)- 1
188-
pwmBits := $00
189-
else
190-
pwmBits := (hex8bit / screen.MAX_PWM_FRAMES) + 1
191-
192-
PRI dutyCycleForIntensityOld3(hex8bit) : pwmBits | segmentSize
193-
' WAIT!!! Pastel colors!???!
194-
' CALCULATE: proper duty cycle for intensity of 0-255
195-
' --- VERSION 3 - Bits spread throughout ---
196-
pwmBits := (hex8bit / screen.MAX_PWM_FRAMES + 1)
197-
198-
PRI dutyCycleForIntensityOld4(hex8bit) : pwmBits | segmentSize
199-
' CALCULATE: proper duty cycle for intensity of 0-255
200-
' --- VERSION 4 - 2/6 high, 1/6 off, rest spread throughout ---
201-
segmentSize := ((256 / (screen.MAX_PWM_FRAMES + 1)) / 2) / 3
202-
if hex8bit >= 255 - (segmentSize * 2) + 1
203-
pwmBits := $ff
204-
elseif hex8bit <= 0 + segmentSize - 1
205-
pwmBits := $00
206-
else
207-
pwmBits := ((hex8bit * 10854) / screen.MAX_PWM_FRAMES) / 10000
208-
209-
PRI dutyCycleForIntensity(hex8bit) : pwmBits
210-
' CALCULATE: proper duty cycle for intensity of 0-255
151+
PUB dutyCycleForIntensity(hex8bit) : pwmBits
152+
'' CALCULATE: proper duty cycle for intensity of 0-255
211153
' --- VERSION 1 - Bits spread throughout ---
212154
if hex8bit == 255
213155
pwmBits := $ff
@@ -257,7 +199,7 @@ gammaOld byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
257199
byte 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 197, 199, 201, 203, 205
258200
byte 207, 210, 212, 214, 216, 219, 221, 223, 226, 228, 230, 233, 235, 237, 240, 242, 245
259201
byte 247, 250, 252, 255
260-
202+
261203
gamma2_0
262204
' 256-step brightness table: gamma = 2.0
263205
byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1
@@ -401,4 +343,3 @@ CON { license }
401343
SOFTWARE.
402344
=================================================================================================
403345
}}
404-
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:519dc394e5fbd44c3eb2ba9fb1a22b4aa31e8c9e9310f0b0140a7338b4c9bd4a
3-
size 16018
2+
oid sha256:fcf16fb8c4209b3584c09cdffb433716f7f96805538cd870f4507af46e26512b
3+
size 18997

libraries/community/p2/All/isp_hub75_matrix/isp_hub75_display.spin2

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'' -- see below for terms of use
88
'' E-mail..... stephen@ironsheep.biz
99
'' Started.... Oct 2020
10-
'' Updated.... 17 Oct 2020
10+
'' Updated.... 01 Dec 2020
1111
''
1212
'' =================================================================================================
1313

@@ -109,13 +109,13 @@ PUB fillScreen(rgbColor) | row, column
109109
pixels.drawPixelAtRC(row, column, rgbColor)
110110

111111
PUB fillPanel(threeBitColor)
112-
'' fill screen but without PWM (for testing underlying driver)
112+
'' Fill screen but without PWM (for testing underlying driver)
113113
panel.fillPanel(threeBitColor)
114114

115115
PUB commitScreenToPanel()
116116
'' Write sceen to panel driver
117117
'debug("- DISP: commit!")
118-
panel.loadScreen(@screen0)
118+
panel.convertScreen2PWM(@screen0)
119119

120120

121121
{ -------------- Text Handling -------------- }
@@ -125,13 +125,13 @@ PUB setCursor(line, column)
125125
' TODO emit error on bad column/row?
126126
cursorLine := 0 #> line <# maxTextLines - 1
127127
cursorColumn := 0 #> column <# maxTextColumns - 1
128-
128+
129129
PUB homeCursor()
130-
'' return the cursor to top left corner of our display
130+
'' Return the cursor to top left corner of our display
131131
setCursor(0, 0)
132132

133133
PUB setTextFont(newFont) | scrollerIndex, hUnusedPix, vUnusedPix
134-
'' Select font and update text grid size
134+
'' Select font and update text grid size
135135
' currently we only support our 8x8 and 5x7 fonts
136136
case newFont
137137
TEXT_FONT_DEFAULT..TEXT_FONT_5x7:
@@ -191,19 +191,19 @@ PUB setTextFont(newFont) | scrollerIndex, hUnusedPix, vUnusedPix
191191
repeat scrollerIndex from 0 to MAX_SCROLLING_REGIONS - 1
192192
scroller[scrollerIndex].setFontInfo(maxTextColumns, charWidthInPix, charHeightInPix, leftOffsetInPix, horizontalGapInPix, hBitmapOffsetInPix, selectedTextFont)
193193

194-
PUB setTextColor(rgbColor)
194+
PUB setTextColor(rgbColor)
195195
'' Set 24-bit color for subsequent text display
196196
currTextColor := rgbColor
197197

198-
PUB setTextAtCursor(zString)
198+
PUB setTextAtCursor(zString)
199199
'' Place text 'zero terminated' at our current cursor position using current text color
200200
setColoredTextAtLnCol(cursorLine, cursorColumn, zString, currTextColor)
201201

202202
PUB setColoredTextAtLnCol(line, column, pString, rgbColor) | charIndex
203203
'' Place text at specific cursor position using current text color
204204
setCursor(line, column)
205205
charIndex := 0
206-
repeat
206+
repeat
207207
if byte[pString][charIndex] <> 0
208208
setColorCharAtCursor(byte[pString][charIndex++], rgbColor)
209209
while byte[pString][charIndex] <> 0
@@ -249,18 +249,18 @@ PUB setColoredCharAtLnCol(line, column, cChar, rgbColor) | pCharBitMap, tlScreen
249249

250250
PUB scrollText(indexAllocated, loopCount)
251251
'debug("dsp:scrollText() ", udec(indexAllocated))
252-
'' specify scrolling text duration (forever, once, twice)
252+
'' Specify scrolling text duration (forever, once, twice)
253253
if indexAllocated >= 0 && indexAllocated < MAX_SCROLLING_REGIONS
254254
scroller[indexAllocated].scrollText(loopCount)
255255

256256

257-
PUB scrollTextOnLine(line, pZString, direction) : indexAllocated
258-
'' place scolling text on line N, of pZString scrolling in direction using current text color
257+
PUB scrollTextOnLine(line, pZString, direction) : indexAllocated
258+
'' Place scolling text on line N, of pZString scrolling in direction using current text color
259259
indexAllocated := scrollColoredTextOnLn(line, pZString, direction, currTextColor)
260260

261261

262262
PUB scrollColoredTextOnLn(line, pZString, direction, rgbColor) : indexAllocated | cLineIndex, cColumnIndex, widthInChars, sRowPixIndex, sColumnPixIndex
263-
'' place scolling text on line N [0 - N-1], of pZString scrolling in direction using rgbColor
263+
'' Place scolling text on line N [0 - N-1], of pZString scrolling in direction using rgbColor
264264
'debug("dsp:scrollColoredTextOnLn()")
265265
' ensure we are asked to use a good location
266266
cLineIndex := 0 #> line <# maxTextLines - 1
@@ -274,13 +274,13 @@ PUB scrollColoredTextOnLn(line, pZString, direction, rgbColor) : indexAllocated
274274
indexAllocated := scrollTextAtRCOfColor(sRowPixIndex, sColumnPixIndex, widthInChars, pZString, direction, rgbColor)
275275

276276

277-
PUB scrollTextAtRC(row, column, widthInChars, pZString, direction) : indexAllocated
278-
'' place scolling text at absolute R,C, of pZString scrolling in direction using current text color
277+
PUB scrollTextAtRC(row, column, widthInChars, pZString, direction) : indexAllocated
278+
'' Place scolling text at absolute R,C, of pZString scrolling in direction using current text color
279279
indexAllocated := scrollTextAtRCOfColor(row, column, widthInChars, pZString, direction, currTextColor)
280280

281281

282282
PUB scrollTextAtRCOfColor(row, column, widthInChars, pZString, direction, rgbColor) : indexAllocated
283-
'' place scolling text at absolute R,C, of pZString scrolling in direction using rgbColor
283+
'' Place scolling text at absolute R,C, of pZString scrolling in direction using rgbColor
284284
indexAllocated := nextFreeScroller()
285285
'debug("dsp:scrollTextAtRCOfColor() ", udec(indexAllocated))
286286
scroller[indexAllocated].scrollTextAtRCOfColor(row, column, widthInChars, pZString, direction, rgbColor)
@@ -315,11 +315,11 @@ PRI nextFreeScroller() : scrollerIndexToUse | scrollerIndex
315315
{ -------------- Basic Graphics -------------- }
316316

317317
PUB drawBox(topRow, leftColumn, width, height, filled)
318-
'' Draw draw box outline/filled of width x height at R,C (using current text color)
318+
'' Draw box outline/filled of width x height at R,C (using current text color)
319319
drawBoxOfColor(topRow, leftColumn, width, height, filled, currTextColor)
320320

321321
PUB drawBoxOfColor(topRow, leftColumn, width, height, filled, rgbColor) | rightColumn, bottomRow, rowIndex
322-
'' Draw draw box outline/filled of width x height at R,C using rgbColor
322+
'' Draw box outline/filled of width x height at R,C using rgbColor
323323
rightColumn := leftColumn + width - 1
324324
bottomRow := topRow + height - 1
325325
if filled == TRUE
@@ -345,11 +345,11 @@ PUB drawLineOfColor(fmRow, fmColumn, toRow, toColumn, rgbColor) | row, column, d
345345
toColumn := 0 #> toColumn <# screen.MAX_DISPLAY_COLUMNS - 1
346346
if fmRow == toRow
347347
' draw Horizontal Line
348-
repeat column from fmColumn to toColumn
348+
repeat column from fmColumn to toColumn
349349
pixels.drawPixelAtRC(fmRow, column, rgbColor)
350350
elseif fmColumn == toColumn
351351
' draw Vertical Line
352-
repeat row from fmRow to toRow
352+
repeat row from fmRow to toRow
353353
pixels.drawPixelAtRC(row, fmColumn, rgbColor)
354354
else
355355
dx := (toColumn - fmColumn)
@@ -363,7 +363,7 @@ PUB drawLineOfColor(fmRow, fmColumn, toRow, toColumn, rgbColor) | row, column, d
363363
column := fmColumn
364364
row := fmRow
365365
ctr := 1
366-
repeat while (ctr <= incr)
366+
repeat while (ctr <= incr)
367367
pixels.drawPixelAtRC(row, column, rgbColor)
368368
column += dx
369369
row += dy
@@ -390,7 +390,6 @@ PRI isDebugLocn(nRow, nCol) : status
390390
status := TRUE ' FALSE ' turn off debug
391391

392392

393-
394393
CON { license }
395394

396395
{{
@@ -419,6 +418,5 @@ CON { license }
419418
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
420419
SOFTWARE.
421420
=================================================================================================
422-
423-
}}
424421

422+
}}

0 commit comments

Comments
 (0)