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

Rotate 90 degree? #7

Open
ozett opened this issue Aug 20, 2016 · 4 comments · May be fixed by #8
Open

Rotate 90 degree? #7

ozett opened this issue Aug 20, 2016 · 4 comments · May be fixed by #8

Comments

@ozett
Copy link

ozett commented Aug 20, 2016

Your lib does not Support a Rotation of certain degree? Or is it in the lib? How to Set?
Thanks for help.. +1
(Or are you expanding your Code?)

@dotsam
Copy link

dotsam commented Sep 2, 2016

This python library (https://github.com/rm-hull/max7219) supports the "vertical" configuration needed to work with modules like this one http://www.gearbest.com/raspberry-pi/pp_391811.html

I'm going to take a look to see if I can incorporate this functionality in this library. I'll submit a PR if I get it working.

@adityarao
Copy link

I have fixed by changing the commit() api as below :

void LedMatrix::commit() {
    byte index = B0000001;
    byte col; 

    if(deviceOrientation == HORIZONTAL) {
        for (col = 0; col < myNumberOfDevices * 8; col++) {
            sendByte(col / 8, col % 8 + 1, cols[col]); 
        }
    } else if(deviceOrientation == VERTICAL){ // orient the device vertically
        for (col = 0; col < myNumberOfDevices * 8; col++) {
            xcols[col] = 0; 
        }
        // little inefficient, can be enhanced, rotate the matrix !
        for (col = 0; col < myNumberOfDevices * 8; col++) {

            for(byte bits = 0; bits < 8; bits++) 
              xcols[col] |= ((cols[bits + 8*(col/8)] & (index << (col%8))) ?
                                     (B10000000 >> bits) : 0);  
            sendByte(col / 8, col % 8 + 1, xcols[col]);
        }
    }
}

@adityarao
Copy link

img_20170918_202009

See the image on a 1x4 matrix module

@TLR1000
Copy link

TLR1000 commented Jan 4, 2018

Look for deviceOrientation in the .h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants