Skip to content

Commit d75ee2f

Browse files
authored
Merge pull request #232 from ironsheep/p2-cube-support
update to p2 Cube supporting version v0.9.0
2 parents e2f902e + 83bbc81 commit d75ee2f

11 files changed

+791
-581
lines changed

libraries/community/p2/All/isp_hub75_matrix/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ Language: Spin2 / Pasm2
66

77
Created: 03-DEC-2020
88

9-
Upadted: 19-FEB-2021
9+
Updated: 12-MAY-2021
10+
11+
Version: 0.9.0
1012

1113
Category: display
1214

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ PUB correctedColor(color) : adjustedColor
7979
'' Correct a color using generic gamma
8080
adjustedColor := color
8181
'return
82-
'adjustedColor := ((color * defaultBrightness) >> 8) & $ff
8382
adjustedColor := byte[@gamma][adjustedColor]
83+
adjustedColor := ((adjustedColor * defaultBrightness) >> 8) & $ff
8484
adjustedColor := dutyCycleForIntensity(adjustedColor)
8585

8686
PUB gammaPeek(color) : adjustedColor | gammmaIndex, lowColor, highColor
@@ -109,7 +109,6 @@ PUB gammaPeek(color) : adjustedColor | gammmaIndex, lowColor, highColor
109109
PUB correctedSingleColor(led, colorValue) : adjustedColor | pGammaTable
110110
'' Correct the color for a specific LED (R, G, or B)
111111
adjustedColor := colorValue
112-
'adjustedColor := ((adjustedColor * defaultBrightness) >> 8) & $ff
113112
case led
114113
LED_RED:
115114
pGammaTable := @gamma
@@ -122,6 +121,7 @@ PUB correctedSingleColor(led, colorValue) : adjustedColor | pGammaTable
122121

123122
if bGammaEnable
124123
adjustedColor := byte[pGammaTable][adjustedColor]
124+
adjustedColor := ((adjustedColor * defaultBrightness) >> 8) & $ff
125125
adjustedColor := dutyCycleForIntensity(adjustedColor)
126126

127127
PUB rgbColorFromDegrees(degrees) : rcbColor | offset60, fract60, red, green, blue
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:088163fc8a12bf2ac9731d0475a485f16a0fe252b35aa2995c3865d092427751
3-
size 17320
2+
oid sha256:54b510f568034f6431a0feabf1ca84e343e0ae5df2c056b9670844f41013c564
3+
size 23227

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

+182-65
Large diffs are not rendered by default.

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ PRI loadBitmap(pBitmapFile) | nPanelCol, nPanelRow, blue, green, red, haveError,
4444
abort
4545

4646
' fill screen buffer
47-
repeat nPanelRow from 0 to screen.MAX_PHYSICAL_ROWS - 1
48-
repeat nPanelCol from 0 to screen.MAX_PHYSICAL_COLUMNS - 1
47+
repeat nPanelRow from 0 to screen.MAX_DISPLAY_ROWS - 1
48+
repeat nPanelCol from 0 to screen.MAX_DISPLAY_COLUMNS - 1
4949
'debug("loadBitmap() - RC=(", udec_(nPanelRow), ", ", udec_(nPanelCol), ")")
5050
showDebug := FALSE
5151
if isDebugLocn(nPanelRow, nPanelCol)
@@ -101,7 +101,7 @@ PRI validateBmpFile(pBmpFileImage) : bValidStatus | pFileHeader, i, iStart, iEnd
101101
' XYZZYpnl debug(" - Img-start @0x", uhex_(iStart))
102102
' XYZZYpnl debug(" - Img-end @0x", uhex_(iEnd))
103103

104-
if biWidth <> screen.MAX_PHYSICAL_COLUMNS or biHeight <> screen.MAX_PHYSICAL_ROWS
104+
if biWidth <> screen.MAX_DISPLAY_COLUMNS or biHeight <> screen.MAX_DISPLAY_ROWS
105105
' XYZZYpnl debug(" !! invalid BMP size! [NOT 64x32]")
106106
bValidStatus := FALSE
107107

@@ -123,11 +123,11 @@ PRI validateBmpFile(pBmpFileImage) : bValidStatus | pFileHeader, i, iStart, iEnd
123123
'screen.dbgMemDump(@fileEndMsg, iEnd-32-1, 32)
124124

125125
PRI get24BitBMPColorForRC(nRow, nColumn) : red, green, blue | pixColorAddr
126-
if(nRow > screen.MAX_PHYSICAL_ROWS - 1)
127-
debug("- ERROR bad nRow value [", udec_(nRow), " > ", udec_(screen.MAX_PHYSICAL_ROWS - 1), "]")
126+
if(nRow > screen.MAX_DISPLAY_ROWS - 1)
127+
debug("- ERROR bad nRow value [", udec_(nRow), " > ", udec_(screen.MAX_DISPLAY_ROWS - 1), "]")
128128

129-
if(nColumn > screen.MAX_PHYSICAL_COLUMNS - 1)
130-
debug("- ERROR bad nColumn value [", udec_(nColumn), " > ", udec_(screen.MAX_PHYSICAL_COLUMNS - 1), "]")
129+
if(nColumn > screen.MAX_DISPLAY_COLUMNS - 1)
130+
debug("- ERROR bad nColumn value [", udec_(nColumn), " > ", udec_(screen.MAX_DISPLAY_COLUMNS - 1), "]")
131131

132132
pixColorAddr := getPixelAddressForBMPRowColumn(nRow, nColumn)
133133
' our intername .bmp file byte order is BGR!
@@ -137,7 +137,7 @@ PRI get24BitBMPColorForRC(nRow, nColumn) : red, green, blue | pixColorAddr
137137

138138
PRI getPixelAddressForBMPRowColumn(nRow, nColumn) : pixColorAddr | rowIndex, columnIndex, nOffset, fileBitsBase, showDebug
139139
' Row is inverted in .BMP file...
140-
rowIndex := (screen.MAX_PHYSICAL_ROWS - 1) - nRow
140+
rowIndex := (screen.MAX_DISPLAY_ROWS - 1) - nRow
141141

142142
' Column is normal in file...
143143
columnIndex := nColumn
@@ -148,7 +148,7 @@ PRI getPixelAddressForBMPRowColumn(nRow, nColumn) : pixColorAddr | rowIndex, col
148148
showDebug := TRUE ' FALSE ' turn off debug
149149

150150
' now offset is simple (just multiply by 3! [bytes of color])
151-
nOffset := ((rowIndex * screen.MAX_PHYSICAL_COLUMNS) + columnIndex) * screen.DISPLAY_BYTES_PER_COLOR
151+
nOffset := ((rowIndex * screen.MAX_DISPLAY_COLUMNS) + columnIndex) * screen.DISPLAY_BYTES_PER_COLOR
152152

153153
fileBitsBase := @byte[pBitmapFileInMemory][bfOffBits] ' get base of image in file (skip header)
154154
pixColorAddr := @byte[fileBitsBase][nOffset] ' add in offset to 24-bit color

0 commit comments

Comments
 (0)