Simple single-color 8x8x8 LED Cube with AVRs
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

strings.c 3.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * strings.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. #include <avr/pgmspace.h>
  24. char buffer[60];
  25. #ifdef DEBUG
  26. char stringVersion[] PROGMEM = "v2 (Debug Build)\nNOT COMPATIBLE WITH CubeControl!\n"; // 0
  27. #else
  28. char stringVersion[] PROGMEM = "v2 Release\n" // 0
  29. #endif
  30. char stringInit[] PROGMEM = "\n\nInitialized: "; // 1
  31. char stringSelfTestError[] PROGMEM = "Self-Test Error: 0b"; // 2
  32. char stringAudioError[] PROGMEM = " => No answer from Audio!\n"; // 3
  33. char stringMemError[] PROGMEM = " => No answer from Memory!\n"; // 4
  34. char stringMemWriteError[] PROGMEM = " => Can't write to Memory!\n"; // 5
  35. char stringHelp1[] PROGMEM = "(d)elete, (g)et anims, (s)et anims, (v)ersion\n"; // 6
  36. char stringHelp2[] PROGMEM = "(t)ime, (a)udio, (c)ount, (x)Custom count\n"; // 7
  37. char stringHelp3[] PROGMEM = "(y)Set fixed animation count\n"; // 8
  38. char stringHelp4[] PROGMEM = "S(e)lf Test\n"; // 9
  39. char stringHelp5[] PROGMEM = "Play S(n)ake\n"; // 10
  40. char stringHelp6[] PROGMEM = "(0): All LEDs Off\n"; // 11
  41. char stringHelp7[] PROGMEM = "(1): All LEDs On\n"; // 12
  42. char stringHelp8[] PROGMEM = "(2): Test Anim. 1\n"; // 13
  43. char stringTime[] PROGMEM = "System Time: "; // 14
  44. char stringFrames[] PROGMEM = " Frames stored\n"; // 15
  45. char stringByte[] PROGMEM = "Send a byte... "; // 16
  46. char stringWritten[] PROGMEM = " written!\n"; // 17
  47. char stringCount[] PROGMEM = "Animation count now 8705!\n"; // 18
  48. char stringSelfTest[] PROGMEM = "Self-Test: 0b"; // 19
  49. char stringKillCount[] PROGMEM = "Killed Animation Counter!\n"; // 20
  50. char stringAccessError[] PROGMEM = "Could not access device!\n"; // 21
  51. char stringAudioData[] PROGMEM = "Audio Data:\n"; // 22
  52. char stringSnakeControl[] PROGMEM = "Controls: W A S D Q E, x to quit\n"; // 23
  53. char stringNoMoreHeap[] PROGMEM = "Ran out of Heap... Bye\n"; // 24
  54. char stringKilledAnimation[] PROGMEM = "Animation aborted!\n"; // 25
  55. char stringHelp9[] PROGMEM = "(i)nterrupt count\n"; // 26
  56. char stringTimerOverflow[] PROGMEM = "Cube Timer Overflowed (now !)\n"; // 27
  57. // Last index + 1
  58. #define STRINGNUM 28
  59. PGM_P stringTable[STRINGNUM] PROGMEM = { stringVersion, stringSelfTestError, stringInit,
  60. stringAudioError, stringMemError, stringMemWriteError,
  61. stringHelp1, stringHelp2, stringHelp3, stringHelp4, stringHelp5,
  62. stringHelp6, stringHelp7, stringHelp8, stringTime, stringFrames,
  63. stringByte, stringWritten, stringCount, stringSelfTest,
  64. stringKillCount, stringAccessError, stringAudioData,
  65. stringSnakeControl, stringNoMoreHeap, stringKilledAnimation,
  66. stringHelp9, stringTimerOverflow };
  67. char stringNotFoundError[] PROGMEM = "String not found!\n";
  68. char *getString(uint8_t id) {
  69. if (id < STRINGNUM) {
  70. strcpy_P(buffer, (PGM_P)pgm_read_word(&(stringTable[id])));
  71. } else {
  72. strcpy_P(buffer, (PGM_P)pgm_read_word(&stringNotFoundError));
  73. }
  74. return buffer;
  75. }