Simple single-color 8x8x8 LED Cube with AVRs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.c 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. /*
  2. * main.c
  3. *
  4. * Copyright 2011 Thomas Buck <xythobuz@me.com>
  5. * Copyright 2011 Max Nuding <max.nuding@gmail.com>
  6. * Copyright 2011 Felix Bäder <baeder.felix@gmail.com>
  7. *
  8. * This file is part of LED-Cube.
  9. *
  10. * LED-Cube is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation, either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * LED-Cube is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with LED-Cube. If not, see <http://www.gnu.org/licenses/>.
  22. */
  23. #ifndef F_CPU
  24. #define F_CPU 16000000L
  25. #endif
  26. #define OK 0x42
  27. #define ERROR 0x23
  28. #include <avr/io.h>
  29. #include <util/delay.h>
  30. #include <avr/interrupt.h>
  31. #include <avr/pgmspace.h>
  32. #include <stdint.h>
  33. #include <stdlib.h>
  34. #include "serial.h"
  35. #include "cube.h"
  36. #include "time.h"
  37. #include "audio.h"
  38. #include "mem.h"
  39. #include "memLayer.h"
  40. #include "twi.h"
  41. #include "strings.h"
  42. #define NOERROR 0
  43. // Audio does not answer
  44. #define AUDIOERROR 1
  45. // Memory does not answer
  46. #define MEMORYERROR 2
  47. // Memory not writeable
  48. #define MEMORYWRITEERROR 4
  49. // x = errorcode, e = error definition, not NOERROR
  50. #define ISERROR(x, e) ((x) & (e))
  51. // Length of an idle animation frame, 24 -> 1 second
  52. #define IDLELENGTH 24
  53. void serialHandler(char c);
  54. void sendAudioData(void);
  55. void recieveAnimations(void);
  56. void transmitAnimations(void);
  57. uint8_t audioModeSelected(void);
  58. void setPixelBuffer(uint8_t x, uint8_t y, uint8_t z, uint8_t *buf);
  59. void setRow(uint8_t x, uint8_t z, uint8_t height, uint8_t *buf);
  60. void visualizeAudioData(uint8_t *audioData, uint8_t *imageData);
  61. #ifdef DEBUG
  62. void printErrors(uint8_t e);
  63. uint8_t selfTest(void);
  64. void printTime(void);
  65. #include "snake.c"
  66. #endif
  67. uint8_t refreshAnimationCount = 1;
  68. uint8_t lastButtonState = 0;
  69. char buffer[11];
  70. uint8_t defaultImage[64] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  71. 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  72. 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  73. 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  74. 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  75. 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  76. 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  77. 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
  78. uint8_t DebugDone = 0; // Bit 0: 10s int. count, Bit 1: switch idle display
  79. // Bit 2: state changed, disable idle
  80. int main(void) {
  81. uint8_t *audioData = NULL;
  82. uint8_t *imageData = NULL;
  83. uint8_t i, length = 0, lastMode;
  84. uint16_t count;
  85. uint64_t lastChecked;
  86. uint32_t temp;
  87. initCube();
  88. serialInit(25, 8, NONE, 1);
  89. i2c_init();
  90. initSystemTimer();
  91. sei(); // Enable Interrupts
  92. DDRD = 0xFC; // Mosfets as Output
  93. DDRB = 0xFE;
  94. DDRC = 0xFF; // Latch Enable
  95. DDRA = 0xFF; // Latch Data
  96. setImage(defaultImage); // Display something
  97. #ifdef DEBUG
  98. // Kill animation counter in debug mode
  99. // => Don't preserve animations while power down
  100. setAnimationCount(0);
  101. i = selfTest();
  102. if (i) {
  103. serialWriteString(getString(1));
  104. serialWriteString(itoa(i, buffer, 2));
  105. serialWrite('\n');
  106. printErrors(i);
  107. }
  108. #endif
  109. #ifdef DEBUG
  110. serialWriteString(getString(2));
  111. serialWriteString(getString(0));
  112. serialWriteString("Took ");
  113. serialWriteString(itoa(getSystemTime(), buffer, 10));
  114. serialWriteString(" ms!\n");
  115. #endif
  116. lastMode = audioModeSelected();
  117. lastChecked = getSystemTime();
  118. i = 0;
  119. count = getAnimationCount();
  120. while (1) {
  121. if(lastMode) {
  122. // Get Audio Data and visualize it
  123. if (isFinished()) {
  124. audioData = getAudioData();
  125. if (audioData != NULL) {
  126. imageData = (uint8_t *)malloc(64);
  127. if (imageData == NULL) {
  128. #ifdef DEBUG
  129. serialWriteString(getString(24));
  130. #endif
  131. while(1);
  132. }
  133. visualizeAudioData(audioData, imageData);
  134. setImage(imageData);
  135. free(imageData);
  136. }
  137. }
  138. } else {
  139. if (refreshAnimationCount) {
  140. // Get animation count stored in FRAM via TWI, if needed
  141. count = getAnimationCount();
  142. refreshAnimationCount = 0;
  143. i = 0;
  144. }
  145. if (count > 0) {
  146. if (isFinished() > length) {
  147. // Load next image
  148. if (i < (count - 1)) {
  149. i++;
  150. } else {
  151. i = 0;
  152. }
  153. imageData = getFrame(i);
  154. length = imageData[64];
  155. setImage(imageData);
  156. free(imageData);
  157. }
  158. } else {
  159. if (!(DebugDone & 4)) {
  160. if (isFinished() >= IDLELENGTH) {
  161. // Should happen every half second
  162. if (DebugDone & 2) {
  163. fillBuffer(0);
  164. DebugDone &= ~(2);
  165. } else {
  166. fillBuffer(0xFF);
  167. DebugDone |= 2;
  168. }
  169. }
  170. }
  171. }
  172. }
  173. if (serialHasChar()) {
  174. serialHandler((char)(serialGet()));
  175. }
  176. if ((getSystemTime() >= 1000) && ((DebugDone & 1) == 0)) {
  177. temp = getTriggerCount();
  178. serialWriteString(ltoa(temp, buffer, 10));
  179. serialWriteString(getString(27));
  180. serialWriteString(ltoa((temp / 8), buffer, 10));
  181. serialWriteString(getString(28));
  182. DebugDone |= 1;
  183. }
  184. if ((getSystemTime() - lastChecked) > 150) {
  185. lastMode = audioModeSelected();
  186. lastChecked = getSystemTime();
  187. }
  188. }
  189. close();
  190. return 0;
  191. }
  192. #ifdef DEBUG
  193. uint8_t selfTest(void) {
  194. uint8_t result = NOERROR;
  195. uint8_t *data = getAudioData();
  196. if (data == NULL) {
  197. result |= AUDIOERROR;
  198. } else {
  199. free(data);
  200. }
  201. data = memGetBytes(0, 1);
  202. if (data == NULL) {
  203. result |= MEMORYERROR;
  204. } else {
  205. free(data);
  206. }
  207. setGeneralPurposeByte(0, 0x42);
  208. if (getGeneralPurposeByte(0) != 0x42) {
  209. result |= MEMORYWRITEERROR;
  210. }
  211. return result;
  212. }
  213. void printErrors(uint8_t e) {
  214. if (ISERROR(e, AUDIOERROR)) {
  215. serialWriteString(getString(3));
  216. }
  217. if (ISERROR(e, MEMORYERROR)) {
  218. serialWriteString(getString(4));
  219. }
  220. if (ISERROR(e, MEMORYWRITEERROR)) {
  221. serialWriteString(getString(5));
  222. }
  223. }
  224. #endif
  225. void serialHandler(char c) {
  226. // Used letters:
  227. // a, c, d, e, g, n, s, t, v, x, 0, 1, 2
  228. uint8_t i, y, z;
  229. #ifdef DEBUG
  230. serialWrite(c);
  231. serialWriteString(": ");
  232. #endif
  233. switch(c) {
  234. case OK:
  235. serialWrite(OK);
  236. break;
  237. case 'h': case 'H': case '?':
  238. serialWriteString(getString(6));
  239. #ifdef DEBUG
  240. serialWriteString(getString(7));
  241. serialWriteString(getString(8));
  242. serialWriteString(getString(9));
  243. serialWriteString(getString(10));
  244. serialWriteString(getString(11));
  245. serialWriteString(getString(12));
  246. serialWriteString(getString(13));
  247. serialWriteString(getString(26));
  248. #endif
  249. break;
  250. case 'd': case 'D':
  251. clearMem();
  252. #ifndef DEBUG
  253. serialWrite(OK);
  254. #endif
  255. #ifdef DEBUG
  256. serialWriteString(getString(29));
  257. #endif
  258. break;
  259. #ifndef DEBUG
  260. case 'g': case 'G':
  261. transmitAnimations();
  262. break;
  263. case 's': case 'S':
  264. recieveAnimations();
  265. break;
  266. #endif
  267. case 'v': case 'V':
  268. serialWriteString(getString(0));
  269. break;
  270. #ifdef DEBUG
  271. case 't': case 'T':
  272. printTime();
  273. break;
  274. case 'a': case 'A':
  275. sendAudioData();
  276. break;
  277. case 'c': case 'C':
  278. serialWriteString(itoa(getAnimationCount(), buffer, 10));
  279. serialWriteString(getString(15));
  280. break;
  281. case 'x': case 'X':
  282. // Get byte, store as animation count
  283. serialWriteString(getString(16));
  284. while (!serialHasChar());
  285. c = serialGet();
  286. setAnimationCount(c);
  287. serialWriteString(itoa(c, buffer, 10));
  288. serialWriteString(getString(17));
  289. break;
  290. case 'y': case 'Y':
  291. setAnimationCount(0x2201);
  292. serialWriteString(getString(18));
  293. break;
  294. case 'e': case 'E':
  295. c = selfTest();
  296. serialWriteString(getString(19));
  297. serialWriteString(itoa(c, buffer, 2));
  298. serialWrite('\n');
  299. printErrors(c);
  300. break;
  301. case 'n': case 'N':
  302. snake();
  303. break;
  304. case '0':
  305. fillBuffer(0);
  306. setAnimationCount(0);
  307. refreshAnimationCount = 1;
  308. serialWriteString(getString(20));
  309. DebugDone |= 4;
  310. break;
  311. case '1':
  312. fillBuffer(0xFF);
  313. setAnimationCount(0);
  314. refreshAnimationCount = 1;
  315. serialWriteString(getString(20));
  316. DebugDone |= 4;
  317. break;
  318. case '2':
  319. DebugDone |= 4;
  320. fillBuffer(0);
  321. for (i = 0; i < 64; i++) {
  322. defaultImage[i] = 0;
  323. }
  324. while(1) {
  325. for (i = 0; i < 8; i++) {
  326. for (y = 0; y < 8; y++) {
  327. defaultImage[y + (i * 8)] = 0;
  328. for (z = 0; z < 8; z++) {
  329. defaultImage[y + (i * 8)] |= (1 << z);
  330. setImage(defaultImage);
  331. while (isFinished() == 0) {
  332. if (serialHasChar()) {
  333. goto killMeForIt; // Yes I know...
  334. // But I need to break out of 2 while Loops...
  335. }
  336. }
  337. }
  338. defaultImage[y + (i * 8)] = 0;
  339. }
  340. }
  341. }
  342. break;
  343. killMeForIt:
  344. serialGet();
  345. serialWriteString(getString(25));
  346. break;
  347. case 'I': case 'i':
  348. serialWriteString(ltoa(getTriggerCount(), buffer, 10));
  349. serialWrite('\n');
  350. break;
  351. #endif
  352. default:
  353. serialWrite(ERROR);
  354. break;
  355. }
  356. // c was used as temp var and does not contain the char anymore...!
  357. }
  358. #ifdef DEBUG
  359. void printTime(void) {
  360. serialWriteString(getString(14));
  361. serialWriteString(ltoa(getSystemTime(), buffer, 10));
  362. serialWriteString("ms");
  363. if (getSystemTime() > 1000) {
  364. serialWriteString(" (");
  365. serialWriteString(itoa(getSystemTime() / 1000, buffer, 10));
  366. itoa(getSystemTime() % 1000, buffer, 10);
  367. if (buffer[0] != '\0')
  368. serialWrite('.');
  369. if (buffer[2] == '\0')
  370. serialWrite('0');
  371. if (buffer[1] == '\0')
  372. serialWrite('0');
  373. if (buffer[0] != '\0')
  374. serialWriteString(buffer);
  375. serialWriteString("s)\n");
  376. } else {
  377. serialWrite('\n');
  378. }
  379. }
  380. void sendAudioData(void) {
  381. uint8_t i;
  382. uint8_t *audioData = getAudioData();
  383. if (audioData == NULL) {
  384. serialWriteString(getString(21));
  385. } else {
  386. serialWriteString(getString(22));
  387. for (i = 0; i < 7; i++) {
  388. serialWrite(i + '0');
  389. serialWriteString(": ");
  390. itoa(audioData[i], buffer, 10);
  391. serialWriteString(buffer);
  392. serialWrite('\n');
  393. }
  394. }
  395. }
  396. #endif
  397. void recieveAnimations() {
  398. uint8_t animCount, a, frameCount, f, i;
  399. uint16_t completeCount = 0, character;
  400. uint8_t frame[65];
  401. serialWrite(OK); // We are ready...
  402. character = serialGet();
  403. while (character & 0xFF00) { // Wait for answer
  404. character = serialGet();
  405. }
  406. animCount = (uint8_t)(character & 0x00FF); // Got animation count
  407. serialWrite(OK);
  408. for (a = 0; a < animCount; a++) {
  409. character = serialGet();
  410. while (character & 0xFF00) { // Wait for answer
  411. character = serialGet();
  412. }
  413. frameCount = (uint8_t)(character & 0x00FF); // Got frame count
  414. serialWrite(OK);
  415. for (f = 0; f < frameCount; f++) {
  416. character = serialGet();
  417. while (character & 0xFF00) { // Wait for answer
  418. character = serialGet();
  419. }
  420. frame[64] = (uint8_t)(character & 0x00FF); // Got duration
  421. serialWrite(OK);
  422. for (i = 0; i < 64; i++) {
  423. character = serialGet();
  424. while (character & 0xFF00) { // Wait for answer
  425. character = serialGet();
  426. }
  427. frame[i] = (uint8_t)(character & 0x00FF); // Got data byte
  428. }
  429. serialWrite(OK);
  430. setFrame(completeCount++, frame);
  431. }
  432. }
  433. character = serialGet();
  434. while (character & 0xFF00) { // Wait for answer
  435. character = serialGet();
  436. }
  437. character = serialGet();
  438. while (character & 0xFF00) { // Wait for answer
  439. character = serialGet();
  440. }
  441. character = serialGet();
  442. while (character & 0xFF00) { // Wait for answer
  443. character = serialGet();
  444. }
  445. character = serialGet();
  446. while (character & 0xFF00) { // Wait for answer
  447. character = serialGet();
  448. }
  449. serialWrite(OK);
  450. setAnimationCount(completeCount);
  451. refreshAnimationCount = 1;
  452. }
  453. void transmitAnimations() {
  454. // We store no animation information in here
  455. // So we have to place all frames in one or more
  456. // animations... We need 8 animations max...
  457. uint8_t animationsToGo;
  458. uint16_t framesToGo = getAnimationCount();
  459. uint16_t character;
  460. uint8_t a;
  461. uint8_t f, fMax, i;
  462. uint8_t *frame;
  463. if ((framesToGo % 255) == 0) {
  464. animationsToGo = framesToGo / 255;
  465. } else {
  466. animationsToGo = (framesToGo / 255) + 1;
  467. }
  468. serialWrite(OK);
  469. serialWrite(animationsToGo);
  470. while ((character = serialGet()) & 0xFF00); // Wait for answer
  471. if ((character & 0x00FF) != OK) { // Error code recieved
  472. return;
  473. }
  474. for (a = 0; a < animationsToGo; a++) {
  475. if (framesToGo > 255) {
  476. fMax = 255;
  477. } else {
  478. fMax = framesToGo;
  479. }
  480. serialWrite(fMax); // Number of Frames in current animation
  481. while ((character = serialGet()) & 0xFF00); // Wait for answer
  482. if ((character & 0x00FF) != OK) { // Error code recieved
  483. return;
  484. }
  485. for (f = 0; f < fMax; f++) {
  486. frame = getFrame(f + (255 * a));
  487. serialWrite(frame[64]); // frame duration
  488. while ((character = serialGet()) & 0xFF00); // Wait for answer
  489. if ((character & 0x00FF) != OK) { // Error code recieved
  490. free(frame);
  491. return;
  492. }
  493. for (i = 0; i < 64; i++) {
  494. serialWrite(frame[i]);
  495. }
  496. while ((character = serialGet()) & 0xFF00); // Wait for answer
  497. if ((character & 0x00FF) != OK) { // Error code recieved
  498. free(frame);
  499. return;
  500. }
  501. free(frame);
  502. }
  503. framesToGo -= fMax;
  504. }
  505. serialWrite(OK);
  506. serialWrite(OK);
  507. serialWrite(OK);
  508. serialWrite(OK);
  509. while ((character = serialGet()) & 0xFF00); // Wait for answer
  510. // Error code ignored...
  511. }
  512. uint8_t audioModeSelected(void) {
  513. // Pushbutton: PB0, Low active
  514. if (!(PINB & (1 << PB0))) {
  515. // Button pushed
  516. if (lastButtonState == 0) {
  517. lastButtonState = 1;
  518. } else {
  519. lastButtonState = 0;
  520. }
  521. #ifdef DEBUG
  522. serialWriteString("New State (");
  523. serialWriteString(itoa(lastButtonState, buffer, 10));
  524. serialWriteString(")\n");
  525. #endif
  526. }
  527. return lastButtonState;
  528. }
  529. void setRow(uint8_t x, uint8_t z, uint8_t height, uint8_t *buf) {
  530. uint8_t i = 0;
  531. for (; i < height; i++) {
  532. setPixelBuffer(x, i, z, buf);
  533. }
  534. }
  535. void setPixelBuffer(uint8_t x, uint8_t y, uint8_t z, uint8_t *buf) {
  536. buf[(8 * z) + y] |= (1 << x);
  537. }
  538. void visualizeAudioData(uint8_t *audioData, uint8_t *imageData) {
  539. uint8_t i;
  540. for (i = 0; i < 64; i++) {
  541. imageData[i] = 0;
  542. }
  543. // 8 LEDs, Max Val 255:
  544. // 256 / 8 = 32 => Divide by 31 (FACTOR) to get num of leds to light
  545. // 255 / FACTOR = 8,...
  546. // 127 / FACTOR = 4,...
  547. #define FACTOR 31
  548. // Could not figure out a way to represent this easily in a loop
  549. // without using a shitload of 'if's...
  550. setRow(0, 0, (audioData[0] / FACTOR), imageData);
  551. setRow(0, 1, (audioData[0] / FACTOR), imageData);
  552. setRow(1, 0, (audioData[0] / FACTOR), imageData);
  553. setRow(0, 2, (audioData[1] / FACTOR), imageData);
  554. setRow(0, 3, (audioData[1] / FACTOR), imageData);
  555. setRow(1, 1, (audioData[1] / FACTOR), imageData);
  556. setRow(1, 2, (audioData[1] / FACTOR), imageData);
  557. setRow(2, 0, (audioData[1] / FACTOR), imageData);
  558. setRow(2, 1, (audioData[1] / FACTOR), imageData);
  559. setRow(0, 4, (audioData[2] / FACTOR), imageData);
  560. setRow(0, 5, (audioData[2] / FACTOR), imageData);
  561. setRow(1, 3, (audioData[2] / FACTOR), imageData);
  562. setRow(1, 4, (audioData[2] / FACTOR), imageData);
  563. setRow(2, 2, (audioData[2] / FACTOR), imageData);
  564. setRow(2, 3, (audioData[2] / FACTOR), imageData);
  565. setRow(3, 0, (audioData[2] / FACTOR), imageData);
  566. setRow(3, 1, (audioData[2] / FACTOR), imageData);
  567. setRow(3, 2, (audioData[2] / FACTOR), imageData);
  568. setRow(4, 0, (audioData[2] / FACTOR), imageData);
  569. setRow(4, 1, (audioData[2] / FACTOR), imageData);
  570. setRow(0, 6, (audioData[3] / FACTOR), imageData);
  571. setRow(0, 7, (audioData[3] / FACTOR), imageData);
  572. setRow(1, 5, (audioData[3] / FACTOR), imageData);
  573. setRow(1, 6, (audioData[3] / FACTOR), imageData);
  574. setRow(2, 4, (audioData[3] / FACTOR), imageData);
  575. setRow(2, 5, (audioData[3] / FACTOR), imageData);
  576. setRow(3, 3, (audioData[3] / FACTOR), imageData);
  577. setRow(3, 4, (audioData[3] / FACTOR), imageData);
  578. setRow(4, 2, (audioData[3] / FACTOR), imageData);
  579. setRow(4, 3, (audioData[3] / FACTOR), imageData);
  580. setRow(5, 0, (audioData[3] / FACTOR), imageData);
  581. setRow(5, 1, (audioData[3] / FACTOR), imageData);
  582. setRow(5, 2, (audioData[3] / FACTOR), imageData);
  583. setRow(6, 0, (audioData[3] / FACTOR), imageData);
  584. setRow(6, 1, (audioData[3] / FACTOR), imageData);
  585. setRow(1, 7, (audioData[4] / FACTOR), imageData);
  586. setRow(2, 6, (audioData[4] / FACTOR), imageData);
  587. setRow(2, 7, (audioData[4] / FACTOR), imageData);
  588. setRow(3, 5, (audioData[4] / FACTOR), imageData);
  589. setRow(3, 6, (audioData[4] / FACTOR), imageData);
  590. setRow(4, 4, (audioData[4] / FACTOR), imageData);
  591. setRow(4, 5, (audioData[4] / FACTOR), imageData);
  592. setRow(5, 3, (audioData[4] / FACTOR), imageData);
  593. setRow(5, 4, (audioData[4] / FACTOR), imageData);
  594. setRow(6, 2, (audioData[4] / FACTOR), imageData);
  595. setRow(6, 3, (audioData[4] / FACTOR), imageData);
  596. setRow(7, 0, (audioData[4] / FACTOR), imageData);
  597. setRow(7, 1, (audioData[4] / FACTOR), imageData);
  598. setRow(3, 7, (audioData[5] / FACTOR), imageData);
  599. setRow(4, 6, (audioData[5] / FACTOR), imageData);
  600. setRow(4, 7, (audioData[5] / FACTOR), imageData);
  601. setRow(5, 5, (audioData[5] / FACTOR), imageData);
  602. setRow(5, 6, (audioData[5] / FACTOR), imageData);
  603. setRow(6, 4, (audioData[5] / FACTOR), imageData);
  604. setRow(6, 5, (audioData[5] / FACTOR), imageData);
  605. setRow(7, 2, (audioData[5] / FACTOR), imageData);
  606. setRow(7, 3, (audioData[5] / FACTOR), imageData);
  607. setRow(7, 4, (audioData[5] / FACTOR), imageData);
  608. setRow(5, 7, (audioData[6] / FACTOR), imageData);
  609. setRow(6, 6, (audioData[6] / FACTOR), imageData);
  610. setRow(6, 7, (audioData[6] / FACTOR), imageData);
  611. setRow(7, 5, (audioData[6] / FACTOR), imageData);
  612. setRow(7, 6, (audioData[6] / FACTOR), imageData);
  613. setRow(7, 7, (audioData[6] / FACTOR), imageData);
  614. }