Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch trittmatte #1

Open
wants to merge 254 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
254 commits
Select commit Hold shift + click to select a range
4996ac3
Changed weight for init func
Jan 31, 2023
6462c19
Revert change in pxt
Jan 31, 2023
6ca83c2
revert last change
Jan 31, 2023
65b741f
small typo
Feb 1, 2023
1a6c03a
set min/max values for brightness; translated some fields; Removed un…
Feb 1, 2023
2f60873
fixed min/max error
Feb 1, 2023
3cf6946
Remove chinese locales and vscode specific stuff
Feb 1, 2023
6a22ae7
Consistent casing
Feb 1, 2023
8e94c17
renamed mapping func.
Feb 1, 2023
76ba596
edited pxt.json
Feb 1, 2023
f085abd
removed chinese locales from pxt
Feb 1, 2023
2e118ef
removed rgbsonar dependency
Feb 1, 2023
152cf31
removed remaining MP3 and ASR stuff
Feb 1, 2023
cae7c70
some minor refactorings
Feb 1, 2023
745ef05
reordered component and clearer descr.
Feb 1, 2023
91f76c8
more consistent initializers
Feb 1, 2023
968327c
even more consistent initializers
Feb 1, 2023
0c8a376
removed unicode icon; removed Port string
Feb 1, 2023
805be39
try to correct bug in argument list
Feb 1, 2023
8db177f
Added servo index
Feb 1, 2023
124cee6
German localisation; Removed unused vars/code
Feb 6, 2023
e28f310
Remove verb in function description in getter functions
Feb 6, 2023
48df1bd
translated blocks in startbitRGBLights
Feb 6, 2023
a6d0918
use LED RGB from enum
Feb 6, 2023
63e13bd
Edited comments for RGB blocks
Feb 6, 2023
38aa590
line follower without new line
Feb 6, 2023
01c313d
replacde % with $ in blocks
Feb 6, 2023
e6b9994
another try...
Feb 6, 2023
b4e16b9
sensor 1 -> sensor1
Feb 6, 2023
8426067
Test for mp3 lists
Feb 6, 2023
1da7d11
more mp3 functions
Feb 6, 2023
dd30922
explicit constructor
Feb 6, 2023
cecf766
default for songliste and subcategory mp3 box
Feb 6, 2023
0943860
without constructor
Feb 6, 2023
8d2ffeb
decalare songliste
Feb 6, 2023
63284ac
default factory for mp3 box
Feb 7, 2023
77e2677
return object
Feb 7, 2023
1fc963a
mp3 box functions without return types for stacking blocks
Feb 7, 2023
edd3b02
mp3 init() in subcategory; Return list entry instead of index
Feb 7, 2023
f479e2f
Weights for mp3
Feb 7, 2023
3ff3710
log -> loc typo
Feb 8, 2023
8b7228b
servo range fix to 180degree
Feb 8, 2023
ed526ae
remove led tm1640 support; renamed Licht 1 to LED 1
Feb 8, 2023
ac431e5
remove leds 3 to 5
Feb 8, 2023
a0dfa71
trittmatte test
Feb 8, 2023
ea83d38
missing empty event handler
Feb 8, 2023
a223fff
event with callback
Feb 8, 2023
4cd1afd
another try..
Feb 8, 2023
dcabe18
pulsed event
Feb 8, 2023
fdd5c2e
added pxtcore; trying to create event handler using dal
Feb 8, 2023
88389f2
temp. remove trittmatte
Feb 13, 2023
e7a64b8
trittmatte pin definition fix
Feb 13, 2023
6b0cee5
Pullup for trittmatte
Feb 13, 2023
4bf3aae
proper types for pin setEvents() and setPull()
Feb 13, 2023
c42df24
tried again with registerWithDal dep
Feb 13, 2023
2ec1da4
removed callback functions
Feb 13, 2023
aa9a6f7
onPulse event handler inside init
Feb 14, 2023
58f88f1
added custom callback
Feb 14, 2023
99b6b1f
commented out handler call
Feb 14, 2023
d327624
bind onPulsed on custom event block
Feb 14, 2023
73075af
another try
Feb 14, 2023
0fc6b0e
added missing port
Feb 14, 2023
112f16a
defl port
Feb 14, 2023
31c0929
missing %
Feb 14, 2023
c11c084
without possible uninitialized code
Feb 14, 2023
113fa54
without defl
Feb 14, 2023
d3b3b0b
remove trittmatte initializer
Feb 14, 2023
e3e64bd
commented missing }
Feb 14, 2023
bbeb263
added debug msgs
Feb 14, 2023
32dddca
trittmatte_released block
Feb 14, 2023
5f2aee7
wrapper for debouncing
Feb 15, 2023
6f4d22d
added missing func arg
Feb 15, 2023
bbf12f8
debounce wrapper for trittmatte pressed; added missing min max
Feb 15, 2023
5e0a9c2
removed wrong whitespace defl
Feb 15, 2023
1238c69
make debounce arg collapsible
Feb 15, 2023
12d71ab
implicitly call show() for LED brightness / color
Feb 15, 2023
03b6c28
remove collapsible debounce time
Feb 15, 2023
ce86f49
trittmatte on/off handler
Feb 15, 2023
d0842bf
renamed trittmatte status var
Feb 15, 2023
f0b3e77
global vars for trittmatte
Feb 20, 2023
3ea7919
renamed duplicated function names
Feb 20, 2023
da6993a
Revert "global vars for trittmatte"
Feb 20, 2023
6f72e26
replaced debounce time func arg as global
Feb 21, 2023
67b803a
Update StartbitV2.ts
Zauberhut Mar 10, 2023
f0e1549
added neopixel library
Mar 13, 2023
1eed00f
Merge branch 'main' of github.com:mint-n-pepper/Informatiktheater
Mar 13, 2023
091581e
added missing neotest.ts
Mar 13, 2023
bbce778
resolve name conflict with sendbufferasm
Mar 13, 2023
ca53059
pixel range function
Mar 13, 2023
b11b16e
removed some unused vars; re-group blocks
Mar 13, 2023
52ea037
move back color blocks
Mar 13, 2023
33dec29
sliders for color value selections
Mar 14, 2023
d7b9bdf
Stripe & Matrix categories; HSV instead of RGB color picker and corre…
Mar 14, 2023
6c61919
rename to Hiwonder LED
Mar 14, 2023
038a8f4
log hue values
Mar 14, 2023
62298cb
log hue values
Mar 14, 2023
ce8611b
hstep log
Mar 14, 2023
97602fe
HueInterpolationDirection value check
Mar 14, 2023
5a2ec36
check for full rainbow
Mar 14, 2023
08f4978
remove unused blocks from locales
Mar 14, 2023
10b55f3
compensate difference in start value for hsv color picker
Mar 14, 2023
4a3213f
keep direction alway clockwise
Mar 14, 2023
a81324f
log estimated current consumption
Mar 14, 2023
08fd3a5
this.power
Mar 14, 2023
333f780
renaming to onboard-led
Mar 15, 2023
0536119
fix GRB mode
Mar 15, 2023
aeba1ff
remove rainbow angle shift which was caused by wrong RGB mode
Mar 15, 2023
a4441a7
enum starting at 2
Mar 15, 2023
8de10b0
enum comparision with valueOf()
Mar 15, 2023
51f6618
enum comparision with number cast
Mar 15, 2023
425d01e
enum type cast
Mar 15, 2023
4cafc65
limit number of pins on neopixel blocks
Mar 15, 2023
f782c5a
pin type cast
Mar 15, 2023
b5cfa7f
ugly switch statement instead of cast
Mar 15, 2023
a94017e
e -> pin
Mar 15, 2023
691da9b
Don't show bargraph
Mar 15, 2023
15abdf7
implicit hiwonder initialisation
Mar 15, 2023
b67362f
implicit hiwonder initialisation done right
Mar 15, 2023
3386e31
undo auto init
Mar 15, 2023
1921d2f
use same sendbufferasm()
Mar 15, 2023
3d39f20
remove old sendbuffer stuff
Mar 15, 2023
09861eb
Auto init (again)
Mar 15, 2023
bed64bb
added hsv picker
Mar 15, 2023
57c503b
removed accidental added func prototypes
Mar 15, 2023
c597d44
move translation into source code (bug)
Mar 20, 2023
c09e72b
added missing % in loc.de
Mar 20, 2023
569c103
added another missing % in loc.de
Mar 20, 2023
bc6d8d7
temp disable auto init
Mar 20, 2023
a0db5b0
reactivate auto init but without audio alert
Mar 20, 2023
3401ce2
more jsdocs
Mar 20, 2023
4626679
remove unknown trackargs from create fn
Mar 20, 2023
ceceaab
remove white led support
Mar 20, 2023
1b63235
limit max brithness
Mar 20, 2023
57fca7c
put back audio alert; edited readme
Mar 20, 2023
32748d0
hide power estimation block
Mar 20, 2023
37a3c7e
add smartMatrix lib
Mar 20, 2023
a7465b4
use hiwonder pin
Mar 20, 2023
d698984
neopixel shadow
Mar 20, 2023
4650d89
limit scroll text speed
Mar 20, 2023
4759735
remove neopixel matrix functions
Mar 21, 2023
eacc743
move smartmatrix stuff in neopixel NS
Mar 21, 2023
fa25de4
move getlettermap into neopixel NS
Mar 21, 2023
a1575a4
grouping for neopixels
Mar 21, 2023
ae05aba
no gaps
Mar 21, 2023
f710fae
bugfix for setPixel() in Matrix uneven cols
Mar 21, 2023
4d0542d
fix position text
Mar 21, 2023
ac0e6f0
remove non implemented y offset draw bitmap
Mar 21, 2023
ce28edf
enable y positioning of text
Mar 21, 2023
5c7269c
bitmap centered
Mar 21, 2023
548c4b2
remove mirrored variant of draw bitmap
Mar 21, 2023
7f9f2f9
log bitmap table
Mar 21, 2023
113fbf5
stringify log output
Mar 21, 2023
ad6c0c8
use enum for matrix size; trying to reorder grouping
Mar 21, 2023
ec984c9
force Setup group to be on top in GUI
Mar 21, 2023
f7b8e8d
Don't clear and auto show non scrolling text
Mar 22, 2023
703541d
more verbose log drawbitmap
Mar 22, 2023
93a71d8
typo
Mar 22, 2023
c77e5dd
log buffer before sending
Mar 22, 2023
06d2193
stringified log
Mar 22, 2023
55a0173
remove some logs, add when pixel drawn
Mar 22, 2023
a65dca5
log pixel on even rows
Mar 22, 2023
2ac3c2e
update ws2812b lib
Mar 22, 2023
b5f88aa
log buffer content before sending
Mar 22, 2023
cbe71b7
added draw_pattern as is (not working, will freeze program)
Mar 22, 2023
1d0ab3f
move draw pattern into matrix group
Mar 27, 2023
b7471d7
added blockId for draw_pattern
Mar 27, 2023
206c864
servo debug log
Mar 28, 2023
982ed96
start servo enum index at 1
Mar 28, 2023
d3c3bfa
correct default for line follower enum
Mar 28, 2023
5df3b40
rename löschen to ausschalten; implicit call show for fix text
Mar 29, 2023
fa5fa5e
commented out knob and line follower inits
Mar 29, 2023
9f43e80
remove line follower and knob because commented block still appear in…
Mar 29, 2023
e5ced5e
remove knob and linefollwer in sensor cat
Mar 29, 2023
8543fdf
rename Board-LED
Mar 29, 2023
179db16
rename LED all to LED 1 + 2
Mar 29, 2023
5eddf8e
rainbow start end vals; rename block text
Mar 29, 2023
57ae61f
remove dc motor block
Mar 29, 2023
9018388
pixel range english text corresponding to german
Mar 29, 2023
f992f0e
LED ein to LED einschalten
Mar 29, 2023
c2cb153
option to for external battery_pack
Mar 29, 2023
4d1e0e8
Board LED on/off english desrc
Mar 29, 2023
d0e5579
Update pxt.json
Zauberhut Apr 16, 2023
bd79539
Update neopixel.ts
Zauberhut Apr 16, 2023
e353820
Update StartbitV2.ts
Zauberhut Apr 16, 2023
90f0dbf
Update StartbitV2.ts
Zauberhut Apr 16, 2023
21d99f0
Update StartbitV2.ts
Zauberhut Apr 16, 2023
2781bab
Update StartbitV2.ts
Zauberhut Apr 16, 2023
0c44f27
debug log color val
Apr 24, 2023
64c549a
neopixel_color shadow
Apr 24, 2023
69435b0
strip pixel range defaults
Apr 24, 2023
9d7d409
pixel offset defaults
Apr 24, 2023
c4ad618
exchange func args positions
Apr 24, 2023
e13b4d0
renamed mp3-box to soundbox
Apr 25, 2023
49c31f1
remove some logs; extend to 16x16px
Apr 25, 2023
bdab8b2
move draw_pattern outside matrix class
Apr 25, 2023
84d3d95
fnc added
Apr 25, 2023
22d0616
export fn
Apr 25, 2023
f8a4237
remove double current for testing purposes
Apr 25, 2023
071bf98
predefined icons
May 3, 2023
5c5becd
larger bitmask for 16x16 icons
May 3, 2023
b687452
bitmap lookup for 16x16 icons
May 3, 2023
570ac7d
implicit call show for icons; don't show icon if size does not match
May 3, 2023
94e36b3
don't show (non working) draw pattern block, hide draw array block
May 3, 2023
df2a8b8
move ultrasonic init block to sensor; renamed sensor to ultraschall
May 3, 2023
e4f410a
Add files via upload
Zauberhut May 4, 2023
882c8fc
changeColour
Zauberhut May 20, 2023
1a1122d
colour dark 4 neopixel-Blocks
Zauberhut May 20, 2023
a141f8b
new feautres from sandbox
sjanuth Oct 10, 2023
4331f44
Beschriftung Matrixenbilder
Zauberhut Mar 23, 2024
ca79377
Pin order changed
Zauberhut Mar 23, 2024
069d449
onboard board
Zauberhut Mar 23, 2024
7bd78b4
order Matrixsizes
Zauberhut Mar 23, 2024
4c2fd11
various
Zauberhut Mar 23, 2024
07c1b47
Update StartbitV2.ts
Zauberhut Mar 23, 2024
092be83
Update StartbitV2.ts
Zauberhut Mar 25, 2024
18973ca
Update StartbitV2.ts
Zauberhut Mar 25, 2024
5cb7a07
Update StartbitV2.ts
Zauberhut Mar 25, 2024
62c3284
Update StartbitV2.ts
Zauberhut Mar 25, 2024
c1ed299
soundbox off
Zauberhut Mar 25, 2024
7fca1c4
order
Zauberhut Mar 25, 2024
14bb400
Update StartbitV2.ts
Zauberhut Mar 25, 2024
1572e85
changes
Zauberhut Mar 25, 2024
51c9450
Update StartbitV2.ts
Zauberhut Mar 25, 2024
180fd31
Update StartbitV2.ts
Zauberhut Mar 25, 2024
0d5cac6
Update StartbitV2.ts
Zauberhut Mar 25, 2024
0f68486
Update StartbitV2.ts
Zauberhut Mar 25, 2024
bd50e49
Update StartbitV2.ts
Zauberhut Mar 25, 2024
cdf6fdc
Update StartbitV2.ts
Zauberhut Mar 25, 2024
5580ca4
Update StartbitV2.ts
Zauberhut Mar 25, 2024
31fe4c8
order
Zauberhut Mar 25, 2024
0eb8080
minor
Zauberhut Mar 25, 2024
c338449
Update StartbitV2.ts
Zauberhut Mar 25, 2024
dfeaf4d
order changed
Zauberhut Mar 28, 2024
0c83cd5
Update StartbitV2.ts
Zauberhut Mar 28, 2024
51503fe
Update StartbitV2.ts
Zauberhut Mar 28, 2024
9f358aa
Update StartbitV2.ts
Zauberhut Mar 28, 2024
1501fa7
Update StartbitV2.ts
Zauberhut Mar 28, 2024
0f405e3
changed Sensoren
Zauberhut Mar 28, 2024
c8c70ae
back
Zauberhut Mar 28, 2024
aeebc3c
Update StartbitV2.ts
Zauberhut Mar 28, 2024
6d44e8a
Update StartbitV2.ts
Zauberhut Apr 8, 2024
2a43e8b
Update StartbitV2.ts
Zauberhut Apr 8, 2024
ba683fe
Update StartbitV2.ts
Zauberhut Apr 8, 2024
cce9e64
Update StartbitV2.ts
Zauberhut Apr 8, 2024
4405289
Update StartbitV2.ts
Zauberhut Apr 8, 2024
f3b0402
Update StartbitV2.ts
Zauberhut Apr 8, 2024
c6c2ebc
Update StartbitV2.ts
Zauberhut Apr 8, 2024
77f045f
Update StartbitV2.ts
Zauberhut Apr 8, 2024
36ef398
Update StartbitV2.ts
Zauberhut Nov 7, 2024
b7b0a14
Update StartbitV2.ts
Zauberhut Nov 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .vscode/settings.json

This file was deleted.

36 changes: 0 additions & 36 deletions .vscode/tasks.json

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# StartbitV2
The block for microbit v2
# Informatiktheater

Adapted code blocks for Hiwonder extension board based on [StartbitV2](https://github.com/Hiwonder/StartbitV2) including 3-party libraries for NeoPixel.
211 changes: 85 additions & 126 deletions StartbitRGBLight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,75 +4,44 @@

enum StartbitRGBColors {
//% block=red
//% block.loc.de=Rot
Red = 1,
//% block=orange
//% block.loc.de=Orange
Orange = 2,
//% block=yellow
//% block.loc.de=Gelb
Yellow = 3,
//% block=green
//% block.loc.de=Grün
Green = 4,
//% block=blue
//% block.loc.de=Blau
Blue = 5,
//% block=indigo
//% block.loc.de=Indigo
Indigo = 6,
//% block=violet
//% block.loc.de=Violett
Violet = 7,
//% block=purple
//% block.loc.de=Lila
Purple = 8,
//% block=white
White = 9
//% block.loc.de=Weiss
White = 9,
}

enum StartbitLights {
//% block="Light 1"
enum StartbitLights {
//% block="LED 1"
//% block.loc.de="LED 1"
Light1 = 0x00,
//% block="Light 2"
//% block="LED 2"
//% block.loc.de="LED 2"
Light2 = 0x01,
//% block="Light 3"
Light3 = 0x02,
//% block="Light 4"
Light4 = 0x03,
//% block="Light 5"
Light5 = 0x04,
//% block="Light 6"
Light6 = 0x05,
//% block="All"
All = 0x06
}

enum StartbitLightsBelt {
//% block="Light 1"
Light1 = 0x00,
//% block="Light 2"
Light2 = 0x01,
//% block="Light 3"
Light3 = 0x02,
//% block="Light 4"
Light4 = 0x03,
//% block="Light 5"
Light5 = 0x04,
//% block="Light 6"
Light6 = 0x05,
//% block="Light 7"
Light7 = 0x06,
//% block="Light 8"
Light8 = 0x07,
//% block="Light 9"
Light9 = 0x08,
//% block="Light 10"
Light10 = 0x09,
//% block="Light 11"
Light11 = 0x0A,
//% block="Light 12"
Light12 = 0x0B,
//% block="Light 13"
Light13 = 0x0C,
//% block="Light 14"
Light14 = 0x0D,
//% block="Light 15"
Light15 = 0x0E,
//% block="All"
All = 0x0F
//% block="LED 1 + 2"
//% block.loc.de="LED 1 + 2"
All = 0x06,
}

/**
Expand All @@ -84,22 +53,16 @@ enum StartbitRGBPixelMode {
//% block="RGB+W"
RGBW = 1,
//% block="RGB (RGB format)"
RGB_RGB = 2
RGB_RGB = 2,
}

/**
* QbitRGBLight Functions
*/
namespace StartbitRGBLight {
//% shim=sendBufferAsm
//% parts="QbitRGBLight"
function sendBuffer(buf: Buffer, pin: DigitalPin) {

}

/**
* A LHQbitRGBLight class
*/
* A LHQbitRGBLight class
*/
export class LHstartbitRGBLight {
buf: Buffer;
pin: DigitalPin;
Expand All @@ -120,80 +83,67 @@ namespace StartbitRGBLight {
}

setBeltPixelColor(pixeloffset: number, rgb: StartbitRGBColors): void {
if (pixeloffset == 15)//全部
{
for (let i = 0; i < this._length; i++)
{
this.setPixelRGB(i, rgb);
if (pixeloffset == 15) {
for (let i = 0; i < this._length; i++) {
this.setPixelRGB(i, rgb);
}
}
else
{
} else {
this.setPixelRGB(pixeloffset * 3, rgb);
this.setPixelRGB(pixeloffset * 3 + 1, rgb);
this.setPixelRGB(pixeloffset*3 + 2, rgb);
this.setPixelRGB(pixeloffset * 3 + 2, rgb);
}

}

setPixelColor(pixeloffset: number, rgb: StartbitRGBColors): void {
if (pixeloffset == this._length)//全部
{
for (let i = 0; i < this._length; i++)
{
this.setPixelRGB(i, rgb);
if (pixeloffset == this._length) {
for (let i = 0; i < this._length; i++) {
this.setPixelRGB(i, rgb);
}
}
else
{
} else {
this.setPixelRGB(pixeloffset, rgb);
}

}

private setPixelRGB(pixeloffset: number, rgb: StartbitRGBColors): void {
if (pixeloffset < 0
|| pixeloffset >= this._length)
return;
if (pixeloffset < 0 || pixeloffset >= this._length) return;
let tureRgb = 0;
switch (rgb)
{
case StartbitRGBColors.Red:
tureRgb = 0xFF0000;
break;

case StartbitRGBColors.Orange:
tureRgb = 0xFFA500;
break;

case StartbitRGBColors.Yellow:
tureRgb = 0xFFFF00;
break;

case StartbitRGBColors.Green:
tureRgb = 0x00FF00;
break;

case StartbitRGBColors.Blue:
tureRgb = 0x0000FF;
break;

case StartbitRGBColors.Indigo:
tureRgb = 0x4b0082;
break;

case StartbitRGBColors.Violet:
tureRgb = 0x8a2be2;
break;

case StartbitRGBColors.Purple:
tureRgb = 0xFF00FF;
break;

case StartbitRGBColors.White:
tureRgb = 0xFFFFFF;
break;
}
switch (rgb) {
case StartbitRGBColors.Red:
tureRgb = 0xff0000;
break;

case StartbitRGBColors.Orange:
tureRgb = 0xffa500;
break;

case StartbitRGBColors.Yellow:
tureRgb = 0xffff00;
break;

case StartbitRGBColors.Green:
tureRgb = 0x00ff00;
break;

case StartbitRGBColors.Blue:
tureRgb = 0x0000ff;
break;

case StartbitRGBColors.Indigo:
tureRgb = 0x4b0082;
break;

case StartbitRGBColors.Violet:
tureRgb = 0x8a2be2;
break;

case StartbitRGBColors.Purple:
tureRgb = 0xff00ff;
break;

case StartbitRGBColors.White:
tureRgb = 0xffffff;
break;
}

let stride = this._mode === StartbitRGBPixelMode.RGBW ? 4 : 3;
pixeloffset = (pixeloffset + this.start) * stride;
Expand All @@ -208,10 +158,15 @@ namespace StartbitRGBLight {
green = (green * br) >> 8;
blue = (blue * br) >> 8;
}
this.setBufferRGB(pixeloffset, red, green, blue)
this.setBufferRGB(pixeloffset, red, green, blue);
}

private setBufferRGB(offset: number, red: number, green: number, blue: number): void {
private setBufferRGB(
offset: number,
red: number,
green: number,
blue: number
): void {
if (this._mode === StartbitRGBPixelMode.RGB_RGB) {
this.buf[offset + 0] = red;
this.buf[offset + 1] = green;
Expand All @@ -223,7 +178,7 @@ namespace StartbitRGBLight {
}

show() {
sendBuffer(this.buf, this.pin);
ws2812b.sendBuffer(this.buf, this.pin);
}

clear(): void {
Expand All @@ -232,7 +187,11 @@ namespace StartbitRGBLight {
this.show();
}
}
export function create(pin: DigitalPin, numleds: number, mode: StartbitRGBPixelMode): LHstartbitRGBLight {
export function create(
pin: DigitalPin,
numleds: number,
mode: StartbitRGBPixelMode
): LHstartbitRGBLight {
let light = new LHstartbitRGBLight();
let stride = mode === StartbitRGBPixelMode.RGBW ? 4 : 3;
light.buf = pins.createBuffer(numleds * stride);
Expand All @@ -245,18 +204,18 @@ namespace StartbitRGBLight {
}

function packRGB(a: number, b: number, c: number): number {
return ((a & 0xFF) << 16) | ((b & 0xFF) << 8) | (c & 0xFF);
return ((a & 0xff) << 16) | ((b & 0xff) << 8) | (c & 0xff);
}
function unpackR(rgb: number): number {
let r = (rgb >> 16) & 0xFF;
let r = (rgb >> 16) & 0xff;
return r;
}
function unpackG(rgb: number): number {
let g = (rgb >> 8) & 0xFF;
let g = (rgb >> 8) & 0xff;
return g;
}
function unpackB(rgb: number): number {
let b = (rgb) & 0xFF;
let b = rgb & 0xff;
return b;
}
}
Loading