123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- unsigned char frame_buffer[] = {
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x22, 0x00, 0x00, 0x44,
- 0x44, 0x00, 0x00, 0x22,
- 0x89, 0x80, 0x01, 0x91,
- 0x92, 0x40, 0x02, 0x49,
- 0x82, 0x40, 0x02, 0x41,
- 0x81, 0x80, 0x01, 0x81,
- 0x80, 0x04, 0x40, 0x01,
- 0x80, 0x09, 0x20, 0x01,
- 0x87, 0x89, 0x21, 0xe1,
- 0x40, 0x06, 0xc0, 0x02,
- 0x27, 0x80, 0x01, 0xe4,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
- };
- byte fByte(byte c) {
- char r = 0;
- for (byte i = 0; i < 8; i++) {
- r <<= 1;
- r |= c & 1;
- c >>= 1;
- } return r;
- }
- void renderFrame() {
-
- int fsize = sizeof(frame_buffer);
- for (int i = 0; i < fsize / 2; i += 4) {
- for (int d = 0; d <= 3; d++) {
-
- byte rowData = frame_buffer[i + d];
- mx.setRow(d, d, 7 - int(i / 4), fByte(rowData));
- }
- }
-
- for (int i = fsize / 2; i < fsize; i += 4) {
- for (int d = 4; d <= 7; d++) {
-
- byte rowData = frame_buffer[i + (d - 4)];
- mx.setRow(d, d, 7 - (int(i / 4) - 8), fByte(rowData));
- }
- }
- }
- void setDisplayBrightness(byte brightness){
- for(int i =0; i<MAX_DEVICES; i++){
- mx.control(i,MD_MAX72XX::INTENSITY, brightness);
- }
- }
|