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 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. const char stringVersion[] PROGMEM = "v2.3 Debug Build\nPROBABLY NOT COMPATIBLE WITH CubeControl Software!\n"; // 0
  27. #else
  28. const char stringVersion[] PROGMEM = "v2.3 Release\n"; // 0
  29. #endif
  30. const char stringInit[] PROGMEM = "Initialized: "; // 1
  31. const char stringSelfTestError[] PROGMEM = "Self-Test Error: 0b"; // 2
  32. const char stringAudioError[] PROGMEM = " => No answer from Audio!\n"; // 3
  33. const char stringMemError[] PROGMEM = " => No answer from Memory!\n"; // 4
  34. const char stringMemWriteError[] PROGMEM = " => Can't write to Memory!\n"; // 5
  35. const char stringHelp1[] PROGMEM = "(d)elete, (g)et anims, (s)et anims, (v)ersion\n"; // 6
  36. const char stringHelp2[] PROGMEM = "(t)ime, (a)udio, (c)ount, (x)Custom count\n"; // 7
  37. const char stringHelp3[] PROGMEM = "(y)Set fixed animation count\n"; // 8
  38. const char stringHelp4[] PROGMEM = "S(e)lf Test, (m)ode\n"; // 9
  39. const char stringHelp5[] PROGMEM = "Play S(n)ake\n"; // 10
  40. const char stringHelp6[] PROGMEM = "All LEDs Off/On (0/1)\n"; // 11
  41. const char stringHelp7[] PROGMEM = "(2): Test Anim. 1\n"; // 12
  42. const char stringHelp8[] PROGMEM = "(3): All Surface LEDs on\n"; // 13
  43. const char stringTime[] PROGMEM = "System Time: "; // 14
  44. const char stringFrames[] PROGMEM = " Frames stored\n"; // 15
  45. const char stringByte[] PROGMEM = "Send a byte... "; // 16
  46. const char stringWritten[] PROGMEM = " written!\n"; // 17
  47. const char stringCount[] PROGMEM = "Animation count now 8705!\n"; // 18
  48. const char stringSelfTest[] PROGMEM = "Self-Test: 0b"; // 19
  49. const char stringKillCount[] PROGMEM = "Killed Animation Counter!\n"; // 20
  50. const char stringAccessError[] PROGMEM = "Could not access device!\n"; // 21
  51. const char stringAudioData[] PROGMEM = "Audio Data:\n"; // 22
  52. const char stringSnakeControl[] PROGMEM = "Controls: W A S D Q E, x to quit\n"; // 23
  53. const char stringNoMoreHeap[] PROGMEM = "Ran out of Heap!\n"; // 24
  54. const char stringKilledAnimation[] PROGMEM = "Animation aborted!\n"; // 25
  55. const char stringHelp9[] PROGMEM = "(i)nterrupt count, (r)andom, (q)reset\n"; // 26
  56. const char stringInterrupts[] PROGMEM = " Interrupts after 1000msec\n"; // 27
  57. const char stringFrames2[] PROGMEM = " Frames per Second\n"; // 28
  58. const char stringDeleted[] PROGMEM = "Memory deleted!\n"; // 29
  59. const char stringReset[] PROGMEM = "Reset in 500ms. Bye!\n"; // 30
  60. const char stringWatchdog[] PROGMEM = "Watchdog Reset detected.\n"; // 31
  61. const char stringBrownout[] PROGMEM = "Brown-Out Reset detected.\n"; // 32
  62. const char stringNothing[] PROGMEM = "No Reset reason detected.\n"; // 33
  63. const char stringExtern[] PROGMEM = "External Reset detected.\n"; // 34
  64. const char stringJtag[] PROGMEM = "JTAG Reset detected.\n"; // 35
  65. const char stringPowerOn[] PROGMEM = "Power-On Reset detected.\n"; // 36
  66. const char stringMinute[] PROGMEM = "Yay! Another minute passed :)\n"; // 37
  67. const char stringAudioMode[] PROGMEM = "Audio Mode!\n"; // 38
  68. const char stringCubeMode[] PROGMEM = "Cube Mode!\n"; // 39
  69. const char stringModeChange[] PROGMEM = "Cube mode entered!\n"; // 40
  70. const char stringModeChange2[] PROGMEM = "Audio mode entered!\n"; // 41
  71. // Last index + 1
  72. #define STRINGNUM 42
  73. PGM_P stringTable[STRINGNUM] PROGMEM = { stringVersion, stringSelfTestError, stringInit,
  74. stringAudioError, stringMemError, stringMemWriteError,
  75. stringHelp1, stringHelp2, stringHelp3, stringHelp4, stringHelp5,
  76. stringHelp6, stringHelp7, stringHelp8, stringTime, stringFrames,
  77. stringByte, stringWritten, stringCount, stringSelfTest,
  78. stringKillCount, stringAccessError, stringAudioData,
  79. stringSnakeControl, stringNoMoreHeap, stringKilledAnimation,
  80. stringHelp9, stringInterrupts, stringFrames2, stringDeleted,
  81. stringReset, stringWatchdog, stringBrownout, stringNothing,
  82. stringExtern, stringJtag, stringPowerOn, stringMinute, stringAudioMode,
  83. stringCubeMode, stringModeChange, stringModeChange2 };
  84. char stringNotFoundError[] PROGMEM = "String not found!\n";
  85. char *getString(uint8_t id) {
  86. if (id < STRINGNUM) {
  87. strcpy_P(buffer, (PGM_P)pgm_read_word(&(stringTable[id])));
  88. } else {
  89. strcpy_P(buffer, (PGM_P)pgm_read_word(&stringNotFoundError));
  90. }
  91. return buffer;
  92. }