Skip to content

Commit

Permalink
o Add support for 'E' line (addresses #120)
Browse files Browse the repository at this point in the history
o (does not yet address adapter PCBs. Awaiting feedback where the
  outputs usually are).
  • Loading branch information
hzeller committed May 5, 2016
1 parent 409d7bd commit 6c67391
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 19 deletions.
8 changes: 4 additions & 4 deletions demo-main.cc
Expand Up @@ -1010,7 +1010,7 @@ static int usage(const char *progname) {
progname);
fprintf(stderr, "Options:\n"
"\t-r <rows> : Panel rows. '16' for 16x32 (1:8 multiplexing),\n"
"\t '32' for 32x32 (1:16), '8' for 1:4 multiplexing; "
"\t '32' for 32x32 (1:16), '8' for 1:4 multiplexing; 64 for 1:32 multiplexing. "
"Default: 32\n"
"\t-P <parallel> : For Plus-models or RPi2: parallel chains. 1..3. "
"Default: 1\n"
Expand Down Expand Up @@ -1135,9 +1135,9 @@ int main(int argc, char *argv[]) {
return 1;
}

if (rows != 8 && rows != 16 && rows != 32) {
fprintf(stderr, "Rows can one of 8, 16 or 32 "
"for 1:4, 1:8 and 1:16 multiplexing respectively.\n");
if (rows != 8 && rows != 16 && rows != 32 && rows != 64) {
fprintf(stderr, "Rows can one of 8, 16, 32 or 32 "
"for 1:4, 1:8, 1:16 and 1:32 multiplexing respectively.\n");
return 1;
}

Expand Down
8 changes: 4 additions & 4 deletions led-image-viewer.cc
Expand Up @@ -149,7 +149,7 @@ static int usage(const char *progname) {
fprintf(stderr, "usage: %s [options] <image>\n", progname);
fprintf(stderr, "Options:\n"
"\t-r <rows> : Panel rows. '16' for 16x32 (1:8 multiplexing),\n"
"\t '32' for 32x32 (1:16), '8' for 1:4 multiplexing; "
"\t '32' for 32x32 (1:16), '8' for 1:4 multiplexing; 64 for 1:32 multiplexing."
"Default: 32\n"
"\t-P <parallel> : For Plus-models or RPi2: parallel chains. 1..3. "
"Default: 1\n"
Expand Down Expand Up @@ -190,9 +190,9 @@ int main(int argc, char *argv[]) {
}
}

if (rows != 8 && rows != 16 && rows != 32) {
fprintf(stderr, "Rows can one of 8, 16 or 32 "
"for 1:4, 1:8 and 1:16 multiplexing respectively.\n");
if (rows != 8 && rows != 16 && rows != 32 && rows != 64) {
fprintf(stderr, "Rows can one of 8, 16, 32 or 32 "
"for 1:4, 1:8, 1:16 and 1:32 multiplexing respectively.\n");
return 1;
}

Expand Down
9 changes: 5 additions & 4 deletions lib/framebuffer-internal.h
Expand Up @@ -31,7 +31,7 @@ class Framebuffer {
~Framebuffer();

// Initialize GPIO bits for output. Only call once.
static void InitGPIO(GPIO *io, int parallel);
static void InitGPIO(GPIO *io, int rows, int parallel);

// Set PWM bits used for output. Default is 11, but if you only deal with
// simple comic-colors, 1 might be sufficient. Lower require less CPU.
Expand Down Expand Up @@ -109,7 +109,8 @@ class Framebuffer {
unsigned int strobe : 1; // 21
unsigned int a : 1; // 22
unsigned int p0_b2 : 1; // 23
unsigned int unused_24_25 : 2; // 24,25
unsigned int e : 1; // 24 // Needs manual wiring
unsigned int unused_25 : 1; // 25
unsigned int b : 1; // 26
unsigned int c : 1; // 27
} bits;
Expand Down Expand Up @@ -150,7 +151,7 @@ class Framebuffer {
unsigned int p1_g2 : 1; // 13 (only on A+/B+/Pi2)
unsigned int p2_r1 : 1; // 14 (masks TxD when parallel=3)
unsigned int p2_r2 : 1; // 15 (masks RxD when parallel=3)
unsigned int unused_16 : 1; // 16 (only on A+/B+/Pi2)
unsigned int e : 1; // 16 (only on A+/B+/Pi2)
unsigned int p0_r1 : 1; // 17
unsigned int p0_g1 : 1; // 18
unsigned int p1_r2 : 1; // 19 (only on A+/B+/Pi2)
Expand Down Expand Up @@ -190,7 +191,7 @@ class Framebuffer {
unsigned int p1_r1 : 1; // 12 P1-32 (only on A+/B+/Pi2)
unsigned int p1_g2 : 1; // 13 P1-33 (only on A+/B+/Pi2)
unsigned int p2_r1 : 1; // 14 P1-08 (masks TxD when parallel=3)
unsigned int unused_15 : 1; // 15 P1-10 (RxD) - kept free.
unsigned int e : 1; // 15 P1-10 (RxD) - kept free unless 1:64
unsigned int p2_g2 : 1; // 16 P1-36 (only on A+/B+/Pi2)

unsigned int clock : 1; // 17 P1-11
Expand Down
15 changes: 11 additions & 4 deletions lib/framebuffer.cc
Expand Up @@ -67,7 +67,7 @@ Framebuffer::Framebuffer(int rows, int columns, int parallel)
double_rows_(rows / SUB_PANELS_), row_mask_(double_rows_ - 1) {
bitplane_buffer_ = new IoBits [double_rows_ * columns_ * kBitPlanes];
Clear();
assert(rows_ <= 32);
assert(rows_ == 4 || rows_ == 8 || rows_ == 16 || rows_ == 32 || rows_ == 64);
assert(parallel >= 1 && parallel <= 3);
#ifdef ONLY_SINGLE_CHAIN
if (parallel > 1) {
Expand All @@ -81,7 +81,7 @@ Framebuffer::~Framebuffer() {
delete [] bitplane_buffer_;
}

/* static */ void Framebuffer::InitGPIO(GPIO *io, int parallel) {
/* static */ void Framebuffer::InitGPIO(GPIO *io, int rows, int parallel) {
if (sOutputEnablePulser != NULL)
return; // already initialized.

Expand Down Expand Up @@ -113,7 +113,12 @@ Framebuffer::~Framebuffer() {
}
#endif

b.bits.a = b.bits.b = b.bits.c = b.bits.d = 1;
const int double_rows = rows / 2;
if (double_rows >= 32) b.bits.e = 1;
if (double_rows >= 16) b.bits.d = 1;
if (double_rows >= 8) b.bits.c = 1;
if (double_rows >= 4) b.bits.b = 1;
b.bits.a = 1;

// Initialize outputs, make sure that all of these are supported bits.
const uint32_t result = io->InitOutputs(b.raw);
Expand Down Expand Up @@ -335,7 +340,8 @@ void Framebuffer::DumpToMatrix(GPIO *io) {
color_clk_mask.bits.clock = 1;

IoBits row_mask;
row_mask.bits.a = row_mask.bits.b = row_mask.bits.c = row_mask.bits.d = 1;
row_mask.bits.a = row_mask.bits.b = row_mask.bits.c
= row_mask.bits.d = row_mask.bits.e = 1;

IoBits clock, strobe, row_address;
#ifdef PI_REV1_RGB_PINOUT_
Expand All @@ -350,6 +356,7 @@ void Framebuffer::DumpToMatrix(GPIO *io) {
row_address.bits.b = d_row >> 1;
row_address.bits.c = d_row >> 2;
row_address.bits.d = d_row >> 3;
row_address.bits.e = d_row >> 4;

io->WriteMaskedBits(row_address.raw, row_mask.raw); // Set row address

Expand Down
2 changes: 1 addition & 1 deletion lib/led-matrix.cc
Expand Up @@ -134,7 +134,7 @@ RGBMatrix::~RGBMatrix() {
void RGBMatrix::SetGPIO(GPIO *io, bool start_thread) {
if (io != NULL && io_ == NULL) {
io_ = io;
internal::Framebuffer::InitGPIO(io_, parallel_displays_);
internal::Framebuffer::InitGPIO(io_, rows_, parallel_displays_);
}
if (start_thread && updater_ == NULL) {
assert(io_ != NULL); // Starting thread: need GPIO
Expand Down
5 changes: 3 additions & 2 deletions text-example.cc
Expand Up @@ -82,8 +82,9 @@ int main(int argc, char *argv[]) {
return usage(argv[0]);
}

if (rows != 16 && rows != 32) {
fprintf(stderr, "Rows can either be 16 or 32\n");
if (rows != 8 && rows != 16 && rows != 32 && rows != 64) {
fprintf(stderr, "Rows can one of 8, 16, 32 or 32 "
"for 1:4, 1:8, 1:16 and 1:32 multiplexing respectively.\n");
return 1;
}

Expand Down

0 comments on commit 6c67391

Please sign in to comment.