screenshot.ino 815 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <SPI.h>
  2. #include <GD.h>
  3. #define RED RGB(255,0,0)
  4. #define GREEN RGB(0,255,0)
  5. void setup()
  6. {
  7. int i;
  8. GD.begin();
  9. GD.ascii();
  10. GD.putstr(20, 0, "Screenshot");
  11. GD.wr16(RAM_PAL + (8 * 127), RED); // char 127: 0=red, 3=green
  12. GD.wr16(RAM_PAL + (8 * 127) + 6, GREEN);
  13. static flash_uint8_t box[] = {
  14. 0xff, 0xff,
  15. 0xc0, 0x03,
  16. 0xc0, 0x03,
  17. 0xc0, 0x03,
  18. 0xc0, 0x03,
  19. 0xc0, 0x03,
  20. 0xc0, 0x03,
  21. 0xff, 0xff };
  22. GD.copy(RAM_CHR + (16 * 127), box, sizeof(box));
  23. for (i = 0; i < 64; i++) {
  24. GD.wr(64 * i + i, 127); // diagonal boxes
  25. char msg[20];
  26. sprintf(msg, "Line %d", i);
  27. GD.putstr(i + 2, i, msg);
  28. GD.wr(64 * i + 49, 127); // boxes on right
  29. }
  30. Serial.begin(1000000);
  31. long started = millis();
  32. GD.screenshot(0);
  33. }
  34. void loop()
  35. {
  36. }