Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
492 changes: 247 additions & 245 deletions firmware/bin/backpack/diecimila/backpack.ino.hex

Large diffs are not rendered by default.

948 changes: 474 additions & 474 deletions firmware/bin/backpack/leonardo/backpack.ino.hex

Large diffs are not rendered by default.

502 changes: 252 additions & 250 deletions firmware/bin/backpack/mega/backpack.ino.hex

Large diffs are not rendered by default.

948 changes: 474 additions & 474 deletions firmware/bin/backpack/micro/backpack.ino.hex

Large diffs are not rendered by default.

492 changes: 247 additions & 245 deletions firmware/bin/backpack/nano/backpack.ino.hex

Large diffs are not rendered by default.

492 changes: 247 additions & 245 deletions firmware/bin/backpack/pro-mini/backpack.ino.hex

Large diffs are not rendered by default.

492 changes: 247 additions & 245 deletions firmware/bin/backpack/uno/backpack.ino.hex

Large diffs are not rendered by default.

1,697 changes: 895 additions & 802 deletions firmware/bin/firmata/diecimila/node_pixel_firmata.ino.hex

Large diffs are not rendered by default.

2,166 changes: 1,151 additions & 1,015 deletions firmware/bin/firmata/leonardo/node_pixel_firmata.ino.hex

Large diffs are not rendered by default.

2,104 changes: 1,126 additions & 978 deletions firmware/bin/firmata/mega/node_pixel_firmata.ino.hex

Large diffs are not rendered by default.

2,166 changes: 1,151 additions & 1,015 deletions firmware/bin/firmata/micro/node_pixel_firmata.ino.hex

Large diffs are not rendered by default.

1,697 changes: 895 additions & 802 deletions firmware/bin/firmata/nano/node_pixel_firmata.ino.hex

Large diffs are not rendered by default.

1,697 changes: 895 additions & 802 deletions firmware/bin/firmata/pro-mini/node_pixel_firmata.ino.hex

Large diffs are not rendered by default.

1,697 changes: 895 additions & 802 deletions firmware/bin/firmata/uno/node_pixel_firmata.ino.hex

Large diffs are not rendered by default.

20 changes: 16 additions & 4 deletions firmware/build/backpack/ws2812.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ bool strip_changed[MAX_STRIPS]; // used to optimise strip writes.
uint8_t *px;
uint16_t px_count;
uint8_t strip_count = 0; // number of strips being used.
uint8_t color_depth = 3; // Bytes used to hold one pixel
uint8_t color_depth = 4; // Bytes used to hold one pixel

uint8_t offsetRed;
uint8_t offsetGreen;
uint8_t offsetBlue;
uint8_t offsetWhite;

void ws2812_initialise() {
// initialises the strip defaults.
Expand Down Expand Up @@ -77,9 +78,10 @@ uint8_t set_rgb_at(uint16_t index, uint32_t px_value) {
uint16_t tmp_pixel;
tmp_pixel = index * color_depth;

px[OFFSET_R(tmp_pixel)] = (uint8_t)(px_value >> 16);
px[OFFSET_G(tmp_pixel)] = (uint8_t)(px_value >> 8);
px[OFFSET_B(tmp_pixel)] = (uint8_t)px_value;
px[OFFSET_R(tmp_pixel)] = (uint8_t)(px_value >> 24);
px[OFFSET_G(tmp_pixel)] = (uint8_t)(px_value >> 16);
px[OFFSET_B(tmp_pixel)] = (uint8_t)(px_value >> 8);
px[OFFSET_W(tmp_pixel)] = (uint8_t)px_value;

return 0;
}
Expand Down Expand Up @@ -261,6 +263,9 @@ void process_command(byte argc, byte *argv){
case PIXEL_COLOUR_BRG:
setColorOrderBRG();
break;
case PIXEL_COLOUR_RGBW:
setColorOrderRGBW();
break;
}

// now get the strand length and set it
Expand Down Expand Up @@ -318,6 +323,13 @@ void setColorOrderBRG() {
offsetGreen = 2;
}

void setColorOrderRGBW() {
offsetRed = 0;
offsetGreen = 1;
offsetBlue = 2;
offsetWhite = 3;
}

#if DEBUG
void print_pixels() {
// prints out the array of pixel values
Expand Down
3 changes: 3 additions & 0 deletions firmware/build/backpack/ws2812.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#define PIXEL_COLOUR_GRB 0x0
#define PIXEL_COLOUR_RGB 0x1
#define PIXEL_COLOUR_BRG 0x2
#define PIXEL_COLOUR_RGBW 0x3

#define STRIP_START_PIN 0

Expand All @@ -47,6 +48,7 @@
#define OFFSET_R(r) r+offsetRed
#define OFFSET_G(g) g+offsetGreen
#define OFFSET_B(b) b+offsetBlue
#define OFFSET_W(w) w+offsetWhite

void ws2812_initialise();
void ws2812_initialise(bool backpack);
Expand All @@ -57,6 +59,7 @@ uint8_t set_rgb_at(uint16_t index, uint32_t px_value);
void setColorOrderRGB();
void setColorOrderGRB();
void setColorOrderBRG();
void setColorOrderRGBW();

#if DEBUG
void print_pixels();
Expand Down
Loading