123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
-
- #include <avr/pgmspace.h>
-
- char buffer[60];
-
- #ifdef DEBUG
- char stringVersion[] PROGMEM = "v2.3 Debug Build\nPROBABLY NOT COMPATIBLE WITH CubeControl Software!\n";
- #else
- char stringVersion[] PROGMEM = "v2.3 Release\n";
- #endif
-
- char stringInit[] PROGMEM = "Initialized: ";
- char stringSelfTestError[] PROGMEM = "Self-Test Error: 0b";
- char stringAudioError[] PROGMEM = " => No answer from Audio!\n";
- char stringMemError[] PROGMEM = " => No answer from Memory!\n";
- char stringMemWriteError[] PROGMEM = " => Can't write to Memory!\n";
- char stringHelp1[] PROGMEM = "(d)elete, (g)et anims, (s)et anims, (v)ersion\n";
- char stringHelp2[] PROGMEM = "(t)ime, (a)udio, (c)ount, (x)Custom count\n";
- char stringHelp3[] PROGMEM = "(y)Set fixed animation count\n";
- char stringHelp4[] PROGMEM = "S(e)lf Test, (m)ode\n";
- char stringHelp5[] PROGMEM = "Play S(n)ake\n";
- char stringHelp6[] PROGMEM = "All LEDs Off/On (0/1)\n";
- char stringHelp7[] PROGMEM = "(2): Test Anim. 1\n";
- char stringHelp8[] PROGMEM = "(3): All Surface LEDs on\n";
- char stringTime[] PROGMEM = "System Time: ";
- char stringFrames[] PROGMEM = " Frames stored\n";
- char stringByte[] PROGMEM = "Send a byte... ";
- char stringWritten[] PROGMEM = " written!\n";
- char stringCount[] PROGMEM = "Animation count now 8705!\n";
- char stringSelfTest[] PROGMEM = "Self-Test: 0b";
- char stringKillCount[] PROGMEM = "Killed Animation Counter!\n";
- char stringAccessError[] PROGMEM = "Could not access device!\n";
- char stringAudioData[] PROGMEM = "Audio Data:\n";
- char stringSnakeControl[] PROGMEM = "Controls: W A S D Q E, x to quit\n";
- char stringNoMoreHeap[] PROGMEM = "Ran out of Heap!\n";
- char stringKilledAnimation[] PROGMEM = "Animation aborted!\n";
- char stringHelp9[] PROGMEM = "(i)nterrupt count, (r)andom, (q)reset\n";
- char stringInterrupts[] PROGMEM = " Interrupts after 1000msec\n";
- char stringFrames2[] PROGMEM = " Frames per Second\n";
- char stringDeleted[] PROGMEM = "Memory deleted!\n";
- char stringReset[] PROGMEM = "Reset in 500ms. Bye!\n";
- char stringWatchdog[] PROGMEM = "Watchdog Reset detected.\n";
- char stringBrownout[] PROGMEM = "Brown-Out Reset detected.\n";
- char stringNothing[] PROGMEM = "No Reset reason detected.\n";
- char stringExtern[] PROGMEM = "External Reset detected.\n";
- char stringJtag[] PROGMEM = "JTAG Reset detected.\n";
- char stringPowerOn[] PROGMEM = "Power-On Reset detected.\n";
- char stringMinute[] PROGMEM = "Yay! Another minute passed :)\n";
- char stringAudioMode[] PROGMEM = "Audio Mode!\n";
- char stringCubeMode[] PROGMEM = "Cube Mode!\n";
- char stringModeChange[] PROGMEM = "Cube mode entered!\n";
- char stringModeChange2[] PROGMEM = "Audio mode entered!\n";
-
-
- #define STRINGNUM 42
-
- PGM_P stringTable[STRINGNUM] PROGMEM = { stringVersion, stringSelfTestError, stringInit,
- stringAudioError, stringMemError, stringMemWriteError,
- stringHelp1, stringHelp2, stringHelp3, stringHelp4, stringHelp5,
- stringHelp6, stringHelp7, stringHelp8, stringTime, stringFrames,
- stringByte, stringWritten, stringCount, stringSelfTest,
- stringKillCount, stringAccessError, stringAudioData,
- stringSnakeControl, stringNoMoreHeap, stringKilledAnimation,
- stringHelp9, stringInterrupts, stringFrames2, stringDeleted,
- stringReset, stringWatchdog, stringBrownout, stringNothing,
- stringExtern, stringJtag, stringPowerOn, stringMinute, stringAudioMode,
- stringCubeMode, stringModeChange, stringModeChange2 };
-
- char stringNotFoundError[] PROGMEM = "String not found!\n";
-
- char *getString(uint8_t id) {
- if (id < STRINGNUM) {
- strcpy_P(buffer, (PGM_P)pgm_read_word(&(stringTable[id])));
- } else {
- strcpy_P(buffer, (PGM_P)pgm_read_word(&stringNotFoundError));
- }
- return buffer;
- }
|