Simple single-color 8x8x8 LED Cube with AVRs
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

main.c 17KB

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